From eb87895f9d4c3cd70c9269aca021e97b27b0ec73 Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Thu, 8 Dec 2022 20:59:56 +0100 Subject: [PATCH 1/5] chore(deps): update all dependencies (#685) --- samples/snippets/requirements.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/samples/snippets/requirements.txt b/samples/snippets/requirements.txt index 0504505e2..4d5a11e58 100644 --- a/samples/snippets/requirements.txt +++ b/samples/snippets/requirements.txt @@ -1,4 +1,4 @@ -google-cloud-logging==3.3.0 +google-cloud-logging==3.3.1 google-cloud-bigquery==3.4.0 -google-cloud-storage==2.6.0 +google-cloud-storage==2.7.0 google-cloud-pubsub==2.13.11 From bf1e45ed227c4d496944dc64a9e6e921ae7d4faf Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 9 Dec 2022 12:43:31 -0500 Subject: [PATCH 2/5] build(deps): bump certifi from 2022.9.24 to 2022.12.7 [autoapprove] (#687) * build(deps): bump certifi from 2022.9.24 to 2022.12.7 in /synthtool/gcp/templates/python_library/.kokoro Source-Link: https://github.com/googleapis/synthtool/commit/b4fe62efb5114b6738ad4b13d6f654f2bf4b7cc0 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:3bf87e47c2173d7eed42714589dc4da2c07c3268610f1e47f8e1a30decbfc7f1 * trigger ci Co-authored-by: Owl Bot Co-authored-by: Anthonios Partheniou --- .github/.OwlBot.lock.yaml | 3 ++- .kokoro/requirements.txt | 6 +++--- .pre-commit-config.yaml | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index bb21147e4..df2cfe5d8 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,4 +13,5 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:3abfa0f1886adaf0b83f07cb117b24a639ea1cb9cffe56d43280b977033563eb + digest: sha256:3bf87e47c2173d7eed42714589dc4da2c07c3268610f1e47f8e1a30decbfc7f1 + diff --git a/.kokoro/requirements.txt b/.kokoro/requirements.txt index 9c1b9be34..05dc4672e 100644 --- a/.kokoro/requirements.txt +++ b/.kokoro/requirements.txt @@ -20,9 +20,9 @@ cachetools==5.2.0 \ --hash=sha256:6a94c6402995a99c3970cc7e4884bb60b4a8639938157eeed436098bf9831757 \ --hash=sha256:f9f17d2aec496a9aa6b76f53e3b614c965223c061982d434d160f930c698a9db # via google-auth -certifi==2022.9.24 \ - --hash=sha256:0d9c601124e5a6ba9712dbc60d9c53c21e34f5f641fe83002317394311bdce14 \ - --hash=sha256:90c1a32f1d68f940488354e36370f6cca89f0f106db09518524c88d6ed83f382 +certifi==2022.12.7 \ + --hash=sha256:35824b4c3a97115964b408844d64aa14db1cc518f6562e8d7261699d1350a9e3 \ + --hash=sha256:4ad3232f5e926d6718ec31cfc1fcadfde020920e278684144551c91769c7bc18 # via requests cffi==1.15.1 \ --hash=sha256:00a9ed42e88df81ffae7a8ab6d9356b371399b91dbdf0c3cb1e84c03a13aceb5 \ diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 46d237160..5405cc8ff 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -25,7 +25,7 @@ repos: rev: 22.3.0 hooks: - id: black -- repo: https://gitlab.com/pycqa/flake8 +- repo: https://github.com/pycqa/flake8 rev: 3.9.2 hooks: - id: flake8 From 9d505f1147ccac8632590b4322945a900ff3c5c2 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 14 Dec 2022 15:41:03 -0500 Subject: [PATCH 3/5] fix(deps): Require google-api-core >=1.34.0, >=2.11.0 (#659) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: update to gapic-generator-python 1.5.0 feat: add support for `google.cloud..__version__` PiperOrigin-RevId: 484665853 Source-Link: https://github.com/googleapis/googleapis/commit/8eb249a19db926c2fbc4ecf1dc09c0e521a88b22 Source-Link: https://github.com/googleapis/googleapis-gen/commit/c8aa327b5f478865fc3fd91e3c2768e54e26ad44 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYzhhYTMyN2I1ZjQ3ODg2NWZjM2ZkOTFlM2MyNzY4ZTU0ZTI2YWQ0NCJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * update version in gapic_version.py * feat: new APIs added to reflect updates to the filestore service - Add ENTERPRISE Tier - Add snapshot APIs: RevertInstance, ListSnapshots, CreateSnapshot, DeleteSnapshot, UpdateSnapshot - Add multi-share APIs: ListShares, GetShare, CreateShare, DeleteShare, UpdateShare - Add ConnectMode to NetworkConfig (for Private Service Access support) - New status codes (SUSPENDED/SUSPENDING, REVERTING/RESUMING) - Add SuspensionReason (for KMS related suspension) - Add new fields to Instance information: max_capacity_gb, capacity_step_size_gb, max_share_count, capacity_gb, multi_share_enabled PiperOrigin-RevId: 487492758 Source-Link: https://github.com/googleapis/googleapis/commit/5be5981f50322cf0c7388595e0f31ac5d0693469 Source-Link: https://github.com/googleapis/googleapis-gen/commit/ab0e217f560cc2c1afc11441c2eab6b6950efd2b Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYWIwZTIxN2Y1NjBjYzJjMWFmYzExNDQxYzJlYWI2YjY5NTBlZmQyYiJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * chore: Update gapic-generator-python to v1.6.1 PiperOrigin-RevId: 488036204 Source-Link: https://github.com/googleapis/googleapis/commit/08f275f5c1c0d99056e1cb68376323414459ee19 Source-Link: https://github.com/googleapis/googleapis-gen/commit/555c0945e60649e38739ae64bc45719cdf72178f Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNTU1YzA5NDVlNjA2NDllMzg3MzlhZTY0YmM0NTcxOWNkZjcyMTc4ZiJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * move version to gapic_version.py; clean up setup.py and owlbot.py * customize testing/constraints-3.7.txt * fix(deps): Require google-api-core >=1.34.0, >=2.11.0 fix: Drop usage of pkg_resources fix: Fix timeout default values docs(samples): Snippetgen should call await on the operation coroutine before calling result PiperOrigin-RevId: 493260409 Source-Link: https://github.com/googleapis/googleapis/commit/fea43879f83a8d0dacc9353b3f75f8f46d37162f Source-Link: https://github.com/googleapis/googleapis-gen/commit/387b7344c7529ee44be84e613b19a820508c612b Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMzg3YjczNDRjNzUyOWVlNDRiZTg0ZTYxM2IxOWE4MjA1MDhjNjEyYiJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * update version * restore test Co-authored-by: Owl Bot Co-authored-by: Anthonios Partheniou Co-authored-by: Daniel Sanche --- .coveragerc | 5 - .github/release-please.yml | 1 + .release-please-manifest.json | 3 + google/cloud/logging/gapic_version.py | 16 ++ google/cloud/logging_v2/__init__.py | 8 +- google/cloud/logging_v2/gapic_version.py | 16 ++ .../config_service_v2/async_client.py | 230 +++++++++-------- .../services/config_service_v2/client.py | 182 ++++++------- .../config_service_v2/transports/base.py | 16 +- .../config_service_v2/transports/grpc.py | 20 +- .../transports/grpc_asyncio.py | 16 +- .../logging_service_v2/async_client.py | 80 +++--- .../services/logging_service_v2/client.py | 76 +++--- .../logging_service_v2/transports/base.py | 16 +- .../logging_service_v2/transports/grpc.py | 20 +- .../transports/grpc_asyncio.py | 16 +- .../metrics_service_v2/async_client.py | 74 +++--- .../services/metrics_service_v2/client.py | 70 ++--- .../metrics_service_v2/transports/base.py | 16 +- .../metrics_service_v2/transports/grpc.py | 20 +- .../transports/grpc_asyncio.py | 16 +- google/cloud/logging_v2/types/log_entry.py | 58 +++-- google/cloud/logging_v2/types/logging.py | 90 +++---- .../cloud/logging_v2/types/logging_config.py | 242 +++++++++--------- .../cloud/logging_v2/types/logging_metrics.py | 50 ++-- owlbot.py | 96 ++++--- release-please-config.json | 25 ++ ...onfig_service_v2_copy_log_entries_async.py | 2 +- ...> snippet_metadata_google.logging.v2.json} | 15 +- samples/snippets/noxfile.py | 15 +- setup.py | 51 ++-- testing/constraints-3.10.txt | 6 + testing/constraints-3.11.txt | 6 + testing/constraints-3.7.txt | 11 +- testing/constraints-3.8.txt | 6 + testing/constraints-3.9.txt | 6 + .../logging_v2/test_config_service_v2.py | 16 -- .../logging_v2/test_logging_service_v2.py | 28 +- .../logging_v2/test_metrics_service_v2.py | 31 ++- 39 files changed, 888 insertions(+), 783 deletions(-) create mode 100644 .release-please-manifest.json create mode 100644 google/cloud/logging/gapic_version.py create mode 100644 google/cloud/logging_v2/gapic_version.py create mode 100644 release-please-config.json rename samples/generated_samples/{snippet_metadata_logging_v2.json => snippet_metadata_google.logging.v2.json} (99%) diff --git a/.coveragerc b/.coveragerc index b38d22e21..c0f6e82df 100644 --- a/.coveragerc +++ b/.coveragerc @@ -10,8 +10,3 @@ exclude_lines = pragma: NO COVER # Ignore debug-only repr def __repr__ - # Ignore pkg_resources exceptions. - # This is added at the module level as a safeguard for if someone - # generates the code and tries to run it without pip installing. This - # makes it virtually impossible to test properly. - except pkg_resources.DistributionNotFound diff --git a/.github/release-please.yml b/.github/release-please.yml index 5161ab347..dbd2cc9de 100644 --- a/.github/release-please.yml +++ b/.github/release-please.yml @@ -1,5 +1,6 @@ releaseType: python handleGHRelease: true +manifest: true # NOTE: this section is generated by synthtool.languages.python # See https://github.com/googleapis/synthtool/blob/master/synthtool/languages/python.py branches: diff --git a/.release-please-manifest.json b/.release-please-manifest.json new file mode 100644 index 000000000..466b7195f --- /dev/null +++ b/.release-please-manifest.json @@ -0,0 +1,3 @@ +{ + ".": "3.3.1" +} diff --git a/google/cloud/logging/gapic_version.py b/google/cloud/logging/gapic_version.py new file mode 100644 index 000000000..c443818a0 --- /dev/null +++ b/google/cloud/logging/gapic_version.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +__version__ = "3.3.1" # {x-release-please-version} diff --git a/google/cloud/logging_v2/__init__.py b/google/cloud/logging_v2/__init__.py index d55e474d9..9860f1e06 100644 --- a/google/cloud/logging_v2/__init__.py +++ b/google/cloud/logging_v2/__init__.py @@ -14,13 +14,9 @@ from __future__ import absolute_import -import pkg_resources - -try: - __version__ = pkg_resources.get_distribution("google-cloud-logging").version -except pkg_resources.DistributionNotFound: - __version__ = None +from google.cloud.logging_v2 import gapic_version as package_version +__version__ = package_version.__version__ from google.cloud.logging_v2.client import Client from google.cloud.logging_v2.entries import logger_name_from_path diff --git a/google/cloud/logging_v2/gapic_version.py b/google/cloud/logging_v2/gapic_version.py new file mode 100644 index 000000000..c443818a0 --- /dev/null +++ b/google/cloud/logging_v2/gapic_version.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +__version__ = "3.3.1" # {x-release-please-version} diff --git a/google/cloud/logging_v2/services/config_service_v2/async_client.py b/google/cloud/logging_v2/services/config_service_v2/async_client.py index 80f740284..f691bd684 100644 --- a/google/cloud/logging_v2/services/config_service_v2/async_client.py +++ b/google/cloud/logging_v2/services/config_service_v2/async_client.py @@ -16,8 +16,19 @@ from collections import OrderedDict import functools import re -from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union -import pkg_resources +from typing import ( + Dict, + Mapping, + MutableMapping, + MutableSequence, + Optional, + Sequence, + Tuple, + Type, + Union, +) + +from google.cloud.logging_v2 import gapic_version as package_version from google.api_core.client_options import ClientOptions from google.api_core import exceptions as core_exceptions @@ -176,9 +187,9 @@ def transport(self) -> ConfigServiceV2Transport: def __init__( self, *, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, transport: Union[str, ConfigServiceV2Transport] = "grpc_asyncio", - client_options: ClientOptions = None, + client_options: Optional[ClientOptions] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiates the config service v2 client. @@ -222,11 +233,11 @@ def __init__( async def list_buckets( self, - request: Union[logging_config.ListBucketsRequest, dict] = None, + request: Optional[Union[logging_config.ListBucketsRequest, dict]] = None, *, - parent: str = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListBucketsAsyncPager: r"""Lists log buckets. @@ -259,7 +270,7 @@ async def sample_list_buckets(): print(response) Args: - request (Union[google.cloud.logging_v2.types.ListBucketsRequest, dict]): + request (Optional[Union[google.cloud.logging_v2.types.ListBucketsRequest, dict]]): The request object. The parameters to `ListBuckets`. parent (:class:`str`): Required. The parent resource whose buckets are to be @@ -346,10 +357,10 @@ async def sample_list_buckets(): async def get_bucket( self, - request: Union[logging_config.GetBucketRequest, dict] = None, + request: Optional[Union[logging_config.GetBucketRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> logging_config.LogBucket: r"""Gets a log bucket. @@ -381,7 +392,7 @@ async def sample_get_bucket(): print(response) Args: - request (Union[google.cloud.logging_v2.types.GetBucketRequest, dict]): + request (Optional[Union[google.cloud.logging_v2.types.GetBucketRequest, dict]]): The request object. The parameters to `GetBucket`. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. @@ -425,10 +436,10 @@ async def sample_get_bucket(): async def create_bucket( self, - request: Union[logging_config.CreateBucketRequest, dict] = None, + request: Optional[Union[logging_config.CreateBucketRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> logging_config.LogBucket: r"""Creates a log bucket that can be used to store log @@ -463,7 +474,7 @@ async def sample_create_bucket(): print(response) Args: - request (Union[google.cloud.logging_v2.types.CreateBucketRequest, dict]): + request (Optional[Union[google.cloud.logging_v2.types.CreateBucketRequest, dict]]): The request object. The parameters to `CreateBucket`. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. @@ -507,10 +518,10 @@ async def sample_create_bucket(): async def update_bucket( self, - request: Union[logging_config.UpdateBucketRequest, dict] = None, + request: Optional[Union[logging_config.UpdateBucketRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> logging_config.LogBucket: r"""Updates a log bucket. This method replaces the following fields @@ -553,7 +564,7 @@ async def sample_update_bucket(): print(response) Args: - request (Union[google.cloud.logging_v2.types.UpdateBucketRequest, dict]): + request (Optional[Union[google.cloud.logging_v2.types.UpdateBucketRequest, dict]]): The request object. The parameters to `UpdateBucket`. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. @@ -597,10 +608,10 @@ async def sample_update_bucket(): async def delete_bucket( self, - request: Union[logging_config.DeleteBucketRequest, dict] = None, + request: Optional[Union[logging_config.DeleteBucketRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Deletes a log bucket. @@ -634,7 +645,7 @@ async def sample_delete_bucket(): await client.delete_bucket(request=request) Args: - request (Union[google.cloud.logging_v2.types.DeleteBucketRequest, dict]): + request (Optional[Union[google.cloud.logging_v2.types.DeleteBucketRequest, dict]]): The request object. The parameters to `DeleteBucket`. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. @@ -669,10 +680,10 @@ async def sample_delete_bucket(): async def undelete_bucket( self, - request: Union[logging_config.UndeleteBucketRequest, dict] = None, + request: Optional[Union[logging_config.UndeleteBucketRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Undeletes a log bucket. A bucket that has been @@ -703,7 +714,7 @@ async def sample_undelete_bucket(): await client.undelete_bucket(request=request) Args: - request (Union[google.cloud.logging_v2.types.UndeleteBucketRequest, dict]): + request (Optional[Union[google.cloud.logging_v2.types.UndeleteBucketRequest, dict]]): The request object. The parameters to `UndeleteBucket`. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. @@ -738,11 +749,11 @@ async def sample_undelete_bucket(): async def list_views( self, - request: Union[logging_config.ListViewsRequest, dict] = None, + request: Optional[Union[logging_config.ListViewsRequest, dict]] = None, *, - parent: str = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListViewsAsyncPager: r"""Lists views on a log bucket. @@ -775,7 +786,7 @@ async def sample_list_views(): print(response) Args: - request (Union[google.cloud.logging_v2.types.ListViewsRequest, dict]): + request (Optional[Union[google.cloud.logging_v2.types.ListViewsRequest, dict]]): The request object. The parameters to `ListViews`. parent (:class:`str`): Required. The bucket whose views are to be listed: @@ -854,10 +865,10 @@ async def sample_list_views(): async def get_view( self, - request: Union[logging_config.GetViewRequest, dict] = None, + request: Optional[Union[logging_config.GetViewRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> logging_config.LogView: r"""Gets a view on a log bucket.. @@ -889,7 +900,7 @@ async def sample_get_view(): print(response) Args: - request (Union[google.cloud.logging_v2.types.GetViewRequest, dict]): + request (Optional[Union[google.cloud.logging_v2.types.GetViewRequest, dict]]): The request object. The parameters to `GetView`. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. @@ -933,10 +944,10 @@ async def sample_get_view(): async def create_view( self, - request: Union[logging_config.CreateViewRequest, dict] = None, + request: Optional[Union[logging_config.CreateViewRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> logging_config.LogView: r"""Creates a view over log entries in a log bucket. A @@ -970,7 +981,7 @@ async def sample_create_view(): print(response) Args: - request (Union[google.cloud.logging_v2.types.CreateViewRequest, dict]): + request (Optional[Union[google.cloud.logging_v2.types.CreateViewRequest, dict]]): The request object. The parameters to `CreateView`. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. @@ -1014,10 +1025,10 @@ async def sample_create_view(): async def update_view( self, - request: Union[logging_config.UpdateViewRequest, dict] = None, + request: Optional[Union[logging_config.UpdateViewRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> logging_config.LogView: r"""Updates a view on a log bucket. This method replaces the @@ -1053,7 +1064,7 @@ async def sample_update_view(): print(response) Args: - request (Union[google.cloud.logging_v2.types.UpdateViewRequest, dict]): + request (Optional[Union[google.cloud.logging_v2.types.UpdateViewRequest, dict]]): The request object. The parameters to `UpdateView`. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. @@ -1097,10 +1108,10 @@ async def sample_update_view(): async def delete_view( self, - request: Union[logging_config.DeleteViewRequest, dict] = None, + request: Optional[Union[logging_config.DeleteViewRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Deletes a view on a log bucket. If an ``UNAVAILABLE`` error is @@ -1132,7 +1143,7 @@ async def sample_delete_view(): await client.delete_view(request=request) Args: - request (Union[google.cloud.logging_v2.types.DeleteViewRequest, dict]): + request (Optional[Union[google.cloud.logging_v2.types.DeleteViewRequest, dict]]): The request object. The parameters to `DeleteView`. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. @@ -1167,11 +1178,11 @@ async def sample_delete_view(): async def list_sinks( self, - request: Union[logging_config.ListSinksRequest, dict] = None, + request: Optional[Union[logging_config.ListSinksRequest, dict]] = None, *, - parent: str = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListSinksAsyncPager: r"""Lists sinks. @@ -1204,7 +1215,7 @@ async def sample_list_sinks(): print(response) Args: - request (Union[google.cloud.logging_v2.types.ListSinksRequest, dict]): + request (Optional[Union[google.cloud.logging_v2.types.ListSinksRequest, dict]]): The request object. The parameters to `ListSinks`. parent (:class:`str`): Required. The parent resource whose sinks are to be @@ -1298,11 +1309,11 @@ async def sample_list_sinks(): async def get_sink( self, - request: Union[logging_config.GetSinkRequest, dict] = None, + request: Optional[Union[logging_config.GetSinkRequest, dict]] = None, *, - sink_name: str = None, + sink_name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> logging_config.LogSink: r"""Gets a sink. @@ -1334,7 +1345,7 @@ async def sample_get_sink(): print(response) Args: - request (Union[google.cloud.logging_v2.types.GetSinkRequest, dict]): + request (Optional[Union[google.cloud.logging_v2.types.GetSinkRequest, dict]]): The request object. The parameters to `GetSink`. sink_name (:class:`str`): Required. The resource name of the sink: @@ -1429,12 +1440,12 @@ async def sample_get_sink(): async def create_sink( self, - request: Union[logging_config.CreateSinkRequest, dict] = None, + request: Optional[Union[logging_config.CreateSinkRequest, dict]] = None, *, - parent: str = None, - sink: logging_config.LogSink = None, + parent: Optional[str] = None, + sink: Optional[logging_config.LogSink] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> logging_config.LogSink: r"""Creates a sink that exports specified log entries to a @@ -1475,7 +1486,7 @@ async def sample_create_sink(): print(response) Args: - request (Union[google.cloud.logging_v2.types.CreateSinkRequest, dict]): + request (Optional[Union[google.cloud.logging_v2.types.CreateSinkRequest, dict]]): The request object. The parameters to `CreateSink`. parent (:class:`str`): Required. The resource in which to create the sink: @@ -1566,13 +1577,13 @@ async def sample_create_sink(): async def update_sink( self, - request: Union[logging_config.UpdateSinkRequest, dict] = None, + request: Optional[Union[logging_config.UpdateSinkRequest, dict]] = None, *, - sink_name: str = None, - sink: logging_config.LogSink = None, - update_mask: field_mask_pb2.FieldMask = None, + sink_name: Optional[str] = None, + sink: Optional[logging_config.LogSink] = None, + update_mask: Optional[field_mask_pb2.FieldMask] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> logging_config.LogSink: r"""Updates a sink. This method replaces the following fields in the @@ -1614,7 +1625,7 @@ async def sample_update_sink(): print(response) Args: - request (Union[google.cloud.logging_v2.types.UpdateSinkRequest, dict]): + request (Optional[Union[google.cloud.logging_v2.types.UpdateSinkRequest, dict]]): The request object. The parameters to `UpdateSink`. sink_name (:class:`str`): Required. The full resource name of the sink to update, @@ -1743,11 +1754,11 @@ async def sample_update_sink(): async def delete_sink( self, - request: Union[logging_config.DeleteSinkRequest, dict] = None, + request: Optional[Union[logging_config.DeleteSinkRequest, dict]] = None, *, - sink_name: str = None, + sink_name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Deletes a sink. If the sink has a unique ``writer_identity``, @@ -1777,7 +1788,7 @@ async def sample_delete_sink(): await client.delete_sink(request=request) Args: - request (Union[google.cloud.logging_v2.types.DeleteSinkRequest, dict]): + request (Optional[Union[google.cloud.logging_v2.types.DeleteSinkRequest, dict]]): The request object. The parameters to `DeleteSink`. sink_name (:class:`str`): Required. The full resource name of the sink to delete, @@ -1857,11 +1868,11 @@ async def sample_delete_sink(): async def list_exclusions( self, - request: Union[logging_config.ListExclusionsRequest, dict] = None, + request: Optional[Union[logging_config.ListExclusionsRequest, dict]] = None, *, - parent: str = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListExclusionsAsyncPager: r"""Lists all the exclusions on the \_Default sink in a parent @@ -1895,7 +1906,7 @@ async def sample_list_exclusions(): print(response) Args: - request (Union[google.cloud.logging_v2.types.ListExclusionsRequest, dict]): + request (Optional[Union[google.cloud.logging_v2.types.ListExclusionsRequest, dict]]): The request object. The parameters to `ListExclusions`. parent (:class:`str`): Required. The parent resource whose exclusions are to be @@ -1989,11 +2000,11 @@ async def sample_list_exclusions(): async def get_exclusion( self, - request: Union[logging_config.GetExclusionRequest, dict] = None, + request: Optional[Union[logging_config.GetExclusionRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> logging_config.LogExclusion: r"""Gets the description of an exclusion in the \_Default sink. @@ -2025,7 +2036,7 @@ async def sample_get_exclusion(): print(response) Args: - request (Union[google.cloud.logging_v2.types.GetExclusionRequest, dict]): + request (Optional[Union[google.cloud.logging_v2.types.GetExclusionRequest, dict]]): The request object. The parameters to `GetExclusion`. name (:class:`str`): Required. The resource name of an existing exclusion: @@ -2116,12 +2127,12 @@ async def sample_get_exclusion(): async def create_exclusion( self, - request: Union[logging_config.CreateExclusionRequest, dict] = None, + request: Optional[Union[logging_config.CreateExclusionRequest, dict]] = None, *, - parent: str = None, - exclusion: logging_config.LogExclusion = None, + parent: Optional[str] = None, + exclusion: Optional[logging_config.LogExclusion] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> logging_config.LogExclusion: r"""Creates a new exclusion in the \_Default sink in a specified @@ -2160,7 +2171,7 @@ async def sample_create_exclusion(): print(response) Args: - request (Union[google.cloud.logging_v2.types.CreateExclusionRequest, dict]): + request (Optional[Union[google.cloud.logging_v2.types.CreateExclusionRequest, dict]]): The request object. The parameters to `CreateExclusion`. parent (:class:`str`): Required. The parent resource in which to create the @@ -2252,13 +2263,13 @@ async def sample_create_exclusion(): async def update_exclusion( self, - request: Union[logging_config.UpdateExclusionRequest, dict] = None, + request: Optional[Union[logging_config.UpdateExclusionRequest, dict]] = None, *, - name: str = None, - exclusion: logging_config.LogExclusion = None, - update_mask: field_mask_pb2.FieldMask = None, + name: Optional[str] = None, + exclusion: Optional[logging_config.LogExclusion] = None, + update_mask: Optional[field_mask_pb2.FieldMask] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> logging_config.LogExclusion: r"""Changes one or more properties of an existing exclusion in the @@ -2296,7 +2307,7 @@ async def sample_update_exclusion(): print(response) Args: - request (Union[google.cloud.logging_v2.types.UpdateExclusionRequest, dict]): + request (Optional[Union[google.cloud.logging_v2.types.UpdateExclusionRequest, dict]]): The request object. The parameters to `UpdateExclusion`. name (:class:`str`): Required. The resource name of the exclusion to update: @@ -2402,11 +2413,11 @@ async def sample_update_exclusion(): async def delete_exclusion( self, - request: Union[logging_config.DeleteExclusionRequest, dict] = None, + request: Optional[Union[logging_config.DeleteExclusionRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Deletes an exclusion in the \_Default sink. @@ -2435,7 +2446,7 @@ async def sample_delete_exclusion(): await client.delete_exclusion(request=request) Args: - request (Union[google.cloud.logging_v2.types.DeleteExclusionRequest, dict]): + request (Optional[Union[google.cloud.logging_v2.types.DeleteExclusionRequest, dict]]): The request object. The parameters to `DeleteExclusion`. name (:class:`str`): Required. The resource name of an existing exclusion to @@ -2513,10 +2524,10 @@ async def sample_delete_exclusion(): async def get_cmek_settings( self, - request: Union[logging_config.GetCmekSettingsRequest, dict] = None, + request: Optional[Union[logging_config.GetCmekSettingsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> logging_config.CmekSettings: r"""Gets the Logging CMEK settings for the given resource. @@ -2557,7 +2568,7 @@ async def sample_get_cmek_settings(): print(response) Args: - request (Union[google.cloud.logging_v2.types.GetCmekSettingsRequest, dict]): + request (Optional[Union[google.cloud.logging_v2.types.GetCmekSettingsRequest, dict]]): The request object. The parameters to [GetCmekSettings][google.logging.v2.ConfigServiceV2.GetCmekSettings]. See [Enabling CMEK for Log @@ -2615,10 +2626,10 @@ async def sample_get_cmek_settings(): async def update_cmek_settings( self, - request: Union[logging_config.UpdateCmekSettingsRequest, dict] = None, + request: Optional[Union[logging_config.UpdateCmekSettingsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> logging_config.CmekSettings: r"""Updates the Log Router CMEK settings for the given resource. @@ -2664,7 +2675,7 @@ async def sample_update_cmek_settings(): print(response) Args: - request (Union[google.cloud.logging_v2.types.UpdateCmekSettingsRequest, dict]): + request (Optional[Union[google.cloud.logging_v2.types.UpdateCmekSettingsRequest, dict]]): The request object. The parameters to [UpdateCmekSettings][google.logging.v2.ConfigServiceV2.UpdateCmekSettings]. See [Enabling CMEK for Log @@ -2722,11 +2733,11 @@ async def sample_update_cmek_settings(): async def get_settings( self, - request: Union[logging_config.GetSettingsRequest, dict] = None, + request: Optional[Union[logging_config.GetSettingsRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> logging_config.Settings: r"""Gets the Log Router settings for the given resource. @@ -2768,7 +2779,7 @@ async def sample_get_settings(): print(response) Args: - request (Union[google.cloud.logging_v2.types.GetSettingsRequest, dict]): + request (Optional[Union[google.cloud.logging_v2.types.GetSettingsRequest, dict]]): The request object. The parameters to [GetSettings][google.logging.v2.ConfigServiceV2.GetSettings]. See [Enabling CMEK for Log @@ -2855,12 +2866,12 @@ async def sample_get_settings(): async def update_settings( self, - request: Union[logging_config.UpdateSettingsRequest, dict] = None, + request: Optional[Union[logging_config.UpdateSettingsRequest, dict]] = None, *, - settings: logging_config.Settings = None, - update_mask: field_mask_pb2.FieldMask = None, + settings: Optional[logging_config.Settings] = None, + update_mask: Optional[field_mask_pb2.FieldMask] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> logging_config.Settings: r"""Updates the Log Router settings for the given resource. @@ -2909,7 +2920,7 @@ async def sample_update_settings(): print(response) Args: - request (Union[google.cloud.logging_v2.types.UpdateSettingsRequest, dict]): + request (Optional[Union[google.cloud.logging_v2.types.UpdateSettingsRequest, dict]]): The request object. The parameters to [UpdateSettings][google.logging.v2.ConfigServiceV2.UpdateSettings]. See [Enabling CMEK for Log @@ -2998,10 +3009,10 @@ async def sample_update_settings(): async def copy_log_entries( self, - request: Union[logging_config.CopyLogEntriesRequest, dict] = None, + request: Optional[Union[logging_config.CopyLogEntriesRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Copies a set of log entries from a log bucket to a @@ -3033,13 +3044,13 @@ async def sample_copy_log_entries(): print("Waiting for operation to complete...") - response = await operation.result() + response = (await operation).result() # Handle the response print(response) Args: - request (Union[google.cloud.logging_v2.types.CopyLogEntriesRequest, dict]): + request (Optional[Union[google.cloud.logging_v2.types.CopyLogEntriesRequest, dict]]): The request object. The parameters to CopyLogEntries. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. @@ -3094,14 +3105,9 @@ async def __aexit__(self, exc_type, exc, tb): await self.transport.close() -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution( - "google-cloud-logging", - ).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() +DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=package_version.__version__ +) __all__ = ("ConfigServiceV2AsyncClient",) diff --git a/google/cloud/logging_v2/services/config_service_v2/client.py b/google/cloud/logging_v2/services/config_service_v2/client.py index b905d1741..7ebbe333f 100644 --- a/google/cloud/logging_v2/services/config_service_v2/client.py +++ b/google/cloud/logging_v2/services/config_service_v2/client.py @@ -16,8 +16,20 @@ from collections import OrderedDict import os import re -from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union -import pkg_resources +from typing import ( + Dict, + Mapping, + MutableMapping, + MutableSequence, + Optional, + Sequence, + Tuple, + Type, + Union, + cast, +) + +from google.cloud.logging_v2 import gapic_version as package_version from google.api_core import client_options as client_options_lib from google.api_core import exceptions as core_exceptions @@ -61,7 +73,7 @@ class ConfigServiceV2ClientMeta(type): def get_transport_class( cls, - label: str = None, + label: Optional[str] = None, ) -> Type[ConfigServiceV2Transport]: """Returns an appropriate transport class. @@ -424,8 +436,8 @@ def __init__( self, *, credentials: Optional[ga_credentials.Credentials] = None, - transport: Union[str, ConfigServiceV2Transport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, + transport: Optional[Union[str, ConfigServiceV2Transport]] = None, + client_options: Optional[Union[client_options_lib.ClientOptions, dict]] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiates the config service v2 client. @@ -439,7 +451,7 @@ def __init__( transport (Union[str, ConfigServiceV2Transport]): The transport to use. If set to None, a transport is chosen automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the + client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]): Custom options for the client. It won't take effect if a ``transport`` instance is provided. (1) The ``api_endpoint`` property can be used to override the default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT @@ -469,6 +481,7 @@ def __init__( client_options = client_options_lib.from_dict(client_options) if client_options is None: client_options = client_options_lib.ClientOptions() + client_options = cast(client_options_lib.ClientOptions, client_options) api_endpoint, client_cert_source_func = self.get_mtls_endpoint_and_cert_source( client_options @@ -521,11 +534,11 @@ def __init__( def list_buckets( self, - request: Union[logging_config.ListBucketsRequest, dict] = None, + request: Optional[Union[logging_config.ListBucketsRequest, dict]] = None, *, - parent: str = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListBucketsPager: r"""Lists log buckets. @@ -645,10 +658,10 @@ def sample_list_buckets(): def get_bucket( self, - request: Union[logging_config.GetBucketRequest, dict] = None, + request: Optional[Union[logging_config.GetBucketRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> logging_config.LogBucket: r"""Gets a log bucket. @@ -725,10 +738,10 @@ def sample_get_bucket(): def create_bucket( self, - request: Union[logging_config.CreateBucketRequest, dict] = None, + request: Optional[Union[logging_config.CreateBucketRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> logging_config.LogBucket: r"""Creates a log bucket that can be used to store log @@ -808,10 +821,10 @@ def sample_create_bucket(): def update_bucket( self, - request: Union[logging_config.UpdateBucketRequest, dict] = None, + request: Optional[Union[logging_config.UpdateBucketRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> logging_config.LogBucket: r"""Updates a log bucket. This method replaces the following fields @@ -899,10 +912,10 @@ def sample_update_bucket(): def delete_bucket( self, - request: Union[logging_config.DeleteBucketRequest, dict] = None, + request: Optional[Union[logging_config.DeleteBucketRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Deletes a log bucket. @@ -972,10 +985,10 @@ def sample_delete_bucket(): def undelete_bucket( self, - request: Union[logging_config.UndeleteBucketRequest, dict] = None, + request: Optional[Union[logging_config.UndeleteBucketRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Undeletes a log bucket. A bucket that has been @@ -1042,11 +1055,11 @@ def sample_undelete_bucket(): def list_views( self, - request: Union[logging_config.ListViewsRequest, dict] = None, + request: Optional[Union[logging_config.ListViewsRequest, dict]] = None, *, - parent: str = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListViewsPager: r"""Lists views on a log bucket. @@ -1158,10 +1171,10 @@ def sample_list_views(): def get_view( self, - request: Union[logging_config.GetViewRequest, dict] = None, + request: Optional[Union[logging_config.GetViewRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> logging_config.LogView: r"""Gets a view on a log bucket.. @@ -1238,10 +1251,10 @@ def sample_get_view(): def create_view( self, - request: Union[logging_config.CreateViewRequest, dict] = None, + request: Optional[Union[logging_config.CreateViewRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> logging_config.LogView: r"""Creates a view over log entries in a log bucket. A @@ -1320,10 +1333,10 @@ def sample_create_view(): def update_view( self, - request: Union[logging_config.UpdateViewRequest, dict] = None, + request: Optional[Union[logging_config.UpdateViewRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> logging_config.LogView: r"""Updates a view on a log bucket. This method replaces the @@ -1404,10 +1417,10 @@ def sample_update_view(): def delete_view( self, - request: Union[logging_config.DeleteViewRequest, dict] = None, + request: Optional[Union[logging_config.DeleteViewRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Deletes a view on a log bucket. If an ``UNAVAILABLE`` error is @@ -1475,11 +1488,11 @@ def sample_delete_view(): def list_sinks( self, - request: Union[logging_config.ListSinksRequest, dict] = None, + request: Optional[Union[logging_config.ListSinksRequest, dict]] = None, *, - parent: str = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListSinksPager: r"""Lists sinks. @@ -1595,11 +1608,11 @@ def sample_list_sinks(): def get_sink( self, - request: Union[logging_config.GetSinkRequest, dict] = None, + request: Optional[Union[logging_config.GetSinkRequest, dict]] = None, *, - sink_name: str = None, + sink_name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> logging_config.LogSink: r"""Gets a sink. @@ -1715,12 +1728,12 @@ def sample_get_sink(): def create_sink( self, - request: Union[logging_config.CreateSinkRequest, dict] = None, + request: Optional[Union[logging_config.CreateSinkRequest, dict]] = None, *, - parent: str = None, - sink: logging_config.LogSink = None, + parent: Optional[str] = None, + sink: Optional[logging_config.LogSink] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> logging_config.LogSink: r"""Creates a sink that exports specified log entries to a @@ -1852,13 +1865,13 @@ def sample_create_sink(): def update_sink( self, - request: Union[logging_config.UpdateSinkRequest, dict] = None, + request: Optional[Union[logging_config.UpdateSinkRequest, dict]] = None, *, - sink_name: str = None, - sink: logging_config.LogSink = None, - update_mask: field_mask_pb2.FieldMask = None, + sink_name: Optional[str] = None, + sink: Optional[logging_config.LogSink] = None, + update_mask: Optional[field_mask_pb2.FieldMask] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> logging_config.LogSink: r"""Updates a sink. This method replaces the following fields in the @@ -2018,11 +2031,11 @@ def sample_update_sink(): def delete_sink( self, - request: Union[logging_config.DeleteSinkRequest, dict] = None, + request: Optional[Union[logging_config.DeleteSinkRequest, dict]] = None, *, - sink_name: str = None, + sink_name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Deletes a sink. If the sink has a unique ``writer_identity``, @@ -2121,11 +2134,11 @@ def sample_delete_sink(): def list_exclusions( self, - request: Union[logging_config.ListExclusionsRequest, dict] = None, + request: Optional[Union[logging_config.ListExclusionsRequest, dict]] = None, *, - parent: str = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListExclusionsPager: r"""Lists all the exclusions on the \_Default sink in a parent @@ -2242,11 +2255,11 @@ def sample_list_exclusions(): def get_exclusion( self, - request: Union[logging_config.GetExclusionRequest, dict] = None, + request: Optional[Union[logging_config.GetExclusionRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> logging_config.LogExclusion: r"""Gets the description of an exclusion in the \_Default sink. @@ -2358,12 +2371,12 @@ def sample_get_exclusion(): def create_exclusion( self, - request: Union[logging_config.CreateExclusionRequest, dict] = None, + request: Optional[Union[logging_config.CreateExclusionRequest, dict]] = None, *, - parent: str = None, - exclusion: logging_config.LogExclusion = None, + parent: Optional[str] = None, + exclusion: Optional[logging_config.LogExclusion] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> logging_config.LogExclusion: r"""Creates a new exclusion in the \_Default sink in a specified @@ -2494,13 +2507,13 @@ def sample_create_exclusion(): def update_exclusion( self, - request: Union[logging_config.UpdateExclusionRequest, dict] = None, + request: Optional[Union[logging_config.UpdateExclusionRequest, dict]] = None, *, - name: str = None, - exclusion: logging_config.LogExclusion = None, - update_mask: field_mask_pb2.FieldMask = None, + name: Optional[str] = None, + exclusion: Optional[logging_config.LogExclusion] = None, + update_mask: Optional[field_mask_pb2.FieldMask] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> logging_config.LogExclusion: r"""Changes one or more properties of an existing exclusion in the @@ -2644,11 +2657,11 @@ def sample_update_exclusion(): def delete_exclusion( self, - request: Union[logging_config.DeleteExclusionRequest, dict] = None, + request: Optional[Union[logging_config.DeleteExclusionRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Deletes an exclusion in the \_Default sink. @@ -2744,10 +2757,10 @@ def sample_delete_exclusion(): def get_cmek_settings( self, - request: Union[logging_config.GetCmekSettingsRequest, dict] = None, + request: Optional[Union[logging_config.GetCmekSettingsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> logging_config.CmekSettings: r"""Gets the Logging CMEK settings for the given resource. @@ -2847,10 +2860,10 @@ def sample_get_cmek_settings(): def update_cmek_settings( self, - request: Union[logging_config.UpdateCmekSettingsRequest, dict] = None, + request: Optional[Union[logging_config.UpdateCmekSettingsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> logging_config.CmekSettings: r"""Updates the Log Router CMEK settings for the given resource. @@ -2955,11 +2968,11 @@ def sample_update_cmek_settings(): def get_settings( self, - request: Union[logging_config.GetSettingsRequest, dict] = None, + request: Optional[Union[logging_config.GetSettingsRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> logging_config.Settings: r"""Gets the Log Router settings for the given resource. @@ -3088,12 +3101,12 @@ def sample_get_settings(): def update_settings( self, - request: Union[logging_config.UpdateSettingsRequest, dict] = None, + request: Optional[Union[logging_config.UpdateSettingsRequest, dict]] = None, *, - settings: logging_config.Settings = None, - update_mask: field_mask_pb2.FieldMask = None, + settings: Optional[logging_config.Settings] = None, + update_mask: Optional[field_mask_pb2.FieldMask] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> logging_config.Settings: r"""Updates the Log Router settings for the given resource. @@ -3231,10 +3244,10 @@ def sample_update_settings(): def copy_log_entries( self, - request: Union[logging_config.CopyLogEntriesRequest, dict] = None, + request: Optional[Union[logging_config.CopyLogEntriesRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> operation.Operation: r"""Copies a set of log entries from a log bucket to a @@ -3335,14 +3348,9 @@ def __exit__(self, type, value, traceback): self.transport.close() -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution( - "google-cloud-logging", - ).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() +DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=package_version.__version__ +) __all__ = ("ConfigServiceV2Client",) diff --git a/google/cloud/logging_v2/services/config_service_v2/transports/base.py b/google/cloud/logging_v2/services/config_service_v2/transports/base.py index b65a2117b..53046583b 100644 --- a/google/cloud/logging_v2/services/config_service_v2/transports/base.py +++ b/google/cloud/logging_v2/services/config_service_v2/transports/base.py @@ -15,7 +15,8 @@ # import abc from typing import Awaitable, Callable, Dict, Optional, Sequence, Union -import pkg_resources + +from google.cloud.logging_v2 import gapic_version as package_version import google.auth # type: ignore import google.api_core @@ -30,14 +31,9 @@ from google.longrunning import operations_pb2 # type: ignore from google.protobuf import empty_pb2 # type: ignore -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution( - "google-cloud-logging", - ).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() +DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=package_version.__version__ +) class ConfigServiceV2Transport(abc.ABC): @@ -56,7 +52,7 @@ def __init__( self, *, host: str = DEFAULT_HOST, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, diff --git a/google/cloud/logging_v2/services/config_service_v2/transports/grpc.py b/google/cloud/logging_v2/services/config_service_v2/transports/grpc.py index d8aca6273..97c220686 100644 --- a/google/cloud/logging_v2/services/config_service_v2/transports/grpc.py +++ b/google/cloud/logging_v2/services/config_service_v2/transports/grpc.py @@ -50,14 +50,14 @@ def __init__( self, *, host: str = "logging.googleapis.com", - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + channel: Optional[grpc.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, @@ -185,8 +185,8 @@ def __init__( def create_channel( cls, host: str = "logging.googleapis.com", - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, **kwargs, diff --git a/google/cloud/logging_v2/services/config_service_v2/transports/grpc_asyncio.py b/google/cloud/logging_v2/services/config_service_v2/transports/grpc_asyncio.py index 2a36a4955..0d0737576 100644 --- a/google/cloud/logging_v2/services/config_service_v2/transports/grpc_asyncio.py +++ b/google/cloud/logging_v2/services/config_service_v2/transports/grpc_asyncio.py @@ -52,7 +52,7 @@ class ConfigServiceV2GrpcAsyncIOTransport(ConfigServiceV2Transport): def create_channel( cls, host: str = "logging.googleapis.com", - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, @@ -95,15 +95,15 @@ def __init__( self, *, host: str = "logging.googleapis.com", - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, - channel: aio.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, - quota_project_id=None, + channel: Optional[aio.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, api_audience: Optional[str] = None, diff --git a/google/cloud/logging_v2/services/logging_service_v2/async_client.py b/google/cloud/logging_v2/services/logging_service_v2/async_client.py index d0c9cc06b..3f5ed6a0c 100644 --- a/google/cloud/logging_v2/services/logging_service_v2/async_client.py +++ b/google/cloud/logging_v2/services/logging_service_v2/async_client.py @@ -19,6 +19,8 @@ from typing import ( Dict, Mapping, + MutableMapping, + MutableSequence, Optional, AsyncIterable, Awaitable, @@ -28,7 +30,8 @@ Type, Union, ) -import pkg_resources + +from google.cloud.logging_v2 import gapic_version as package_version from google.api_core.client_options import ClientOptions from google.api_core import exceptions as core_exceptions @@ -171,9 +174,9 @@ def transport(self) -> LoggingServiceV2Transport: def __init__( self, *, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, transport: Union[str, LoggingServiceV2Transport] = "grpc_asyncio", - client_options: ClientOptions = None, + client_options: Optional[ClientOptions] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiates the logging service v2 client. @@ -217,11 +220,11 @@ def __init__( async def delete_log( self, - request: Union[logging.DeleteLogRequest, dict] = None, + request: Optional[Union[logging.DeleteLogRequest, dict]] = None, *, - log_name: str = None, + log_name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Deletes all the log entries in a log for the \_Default Log @@ -254,7 +257,7 @@ async def sample_delete_log(): await client.delete_log(request=request) Args: - request (Union[google.cloud.logging_v2.types.DeleteLogRequest, dict]): + request (Optional[Union[google.cloud.logging_v2.types.DeleteLogRequest, dict]]): The request object. The parameters to DeleteLog. log_name (:class:`str`): Required. The resource name of the log to delete: @@ -332,14 +335,14 @@ async def sample_delete_log(): async def write_log_entries( self, - request: Union[logging.WriteLogEntriesRequest, dict] = None, + request: Optional[Union[logging.WriteLogEntriesRequest, dict]] = None, *, - log_name: str = None, - resource: monitored_resource_pb2.MonitoredResource = None, - labels: Mapping[str, str] = None, - entries: Sequence[log_entry.LogEntry] = None, + log_name: Optional[str] = None, + resource: Optional[monitored_resource_pb2.MonitoredResource] = None, + labels: Optional[MutableMapping[str, str]] = None, + entries: Optional[MutableSequence[log_entry.LogEntry]] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> logging.WriteLogEntriesResponse: r"""Writes log entries to Logging. This API method is the @@ -380,7 +383,7 @@ async def sample_write_log_entries(): print(response) Args: - request (Union[google.cloud.logging_v2.types.WriteLogEntriesRequest, dict]): + request (Optional[Union[google.cloud.logging_v2.types.WriteLogEntriesRequest, dict]]): The request object. The parameters to WriteLogEntries. log_name (:class:`str`): Optional. A default log resource name that is assigned @@ -424,7 +427,7 @@ async def sample_write_log_entries(): This corresponds to the ``resource`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - labels (:class:`Mapping[str, str]`): + labels (:class:`MutableMapping[str, str]`): Optional. Default labels that are added to the ``labels`` field of all log entries in ``entries``. If a log entry already has a label with the same key as a @@ -434,7 +437,7 @@ async def sample_write_log_entries(): This corresponds to the ``labels`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - entries (:class:`Sequence[google.cloud.logging_v2.types.LogEntry]`): + entries (:class:`MutableSequence[google.cloud.logging_v2.types.LogEntry]`): Required. The log entries to send to Logging. The order of log entries in this list does not matter. Values supplied in this method's ``log_name``, ``resource``, @@ -534,13 +537,13 @@ async def sample_write_log_entries(): async def list_log_entries( self, - request: Union[logging.ListLogEntriesRequest, dict] = None, + request: Optional[Union[logging.ListLogEntriesRequest, dict]] = None, *, - resource_names: Sequence[str] = None, - filter: str = None, - order_by: str = None, + resource_names: Optional[MutableSequence[str]] = None, + filter: Optional[str] = None, + order_by: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListLogEntriesAsyncPager: r"""Lists log entries. Use this method to retrieve log entries that @@ -576,9 +579,9 @@ async def sample_list_log_entries(): print(response) Args: - request (Union[google.cloud.logging_v2.types.ListLogEntriesRequest, dict]): + request (Optional[Union[google.cloud.logging_v2.types.ListLogEntriesRequest, dict]]): The request object. The parameters to `ListLogEntries`. - resource_names (:class:`Sequence[str]`): + resource_names (:class:`MutableSequence[str]`): Required. Names of one or more parent resources from which to retrieve log entries: @@ -703,10 +706,12 @@ async def sample_list_log_entries(): async def list_monitored_resource_descriptors( self, - request: Union[logging.ListMonitoredResourceDescriptorsRequest, dict] = None, + request: Optional[ + Union[logging.ListMonitoredResourceDescriptorsRequest, dict] + ] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListMonitoredResourceDescriptorsAsyncPager: r"""Lists the descriptors for monitored resource types @@ -739,7 +744,7 @@ async def sample_list_monitored_resource_descriptors(): print(response) Args: - request (Union[google.cloud.logging_v2.types.ListMonitoredResourceDescriptorsRequest, dict]): + request (Optional[Union[google.cloud.logging_v2.types.ListMonitoredResourceDescriptorsRequest, dict]]): The request object. The parameters to ListMonitoredResourceDescriptors retry (google.api_core.retry.Retry): Designation of what errors, if any, @@ -801,11 +806,11 @@ async def sample_list_monitored_resource_descriptors(): async def list_logs( self, - request: Union[logging.ListLogsRequest, dict] = None, + request: Optional[Union[logging.ListLogsRequest, dict]] = None, *, - parent: str = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListLogsAsyncPager: r"""Lists the logs in projects, organizations, folders, @@ -840,7 +845,7 @@ async def sample_list_logs(): print(response) Args: - request (Union[google.cloud.logging_v2.types.ListLogsRequest, dict]): + request (Optional[Union[google.cloud.logging_v2.types.ListLogsRequest, dict]]): The request object. The parameters to ListLogs. parent (:class:`str`): Required. The resource name that owns the logs: @@ -931,10 +936,10 @@ async def sample_list_logs(): def tail_log_entries( self, - requests: AsyncIterator[logging.TailLogEntriesRequest] = None, + requests: Optional[AsyncIterator[logging.TailLogEntriesRequest]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> Awaitable[AsyncIterable[logging.TailLogEntriesResponse]]: r"""Streaming read of log entries as they are ingested. @@ -1029,14 +1034,9 @@ async def __aexit__(self, exc_type, exc, tb): await self.transport.close() -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution( - "google-cloud-logging", - ).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() +DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=package_version.__version__ +) __all__ = ("LoggingServiceV2AsyncClient",) diff --git a/google/cloud/logging_v2/services/logging_service_v2/client.py b/google/cloud/logging_v2/services/logging_service_v2/client.py index 930f94c61..fa3e15e6c 100644 --- a/google/cloud/logging_v2/services/logging_service_v2/client.py +++ b/google/cloud/logging_v2/services/logging_service_v2/client.py @@ -19,6 +19,8 @@ from typing import ( Dict, Mapping, + MutableMapping, + MutableSequence, Optional, Iterable, Iterator, @@ -26,8 +28,10 @@ Tuple, Type, Union, + cast, ) -import pkg_resources + +from google.cloud.logging_v2 import gapic_version as package_version from google.api_core import client_options as client_options_lib from google.api_core import exceptions as core_exceptions @@ -69,7 +73,7 @@ class LoggingServiceV2ClientMeta(type): def get_transport_class( cls, - label: str = None, + label: Optional[str] = None, ) -> Type[LoggingServiceV2Transport]: """Returns an appropriate transport class. @@ -339,8 +343,8 @@ def __init__( self, *, credentials: Optional[ga_credentials.Credentials] = None, - transport: Union[str, LoggingServiceV2Transport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, + transport: Optional[Union[str, LoggingServiceV2Transport]] = None, + client_options: Optional[Union[client_options_lib.ClientOptions, dict]] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiates the logging service v2 client. @@ -354,7 +358,7 @@ def __init__( transport (Union[str, LoggingServiceV2Transport]): The transport to use. If set to None, a transport is chosen automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the + client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]): Custom options for the client. It won't take effect if a ``transport`` instance is provided. (1) The ``api_endpoint`` property can be used to override the default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT @@ -384,6 +388,7 @@ def __init__( client_options = client_options_lib.from_dict(client_options) if client_options is None: client_options = client_options_lib.ClientOptions() + client_options = cast(client_options_lib.ClientOptions, client_options) api_endpoint, client_cert_source_func = self.get_mtls_endpoint_and_cert_source( client_options @@ -436,11 +441,11 @@ def __init__( def delete_log( self, - request: Union[logging.DeleteLogRequest, dict] = None, + request: Optional[Union[logging.DeleteLogRequest, dict]] = None, *, - log_name: str = None, + log_name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Deletes all the log entries in a log for the \_Default Log @@ -540,14 +545,14 @@ def sample_delete_log(): def write_log_entries( self, - request: Union[logging.WriteLogEntriesRequest, dict] = None, + request: Optional[Union[logging.WriteLogEntriesRequest, dict]] = None, *, - log_name: str = None, - resource: monitored_resource_pb2.MonitoredResource = None, - labels: Mapping[str, str] = None, - entries: Sequence[log_entry.LogEntry] = None, + log_name: Optional[str] = None, + resource: Optional[monitored_resource_pb2.MonitoredResource] = None, + labels: Optional[MutableMapping[str, str]] = None, + entries: Optional[MutableSequence[log_entry.LogEntry]] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> logging.WriteLogEntriesResponse: r"""Writes log entries to Logging. This API method is the @@ -632,7 +637,7 @@ def sample_write_log_entries(): This corresponds to the ``resource`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - labels (Mapping[str, str]): + labels (MutableMapping[str, str]): Optional. Default labels that are added to the ``labels`` field of all log entries in ``entries``. If a log entry already has a label with the same key as a @@ -642,7 +647,7 @@ def sample_write_log_entries(): This corresponds to the ``labels`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - entries (Sequence[google.cloud.logging_v2.types.LogEntry]): + entries (MutableSequence[google.cloud.logging_v2.types.LogEntry]): Required. The log entries to send to Logging. The order of log entries in this list does not matter. Values supplied in this method's ``log_name``, ``resource``, @@ -730,13 +735,13 @@ def sample_write_log_entries(): def list_log_entries( self, - request: Union[logging.ListLogEntriesRequest, dict] = None, + request: Optional[Union[logging.ListLogEntriesRequest, dict]] = None, *, - resource_names: Sequence[str] = None, - filter: str = None, - order_by: str = None, + resource_names: Optional[MutableSequence[str]] = None, + filter: Optional[str] = None, + order_by: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListLogEntriesPager: r"""Lists log entries. Use this method to retrieve log entries that @@ -774,7 +779,7 @@ def sample_list_log_entries(): Args: request (Union[google.cloud.logging_v2.types.ListLogEntriesRequest, dict]): The request object. The parameters to `ListLogEntries`. - resource_names (Sequence[str]): + resource_names (MutableSequence[str]): Required. Names of one or more parent resources from which to retrieve log entries: @@ -888,10 +893,12 @@ def sample_list_log_entries(): def list_monitored_resource_descriptors( self, - request: Union[logging.ListMonitoredResourceDescriptorsRequest, dict] = None, + request: Optional[ + Union[logging.ListMonitoredResourceDescriptorsRequest, dict] + ] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListMonitoredResourceDescriptorsPager: r"""Lists the descriptors for monitored resource types @@ -978,11 +985,11 @@ def sample_list_monitored_resource_descriptors(): def list_logs( self, - request: Union[logging.ListLogsRequest, dict] = None, + request: Optional[Union[logging.ListLogsRequest, dict]] = None, *, - parent: str = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListLogsPager: r"""Lists the logs in projects, organizations, folders, @@ -1097,10 +1104,10 @@ def sample_list_logs(): def tail_log_entries( self, - requests: Iterator[logging.TailLogEntriesRequest] = None, + requests: Optional[Iterator[logging.TailLogEntriesRequest]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> Iterable[logging.TailLogEntriesResponse]: r"""Streaming read of log entries as they are ingested. @@ -1187,14 +1194,9 @@ def __exit__(self, type, value, traceback): self.transport.close() -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution( - "google-cloud-logging", - ).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() +DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=package_version.__version__ +) __all__ = ("LoggingServiceV2Client",) diff --git a/google/cloud/logging_v2/services/logging_service_v2/transports/base.py b/google/cloud/logging_v2/services/logging_service_v2/transports/base.py index d308f7d01..22665b15e 100644 --- a/google/cloud/logging_v2/services/logging_service_v2/transports/base.py +++ b/google/cloud/logging_v2/services/logging_service_v2/transports/base.py @@ -15,7 +15,8 @@ # import abc from typing import Awaitable, Callable, Dict, Optional, Sequence, Union -import pkg_resources + +from google.cloud.logging_v2 import gapic_version as package_version import google.auth # type: ignore import google.api_core @@ -28,14 +29,9 @@ from google.cloud.logging_v2.types import logging from google.protobuf import empty_pb2 # type: ignore -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution( - "google-cloud-logging", - ).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() +DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=package_version.__version__ +) class LoggingServiceV2Transport(abc.ABC): @@ -55,7 +51,7 @@ def __init__( self, *, host: str = DEFAULT_HOST, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, diff --git a/google/cloud/logging_v2/services/logging_service_v2/transports/grpc.py b/google/cloud/logging_v2/services/logging_service_v2/transports/grpc.py index 3c9c7743e..a6878b6fa 100644 --- a/google/cloud/logging_v2/services/logging_service_v2/transports/grpc.py +++ b/google/cloud/logging_v2/services/logging_service_v2/transports/grpc.py @@ -48,14 +48,14 @@ def __init__( self, *, host: str = "logging.googleapis.com", - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + channel: Optional[grpc.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, @@ -182,8 +182,8 @@ def __init__( def create_channel( cls, host: str = "logging.googleapis.com", - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, **kwargs, diff --git a/google/cloud/logging_v2/services/logging_service_v2/transports/grpc_asyncio.py b/google/cloud/logging_v2/services/logging_service_v2/transports/grpc_asyncio.py index a7fdf5ffc..2e8f76017 100644 --- a/google/cloud/logging_v2/services/logging_service_v2/transports/grpc_asyncio.py +++ b/google/cloud/logging_v2/services/logging_service_v2/transports/grpc_asyncio.py @@ -50,7 +50,7 @@ class LoggingServiceV2GrpcAsyncIOTransport(LoggingServiceV2Transport): def create_channel( cls, host: str = "logging.googleapis.com", - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, @@ -93,15 +93,15 @@ def __init__( self, *, host: str = "logging.googleapis.com", - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, - channel: aio.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, - quota_project_id=None, + channel: Optional[aio.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, api_audience: Optional[str] = None, diff --git a/google/cloud/logging_v2/services/metrics_service_v2/async_client.py b/google/cloud/logging_v2/services/metrics_service_v2/async_client.py index 2e8996404..14a3d5f2a 100644 --- a/google/cloud/logging_v2/services/metrics_service_v2/async_client.py +++ b/google/cloud/logging_v2/services/metrics_service_v2/async_client.py @@ -16,8 +16,19 @@ from collections import OrderedDict import functools import re -from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union -import pkg_resources +from typing import ( + Dict, + Mapping, + MutableMapping, + MutableSequence, + Optional, + Sequence, + Tuple, + Type, + Union, +) + +from google.cloud.logging_v2 import gapic_version as package_version from google.api_core.client_options import ClientOptions from google.api_core import exceptions as core_exceptions @@ -161,9 +172,9 @@ def transport(self) -> MetricsServiceV2Transport: def __init__( self, *, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, transport: Union[str, MetricsServiceV2Transport] = "grpc_asyncio", - client_options: ClientOptions = None, + client_options: Optional[ClientOptions] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiates the metrics service v2 client. @@ -207,11 +218,11 @@ def __init__( async def list_log_metrics( self, - request: Union[logging_metrics.ListLogMetricsRequest, dict] = None, + request: Optional[Union[logging_metrics.ListLogMetricsRequest, dict]] = None, *, - parent: str = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListLogMetricsAsyncPager: r"""Lists logs-based metrics. @@ -244,7 +255,7 @@ async def sample_list_log_metrics(): print(response) Args: - request (Union[google.cloud.logging_v2.types.ListLogMetricsRequest, dict]): + request (Optional[Union[google.cloud.logging_v2.types.ListLogMetricsRequest, dict]]): The request object. The parameters to ListLogMetrics. parent (:class:`str`): Required. The name of the project containing the @@ -335,11 +346,11 @@ async def sample_list_log_metrics(): async def get_log_metric( self, - request: Union[logging_metrics.GetLogMetricRequest, dict] = None, + request: Optional[Union[logging_metrics.GetLogMetricRequest, dict]] = None, *, - metric_name: str = None, + metric_name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> logging_metrics.LogMetric: r"""Gets a logs-based metric. @@ -371,7 +382,7 @@ async def sample_get_log_metric(): print(response) Args: - request (Union[google.cloud.logging_v2.types.GetLogMetricRequest, dict]): + request (Optional[Union[google.cloud.logging_v2.types.GetLogMetricRequest, dict]]): The request object. The parameters to GetLogMetric. metric_name (:class:`str`): Required. The resource name of the desired metric: @@ -461,12 +472,12 @@ async def sample_get_log_metric(): async def create_log_metric( self, - request: Union[logging_metrics.CreateLogMetricRequest, dict] = None, + request: Optional[Union[logging_metrics.CreateLogMetricRequest, dict]] = None, *, - parent: str = None, - metric: logging_metrics.LogMetric = None, + parent: Optional[str] = None, + metric: Optional[logging_metrics.LogMetric] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> logging_metrics.LogMetric: r"""Creates a logs-based metric. @@ -503,7 +514,7 @@ async def sample_create_log_metric(): print(response) Args: - request (Union[google.cloud.logging_v2.types.CreateLogMetricRequest, dict]): + request (Optional[Union[google.cloud.logging_v2.types.CreateLogMetricRequest, dict]]): The request object. The parameters to CreateLogMetric. parent (:class:`str`): Required. The resource name of the project in which to @@ -593,12 +604,12 @@ async def sample_create_log_metric(): async def update_log_metric( self, - request: Union[logging_metrics.UpdateLogMetricRequest, dict] = None, + request: Optional[Union[logging_metrics.UpdateLogMetricRequest, dict]] = None, *, - metric_name: str = None, - metric: logging_metrics.LogMetric = None, + metric_name: Optional[str] = None, + metric: Optional[logging_metrics.LogMetric] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> logging_metrics.LogMetric: r"""Creates or updates a logs-based metric. @@ -635,7 +646,7 @@ async def sample_update_log_metric(): print(response) Args: - request (Union[google.cloud.logging_v2.types.UpdateLogMetricRequest, dict]): + request (Optional[Union[google.cloud.logging_v2.types.UpdateLogMetricRequest, dict]]): The request object. The parameters to UpdateLogMetric. metric_name (:class:`str`): Required. The resource name of the metric to update: @@ -737,11 +748,11 @@ async def sample_update_log_metric(): async def delete_log_metric( self, - request: Union[logging_metrics.DeleteLogMetricRequest, dict] = None, + request: Optional[Union[logging_metrics.DeleteLogMetricRequest, dict]] = None, *, - metric_name: str = None, + metric_name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Deletes a logs-based metric. @@ -770,7 +781,7 @@ async def sample_delete_log_metric(): await client.delete_log_metric(request=request) Args: - request (Union[google.cloud.logging_v2.types.DeleteLogMetricRequest, dict]): + request (Optional[Union[google.cloud.logging_v2.types.DeleteLogMetricRequest, dict]]): The request object. The parameters to DeleteLogMetric. metric_name (:class:`str`): Required. The resource name of the metric to delete: @@ -847,14 +858,9 @@ async def __aexit__(self, exc_type, exc, tb): await self.transport.close() -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution( - "google-cloud-logging", - ).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() +DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=package_version.__version__ +) __all__ = ("MetricsServiceV2AsyncClient",) diff --git a/google/cloud/logging_v2/services/metrics_service_v2/client.py b/google/cloud/logging_v2/services/metrics_service_v2/client.py index 9a707b2ac..c8bacd434 100644 --- a/google/cloud/logging_v2/services/metrics_service_v2/client.py +++ b/google/cloud/logging_v2/services/metrics_service_v2/client.py @@ -16,8 +16,20 @@ from collections import OrderedDict import os import re -from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union -import pkg_resources +from typing import ( + Dict, + Mapping, + MutableMapping, + MutableSequence, + Optional, + Sequence, + Tuple, + Type, + Union, + cast, +) + +from google.cloud.logging_v2 import gapic_version as package_version from google.api_core import client_options as client_options_lib from google.api_core import exceptions as core_exceptions @@ -60,7 +72,7 @@ class MetricsServiceV2ClientMeta(type): def get_transport_class( cls, - label: str = None, + label: Optional[str] = None, ) -> Type[MetricsServiceV2Transport]: """Returns an appropriate transport class. @@ -330,8 +342,8 @@ def __init__( self, *, credentials: Optional[ga_credentials.Credentials] = None, - transport: Union[str, MetricsServiceV2Transport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, + transport: Optional[Union[str, MetricsServiceV2Transport]] = None, + client_options: Optional[Union[client_options_lib.ClientOptions, dict]] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiates the metrics service v2 client. @@ -345,7 +357,7 @@ def __init__( transport (Union[str, MetricsServiceV2Transport]): The transport to use. If set to None, a transport is chosen automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the + client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]): Custom options for the client. It won't take effect if a ``transport`` instance is provided. (1) The ``api_endpoint`` property can be used to override the default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT @@ -375,6 +387,7 @@ def __init__( client_options = client_options_lib.from_dict(client_options) if client_options is None: client_options = client_options_lib.ClientOptions() + client_options = cast(client_options_lib.ClientOptions, client_options) api_endpoint, client_cert_source_func = self.get_mtls_endpoint_and_cert_source( client_options @@ -427,11 +440,11 @@ def __init__( def list_log_metrics( self, - request: Union[logging_metrics.ListLogMetricsRequest, dict] = None, + request: Optional[Union[logging_metrics.ListLogMetricsRequest, dict]] = None, *, - parent: str = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListLogMetricsPager: r"""Lists logs-based metrics. @@ -544,11 +557,11 @@ def sample_list_log_metrics(): def get_log_metric( self, - request: Union[logging_metrics.GetLogMetricRequest, dict] = None, + request: Optional[Union[logging_metrics.GetLogMetricRequest, dict]] = None, *, - metric_name: str = None, + metric_name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> logging_metrics.LogMetric: r"""Gets a logs-based metric. @@ -659,12 +672,12 @@ def sample_get_log_metric(): def create_log_metric( self, - request: Union[logging_metrics.CreateLogMetricRequest, dict] = None, + request: Optional[Union[logging_metrics.CreateLogMetricRequest, dict]] = None, *, - parent: str = None, - metric: logging_metrics.LogMetric = None, + parent: Optional[str] = None, + metric: Optional[logging_metrics.LogMetric] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> logging_metrics.LogMetric: r"""Creates a logs-based metric. @@ -791,12 +804,12 @@ def sample_create_log_metric(): def update_log_metric( self, - request: Union[logging_metrics.UpdateLogMetricRequest, dict] = None, + request: Optional[Union[logging_metrics.UpdateLogMetricRequest, dict]] = None, *, - metric_name: str = None, - metric: logging_metrics.LogMetric = None, + metric_name: Optional[str] = None, + metric: Optional[logging_metrics.LogMetric] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> logging_metrics.LogMetric: r"""Creates or updates a logs-based metric. @@ -924,11 +937,11 @@ def sample_update_log_metric(): def delete_log_metric( self, - request: Union[logging_metrics.DeleteLogMetricRequest, dict] = None, + request: Optional[Union[logging_metrics.DeleteLogMetricRequest, dict]] = None, *, - metric_name: str = None, + metric_name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Deletes a logs-based metric. @@ -1030,14 +1043,9 @@ def __exit__(self, type, value, traceback): self.transport.close() -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution( - "google-cloud-logging", - ).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() +DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=package_version.__version__ +) __all__ = ("MetricsServiceV2Client",) diff --git a/google/cloud/logging_v2/services/metrics_service_v2/transports/base.py b/google/cloud/logging_v2/services/metrics_service_v2/transports/base.py index f7e9c5edc..6e0f1698e 100644 --- a/google/cloud/logging_v2/services/metrics_service_v2/transports/base.py +++ b/google/cloud/logging_v2/services/metrics_service_v2/transports/base.py @@ -15,7 +15,8 @@ # import abc from typing import Awaitable, Callable, Dict, Optional, Sequence, Union -import pkg_resources + +from google.cloud.logging_v2 import gapic_version as package_version import google.auth # type: ignore import google.api_core @@ -28,14 +29,9 @@ from google.cloud.logging_v2.types import logging_metrics from google.protobuf import empty_pb2 # type: ignore -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution( - "google-cloud-logging", - ).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() +DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=package_version.__version__ +) class MetricsServiceV2Transport(abc.ABC): @@ -55,7 +51,7 @@ def __init__( self, *, host: str = DEFAULT_HOST, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, diff --git a/google/cloud/logging_v2/services/metrics_service_v2/transports/grpc.py b/google/cloud/logging_v2/services/metrics_service_v2/transports/grpc.py index 13cc653f7..7eac78848 100644 --- a/google/cloud/logging_v2/services/metrics_service_v2/transports/grpc.py +++ b/google/cloud/logging_v2/services/metrics_service_v2/transports/grpc.py @@ -48,14 +48,14 @@ def __init__( self, *, host: str = "logging.googleapis.com", - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + channel: Optional[grpc.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, @@ -182,8 +182,8 @@ def __init__( def create_channel( cls, host: str = "logging.googleapis.com", - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, **kwargs, diff --git a/google/cloud/logging_v2/services/metrics_service_v2/transports/grpc_asyncio.py b/google/cloud/logging_v2/services/metrics_service_v2/transports/grpc_asyncio.py index 93ca38ba5..99764a592 100644 --- a/google/cloud/logging_v2/services/metrics_service_v2/transports/grpc_asyncio.py +++ b/google/cloud/logging_v2/services/metrics_service_v2/transports/grpc_asyncio.py @@ -50,7 +50,7 @@ class MetricsServiceV2GrpcAsyncIOTransport(MetricsServiceV2Transport): def create_channel( cls, host: str = "logging.googleapis.com", - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, @@ -93,15 +93,15 @@ def __init__( self, *, host: str = "logging.googleapis.com", - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, - channel: aio.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, - quota_project_id=None, + channel: Optional[aio.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, api_audience: Optional[str] = None, diff --git a/google/cloud/logging_v2/types/log_entry.py b/google/cloud/logging_v2/types/log_entry.py index cc3469428..60da219ab 100644 --- a/google/cloud/logging_v2/types/log_entry.py +++ b/google/cloud/logging_v2/types/log_entry.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + import proto # type: ignore from google.api import monitored_resource_pb2 # type: ignore @@ -144,7 +146,7 @@ class LogEntry(proto.Message): http_request (google.logging.type.http_request_pb2.HttpRequest): Optional. Information about the HTTP request associated with this log entry, if applicable. - labels (Mapping[str, str]): + labels (MutableMapping[str, str]): Optional. A map of key, value pairs that provides additional information about the log entry. The labels can be user-defined or system-defined. @@ -196,84 +198,84 @@ class LogEntry(proto.Message): entries split from a single LogEntry. """ - log_name = proto.Field( + log_name: str = proto.Field( proto.STRING, number=12, ) - resource = proto.Field( + resource: monitored_resource_pb2.MonitoredResource = proto.Field( proto.MESSAGE, number=8, message=monitored_resource_pb2.MonitoredResource, ) - proto_payload = proto.Field( + proto_payload: any_pb2.Any = proto.Field( proto.MESSAGE, number=2, oneof="payload", message=any_pb2.Any, ) - text_payload = proto.Field( + text_payload: str = proto.Field( proto.STRING, number=3, oneof="payload", ) - json_payload = proto.Field( + json_payload: struct_pb2.Struct = proto.Field( proto.MESSAGE, number=6, oneof="payload", message=struct_pb2.Struct, ) - timestamp = proto.Field( + timestamp: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=9, message=timestamp_pb2.Timestamp, ) - receive_timestamp = proto.Field( + receive_timestamp: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=24, message=timestamp_pb2.Timestamp, ) - severity = proto.Field( + severity: log_severity_pb2.LogSeverity = proto.Field( proto.ENUM, number=10, enum=log_severity_pb2.LogSeverity, ) - insert_id = proto.Field( + insert_id: str = proto.Field( proto.STRING, number=4, ) - http_request = proto.Field( + http_request: http_request_pb2.HttpRequest = proto.Field( proto.MESSAGE, number=7, message=http_request_pb2.HttpRequest, ) - labels = proto.MapField( + labels: MutableMapping[str, str] = proto.MapField( proto.STRING, proto.STRING, number=11, ) - operation = proto.Field( + operation: "LogEntryOperation" = proto.Field( proto.MESSAGE, number=15, message="LogEntryOperation", ) - trace = proto.Field( + trace: str = proto.Field( proto.STRING, number=22, ) - span_id = proto.Field( + span_id: str = proto.Field( proto.STRING, number=27, ) - trace_sampled = proto.Field( + trace_sampled: bool = proto.Field( proto.BOOL, number=30, ) - source_location = proto.Field( + source_location: "LogEntrySourceLocation" = proto.Field( proto.MESSAGE, number=23, message="LogEntrySourceLocation", ) - split = proto.Field( + split: "LogSplit" = proto.Field( proto.MESSAGE, number=35, message="LogSplit", @@ -302,19 +304,19 @@ class LogEntryOperation(proto.Message): last log entry in the operation. """ - id = proto.Field( + id: str = proto.Field( proto.STRING, number=1, ) - producer = proto.Field( + producer: str = proto.Field( proto.STRING, number=2, ) - first = proto.Field( + first: bool = proto.Field( proto.BOOL, number=3, ) - last = proto.Field( + last: bool = proto.Field( proto.BOOL, number=4, ) @@ -342,15 +344,15 @@ class LogEntrySourceLocation(proto.Message): (Go), ``function`` (Python). """ - file = proto.Field( + file: str = proto.Field( proto.STRING, number=1, ) - line = proto.Field( + line: int = proto.Field( proto.INT64, number=2, ) - function = proto.Field( + function: str = proto.Field( proto.STRING, number=3, ) @@ -377,15 +379,15 @@ class LogSplit(proto.Message): original LogEntry was split into. """ - uid = proto.Field( + uid: str = proto.Field( proto.STRING, number=1, ) - index = proto.Field( + index: int = proto.Field( proto.INT32, number=2, ) - total_splits = proto.Field( + total_splits: int = proto.Field( proto.INT32, number=3, ) diff --git a/google/cloud/logging_v2/types/logging.py b/google/cloud/logging_v2/types/logging.py index 42bb9dbb8..903f875ad 100644 --- a/google/cloud/logging_v2/types/logging.py +++ b/google/cloud/logging_v2/types/logging.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + import proto # type: ignore from google.api import monitored_resource_pb2 # type: ignore @@ -60,7 +62,7 @@ class DeleteLogRequest(proto.Message): [LogEntry][google.logging.v2.LogEntry]. """ - log_name = proto.Field( + log_name: str = proto.Field( proto.STRING, number=1, ) @@ -103,13 +105,13 @@ class WriteLogEntriesRequest(proto.Message): "zone": "us-central1-a", "instance_id": "00000000000000000000" }} See [LogEntry][google.logging.v2.LogEntry]. - labels (Mapping[str, str]): + labels (MutableMapping[str, str]): Optional. Default labels that are added to the ``labels`` field of all log entries in ``entries``. If a log entry already has a label with the same key as a label in this parameter, then the log entry's label is not changed. See [LogEntry][google.logging.v2.LogEntry]. - entries (Sequence[google.cloud.logging_v2.types.LogEntry]): + entries (MutableSequence[google.cloud.logging_v2.types.LogEntry]): Required. The log entries to send to Logging. The order of log entries in this list does not matter. Values supplied in this method's ``log_name``, ``resource``, and ``labels`` @@ -155,30 +157,30 @@ class WriteLogEntriesRequest(proto.Message): properly before sending valuable data. """ - log_name = proto.Field( + log_name: str = proto.Field( proto.STRING, number=1, ) - resource = proto.Field( + resource: monitored_resource_pb2.MonitoredResource = proto.Field( proto.MESSAGE, number=2, message=monitored_resource_pb2.MonitoredResource, ) - labels = proto.MapField( + labels: MutableMapping[str, str] = proto.MapField( proto.STRING, proto.STRING, number=3, ) - entries = proto.RepeatedField( + entries: MutableSequence[log_entry.LogEntry] = proto.RepeatedField( proto.MESSAGE, number=4, message=log_entry.LogEntry, ) - partial_success = proto.Field( + partial_success: bool = proto.Field( proto.BOOL, number=5, ) - dry_run = proto.Field( + dry_run: bool = proto.Field( proto.BOOL, number=6, ) @@ -192,7 +194,7 @@ class WriteLogEntriesPartialErrors(proto.Message): r"""Error details for WriteLogEntries with partial success. Attributes: - log_entry_errors (Mapping[int, google.rpc.status_pb2.Status]): + log_entry_errors (MutableMapping[int, google.rpc.status_pb2.Status]): When ``WriteLogEntriesRequest.partial_success`` is true, records the error status for entries that were not written due to a permanent error, keyed by the entry's zero-based @@ -202,7 +204,7 @@ class WriteLogEntriesPartialErrors(proto.Message): include per-entry errors. """ - log_entry_errors = proto.MapField( + log_entry_errors: MutableMapping[int, status_pb2.Status] = proto.MapField( proto.INT32, proto.MESSAGE, number=1, @@ -214,7 +216,7 @@ class ListLogEntriesRequest(proto.Message): r"""The parameters to ``ListLogEntries``. Attributes: - resource_names (Sequence[str]): + resource_names (MutableSequence[str]): Required. Names of one or more parent resources from which to retrieve log entries: @@ -265,23 +267,23 @@ class ListLogEntriesRequest(proto.Message): should be identical to those in the previous call. """ - resource_names = proto.RepeatedField( + resource_names: MutableSequence[str] = proto.RepeatedField( proto.STRING, number=8, ) - filter = proto.Field( + filter: str = proto.Field( proto.STRING, number=2, ) - order_by = proto.Field( + order_by: str = proto.Field( proto.STRING, number=3, ) - page_size = proto.Field( + page_size: int = proto.Field( proto.INT32, number=4, ) - page_token = proto.Field( + page_token: str = proto.Field( proto.STRING, number=5, ) @@ -291,7 +293,7 @@ class ListLogEntriesResponse(proto.Message): r"""Result returned from ``ListLogEntries``. Attributes: - entries (Sequence[google.cloud.logging_v2.types.LogEntry]): + entries (MutableSequence[google.cloud.logging_v2.types.LogEntry]): A list of log entries. If ``entries`` is empty, ``nextPageToken`` may still be returned, indicating that more entries may exist. See ``nextPageToken`` for more @@ -316,12 +318,12 @@ class ListLogEntriesResponse(proto.Message): def raw_page(self): return self - entries = proto.RepeatedField( + entries: MutableSequence[log_entry.LogEntry] = proto.RepeatedField( proto.MESSAGE, number=1, message=log_entry.LogEntry, ) - next_page_token = proto.Field( + next_page_token: str = proto.Field( proto.STRING, number=2, ) @@ -344,11 +346,11 @@ class ListMonitoredResourceDescriptorsRequest(proto.Message): should be identical to those in the previous call. """ - page_size = proto.Field( + page_size: int = proto.Field( proto.INT32, number=1, ) - page_token = proto.Field( + page_token: str = proto.Field( proto.STRING, number=2, ) @@ -358,7 +360,7 @@ class ListMonitoredResourceDescriptorsResponse(proto.Message): r"""Result returned from ListMonitoredResourceDescriptors. Attributes: - resource_descriptors (Sequence[google.api.monitored_resource_pb2.MonitoredResourceDescriptor]): + resource_descriptors (MutableSequence[google.api.monitored_resource_pb2.MonitoredResourceDescriptor]): A list of resource descriptors. next_page_token (str): If there might be more results than those appearing in this @@ -371,12 +373,14 @@ class ListMonitoredResourceDescriptorsResponse(proto.Message): def raw_page(self): return self - resource_descriptors = proto.RepeatedField( + resource_descriptors: MutableSequence[ + monitored_resource_pb2.MonitoredResourceDescriptor + ] = proto.RepeatedField( proto.MESSAGE, number=1, message=monitored_resource_pb2.MonitoredResourceDescriptor, ) - next_page_token = proto.Field( + next_page_token: str = proto.Field( proto.STRING, number=2, ) @@ -404,7 +408,7 @@ class ListLogsRequest(proto.Message): ``pageToken`` must be the value of ``nextPageToken`` from the previous response. The values of other method parameters should be identical to those in the previous call. - resource_names (Sequence[str]): + resource_names (MutableSequence[str]): Optional. The resource name that owns the logs: - ``projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]`` @@ -420,19 +424,19 @@ class ListLogsRequest(proto.Message): - ``folders/[FOLDER_ID]`` """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - page_size = proto.Field( + page_size: int = proto.Field( proto.INT32, number=2, ) - page_token = proto.Field( + page_token: str = proto.Field( proto.STRING, number=3, ) - resource_names = proto.RepeatedField( + resource_names: MutableSequence[str] = proto.RepeatedField( proto.STRING, number=8, ) @@ -442,7 +446,7 @@ class ListLogsResponse(proto.Message): r"""Result returned from ListLogs. Attributes: - log_names (Sequence[str]): + log_names (MutableSequence[str]): A list of log names. For example, ``"projects/my-project/logs/syslog"`` or ``"organizations/123/logs/cloudresourcemanager.googleapis.com%2Factivity"``. @@ -457,11 +461,11 @@ class ListLogsResponse(proto.Message): def raw_page(self): return self - log_names = proto.RepeatedField( + log_names: MutableSequence[str] = proto.RepeatedField( proto.STRING, number=3, ) - next_page_token = proto.Field( + next_page_token: str = proto.Field( proto.STRING, number=2, ) @@ -471,7 +475,7 @@ class TailLogEntriesRequest(proto.Message): r"""The parameters to ``TailLogEntries``. Attributes: - resource_names (Sequence[str]): + resource_names (MutableSequence[str]): Required. Name of a parent resource from which to retrieve log entries: @@ -505,15 +509,15 @@ class TailLogEntriesRequest(proto.Message): milliseconds. """ - resource_names = proto.RepeatedField( + resource_names: MutableSequence[str] = proto.RepeatedField( proto.STRING, number=1, ) - filter = proto.Field( + filter: str = proto.Field( proto.STRING, number=2, ) - buffer_window = proto.Field( + buffer_window: duration_pb2.Duration = proto.Field( proto.MESSAGE, number=3, message=duration_pb2.Duration, @@ -524,12 +528,12 @@ class TailLogEntriesResponse(proto.Message): r"""Result returned from ``TailLogEntries``. Attributes: - entries (Sequence[google.cloud.logging_v2.types.LogEntry]): + entries (MutableSequence[google.cloud.logging_v2.types.LogEntry]): A list of log entries. Each response in the stream will order entries with increasing values of ``LogEntry.timestamp``. Ordering is not guaranteed between separate responses. - suppression_info (Sequence[google.cloud.logging_v2.types.TailLogEntriesResponse.SuppressionInfo]): + suppression_info (MutableSequence[google.cloud.logging_v2.types.TailLogEntriesResponse.SuppressionInfo]): If entries that otherwise would have been included in the session were not sent back to the client, counts of relevant entries omitted @@ -558,22 +562,22 @@ class Reason(proto.Enum): RATE_LIMIT = 1 NOT_CONSUMED = 2 - reason = proto.Field( + reason: "TailLogEntriesResponse.SuppressionInfo.Reason" = proto.Field( proto.ENUM, number=1, enum="TailLogEntriesResponse.SuppressionInfo.Reason", ) - suppressed_count = proto.Field( + suppressed_count: int = proto.Field( proto.INT32, number=2, ) - entries = proto.RepeatedField( + entries: MutableSequence[log_entry.LogEntry] = proto.RepeatedField( proto.MESSAGE, number=1, message=log_entry.LogEntry, ) - suppression_info = proto.RepeatedField( + suppression_info: MutableSequence[SuppressionInfo] = proto.RepeatedField( proto.MESSAGE, number=2, message=SuppressionInfo, diff --git a/google/cloud/logging_v2/types/logging_config.py b/google/cloud/logging_v2/types/logging_config.py index c2fcf30bd..bc81412e7 100644 --- a/google/cloud/logging_v2/types/logging_config.py +++ b/google/cloud/logging_v2/types/logging_config.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + import proto # type: ignore from google.protobuf import field_mask_pb2 # type: ignore @@ -133,7 +135,7 @@ class LogBucket(proto.Message): if they are empty. lifecycle_state (google.cloud.logging_v2.types.LifecycleState): Output only. The bucket lifecycle state. - restricted_fields (Sequence[str]): + restricted_fields (MutableSequence[str]): Log entry field paths that are denied access in this bucket. The following fields and their children are eligible: @@ -153,42 +155,42 @@ class LogBucket(proto.Message): KMS key is allowed. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - description = proto.Field( + description: str = proto.Field( proto.STRING, number=3, ) - create_time = proto.Field( + create_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=4, message=timestamp_pb2.Timestamp, ) - update_time = proto.Field( + update_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=5, message=timestamp_pb2.Timestamp, ) - retention_days = proto.Field( + retention_days: int = proto.Field( proto.INT32, number=11, ) - locked = proto.Field( + locked: bool = proto.Field( proto.BOOL, number=9, ) - lifecycle_state = proto.Field( + lifecycle_state: "LifecycleState" = proto.Field( proto.ENUM, number=12, enum="LifecycleState", ) - restricted_fields = proto.RepeatedField( + restricted_fields: MutableSequence[str] = proto.RepeatedField( proto.STRING, number=15, ) - cmek_settings = proto.Field( + cmek_settings: "CmekSettings" = proto.Field( proto.MESSAGE, number=19, message="CmekSettings", @@ -230,25 +232,25 @@ class LogView(proto.Message): "gce_instance" AND LOG_ID("stdout") """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - description = proto.Field( + description: str = proto.Field( proto.STRING, number=3, ) - create_time = proto.Field( + create_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=4, message=timestamp_pb2.Timestamp, ) - update_time = proto.Field( + update_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=5, message=timestamp_pb2.Timestamp, ) - filter = proto.Field( + filter: str = proto.Field( proto.STRING, number=7, ) @@ -305,7 +307,7 @@ class LogSink(proto.Message): disabled (bool): Optional. If set to true, then this sink is disabled and it does not export any log entries. - exclusions (Sequence[google.cloud.logging_v2.types.LogExclusion]): + exclusions (MutableSequence[google.cloud.logging_v2.types.LogExclusion]): Optional. Log entries that match any of these exclusion filters will not be exported. @@ -374,56 +376,56 @@ class VersionFormat(proto.Enum): V2 = 1 V1 = 2 - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - destination = proto.Field( + destination: str = proto.Field( proto.STRING, number=3, ) - filter = proto.Field( + filter: str = proto.Field( proto.STRING, number=5, ) - description = proto.Field( + description: str = proto.Field( proto.STRING, number=18, ) - disabled = proto.Field( + disabled: bool = proto.Field( proto.BOOL, number=19, ) - exclusions = proto.RepeatedField( + exclusions: MutableSequence["LogExclusion"] = proto.RepeatedField( proto.MESSAGE, number=16, message="LogExclusion", ) - output_version_format = proto.Field( + output_version_format: VersionFormat = proto.Field( proto.ENUM, number=6, enum=VersionFormat, ) - writer_identity = proto.Field( + writer_identity: str = proto.Field( proto.STRING, number=8, ) - include_children = proto.Field( + include_children: bool = proto.Field( proto.BOOL, number=9, ) - bigquery_options = proto.Field( + bigquery_options: "BigQueryOptions" = proto.Field( proto.MESSAGE, number=12, oneof="options", message="BigQueryOptions", ) - create_time = proto.Field( + create_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=13, message=timestamp_pb2.Timestamp, ) - update_time = proto.Field( + update_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=14, message=timestamp_pb2.Timestamp, @@ -457,11 +459,11 @@ class BigQueryOptions(proto.Message): will have this field set to false. """ - use_partitioned_tables = proto.Field( + use_partitioned_tables: bool = proto.Field( proto.BOOL, number=1, ) - uses_timestamp_column_partitioning = proto.Field( + uses_timestamp_column_partitioning: bool = proto.Field( proto.BOOL, number=3, ) @@ -498,15 +500,15 @@ class ListBucketsRequest(proto.Message): results might be available. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - page_token = proto.Field( + page_token: str = proto.Field( proto.STRING, number=2, ) - page_size = proto.Field( + page_size: int = proto.Field( proto.INT32, number=3, ) @@ -516,7 +518,7 @@ class ListBucketsResponse(proto.Message): r"""The response from ListBuckets. Attributes: - buckets (Sequence[google.cloud.logging_v2.types.LogBucket]): + buckets (MutableSequence[google.cloud.logging_v2.types.LogBucket]): A list of buckets. next_page_token (str): If there might be more results than appear in this response, @@ -529,12 +531,12 @@ class ListBucketsResponse(proto.Message): def raw_page(self): return self - buckets = proto.RepeatedField( + buckets: MutableSequence["LogBucket"] = proto.RepeatedField( proto.MESSAGE, number=1, message="LogBucket", ) - next_page_token = proto.Field( + next_page_token: str = proto.Field( proto.STRING, number=2, ) @@ -566,15 +568,15 @@ class CreateBucketRequest(proto.Message): name field in the bucket is ignored. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - bucket_id = proto.Field( + bucket_id: str = proto.Field( proto.STRING, number=2, ) - bucket = proto.Field( + bucket: "LogBucket" = proto.Field( proto.MESSAGE, number=3, message="LogBucket", @@ -612,16 +614,16 @@ class UpdateBucketRequest(proto.Message): For example: ``updateMask=retention_days`` """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - bucket = proto.Field( + bucket: "LogBucket" = proto.Field( proto.MESSAGE, number=2, message="LogBucket", ) - update_mask = proto.Field( + update_mask: field_mask_pb2.FieldMask = proto.Field( proto.MESSAGE, number=4, message=field_mask_pb2.FieldMask, @@ -647,7 +649,7 @@ class GetBucketRequest(proto.Message): ``"projects/my-project/locations/global/buckets/my-bucket"`` """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -672,7 +674,7 @@ class DeleteBucketRequest(proto.Message): ``"projects/my-project/locations/global/buckets/my-bucket"`` """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -697,7 +699,7 @@ class UndeleteBucketRequest(proto.Message): ``"projects/my-project/locations/global/buckets/my-bucket"`` """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -728,15 +730,15 @@ class ListViewsRequest(proto.Message): results might be available. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - page_token = proto.Field( + page_token: str = proto.Field( proto.STRING, number=2, ) - page_size = proto.Field( + page_size: int = proto.Field( proto.INT32, number=3, ) @@ -746,7 +748,7 @@ class ListViewsResponse(proto.Message): r"""The response from ListViews. Attributes: - views (Sequence[google.cloud.logging_v2.types.LogView]): + views (MutableSequence[google.cloud.logging_v2.types.LogView]): A list of views. next_page_token (str): If there might be more results than appear in this response, @@ -759,12 +761,12 @@ class ListViewsResponse(proto.Message): def raw_page(self): return self - views = proto.RepeatedField( + views: MutableSequence["LogView"] = proto.RepeatedField( proto.MESSAGE, number=1, message="LogView", ) - next_page_token = proto.Field( + next_page_token: str = proto.Field( proto.STRING, number=2, ) @@ -790,15 +792,15 @@ class CreateViewRequest(proto.Message): Required. The new view. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - view_id = proto.Field( + view_id: str = proto.Field( proto.STRING, number=2, ) - view = proto.Field( + view: "LogView" = proto.Field( proto.MESSAGE, number=3, message="LogView", @@ -833,16 +835,16 @@ class UpdateViewRequest(proto.Message): For example: ``updateMask=filter`` """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - view = proto.Field( + view: "LogView" = proto.Field( proto.MESSAGE, number=2, message="LogView", ) - update_mask = proto.Field( + update_mask: field_mask_pb2.FieldMask = proto.Field( proto.MESSAGE, number=4, message=field_mask_pb2.FieldMask, @@ -865,7 +867,7 @@ class GetViewRequest(proto.Message): ``"projects/my-project/locations/global/buckets/my-bucket/views/my-view"`` """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -889,7 +891,7 @@ class DeleteViewRequest(proto.Message): `"projects/my-project/locations/global/buckets/my-bucket/views/my-view"` """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -921,15 +923,15 @@ class ListSinksRequest(proto.Message): results might be available. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - page_token = proto.Field( + page_token: str = proto.Field( proto.STRING, number=2, ) - page_size = proto.Field( + page_size: int = proto.Field( proto.INT32, number=3, ) @@ -939,7 +941,7 @@ class ListSinksResponse(proto.Message): r"""Result returned from ``ListSinks``. Attributes: - sinks (Sequence[google.cloud.logging_v2.types.LogSink]): + sinks (MutableSequence[google.cloud.logging_v2.types.LogSink]): A list of sinks. next_page_token (str): If there might be more results than appear in this response, @@ -952,12 +954,12 @@ class ListSinksResponse(proto.Message): def raw_page(self): return self - sinks = proto.RepeatedField( + sinks: MutableSequence["LogSink"] = proto.RepeatedField( proto.MESSAGE, number=1, message="LogSink", ) - next_page_token = proto.Field( + next_page_token: str = proto.Field( proto.STRING, number=2, ) @@ -982,7 +984,7 @@ class GetSinkRequest(proto.Message): ``"projects/my-project/sinks/my-sink"`` """ - sink_name = proto.Field( + sink_name: str = proto.Field( proto.STRING, number=1, ) @@ -1026,16 +1028,16 @@ class CreateSinkRequest(proto.Message): [LogSink][google.logging.v2.LogSink]. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - sink = proto.Field( + sink: "LogSink" = proto.Field( proto.MESSAGE, number=2, message="LogSink", ) - unique_writer_identity = proto.Field( + unique_writer_identity: bool = proto.Field( proto.BOOL, number=3, ) @@ -1098,20 +1100,20 @@ class UpdateSinkRequest(proto.Message): For example: ``updateMask=filter`` """ - sink_name = proto.Field( + sink_name: str = proto.Field( proto.STRING, number=1, ) - sink = proto.Field( + sink: "LogSink" = proto.Field( proto.MESSAGE, number=2, message="LogSink", ) - unique_writer_identity = proto.Field( + unique_writer_identity: bool = proto.Field( proto.BOOL, number=3, ) - update_mask = proto.Field( + update_mask: field_mask_pb2.FieldMask = proto.Field( proto.MESSAGE, number=4, message=field_mask_pb2.FieldMask, @@ -1138,7 +1140,7 @@ class DeleteSinkRequest(proto.Message): ``"projects/my-project/sinks/my-sink"`` """ - sink_name = proto.Field( + sink_name: str = proto.Field( proto.STRING, number=1, ) @@ -1190,28 +1192,28 @@ class LogExclusion(proto.Message): exclusions. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - description = proto.Field( + description: str = proto.Field( proto.STRING, number=2, ) - filter = proto.Field( + filter: str = proto.Field( proto.STRING, number=3, ) - disabled = proto.Field( + disabled: bool = proto.Field( proto.BOOL, number=4, ) - create_time = proto.Field( + create_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=5, message=timestamp_pb2.Timestamp, ) - update_time = proto.Field( + update_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=6, message=timestamp_pb2.Timestamp, @@ -1245,15 +1247,15 @@ class ListExclusionsRequest(proto.Message): results might be available. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - page_token = proto.Field( + page_token: str = proto.Field( proto.STRING, number=2, ) - page_size = proto.Field( + page_size: int = proto.Field( proto.INT32, number=3, ) @@ -1263,7 +1265,7 @@ class ListExclusionsResponse(proto.Message): r"""Result returned from ``ListExclusions``. Attributes: - exclusions (Sequence[google.cloud.logging_v2.types.LogExclusion]): + exclusions (MutableSequence[google.cloud.logging_v2.types.LogExclusion]): A list of exclusions. next_page_token (str): If there might be more results than appear in this response, @@ -1276,12 +1278,12 @@ class ListExclusionsResponse(proto.Message): def raw_page(self): return self - exclusions = proto.RepeatedField( + exclusions: MutableSequence["LogExclusion"] = proto.RepeatedField( proto.MESSAGE, number=1, message="LogExclusion", ) - next_page_token = proto.Field( + next_page_token: str = proto.Field( proto.STRING, number=2, ) @@ -1306,7 +1308,7 @@ class GetExclusionRequest(proto.Message): ``"projects/my-project/exclusions/my-exclusion"`` """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -1337,11 +1339,11 @@ class CreateExclusionRequest(proto.Message): resource. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - exclusion = proto.Field( + exclusion: "LogExclusion" = proto.Field( proto.MESSAGE, number=2, message="LogExclusion", @@ -1381,16 +1383,16 @@ class UpdateExclusionRequest(proto.Message): ``"filter,description"``. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - exclusion = proto.Field( + exclusion: "LogExclusion" = proto.Field( proto.MESSAGE, number=2, message="LogExclusion", ) - update_mask = proto.Field( + update_mask: field_mask_pb2.FieldMask = proto.Field( proto.MESSAGE, number=3, message=field_mask_pb2.FieldMask, @@ -1417,7 +1419,7 @@ class DeleteExclusionRequest(proto.Message): ``"projects/my-project/exclusions/my-exclusion"`` """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -1452,7 +1454,7 @@ class GetCmekSettingsRequest(proto.Message): projects and folders in the Google Cloud organization. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -1503,16 +1505,16 @@ class UpdateCmekSettingsRequest(proto.Message): For example: ``"updateMask=kmsKeyName"`` """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - cmek_settings = proto.Field( + cmek_settings: "CmekSettings" = proto.Field( proto.MESSAGE, number=2, message="CmekSettings", ) - update_mask = proto.Field( + update_mask: field_mask_pb2.FieldMask = proto.Field( proto.MESSAGE, number=3, message=field_mask_pb2.FieldMask, @@ -1585,15 +1587,15 @@ class CmekSettings(proto.Message): for more information. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - kms_key_name = proto.Field( + kms_key_name: str = proto.Field( proto.STRING, number=2, ) - service_account_id = proto.Field( + service_account_id: str = proto.Field( proto.STRING, number=3, ) @@ -1629,7 +1631,7 @@ class GetSettingsRequest(proto.Message): and folders in the Google Cloud organization. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -1677,16 +1679,16 @@ class UpdateSettingsRequest(proto.Message): For example: ``"updateMask=kmsKeyName"`` """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - settings = proto.Field( + settings: "Settings" = proto.Field( proto.MESSAGE, number=2, message="Settings", ) - update_mask = proto.Field( + update_mask: field_mask_pb2.FieldMask = proto.Field( proto.MESSAGE, number=3, message=field_mask_pb2.FieldMask, @@ -1763,23 +1765,23 @@ class Settings(proto.Message): manually if needed. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - kms_key_name = proto.Field( + kms_key_name: str = proto.Field( proto.STRING, number=2, ) - kms_service_account_id = proto.Field( + kms_service_account_id: str = proto.Field( proto.STRING, number=3, ) - storage_location = proto.Field( + storage_location: str = proto.Field( proto.STRING, number=4, ) - disable_default_sink = proto.Field( + disable_default_sink: bool = proto.Field( proto.BOOL, number=5, ) @@ -1805,15 +1807,15 @@ class CopyLogEntriesRequest(proto.Message): entries. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - filter = proto.Field( + filter: str = proto.Field( proto.STRING, number=3, ) - destination = proto.Field( + destination: str = proto.Field( proto.STRING, number=4, ) @@ -1847,35 +1849,35 @@ class CopyLogEntriesMetadata(proto.Message): For example: ``"serviceAccount:foo@bar.com"`` """ - start_time = proto.Field( + start_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=1, message=timestamp_pb2.Timestamp, ) - end_time = proto.Field( + end_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=2, message=timestamp_pb2.Timestamp, ) - state = proto.Field( + state: "OperationState" = proto.Field( proto.ENUM, number=3, enum="OperationState", ) - cancellation_requested = proto.Field( + cancellation_requested: bool = proto.Field( proto.BOOL, number=4, ) - request = proto.Field( + request: "CopyLogEntriesRequest" = proto.Field( proto.MESSAGE, number=5, message="CopyLogEntriesRequest", ) - progress = proto.Field( + progress: int = proto.Field( proto.INT32, number=6, ) - writer_identity = proto.Field( + writer_identity: str = proto.Field( proto.STRING, number=7, ) @@ -1889,7 +1891,7 @@ class CopyLogEntriesResponse(proto.Message): Number of log entries copied. """ - log_entries_copied_count = proto.Field( + log_entries_copied_count: int = proto.Field( proto.INT64, number=1, ) diff --git a/google/cloud/logging_v2/types/logging_metrics.py b/google/cloud/logging_v2/types/logging_metrics.py index bcad752b3..7bad4e319 100644 --- a/google/cloud/logging_v2/types/logging_metrics.py +++ b/google/cloud/logging_v2/types/logging_metrics.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + import proto # type: ignore from google.api import distribution_pb2 # type: ignore @@ -128,7 +130,7 @@ class LogMetric(proto.Message): Example: ``REGEXP_EXTRACT(jsonPayload.request, ".*quantity=(\d+).*")`` - label_extractors (Mapping[str, str]): + label_extractors (MutableMapping[str, str]): Optional. A map from a label key string to an extractor expression which is used to extract data from a log entry field and assign as the label value. Each label key @@ -170,52 +172,52 @@ class ApiVersion(proto.Enum): V2 = 0 V1 = 1 - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - description = proto.Field( + description: str = proto.Field( proto.STRING, number=2, ) - filter = proto.Field( + filter: str = proto.Field( proto.STRING, number=3, ) - disabled = proto.Field( + disabled: bool = proto.Field( proto.BOOL, number=12, ) - metric_descriptor = proto.Field( + metric_descriptor: metric_pb2.MetricDescriptor = proto.Field( proto.MESSAGE, number=5, message=metric_pb2.MetricDescriptor, ) - value_extractor = proto.Field( + value_extractor: str = proto.Field( proto.STRING, number=6, ) - label_extractors = proto.MapField( + label_extractors: MutableMapping[str, str] = proto.MapField( proto.STRING, proto.STRING, number=7, ) - bucket_options = proto.Field( + bucket_options: distribution_pb2.Distribution.BucketOptions = proto.Field( proto.MESSAGE, number=8, message=distribution_pb2.Distribution.BucketOptions, ) - create_time = proto.Field( + create_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=9, message=timestamp_pb2.Timestamp, ) - update_time = proto.Field( + update_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=10, message=timestamp_pb2.Timestamp, ) - version = proto.Field( + version: ApiVersion = proto.Field( proto.ENUM, number=4, enum=ApiVersion, @@ -245,15 +247,15 @@ class ListLogMetricsRequest(proto.Message): results might be available. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - page_token = proto.Field( + page_token: str = proto.Field( proto.STRING, number=2, ) - page_size = proto.Field( + page_size: int = proto.Field( proto.INT32, number=3, ) @@ -263,7 +265,7 @@ class ListLogMetricsResponse(proto.Message): r"""Result returned from ListLogMetrics. Attributes: - metrics (Sequence[google.cloud.logging_v2.types.LogMetric]): + metrics (MutableSequence[google.cloud.logging_v2.types.LogMetric]): A list of logs-based metrics. next_page_token (str): If there might be more results than appear in this response, @@ -276,12 +278,12 @@ class ListLogMetricsResponse(proto.Message): def raw_page(self): return self - metrics = proto.RepeatedField( + metrics: MutableSequence["LogMetric"] = proto.RepeatedField( proto.MESSAGE, number=1, message="LogMetric", ) - next_page_token = proto.Field( + next_page_token: str = proto.Field( proto.STRING, number=2, ) @@ -299,7 +301,7 @@ class GetLogMetricRequest(proto.Message): "projects/[PROJECT_ID]/metrics/[METRIC_ID]". """ - metric_name = proto.Field( + metric_name: str = proto.Field( proto.STRING, number=1, ) @@ -323,11 +325,11 @@ class CreateLogMetricRequest(proto.Message): must not have an identifier that already exists. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - metric = proto.Field( + metric: "LogMetric" = proto.Field( proto.MESSAGE, number=2, message="LogMetric", @@ -353,11 +355,11 @@ class UpdateLogMetricRequest(proto.Message): Required. The updated metric. """ - metric_name = proto.Field( + metric_name: str = proto.Field( proto.STRING, number=1, ) - metric = proto.Field( + metric: "LogMetric" = proto.Field( proto.MESSAGE, number=2, message="LogMetric", @@ -376,7 +378,7 @@ class DeleteLogMetricRequest(proto.Message): "projects/[PROJECT_ID]/metrics/[METRIC_ID]". """ - metric_name = proto.Field( + metric_name: str = proto.Field( proto.STRING, number=1, ) diff --git a/owlbot.py b/owlbot.py index 0ef7dcaa1..3e932c854 100644 --- a/owlbot.py +++ b/owlbot.py @@ -1,4 +1,4 @@ -# Copyright 2018 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,29 +12,61 @@ # See the License for the specific language governing permissions and # limitations under the License. -"""This script is used to synthesize generated parts of this library.""" +import json +import os +import shutil + import synthtool as s -from synthtool import gcp +import synthtool.gcp as gcp from synthtool.languages import python -import os -common = gcp.CommonTemplates() +# ---------------------------------------------------------------------------- +# Copy the generated client from the owl-bot staging directory +# ---------------------------------------------------------------------------- + +clean_up_generated_samples = True -default_version = "v2" +# Load the default version defined in .repo-metadata.json. +default_version = json.load(open(".repo-metadata.json", "rt")).get("default_version") + +def place_before(path, text, *before_text, escape=None): + replacement = "\n".join(before_text) + "\n" + text + if escape: + for c in escape: + text = text.replace(c, '\\' + c) + s.replace([path], text, replacement) + +test_metrics_default_client_info_headers = \ +"""def test_metrics_default_client_info_headers(): + import re + + # test that DEFAULT_CLIENT_INFO contains the expected gapic headers + gapic_header_regex = re.compile( + r"gapic\\\\/[0-9]+\\.[\\\\w.-]+ gax\\/[0-9]+\.[\\\\w.-]+ gl-python\\/[0-9]+\\.[\\\\w.-]+ grpc\\/[0-9]+\.[\\\\w.-]+" + ) + detected_info = ( + google.cloud.logging_v2.services.metrics_service_v2.transports.base.DEFAULT_CLIENT_INFO + ) + assert detected_info is not None + detected_agent = " ".join(sorted(detected_info.to_user_agent().split(" "))) + assert gapic_header_regex.match(detected_agent)\n\n\n""" for library in s.get_staging_dirs(default_version): - if library.name == "v2": - # Fix generated unit tests - s.replace( - library / "tests/unit/gapic/logging_v2/test_logging_service_v2.py", - "MonitoredResource\(\s*type_", - "MonitoredResource(type" - ) - - s.move( - library, - excludes=[ + if clean_up_generated_samples: + shutil.rmtree("samples/generated_samples", ignore_errors=True) + clean_up_generated_samples = False + + place_before( + library / "tests/unit/gapic/logging_v2/test_metrics_service_v2.py", + "def test_metrics_service_v2_client_get_transport_class()", + test_metrics_default_client_info_headers, + escape="()", + ) + + s.move([library], excludes=[ + "**/gapic_version.py", "setup.py", + "testing/constraints-3.7.txt", "README.rst", "google/cloud/logging/__init__.py", # generated types are hidden from users "google/cloud/logging_v2/__init__.py", @@ -49,10 +81,11 @@ # ---------------------------------------------------------------------------- # Add templated files # ---------------------------------------------------------------------------- -templated_files = common.py_library( - unit_cov_level=95, + +templated_files = gcp.CommonTemplates().py_library( cov_level=99, microgenerator=True, + versions=gcp.common.detect_versions(path="./google", default_first=True), system_test_external_dependencies=[ "google-cloud-bigquery", "google-cloud-pubsub", @@ -62,32 +95,32 @@ unit_test_external_dependencies=["flask", "webob", "django"], samples=True, ) + s.move(templated_files, excludes=[ - ".coveragerc", + "docs/index.rst", + ".github/release-please.yml", + ".coveragerc", "docs/multiprocessing.rst", ".github/workflows", # exclude gh actions as credentials are needed for tests ".github/auto-label.yaml", "README.rst", # This repo has a customized README - ]) + ], +) # adjust .trampolinerc for environment tests -s.replace( - ".trampolinerc", - "required_envvars[^\)]*\)", - "required_envvars+=()" -) +s.replace(".trampolinerc", "required_envvars[^\)]*\)", "required_envvars+=()") s.replace( ".trampolinerc", "pass_down_envvars\+\=\(", - 'pass_down_envvars+=(\n "ENVIRONMENT"\n "RUNTIME"' + 'pass_down_envvars+=(\n "ENVIRONMENT"\n "RUNTIME"', ) # don't lint environment tests s.replace( ".flake8", "exclude =", - 'exclude =\n # Exclude environment test code.\n tests/environment/**\n' + "exclude =\n # Exclude environment test code.\n tests/environment/**\n", ) # use conventional commits for renovate bot @@ -97,7 +130,7 @@ }""", """}, "semanticCommits": "enabled" -}""" +}""", ) # -------------------------------------------------------------------------- @@ -106,9 +139,8 @@ python.py_samples() -python.configure_previous_major_version_branches() - s.shell.run(["nox", "-s", "blacken"], hide_output=False) +s.shell.run(["nox", "-s", "blacken"], cwd="samples/snippets", hide_output=False) # -------------------------------------------------------------------------- # Modify test configs @@ -124,5 +156,5 @@ s.move( ".kokoro/common_env_vars.cfg", file_path, - merge=lambda src, dst, _, : f"{dst}\n{src}", + merge=lambda src, dst, _,: f"{dst}\n{src}", ) diff --git a/release-please-config.json b/release-please-config.json new file mode 100644 index 000000000..264e357f4 --- /dev/null +++ b/release-please-config.json @@ -0,0 +1,25 @@ +{ + "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json", + "packages": { + ".": { + "release-type": "python", + "extra-files": [ + "google/cloud/logging_v2/gapic_version.py", + "google/cloud/logging/gapic_version.py", + { + "type": "json", + "path": "samples/generated_samples/snippet_metadata_google.logging.v2.json", + "jsonpath": "$.clientLibrary.version" + } + ] + } + }, + "release-type": "python", + "plugins": [ + { + "type": "sentence-case" + } + ], + "initial-version": "0.1.0" +} + \ No newline at end of file diff --git a/samples/generated_samples/logging_v2_generated_config_service_v2_copy_log_entries_async.py b/samples/generated_samples/logging_v2_generated_config_service_v2_copy_log_entries_async.py index 9d97df874..dead26544 100644 --- a/samples/generated_samples/logging_v2_generated_config_service_v2_copy_log_entries_async.py +++ b/samples/generated_samples/logging_v2_generated_config_service_v2_copy_log_entries_async.py @@ -49,7 +49,7 @@ async def sample_copy_log_entries(): print("Waiting for operation to complete...") - response = await operation.result() + response = (await operation).result() # Handle the response print(response) diff --git a/samples/generated_samples/snippet_metadata_logging_v2.json b/samples/generated_samples/snippet_metadata_google.logging.v2.json similarity index 99% rename from samples/generated_samples/snippet_metadata_logging_v2.json rename to samples/generated_samples/snippet_metadata_google.logging.v2.json index 3c6bc46bf..6fc255d82 100644 --- a/samples/generated_samples/snippet_metadata_logging_v2.json +++ b/samples/generated_samples/snippet_metadata_google.logging.v2.json @@ -7,7 +7,8 @@ } ], "language": "PYTHON", - "name": "google-cloud-logging" + "name": "google-cloud-logging", + "version": "0.1.0" }, "snippets": [ { @@ -4305,7 +4306,7 @@ }, { "name": "resource_names", - "type": "Sequence[str]" + "type": "MutableSequence[str]" }, { "name": "filter", @@ -4393,7 +4394,7 @@ }, { "name": "resource_names", - "type": "Sequence[str]" + "type": "MutableSequence[str]" }, { "name": "filter", @@ -4957,11 +4958,11 @@ }, { "name": "labels", - "type": "Mapping[str, str]" + "type": "MutableMapping[str, str]" }, { "name": "entries", - "type": "Sequence[google.cloud.logging_v2.types.LogEntry]" + "type": "MutableSequence[google.cloud.logging_v2.types.LogEntry]" }, { "name": "retry", @@ -5049,11 +5050,11 @@ }, { "name": "labels", - "type": "Mapping[str, str]" + "type": "MutableMapping[str, str]" }, { "name": "entries", - "type": "Sequence[google.cloud.logging_v2.types.LogEntry]" + "type": "MutableSequence[google.cloud.logging_v2.types.LogEntry]" }, { "name": "retry", diff --git a/samples/snippets/noxfile.py b/samples/snippets/noxfile.py index f5c32b227..e8283c38d 100644 --- a/samples/snippets/noxfile.py +++ b/samples/snippets/noxfile.py @@ -160,6 +160,7 @@ def blacken(session: nox.sessions.Session) -> None: # format = isort + black # + @nox.session def format(session: nox.sessions.Session) -> None: """ @@ -187,7 +188,9 @@ def _session_tests( session: nox.sessions.Session, post_install: Callable = None ) -> None: # check for presence of tests - test_list = glob.glob("**/*_test.py", recursive=True) + glob.glob("**/test_*.py", recursive=True) + test_list = glob.glob("**/*_test.py", recursive=True) + glob.glob( + "**/test_*.py", recursive=True + ) test_list.extend(glob.glob("**/tests", recursive=True)) if len(test_list) == 0: @@ -209,9 +212,7 @@ def _session_tests( if os.path.exists("requirements-test.txt"): if os.path.exists("constraints-test.txt"): - session.install( - "-r", "requirements-test.txt", "-c", "constraints-test.txt" - ) + session.install("-r", "requirements-test.txt", "-c", "constraints-test.txt") else: session.install("-r", "requirements-test.txt") with open("requirements-test.txt") as rtfile: @@ -224,9 +225,9 @@ def _session_tests( post_install(session) if "pytest-parallel" in packages: - concurrent_args.extend(['--workers', 'auto', '--tests-per-worker', 'auto']) + concurrent_args.extend(["--workers", "auto", "--tests-per-worker", "auto"]) elif "pytest-xdist" in packages: - concurrent_args.extend(['-n', 'auto']) + concurrent_args.extend(["-n", "auto"]) session.run( "pytest", @@ -256,7 +257,7 @@ def py(session: nox.sessions.Session) -> None: def _get_repo_root() -> Optional[str]: - """ Returns the root folder of the project. """ + """Returns the root folder of the project.""" # Get root of this repository. Assume we don't have directories nested deeper than 10 items. p = Path(os.getcwd()) for i in range(10): diff --git a/setup.py b/setup.py index d1fc8f037..80f95a572 100644 --- a/setup.py +++ b/setup.py @@ -1,4 +1,5 @@ -# Copyright 2018 Google LLC +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -11,36 +12,39 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. - +# import io import os -import setuptools +import setuptools # type: ignore - -# Package metadata. +package_root = os.path.abspath(os.path.dirname(__file__)) name = "google-cloud-logging" + + description = "Stackdriver Logging API client library" -version = "3.3.1" -# Should be one of: -# 'Development Status :: 3 - Alpha' -# 'Development Status :: 4 - Beta' -# 'Development Status :: 5 - Production/Stable' -release_status = "Development Status :: 5 - Production/Stable" + +version = {} +with open(os.path.join(package_root, "google/cloud/logging/gapic_version.py")) as fp: + exec(fp.read(), version) +version = version["__version__"] + +if version[0] == "0": + release_status = "Development Status :: 4 - Beta" +else: + release_status = "Development Status :: 5 - Production/Stable" + dependencies = [ - "google-api-core[grpc] >= 1.32.0, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*", + "google-api-core[grpc] >= 1.33.2, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*", "google-cloud-appengine-logging>=0.1.0, <2.0.0dev", "google-cloud-audit-log >= 0.1.0, < 1.0.0dev", "google-cloud-core >= 2.0.0, <3.0.0dev", "grpc-google-iam-v1 >=0.12.4, <1.0.0dev", "proto-plus >= 1.22.0, <2.0.0dev", - "protobuf>=3.19.5,<5.0.0dev,!=3.20.0,!=3.20.1,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5", + "protobuf>=3.19.5,<5.0.0dev,!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5", ] -extras = {} - - -# Setup boilerplate below this line. +url = "https://github.com/googleapis/python-logging" package_root = os.path.abspath(os.path.dirname(__file__)) @@ -48,18 +52,16 @@ with io.open(readme_filename, encoding="utf-8") as readme_file: readme = readme_file.read() -# Only include packages under the 'google' namespace. Do not include tests, -# benchmarks, etc. packages = [ - package for package in setuptools.find_packages() if package.startswith("google") + package + for package in setuptools.PEP420PackageFinder.find() + if package.startswith("google") ] -# Determine which namespaces are needed. namespaces = ["google"] if "google.cloud" in packages: namespaces.append("google.cloud") - setuptools.setup( name=name, version=version, @@ -68,7 +70,7 @@ author="Google LLC", author_email="googleapis-packages@google.com", license="Apache 2.0", - url="https://github.com/googleapis/python-logging", + url=url, classifiers=[ release_status, "Intended Audience :: Developers", @@ -84,10 +86,9 @@ ], platforms="Posix; MacOS X; Windows", packages=packages, + python_requires=">=3.7", namespace_packages=namespaces, install_requires=dependencies, - extras_require=extras, - python_requires=">=3.7", include_package_data=True, zip_safe=False, ) diff --git a/testing/constraints-3.10.txt b/testing/constraints-3.10.txt index e69de29bb..ed7f9aed2 100644 --- a/testing/constraints-3.10.txt +++ b/testing/constraints-3.10.txt @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +# This constraints file is required for unit tests. +# List all library dependencies and extras in this file. +google-api-core +proto-plus +protobuf diff --git a/testing/constraints-3.11.txt b/testing/constraints-3.11.txt index e69de29bb..ed7f9aed2 100644 --- a/testing/constraints-3.11.txt +++ b/testing/constraints-3.11.txt @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +# This constraints file is required for unit tests. +# List all library dependencies and extras in this file. +google-api-core +proto-plus +protobuf diff --git a/testing/constraints-3.7.txt b/testing/constraints-3.7.txt index 6db145a06..587626c54 100644 --- a/testing/constraints-3.7.txt +++ b/testing/constraints-3.7.txt @@ -1,11 +1,10 @@ # This constraints file is used to check that lower bounds # are correct in setup.py -# List *all* library dependencies and extras in this file. +# List all library dependencies and extras in this file. # Pin the version to the lower bound. -# -# e.g., if setup.py has "foo >= 1.14.0, < 2.0.0dev", -# Then this file should have foo==1.14.0 -google-api-core==1.32.0 -google-cloud-core==2.0.0 +# e.g., if setup.py has "google-cloud-foo >= 1.14.0, < 2.0.0dev", +# Then this file should have google-cloud-foo==1.14.0 +google-api-core==1.33.2 proto-plus==1.22.0 protobuf==3.19.5 +google-cloud-core==2.0.0 diff --git a/testing/constraints-3.8.txt b/testing/constraints-3.8.txt index e69de29bb..ed7f9aed2 100644 --- a/testing/constraints-3.8.txt +++ b/testing/constraints-3.8.txt @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +# This constraints file is required for unit tests. +# List all library dependencies and extras in this file. +google-api-core +proto-plus +protobuf diff --git a/testing/constraints-3.9.txt b/testing/constraints-3.9.txt index e69de29bb..ed7f9aed2 100644 --- a/testing/constraints-3.9.txt +++ b/testing/constraints-3.9.txt @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +# This constraints file is required for unit tests. +# List all library dependencies and extras in this file. +google-api-core +proto-plus +protobuf diff --git a/tests/unit/gapic/logging_v2/test_config_service_v2.py b/tests/unit/gapic/logging_v2/test_config_service_v2.py index 8e8671e68..be77714c0 100644 --- a/tests/unit/gapic/logging_v2/test_config_service_v2.py +++ b/tests/unit/gapic/logging_v2/test_config_service_v2.py @@ -99,22 +99,6 @@ def test__get_default_mtls_endpoint(): ) -def test_config_default_client_info_headers(): - import re - import pkg_resources - - # test that DEFAULT_CLIENT_INFO contains the expected gapic headers - gapic_header_regex = re.compile( - r"gapic\/[0-9]+\.[\w.-]+ gax\/[0-9]+\.[\w.-]+ gl-python\/[0-9]+\.[\w.-]+ grpc\/[0-9]+\.[\w.-]+" - ) - detected_info = ( - google.cloud.logging_v2.services.config_service_v2.transports.base.DEFAULT_CLIENT_INFO - ) - assert detected_info is not None - detected_agent = " ".join(sorted(detected_info.to_user_agent().split(" "))) - assert gapic_header_regex.match(detected_agent) - - @pytest.mark.parametrize( "client_class,transport_name", [ diff --git a/tests/unit/gapic/logging_v2/test_logging_service_v2.py b/tests/unit/gapic/logging_v2/test_logging_service_v2.py index 832ad63dc..d8bbd5b73 100644 --- a/tests/unit/gapic/logging_v2/test_logging_service_v2.py +++ b/tests/unit/gapic/logging_v2/test_logging_service_v2.py @@ -71,22 +71,6 @@ def modify_default_endpoint(client): ) -def test_logging_default_client_info_headers(): - import re - import pkg_resources - - # test that DEFAULT_CLIENT_INFO contains the expected gapic headers - gapic_header_regex = re.compile( - r"gapic\/[0-9]+\.[\w.-]+ gax\/[0-9]+\.[\w.-]+ gl-python\/[0-9]+\.[\w.-]+ grpc\/[0-9]+\.[\w.-]+" - ) - detected_info = ( - google.cloud.logging_v2.services.logging_service_v2.transports.base.DEFAULT_CLIENT_INFO - ) - assert detected_info is not None - detected_agent = " ".join(sorted(detected_info.to_user_agent().split(" "))) - assert gapic_header_regex.match(detected_agent) - - def test__get_default_mtls_endpoint(): api_endpoint = "example.googleapis.com" api_mtls_endpoint = "example.mtls.googleapis.com" @@ -1051,7 +1035,7 @@ def test_write_log_entries_flattened(): # using the keyword arguments to the method. client.write_log_entries( log_name="log_name_value", - resource=monitored_resource_pb2.MonitoredResource(type="type__value"), + resource=monitored_resource_pb2.MonitoredResource(type="type_value"), labels={"key_value": "value_value"}, entries=[log_entry.LogEntry(log_name="log_name_value")], ) @@ -1064,7 +1048,7 @@ def test_write_log_entries_flattened(): mock_val = "log_name_value" assert arg == mock_val arg = args[0].resource - mock_val = monitored_resource_pb2.MonitoredResource(type="type__value") + mock_val = monitored_resource_pb2.MonitoredResource(type="type_value") assert arg == mock_val arg = args[0].labels mock_val = {"key_value": "value_value"} @@ -1085,7 +1069,7 @@ def test_write_log_entries_flattened_error(): client.write_log_entries( logging.WriteLogEntriesRequest(), log_name="log_name_value", - resource=monitored_resource_pb2.MonitoredResource(type="type__value"), + resource=monitored_resource_pb2.MonitoredResource(type="type_value"), labels={"key_value": "value_value"}, entries=[log_entry.LogEntry(log_name="log_name_value")], ) @@ -1111,7 +1095,7 @@ async def test_write_log_entries_flattened_async(): # using the keyword arguments to the method. response = await client.write_log_entries( log_name="log_name_value", - resource=monitored_resource_pb2.MonitoredResource(type="type__value"), + resource=monitored_resource_pb2.MonitoredResource(type="type_value"), labels={"key_value": "value_value"}, entries=[log_entry.LogEntry(log_name="log_name_value")], ) @@ -1124,7 +1108,7 @@ async def test_write_log_entries_flattened_async(): mock_val = "log_name_value" assert arg == mock_val arg = args[0].resource - mock_val = monitored_resource_pb2.MonitoredResource(type="type__value") + mock_val = monitored_resource_pb2.MonitoredResource(type="type_value") assert arg == mock_val arg = args[0].labels mock_val = {"key_value": "value_value"} @@ -1146,7 +1130,7 @@ async def test_write_log_entries_flattened_error_async(): await client.write_log_entries( logging.WriteLogEntriesRequest(), log_name="log_name_value", - resource=monitored_resource_pb2.MonitoredResource(type="type__value"), + resource=monitored_resource_pb2.MonitoredResource(type="type_value"), labels={"key_value": "value_value"}, entries=[log_entry.LogEntry(log_name="log_name_value")], ) diff --git a/tests/unit/gapic/logging_v2/test_metrics_service_v2.py b/tests/unit/gapic/logging_v2/test_metrics_service_v2.py index 4f9e2347c..39a005c97 100644 --- a/tests/unit/gapic/logging_v2/test_metrics_service_v2.py +++ b/tests/unit/gapic/logging_v2/test_metrics_service_v2.py @@ -99,22 +99,6 @@ def test__get_default_mtls_endpoint(): ) -def test_metrics_default_client_info_headers(): - import re - import pkg_resources - - # test that DEFAULT_CLIENT_INFO contains the expected gapic headers - gapic_header_regex = re.compile( - r"gapic\/[0-9]+\.[\w.-]+ gax\/[0-9]+\.[\w.-]+ gl-python\/[0-9]+\.[\w.-]+ grpc\/[0-9]+\.[\w.-]+" - ) - detected_info = ( - google.cloud.logging_v2.services.metrics_service_v2.transports.base.DEFAULT_CLIENT_INFO - ) - assert detected_info is not None - detected_agent = " ".join(sorted(detected_info.to_user_agent().split(" "))) - assert gapic_header_regex.match(detected_agent) - - @pytest.mark.parametrize( "client_class,transport_name", [ @@ -193,6 +177,21 @@ def test_metrics_service_v2_client_from_service_account_file( assert client.transport._host == ("logging.googleapis.com:443") +def test_metrics_default_client_info_headers(): + import re + + # test that DEFAULT_CLIENT_INFO contains the expected gapic headers + gapic_header_regex = re.compile( + r"gapic\/[0-9]+\.[\w.-]+ gax\/[0-9]+\.[\w.-]+ gl-python\/[0-9]+\.[\w.-]+ grpc\/[0-9]+\.[\w.-]+" + ) + detected_info = ( + google.cloud.logging_v2.services.metrics_service_v2.transports.base.DEFAULT_CLIENT_INFO + ) + assert detected_info is not None + detected_agent = " ".join(sorted(detected_info.to_user_agent().split(" "))) + assert gapic_header_regex.match(detected_agent) + + def test_metrics_service_v2_client_get_transport_class(): transport = MetricsServiceV2Client.get_transport_class() available_transports = [ From 8bb9cd4ec6efe5c1bd33cabe6a851c9baf9ecd6b Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Thu, 15 Dec 2022 18:01:31 +0100 Subject: [PATCH 4/5] chore(deps): update dependency google-cloud-bigquery to v3.4.1 (#689) Co-authored-by: Anthonios Partheniou --- samples/snippets/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/snippets/requirements.txt b/samples/snippets/requirements.txt index 4d5a11e58..32a82202c 100644 --- a/samples/snippets/requirements.txt +++ b/samples/snippets/requirements.txt @@ -1,4 +1,4 @@ google-cloud-logging==3.3.1 -google-cloud-bigquery==3.4.0 +google-cloud-bigquery==3.4.1 google-cloud-storage==2.7.0 google-cloud-pubsub==2.13.11 From 7b8965a1469423d2cd61e045399b3ec6f7e85cd6 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Tue, 27 Dec 2022 13:54:36 -0800 Subject: [PATCH 5/5] chore(main): release 3.4.0 (#691) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- .release-please-manifest.json | 2 +- CHANGELOG.md | 21 +++++++++++++++++++ google/cloud/logging/gapic_version.py | 2 +- google/cloud/logging_v2/gapic_version.py | 2 +- .../snippet_metadata_google.logging.v2.json | 2 +- 5 files changed, 25 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 466b7195f..395791d45 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "3.3.1" + ".": "3.4.0" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 838f36fca..e82a7e1da 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,27 @@ [1]: https://pypi.org/project/google-cloud-logging/#history +## [3.4.0](https://github.com/googleapis/python-logging/compare/v3.3.1...v3.4.0) (2022-12-15) + + +### Features + +* Add typing to proto.Message based class attributes ([9d505f1](https://github.com/googleapis/python-logging/commit/9d505f1147ccac8632590b4322945a900ff3c5c2)) + + +### Bug Fixes + +* Add dict typing for client_options ([9d505f1](https://github.com/googleapis/python-logging/commit/9d505f1147ccac8632590b4322945a900ff3c5c2)) +* **deps:** Require google-api-core >=1.34.0, >=2.11.0 ([9d505f1](https://github.com/googleapis/python-logging/commit/9d505f1147ccac8632590b4322945a900ff3c5c2)) +* Drop usage of pkg_resources ([9d505f1](https://github.com/googleapis/python-logging/commit/9d505f1147ccac8632590b4322945a900ff3c5c2)) +* Fix timeout default values ([9d505f1](https://github.com/googleapis/python-logging/commit/9d505f1147ccac8632590b4322945a900ff3c5c2)) + + +### Documentation + +* **samples:** Snippetgen handling of repeated enum field ([9d505f1](https://github.com/googleapis/python-logging/commit/9d505f1147ccac8632590b4322945a900ff3c5c2)) +* **samples:** Snippetgen should call await on the operation coroutine before calling result ([9d505f1](https://github.com/googleapis/python-logging/commit/9d505f1147ccac8632590b4322945a900ff3c5c2)) + ## [3.3.1](https://github.com/googleapis/python-logging/compare/v3.3.0...v3.3.1) (2022-12-05) diff --git a/google/cloud/logging/gapic_version.py b/google/cloud/logging/gapic_version.py index c443818a0..431567aa0 100644 --- a/google/cloud/logging/gapic_version.py +++ b/google/cloud/logging/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "3.3.1" # {x-release-please-version} +__version__ = "3.4.0" # {x-release-please-version} diff --git a/google/cloud/logging_v2/gapic_version.py b/google/cloud/logging_v2/gapic_version.py index c443818a0..431567aa0 100644 --- a/google/cloud/logging_v2/gapic_version.py +++ b/google/cloud/logging_v2/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "3.3.1" # {x-release-please-version} +__version__ = "3.4.0" # {x-release-please-version} diff --git a/samples/generated_samples/snippet_metadata_google.logging.v2.json b/samples/generated_samples/snippet_metadata_google.logging.v2.json index 6fc255d82..e1fe3fcc1 100644 --- a/samples/generated_samples/snippet_metadata_google.logging.v2.json +++ b/samples/generated_samples/snippet_metadata_google.logging.v2.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-logging", - "version": "0.1.0" + "version": "3.4.0" }, "snippets": [ { pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy