From df69ccc66f45ccb4e94fbe8251c3f58e744fcf6b Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Mon, 1 Nov 2021 10:56:12 +0000 Subject: [PATCH] chore: use gapic-generator-python 0.53.4 (#140) - [ ] Regenerate this pull request now. docs: list oneofs in docstring fix(deps): require google-api-core >= 1.28.0 fix(deps): drop packaging dependency committer: busunkim96@ PiperOrigin-RevId: 406468269 Source-Link: https://github.com/googleapis/googleapis/commit/83d81b0c8fc22291a13398d6d77f02dc97a5b6f4 Source-Link: https://github.com/googleapis/googleapis-gen/commit/2ff001fbacb9e77e71d734de5f955c05fdae8526 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMmZmMDAxZmJhY2I5ZTc3ZTcxZDczNGRlNWY5NTVjMDVmZGFlODUyNiJ9 --- .../os_config_service/async_client.py | 58 ++++++------ .../services/os_config_service/client.py | 20 ++-- .../os_config_service/transports/base.py | 35 +------ .../transports/grpc_asyncio.py | 1 - .../os_config_zonal_service/async_client.py | 28 +++--- .../os_config_zonal_service/client.py | 10 +- .../transports/base.py | 35 +------ .../transports/grpc_asyncio.py | 1 - google/cloud/osconfig_v1/types/inventory.py | 25 +++++ .../osconfig_v1/types/osconfig_common.py | 9 ++ .../osconfig_v1/types/patch_deployments.py | 27 ++++++ google/cloud/osconfig_v1/types/patch_jobs.py | 9 ++ .../os_config_zonal_service/async_client.py | 91 +++++++++++-------- .../os_config_zonal_service/client.py | 26 +++--- .../transports/base.py | 37 +------- .../transports/grpc.py | 2 +- .../transports/grpc_asyncio.py | 3 +- .../osconfig_v1alpha/types/config_common.py | 3 + .../cloud/osconfig_v1alpha/types/inventory.py | 25 +++++ .../cloud/osconfig_v1alpha/types/os_policy.py | 64 +++++++++++++ .../osconfig_v1alpha/types/osconfig_common.py | 9 ++ setup.py | 3 +- testing/constraints-3.6.txt | 3 +- .../osconfig_v1/test_os_config_service.py | 91 ++----------------- .../test_os_config_zonal_service.py | 91 ++----------------- .../test_os_config_zonal_service.py | 91 ++----------------- 26 files changed, 336 insertions(+), 461 deletions(-) diff --git a/google/cloud/osconfig_v1/services/os_config_service/async_client.py b/google/cloud/osconfig_v1/services/os_config_service/async_client.py index 297cc66..d01127d 100644 --- a/google/cloud/osconfig_v1/services/os_config_service/async_client.py +++ b/google/cloud/osconfig_v1/services/os_config_service/async_client.py @@ -19,13 +19,15 @@ from typing import Dict, Sequence, Tuple, Type, Union import pkg_resources -import google.api_core.client_options as ClientOptions # type: ignore +from google.api_core.client_options import ClientOptions # type: ignore from google.api_core import exceptions as core_exceptions # type: ignore from google.api_core import gapic_v1 # type: ignore from google.api_core import retry as retries # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore +OptionalRetry = Union[retries.Retry, object] + from google.cloud.osconfig_v1.services.os_config_service import pagers from google.cloud.osconfig_v1.types import patch_deployments from google.cloud.osconfig_v1.types import patch_jobs @@ -176,9 +178,9 @@ def __init__( async def execute_patch_job( self, - request: patch_jobs.ExecutePatchJobRequest = None, + request: Union[patch_jobs.ExecutePatchJobRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> patch_jobs.PatchJob: @@ -186,7 +188,7 @@ async def execute_patch_job( job. Args: - request (:class:`google.cloud.osconfig_v1.types.ExecutePatchJobRequest`): + request (Union[google.cloud.osconfig_v1.types.ExecutePatchJobRequest, dict]): The request object. A request message to initiate patching across Compute Engine instances. retry (google.api_core.retry.Retry): Designation of what errors, if any, @@ -234,10 +236,10 @@ async def execute_patch_job( async def get_patch_job( self, - request: patch_jobs.GetPatchJobRequest = None, + request: Union[patch_jobs.GetPatchJobRequest, dict] = None, *, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> patch_jobs.PatchJob: @@ -246,7 +248,7 @@ async def get_patch_job( of completed jobs. Args: - request (:class:`google.cloud.osconfig_v1.types.GetPatchJobRequest`): + request (Union[google.cloud.osconfig_v1.types.GetPatchJobRequest, dict]): The request object. Request to get an active or completed patch job. name (:class:`str`): @@ -315,9 +317,9 @@ async def get_patch_job( async def cancel_patch_job( self, - request: patch_jobs.CancelPatchJobRequest = None, + request: Union[patch_jobs.CancelPatchJobRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> patch_jobs.PatchJob: @@ -325,7 +327,7 @@ async def cancel_patch_job( Canceled patch jobs cannot be restarted. Args: - request (:class:`google.cloud.osconfig_v1.types.CancelPatchJobRequest`): + request (Union[google.cloud.osconfig_v1.types.CancelPatchJobRequest, dict]): The request object. Message for canceling a patch job. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. @@ -372,17 +374,17 @@ async def cancel_patch_job( async def list_patch_jobs( self, - request: patch_jobs.ListPatchJobsRequest = None, + request: Union[patch_jobs.ListPatchJobsRequest, dict] = None, *, parent: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListPatchJobsAsyncPager: r"""Get a list of patch jobs. Args: - request (:class:`google.cloud.osconfig_v1.types.ListPatchJobsRequest`): + request (Union[google.cloud.osconfig_v1.types.ListPatchJobsRequest, dict]): The request object. A request message for listing patch jobs. parent (:class:`str`): @@ -450,17 +452,17 @@ async def list_patch_jobs( async def list_patch_job_instance_details( self, - request: patch_jobs.ListPatchJobInstanceDetailsRequest = None, + request: Union[patch_jobs.ListPatchJobInstanceDetailsRequest, dict] = None, *, parent: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListPatchJobInstanceDetailsAsyncPager: r"""Get a list of instance details for a given patch job. Args: - request (:class:`google.cloud.osconfig_v1.types.ListPatchJobInstanceDetailsRequest`): + request (Union[google.cloud.osconfig_v1.types.ListPatchJobInstanceDetailsRequest, dict]): The request object. Request to list details for all instances that are part of a patch job. parent (:class:`str`): @@ -530,19 +532,19 @@ async def list_patch_job_instance_details( async def create_patch_deployment( self, - request: patch_deployments.CreatePatchDeploymentRequest = None, + request: Union[patch_deployments.CreatePatchDeploymentRequest, dict] = None, *, parent: str = None, patch_deployment: patch_deployments.PatchDeployment = None, patch_deployment_id: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> patch_deployments.PatchDeployment: r"""Create an OS Config patch deployment. Args: - request (:class:`google.cloud.osconfig_v1.types.CreatePatchDeploymentRequest`): + request (Union[google.cloud.osconfig_v1.types.CreatePatchDeploymentRequest, dict]): The request object. A request message for creating a patch deployment. parent (:class:`str`): @@ -633,17 +635,17 @@ async def create_patch_deployment( async def get_patch_deployment( self, - request: patch_deployments.GetPatchDeploymentRequest = None, + request: Union[patch_deployments.GetPatchDeploymentRequest, dict] = None, *, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> patch_deployments.PatchDeployment: r"""Get an OS Config patch deployment. Args: - request (:class:`google.cloud.osconfig_v1.types.GetPatchDeploymentRequest`): + request (Union[google.cloud.osconfig_v1.types.GetPatchDeploymentRequest, dict]): The request object. A request message for retrieving a patch deployment. name (:class:`str`): @@ -708,17 +710,17 @@ async def get_patch_deployment( async def list_patch_deployments( self, - request: patch_deployments.ListPatchDeploymentsRequest = None, + request: Union[patch_deployments.ListPatchDeploymentsRequest, dict] = None, *, parent: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListPatchDeploymentsAsyncPager: r"""Get a page of OS Config patch deployments. Args: - request (:class:`google.cloud.osconfig_v1.types.ListPatchDeploymentsRequest`): + request (Union[google.cloud.osconfig_v1.types.ListPatchDeploymentsRequest, dict]): The request object. A request message for listing patch deployments. parent (:class:`str`): @@ -788,17 +790,17 @@ async def list_patch_deployments( async def delete_patch_deployment( self, - request: patch_deployments.DeletePatchDeploymentRequest = None, + request: Union[patch_deployments.DeletePatchDeploymentRequest, dict] = None, *, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Delete an OS Config patch deployment. Args: - request (:class:`google.cloud.osconfig_v1.types.DeletePatchDeploymentRequest`): + request (Union[google.cloud.osconfig_v1.types.DeletePatchDeploymentRequest, dict]): The request object. A request message for deleting a patch deployment. name (:class:`str`): diff --git a/google/cloud/osconfig_v1/services/os_config_service/client.py b/google/cloud/osconfig_v1/services/os_config_service/client.py index 2a86b37..36897b4 100644 --- a/google/cloud/osconfig_v1/services/os_config_service/client.py +++ b/google/cloud/osconfig_v1/services/os_config_service/client.py @@ -30,6 +30,8 @@ from google.auth.exceptions import MutualTLSChannelError # type: ignore from google.oauth2 import service_account # type: ignore +OptionalRetry = Union[retries.Retry, object] + from google.cloud.osconfig_v1.services.os_config_service import pagers from google.cloud.osconfig_v1.types import patch_deployments from google.cloud.osconfig_v1.types import patch_jobs @@ -387,7 +389,7 @@ def execute_patch_job( self, request: Union[patch_jobs.ExecutePatchJobRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> patch_jobs.PatchJob: @@ -447,7 +449,7 @@ def get_patch_job( request: Union[patch_jobs.GetPatchJobRequest, dict] = None, *, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> patch_jobs.PatchJob: @@ -527,7 +529,7 @@ def cancel_patch_job( self, request: Union[patch_jobs.CancelPatchJobRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> patch_jobs.PatchJob: @@ -586,7 +588,7 @@ def list_patch_jobs( request: Union[patch_jobs.ListPatchJobsRequest, dict] = None, *, parent: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListPatchJobsPager: @@ -664,7 +666,7 @@ def list_patch_job_instance_details( request: Union[patch_jobs.ListPatchJobInstanceDetailsRequest, dict] = None, *, parent: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListPatchJobInstanceDetailsPager: @@ -748,7 +750,7 @@ def create_patch_deployment( parent: str = None, patch_deployment: patch_deployments.PatchDeployment = None, patch_deployment_id: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> patch_deployments.PatchDeployment: @@ -849,7 +851,7 @@ def get_patch_deployment( request: Union[patch_deployments.GetPatchDeploymentRequest, dict] = None, *, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> patch_deployments.PatchDeployment: @@ -924,7 +926,7 @@ def list_patch_deployments( request: Union[patch_deployments.ListPatchDeploymentsRequest, dict] = None, *, parent: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListPatchDeploymentsPager: @@ -1004,7 +1006,7 @@ def delete_patch_deployment( request: Union[patch_deployments.DeletePatchDeploymentRequest, dict] = None, *, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> None: diff --git a/google/cloud/osconfig_v1/services/os_config_service/transports/base.py b/google/cloud/osconfig_v1/services/os_config_service/transports/base.py index 9699f5a..945e016 100644 --- a/google/cloud/osconfig_v1/services/os_config_service/transports/base.py +++ b/google/cloud/osconfig_v1/services/os_config_service/transports/base.py @@ -15,7 +15,6 @@ # import abc from typing import Awaitable, Callable, Dict, Optional, Sequence, Union -import packaging.version import pkg_resources import google.auth # type: ignore @@ -37,15 +36,6 @@ except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() -try: - # google.auth.__version__ was added in 1.26.0 - _GOOGLE_AUTH_VERSION = google.auth.__version__ -except AttributeError: - try: # try pkg_resources if it is available - _GOOGLE_AUTH_VERSION = pkg_resources.get_distribution("google-auth").version - except pkg_resources.DistributionNotFound: # pragma: NO COVER - _GOOGLE_AUTH_VERSION = None - class OsConfigServiceTransport(abc.ABC): """Abstract transport class for OsConfigService.""" @@ -95,7 +85,7 @@ def __init__( host += ":443" self._host = host - scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) + scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES} # Save the scopes. self._scopes = scopes @@ -128,29 +118,6 @@ def __init__( # Save the credentials. self._credentials = credentials - # TODO(busunkim): This method is in the base transport - # to avoid duplicating code across the transport classes. These functions - # should be deleted once the minimum required versions of google-auth is increased. - - # TODO: Remove this function once google-auth >= 1.25.0 is required - @classmethod - def _get_scopes_kwargs( - cls, host: str, scopes: Optional[Sequence[str]] - ) -> Dict[str, Optional[Sequence[str]]]: - """Returns scopes kwargs to pass to google-auth methods depending on the google-auth version""" - - scopes_kwargs = {} - - if _GOOGLE_AUTH_VERSION and ( - packaging.version.parse(_GOOGLE_AUTH_VERSION) - >= packaging.version.parse("1.25.0") - ): - scopes_kwargs = {"scopes": scopes, "default_scopes": cls.AUTH_SCOPES} - else: - scopes_kwargs = {"scopes": scopes or cls.AUTH_SCOPES} - - return scopes_kwargs - def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { diff --git a/google/cloud/osconfig_v1/services/os_config_service/transports/grpc_asyncio.py b/google/cloud/osconfig_v1/services/os_config_service/transports/grpc_asyncio.py index 9820ac6..e176827 100644 --- a/google/cloud/osconfig_v1/services/os_config_service/transports/grpc_asyncio.py +++ b/google/cloud/osconfig_v1/services/os_config_service/transports/grpc_asyncio.py @@ -20,7 +20,6 @@ from google.api_core import grpc_helpers_async # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore -import packaging.version import grpc # type: ignore from grpc.experimental import aio # type: ignore diff --git a/google/cloud/osconfig_v1/services/os_config_zonal_service/async_client.py b/google/cloud/osconfig_v1/services/os_config_zonal_service/async_client.py index 6817eb9..20ed650 100644 --- a/google/cloud/osconfig_v1/services/os_config_zonal_service/async_client.py +++ b/google/cloud/osconfig_v1/services/os_config_zonal_service/async_client.py @@ -19,13 +19,15 @@ from typing import Dict, Sequence, Tuple, Type, Union import pkg_resources -import google.api_core.client_options as ClientOptions # type: ignore +from google.api_core.client_options import ClientOptions # type: ignore from google.api_core import exceptions as core_exceptions # type: ignore from google.api_core import gapic_v1 # type: ignore from google.api_core import retry as retries # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore +OptionalRetry = Union[retries.Retry, object] + from google.cloud.osconfig_v1.services.os_config_zonal_service import pagers from google.cloud.osconfig_v1.types import inventory from google.cloud.osconfig_v1.types import vulnerability @@ -178,10 +180,10 @@ def __init__( async def get_inventory( self, - request: inventory.GetInventoryRequest = None, + request: Union[inventory.GetInventoryRequest, dict] = None, *, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> inventory.Inventory: @@ -189,7 +191,7 @@ async def get_inventory( no associated inventory, the message ``NOT_FOUND`` is returned. Args: - request (:class:`google.cloud.osconfig_v1.types.GetInventoryRequest`): + request (Union[google.cloud.osconfig_v1.types.GetInventoryRequest, dict]): The request object. A request message for getting inventory data for the specified VM. name (:class:`str`): @@ -265,10 +267,10 @@ async def get_inventory( async def list_inventories( self, - request: inventory.ListInventoriesRequest = None, + request: Union[inventory.ListInventoriesRequest, dict] = None, *, parent: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListInventoriesAsyncPager: @@ -276,7 +278,7 @@ async def list_inventories( specified zone. Args: - request (:class:`google.cloud.osconfig_v1.types.ListInventoriesRequest`): + request (Union[google.cloud.osconfig_v1.types.ListInventoriesRequest, dict]): The request object. A request message for listing inventory data for all VMs in the specified location. parent (:class:`str`): @@ -352,10 +354,10 @@ async def list_inventories( async def get_vulnerability_report( self, - request: vulnerability.GetVulnerabilityReportRequest = None, + request: Union[vulnerability.GetVulnerabilityReportRequest, dict] = None, *, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> vulnerability.VulnerabilityReport: @@ -364,7 +366,7 @@ async def get_vulnerability_report( vulnerability reports associated with them. Args: - request (:class:`google.cloud.osconfig_v1.types.GetVulnerabilityReportRequest`): + request (Union[google.cloud.osconfig_v1.types.GetVulnerabilityReportRequest, dict]): The request object. A request message for getting the vulnerability report for the specified VM. name (:class:`str`): @@ -436,10 +438,10 @@ async def get_vulnerability_report( async def list_vulnerability_reports( self, - request: vulnerability.ListVulnerabilityReportsRequest = None, + request: Union[vulnerability.ListVulnerabilityReportsRequest, dict] = None, *, parent: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListVulnerabilityReportsAsyncPager: @@ -447,7 +449,7 @@ async def list_vulnerability_reports( the specified zone. Args: - request (:class:`google.cloud.osconfig_v1.types.ListVulnerabilityReportsRequest`): + request (Union[google.cloud.osconfig_v1.types.ListVulnerabilityReportsRequest, dict]): The request object. A request message for listing vulnerability reports for all VM instances in the specified location. diff --git a/google/cloud/osconfig_v1/services/os_config_zonal_service/client.py b/google/cloud/osconfig_v1/services/os_config_zonal_service/client.py index 0ec4a5b..906f5c8 100644 --- a/google/cloud/osconfig_v1/services/os_config_zonal_service/client.py +++ b/google/cloud/osconfig_v1/services/os_config_zonal_service/client.py @@ -30,6 +30,8 @@ from google.auth.exceptions import MutualTLSChannelError # type: ignore from google.oauth2 import service_account # type: ignore +OptionalRetry = Union[retries.Retry, object] + from google.cloud.osconfig_v1.services.os_config_zonal_service import pagers from google.cloud.osconfig_v1.types import inventory from google.cloud.osconfig_v1.types import vulnerability @@ -392,7 +394,7 @@ def get_inventory( request: Union[inventory.GetInventoryRequest, dict] = None, *, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> inventory.Inventory: @@ -479,7 +481,7 @@ def list_inventories( request: Union[inventory.ListInventoriesRequest, dict] = None, *, parent: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListInventoriesPager: @@ -566,7 +568,7 @@ def get_vulnerability_report( request: Union[vulnerability.GetVulnerabilityReportRequest, dict] = None, *, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> vulnerability.VulnerabilityReport: @@ -650,7 +652,7 @@ def list_vulnerability_reports( request: Union[vulnerability.ListVulnerabilityReportsRequest, dict] = None, *, parent: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListVulnerabilityReportsPager: diff --git a/google/cloud/osconfig_v1/services/os_config_zonal_service/transports/base.py b/google/cloud/osconfig_v1/services/os_config_zonal_service/transports/base.py index a070518..9693d25 100644 --- a/google/cloud/osconfig_v1/services/os_config_zonal_service/transports/base.py +++ b/google/cloud/osconfig_v1/services/os_config_zonal_service/transports/base.py @@ -15,7 +15,6 @@ # import abc from typing import Awaitable, Callable, Dict, Optional, Sequence, Union -import packaging.version import pkg_resources import google.auth # type: ignore @@ -36,15 +35,6 @@ except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() -try: - # google.auth.__version__ was added in 1.26.0 - _GOOGLE_AUTH_VERSION = google.auth.__version__ -except AttributeError: - try: # try pkg_resources if it is available - _GOOGLE_AUTH_VERSION = pkg_resources.get_distribution("google-auth").version - except pkg_resources.DistributionNotFound: # pragma: NO COVER - _GOOGLE_AUTH_VERSION = None - class OsConfigZonalServiceTransport(abc.ABC): """Abstract transport class for OsConfigZonalService.""" @@ -94,7 +84,7 @@ def __init__( host += ":443" self._host = host - scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) + scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES} # Save the scopes. self._scopes = scopes @@ -127,29 +117,6 @@ def __init__( # Save the credentials. self._credentials = credentials - # TODO(busunkim): This method is in the base transport - # to avoid duplicating code across the transport classes. These functions - # should be deleted once the minimum required versions of google-auth is increased. - - # TODO: Remove this function once google-auth >= 1.25.0 is required - @classmethod - def _get_scopes_kwargs( - cls, host: str, scopes: Optional[Sequence[str]] - ) -> Dict[str, Optional[Sequence[str]]]: - """Returns scopes kwargs to pass to google-auth methods depending on the google-auth version""" - - scopes_kwargs = {} - - if _GOOGLE_AUTH_VERSION and ( - packaging.version.parse(_GOOGLE_AUTH_VERSION) - >= packaging.version.parse("1.25.0") - ): - scopes_kwargs = {"scopes": scopes, "default_scopes": cls.AUTH_SCOPES} - else: - scopes_kwargs = {"scopes": scopes or cls.AUTH_SCOPES} - - return scopes_kwargs - def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { diff --git a/google/cloud/osconfig_v1/services/os_config_zonal_service/transports/grpc_asyncio.py b/google/cloud/osconfig_v1/services/os_config_zonal_service/transports/grpc_asyncio.py index 42038e4..03519a9 100644 --- a/google/cloud/osconfig_v1/services/os_config_zonal_service/transports/grpc_asyncio.py +++ b/google/cloud/osconfig_v1/services/os_config_zonal_service/transports/grpc_asyncio.py @@ -20,7 +20,6 @@ from google.api_core import grpc_helpers_async # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore -import packaging.version import grpc # type: ignore from grpc.experimental import aio # type: ignore diff --git a/google/cloud/osconfig_v1/types/inventory.py b/google/cloud/osconfig_v1/types/inventory.py index 1714807..8202948 100644 --- a/google/cloud/osconfig_v1/types/inventory.py +++ b/google/cloud/osconfig_v1/types/inventory.py @@ -108,6 +108,13 @@ class OsInfo(proto.Message): class Item(proto.Message): r"""A single piece of inventory on a VM. + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + Attributes: id (str): Identifier for this item, unique across items @@ -123,9 +130,11 @@ class Item(proto.Message): to its specific details. installed_package (google.cloud.osconfig_v1.types.Inventory.SoftwarePackage): Software package present on the VM instance. + This field is a member of `oneof`_ ``details``. available_package (google.cloud.osconfig_v1.types.Inventory.SoftwarePackage): Software package available to be installed on the VM instance. + This field is a member of `oneof`_ ``details``. """ class OriginType(proto.Enum): @@ -166,41 +175,57 @@ class Type(proto.Enum): class SoftwarePackage(proto.Message): r"""Software package information of the operating system. + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + Attributes: yum_package (google.cloud.osconfig_v1.types.Inventory.VersionedPackage): Yum package info. For details about the yum package manager, see https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/deployment_guide/ch-yum. + This field is a member of `oneof`_ ``details``. apt_package (google.cloud.osconfig_v1.types.Inventory.VersionedPackage): Details of an APT package. For details about the apt package manager, see https://wiki.debian.org/Apt. + This field is a member of `oneof`_ ``details``. zypper_package (google.cloud.osconfig_v1.types.Inventory.VersionedPackage): Details of a Zypper package. For details about the Zypper package manager, see https://en.opensuse.org/SDB:Zypper_manual. + This field is a member of `oneof`_ ``details``. googet_package (google.cloud.osconfig_v1.types.Inventory.VersionedPackage): Details of a Googet package. For details about the googet package manager, see https://github.com/google/googet. + This field is a member of `oneof`_ ``details``. zypper_patch (google.cloud.osconfig_v1.types.Inventory.ZypperPatch): Details of a Zypper patch. For details about the Zypper package manager, see https://en.opensuse.org/SDB:Zypper_manual. + This field is a member of `oneof`_ ``details``. wua_package (google.cloud.osconfig_v1.types.Inventory.WindowsUpdatePackage): Details of a Windows Update package. See https://docs.microsoft.com/en-us/windows/win32/api/_wua/ for information about Windows Update. + This field is a member of `oneof`_ ``details``. qfe_package (google.cloud.osconfig_v1.types.Inventory.WindowsQuickFixEngineeringPackage): Details of a Windows Quick Fix engineering package. See https://docs.microsoft.com/en- us/windows/win32/cimwin32prov/win32-quickfixengineering for info in Windows Quick Fix Engineering. + This field is a member of `oneof`_ ``details``. cos_package (google.cloud.osconfig_v1.types.Inventory.VersionedPackage): Details of a COS package. + This field is a member of `oneof`_ ``details``. windows_application (google.cloud.osconfig_v1.types.Inventory.WindowsApplication): Details of Windows Application. + This field is a member of `oneof`_ ``details``. """ yum_package = proto.Field( diff --git a/google/cloud/osconfig_v1/types/osconfig_common.py b/google/cloud/osconfig_v1/types/osconfig_common.py index 2bf62d6..266d396 100644 --- a/google/cloud/osconfig_v1/types/osconfig_common.py +++ b/google/cloud/osconfig_v1/types/osconfig_common.py @@ -25,13 +25,22 @@ class FixedOrPercent(proto.Message): r"""Message encapsulating a value that can be either absolute ("fixed") or relative ("percent") to a value. + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + Attributes: fixed (int): Specifies a fixed value. + This field is a member of `oneof`_ ``mode``. percent (int): Specifies the relative value defined as a percentage, which will be multiplied by a reference value. + This field is a member of `oneof`_ ``mode``. """ fixed = proto.Field(proto.INT32, number=1, oneof="mode",) diff --git a/google/cloud/osconfig_v1/types/patch_deployments.py b/google/cloud/osconfig_v1/types/patch_deployments.py index 321f976..71b47da 100644 --- a/google/cloud/osconfig_v1/types/patch_deployments.py +++ b/google/cloud/osconfig_v1/types/patch_deployments.py @@ -48,6 +48,13 @@ class PatchDeployment(proto.Message): about creating and managing patch deployments, see `Scheduling patch jobs `__. + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + Attributes: name (str): Unique name for the patch deployment resource in a project. @@ -69,8 +76,10 @@ class PatchDeployment(proto.Message): duration ends, the patch times out. one_time_schedule (google.cloud.osconfig_v1.types.OneTimeSchedule): Required. Schedule a one-time execution. + This field is a member of `oneof`_ ``schedule``. recurring_schedule (google.cloud.osconfig_v1.types.RecurringSchedule): Required. Schedule recurring executions. + This field is a member of `oneof`_ ``schedule``. create_time (google.protobuf.timestamp_pb2.Timestamp): Output only. Time the patch deployment was created. Timestamp is in @@ -129,6 +138,13 @@ class OneTimeSchedule(proto.Message): class RecurringSchedule(proto.Message): r"""Sets the time for recurring patch deployments. + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + Attributes: time_zone (google.type.datetime_pb2.TimeZone): Required. Defines the time zone that ``time_of_day`` is @@ -149,8 +165,10 @@ class RecurringSchedule(proto.Message): recurring schedule. weekly (google.cloud.osconfig_v1.types.WeeklySchedule): Required. Schedule with weekly executions. + This field is a member of `oneof`_ ``schedule_config``. monthly (google.cloud.osconfig_v1.types.MonthlySchedule): Required. Schedule with monthly executions. + This field is a member of `oneof`_ ``schedule_config``. last_execute_time (google.protobuf.timestamp_pb2.Timestamp): Output only. The time the last patch job ran successfully. @@ -201,9 +219,17 @@ class MonthlySchedule(proto.Message): schedule is "on the third Tuesday of the month" or "on the 15th of the month". + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + Attributes: week_day_of_month (google.cloud.osconfig_v1.types.WeekDayOfMonth): Required. Week day in a month. + This field is a member of `oneof`_ ``day_of_month``. month_day (int): Required. One day of the month. 1-31 indicates the 1st to the 31st day. -1 indicates @@ -211,6 +237,7 @@ class MonthlySchedule(proto.Message): target day will be skipped. For example, a schedule to run "every month on the 31st" will not run in February, April, June, etc. + This field is a member of `oneof`_ ``day_of_month``. """ week_day_of_month = proto.Field( diff --git a/google/cloud/osconfig_v1/types/patch_jobs.py b/google/cloud/osconfig_v1/types/patch_jobs.py index ee075d5..3da5b3a 100644 --- a/google/cloud/osconfig_v1/types/patch_jobs.py +++ b/google/cloud/osconfig_v1/types/patch_jobs.py @@ -623,12 +623,21 @@ class ExecStep(proto.Message): class ExecStepConfig(proto.Message): r"""Common configurations for an ExecStep. + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + Attributes: local_path (str): An absolute path to the executable on the VM. + This field is a member of `oneof`_ ``executable``. gcs_object (google.cloud.osconfig_v1.types.GcsObject): A Cloud Storage object containing the executable. + This field is a member of `oneof`_ ``executable``. allowed_success_codes (Sequence[int]): Defaults to [0]. A list of possible return values that the execution can return to indicate a success. diff --git a/google/cloud/osconfig_v1alpha/services/os_config_zonal_service/async_client.py b/google/cloud/osconfig_v1alpha/services/os_config_zonal_service/async_client.py index a516966..a099930 100644 --- a/google/cloud/osconfig_v1alpha/services/os_config_zonal_service/async_client.py +++ b/google/cloud/osconfig_v1alpha/services/os_config_zonal_service/async_client.py @@ -19,13 +19,15 @@ from typing import Dict, Sequence, Tuple, Type, Union import pkg_resources -import google.api_core.client_options as ClientOptions # type: ignore +from google.api_core.client_options import ClientOptions # type: ignore from google.api_core import exceptions as core_exceptions # type: ignore from google.api_core import gapic_v1 # type: ignore from google.api_core import retry as retries # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore +OptionalRetry = Union[retries.Retry, object] + from google.api_core import operation # type: ignore from google.api_core import operation_async # type: ignore from google.cloud.osconfig_v1alpha.services.os_config_zonal_service import pagers @@ -198,12 +200,14 @@ def __init__( async def create_os_policy_assignment( self, - request: os_policy_assignments.CreateOSPolicyAssignmentRequest = None, + request: Union[ + os_policy_assignments.CreateOSPolicyAssignmentRequest, dict + ] = None, *, parent: str = None, os_policy_assignment: os_policy_assignments.OSPolicyAssignment = None, os_policy_assignment_id: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: @@ -220,7 +224,7 @@ async def create_os_policy_assignment( projects.locations.osPolicyAssignments.operations.cancel `__. Args: - request (:class:`google.cloud.osconfig_v1alpha.types.CreateOSPolicyAssignmentRequest`): + request (Union[google.cloud.osconfig_v1alpha.types.CreateOSPolicyAssignmentRequest, dict]): The request object. A request message to create an OS policy assignment parent (:class:`str`): @@ -330,11 +334,13 @@ async def create_os_policy_assignment( async def update_os_policy_assignment( self, - request: os_policy_assignments.UpdateOSPolicyAssignmentRequest = None, + request: Union[ + os_policy_assignments.UpdateOSPolicyAssignmentRequest, dict + ] = None, *, os_policy_assignment: os_policy_assignments.OSPolicyAssignment = None, update_mask: field_mask_pb2.FieldMask = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: @@ -350,7 +356,7 @@ async def update_os_policy_assignment( projects.locations.osPolicyAssignments.operations.cancel `__. Args: - request (:class:`google.cloud.osconfig_v1alpha.types.UpdateOSPolicyAssignmentRequest`): + request (Union[google.cloud.osconfig_v1alpha.types.UpdateOSPolicyAssignmentRequest, dict]): The request object. A request message to update an OS policy assignment os_policy_assignment (:class:`google.cloud.osconfig_v1alpha.types.OSPolicyAssignment`): @@ -443,10 +449,10 @@ async def update_os_policy_assignment( async def get_os_policy_assignment( self, - request: os_policy_assignments.GetOSPolicyAssignmentRequest = None, + request: Union[os_policy_assignments.GetOSPolicyAssignmentRequest, dict] = None, *, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> os_policy_assignments.OSPolicyAssignment: @@ -457,7 +463,7 @@ async def get_os_policy_assignment( revision ID in the ``name`` parameter. Args: - request (:class:`google.cloud.osconfig_v1alpha.types.GetOSPolicyAssignmentRequest`): + request (Union[google.cloud.osconfig_v1alpha.types.GetOSPolicyAssignmentRequest, dict]): The request object. A request message to get an OS policy assignment name (:class:`str`): @@ -530,10 +536,12 @@ async def get_os_policy_assignment( async def list_os_policy_assignments( self, - request: os_policy_assignments.ListOSPolicyAssignmentsRequest = None, + request: Union[ + os_policy_assignments.ListOSPolicyAssignmentsRequest, dict + ] = None, *, parent: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListOSPolicyAssignmentsAsyncPager: @@ -543,7 +551,7 @@ async def list_os_policy_assignments( returned. Args: - request (:class:`google.cloud.osconfig_v1alpha.types.ListOSPolicyAssignmentsRequest`): + request (Union[google.cloud.osconfig_v1alpha.types.ListOSPolicyAssignmentsRequest, dict]): The request object. A request message to list OS policy assignments for a parent resource parent (:class:`str`): @@ -611,10 +619,12 @@ async def list_os_policy_assignments( async def list_os_policy_assignment_revisions( self, - request: os_policy_assignments.ListOSPolicyAssignmentRevisionsRequest = None, + request: Union[ + os_policy_assignments.ListOSPolicyAssignmentRevisionsRequest, dict + ] = None, *, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListOSPolicyAssignmentRevisionsAsyncPager: @@ -622,7 +632,7 @@ async def list_os_policy_assignment_revisions( OS policy assignment. Args: - request (:class:`google.cloud.osconfig_v1alpha.types.ListOSPolicyAssignmentRevisionsRequest`): + request (Union[google.cloud.osconfig_v1alpha.types.ListOSPolicyAssignmentRevisionsRequest, dict]): The request object. A request message to list revisions for a OS policy assignment name (:class:`str`): @@ -692,10 +702,12 @@ async def list_os_policy_assignment_revisions( async def delete_os_policy_assignment( self, - request: os_policy_assignments.DeleteOSPolicyAssignmentRequest = None, + request: Union[ + os_policy_assignments.DeleteOSPolicyAssignmentRequest, dict + ] = None, *, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: @@ -714,7 +726,7 @@ async def delete_os_policy_assignment( projects.locations.osPolicyAssignments.operations.cancel `__. Args: - request (:class:`google.cloud.osconfig_v1alpha.types.DeleteOSPolicyAssignmentRequest`): + request (Union[google.cloud.osconfig_v1alpha.types.DeleteOSPolicyAssignmentRequest, dict]): The request object. A request message for deleting a OS policy assignment. name (:class:`str`): @@ -796,10 +808,12 @@ async def delete_os_policy_assignment( async def get_instance_os_policies_compliance( self, - request: instance_os_policies_compliance.GetInstanceOSPoliciesComplianceRequest = None, + request: Union[ + instance_os_policies_compliance.GetInstanceOSPoliciesComplianceRequest, dict + ] = None, *, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> instance_os_policies_compliance.InstanceOSPoliciesCompliance: @@ -807,7 +821,7 @@ async def get_instance_os_policies_compliance( Compute Engine VM instance. Args: - request (:class:`google.cloud.osconfig_v1alpha.types.GetInstanceOSPoliciesComplianceRequest`): + request (Union[google.cloud.osconfig_v1alpha.types.GetInstanceOSPoliciesComplianceRequest, dict]): The request object. A request message for getting OS policies compliance data for the given Compute Engine VM instance. @@ -892,10 +906,13 @@ async def get_instance_os_policies_compliance( async def list_instance_os_policies_compliances( self, - request: instance_os_policies_compliance.ListInstanceOSPoliciesCompliancesRequest = None, + request: Union[ + instance_os_policies_compliance.ListInstanceOSPoliciesCompliancesRequest, + dict, + ] = None, *, parent: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListInstanceOSPoliciesCompliancesAsyncPager: @@ -903,7 +920,7 @@ async def list_instance_os_policies_compliances( Engine VM instances in the specified zone. Args: - request (:class:`google.cloud.osconfig_v1alpha.types.ListInstanceOSPoliciesCompliancesRequest`): + request (Union[google.cloud.osconfig_v1alpha.types.ListInstanceOSPoliciesCompliancesRequest, dict]): The request object. A request message for listing OS policies compliance data for all Compute Engine VMs in the given location. @@ -981,10 +998,10 @@ async def list_instance_os_policies_compliances( async def get_inventory( self, - request: inventory.GetInventoryRequest = None, + request: Union[inventory.GetInventoryRequest, dict] = None, *, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> inventory.Inventory: @@ -992,7 +1009,7 @@ async def get_inventory( no associated inventory, the message ``NOT_FOUND`` is returned. Args: - request (:class:`google.cloud.osconfig_v1alpha.types.GetInventoryRequest`): + request (Union[google.cloud.osconfig_v1alpha.types.GetInventoryRequest, dict]): The request object. A request message for getting inventory data for the specified VM. name (:class:`str`): @@ -1068,10 +1085,10 @@ async def get_inventory( async def list_inventories( self, - request: inventory.ListInventoriesRequest = None, + request: Union[inventory.ListInventoriesRequest, dict] = None, *, parent: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListInventoriesAsyncPager: @@ -1079,7 +1096,7 @@ async def list_inventories( specified zone. Args: - request (:class:`google.cloud.osconfig_v1alpha.types.ListInventoriesRequest`): + request (Union[google.cloud.osconfig_v1alpha.types.ListInventoriesRequest, dict]): The request object. A request message for listing inventory data for all VMs in the specified location. parent (:class:`str`): @@ -1157,10 +1174,10 @@ async def list_inventories( async def get_vulnerability_report( self, - request: vulnerability.GetVulnerabilityReportRequest = None, + request: Union[vulnerability.GetVulnerabilityReportRequest, dict] = None, *, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> vulnerability.VulnerabilityReport: @@ -1169,7 +1186,7 @@ async def get_vulnerability_report( vulnerability reports associated with them. Args: - request (:class:`google.cloud.osconfig_v1alpha.types.GetVulnerabilityReportRequest`): + request (Union[google.cloud.osconfig_v1alpha.types.GetVulnerabilityReportRequest, dict]): The request object. A request message for getting the vulnerability report for the specified VM. name (:class:`str`): @@ -1241,10 +1258,10 @@ async def get_vulnerability_report( async def list_vulnerability_reports( self, - request: vulnerability.ListVulnerabilityReportsRequest = None, + request: Union[vulnerability.ListVulnerabilityReportsRequest, dict] = None, *, parent: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListVulnerabilityReportsAsyncPager: @@ -1252,7 +1269,7 @@ async def list_vulnerability_reports( the specified zone. Args: - request (:class:`google.cloud.osconfig_v1alpha.types.ListVulnerabilityReportsRequest`): + request (Union[google.cloud.osconfig_v1alpha.types.ListVulnerabilityReportsRequest, dict]): The request object. A request message for listing vulnerability reports for all VM instances in the specified location. diff --git a/google/cloud/osconfig_v1alpha/services/os_config_zonal_service/client.py b/google/cloud/osconfig_v1alpha/services/os_config_zonal_service/client.py index b4fecc7..5e510a6 100644 --- a/google/cloud/osconfig_v1alpha/services/os_config_zonal_service/client.py +++ b/google/cloud/osconfig_v1alpha/services/os_config_zonal_service/client.py @@ -30,6 +30,8 @@ from google.auth.exceptions import MutualTLSChannelError # type: ignore from google.oauth2 import service_account # type: ignore +OptionalRetry = Union[retries.Retry, object] + from google.api_core import operation # type: ignore from google.api_core import operation_async # type: ignore from google.cloud.osconfig_v1alpha.services.os_config_zonal_service import pagers @@ -442,7 +444,7 @@ def create_os_policy_assignment( parent: str = None, os_policy_assignment: os_policy_assignments.OSPolicyAssignment = None, os_policy_assignment_id: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation.Operation: @@ -579,7 +581,7 @@ def update_os_policy_assignment( *, os_policy_assignment: os_policy_assignments.OSPolicyAssignment = None, update_mask: field_mask_pb2.FieldMask = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation.Operation: @@ -695,7 +697,7 @@ def get_os_policy_assignment( request: Union[os_policy_assignments.GetOSPolicyAssignmentRequest, dict] = None, *, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> os_policy_assignments.OSPolicyAssignment: @@ -784,7 +786,7 @@ def list_os_policy_assignments( ] = None, *, parent: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListOSPolicyAssignmentsPager: @@ -871,7 +873,7 @@ def list_os_policy_assignment_revisions( ] = None, *, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListOSPolicyAssignmentRevisionsPager: @@ -960,7 +962,7 @@ def delete_os_policy_assignment( ] = None, *, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation.Operation: @@ -1070,7 +1072,7 @@ def get_instance_os_policies_compliance( ] = None, *, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> instance_os_policies_compliance.InstanceOSPoliciesCompliance: @@ -1174,7 +1176,7 @@ def list_instance_os_policies_compliances( ] = None, *, parent: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListInstanceOSPoliciesCompliancesPager: @@ -1268,7 +1270,7 @@ def get_inventory( request: Union[inventory.GetInventoryRequest, dict] = None, *, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> inventory.Inventory: @@ -1355,7 +1357,7 @@ def list_inventories( request: Union[inventory.ListInventoriesRequest, dict] = None, *, parent: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListInventoriesPager: @@ -1444,7 +1446,7 @@ def get_vulnerability_report( request: Union[vulnerability.GetVulnerabilityReportRequest, dict] = None, *, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> vulnerability.VulnerabilityReport: @@ -1528,7 +1530,7 @@ def list_vulnerability_reports( request: Union[vulnerability.ListVulnerabilityReportsRequest, dict] = None, *, parent: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListVulnerabilityReportsPager: diff --git a/google/cloud/osconfig_v1alpha/services/os_config_zonal_service/transports/base.py b/google/cloud/osconfig_v1alpha/services/os_config_zonal_service/transports/base.py index 616108e..71471c0 100644 --- a/google/cloud/osconfig_v1alpha/services/os_config_zonal_service/transports/base.py +++ b/google/cloud/osconfig_v1alpha/services/os_config_zonal_service/transports/base.py @@ -15,7 +15,6 @@ # import abc from typing import Awaitable, Callable, Dict, Optional, Sequence, Union -import packaging.version import pkg_resources import google.auth # type: ignore @@ -40,15 +39,6 @@ except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() -try: - # google.auth.__version__ was added in 1.26.0 - _GOOGLE_AUTH_VERSION = google.auth.__version__ -except AttributeError: - try: # try pkg_resources if it is available - _GOOGLE_AUTH_VERSION = pkg_resources.get_distribution("google-auth").version - except pkg_resources.DistributionNotFound: # pragma: NO COVER - _GOOGLE_AUTH_VERSION = None - class OsConfigZonalServiceTransport(abc.ABC): """Abstract transport class for OsConfigZonalService.""" @@ -98,7 +88,7 @@ def __init__( host += ":443" self._host = host - scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) + scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES} # Save the scopes. self._scopes = scopes @@ -131,29 +121,6 @@ def __init__( # Save the credentials. self._credentials = credentials - # TODO(busunkim): This method is in the base transport - # to avoid duplicating code across the transport classes. These functions - # should be deleted once the minimum required versions of google-auth is increased. - - # TODO: Remove this function once google-auth >= 1.25.0 is required - @classmethod - def _get_scopes_kwargs( - cls, host: str, scopes: Optional[Sequence[str]] - ) -> Dict[str, Optional[Sequence[str]]]: - """Returns scopes kwargs to pass to google-auth methods depending on the google-auth version""" - - scopes_kwargs = {} - - if _GOOGLE_AUTH_VERSION and ( - packaging.version.parse(_GOOGLE_AUTH_VERSION) - >= packaging.version.parse("1.25.0") - ): - scopes_kwargs = {"scopes": scopes, "default_scopes": cls.AUTH_SCOPES} - else: - scopes_kwargs = {"scopes": scopes or cls.AUTH_SCOPES} - - return scopes_kwargs - def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { @@ -225,7 +192,7 @@ def close(self): raise NotImplementedError() @property - def operations_client(self) -> operations_v1.OperationsClient: + def operations_client(self): """Return the client designed to process long-running operations.""" raise NotImplementedError() diff --git a/google/cloud/osconfig_v1alpha/services/os_config_zonal_service/transports/grpc.py b/google/cloud/osconfig_v1alpha/services/os_config_zonal_service/transports/grpc.py index 7222ac2..c42c64f 100644 --- a/google/cloud/osconfig_v1alpha/services/os_config_zonal_service/transports/grpc.py +++ b/google/cloud/osconfig_v1alpha/services/os_config_zonal_service/transports/grpc.py @@ -118,7 +118,7 @@ def __init__( self._grpc_channel = None self._ssl_channel_credentials = ssl_channel_credentials self._stubs: Dict[str, Callable] = {} - self._operations_client = None + self._operations_client: Optional[operations_v1.OperationsClient] = None if api_mtls_endpoint: warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) diff --git a/google/cloud/osconfig_v1alpha/services/os_config_zonal_service/transports/grpc_asyncio.py b/google/cloud/osconfig_v1alpha/services/os_config_zonal_service/transports/grpc_asyncio.py index ccbcfda..f0161bb 100644 --- a/google/cloud/osconfig_v1alpha/services/os_config_zonal_service/transports/grpc_asyncio.py +++ b/google/cloud/osconfig_v1alpha/services/os_config_zonal_service/transports/grpc_asyncio.py @@ -21,7 +21,6 @@ from google.api_core import operations_v1 # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore -import packaging.version import grpc # type: ignore from grpc.experimental import aio # type: ignore @@ -165,7 +164,7 @@ def __init__( self._grpc_channel = None self._ssl_channel_credentials = ssl_channel_credentials self._stubs: Dict[str, Callable] = {} - self._operations_client = None + self._operations_client: Optional[operations_v1.OperationsAsyncClient] = None if api_mtls_endpoint: warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) diff --git a/google/cloud/osconfig_v1alpha/types/config_common.py b/google/cloud/osconfig_v1alpha/types/config_common.py index db66cff..5b119f2 100644 --- a/google/cloud/osconfig_v1alpha/types/config_common.py +++ b/google/cloud/osconfig_v1alpha/types/config_common.py @@ -72,6 +72,8 @@ class Outcome(proto.Enum): class OSPolicyResourceCompliance(proto.Message): r"""Compliance data for an OS policy resource. + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + Attributes: os_policy_resource_id (str): The id of the OS policy resource. @@ -82,6 +84,7 @@ class OSPolicyResourceCompliance(proto.Message): Compliance state of the OS policy resource. exec_resource_output (google.cloud.osconfig_v1alpha.types.OSPolicyResourceCompliance.ExecResourceOutput): ExecResource specific output. + This field is a member of `oneof`_ ``output``. """ class ExecResourceOutput(proto.Message): diff --git a/google/cloud/osconfig_v1alpha/types/inventory.py b/google/cloud/osconfig_v1alpha/types/inventory.py index 6b30364..4b78b91 100644 --- a/google/cloud/osconfig_v1alpha/types/inventory.py +++ b/google/cloud/osconfig_v1alpha/types/inventory.py @@ -108,6 +108,13 @@ class OsInfo(proto.Message): class Item(proto.Message): r"""A single piece of inventory on a VM. + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + Attributes: id (str): Identifier for this item, unique across items @@ -123,9 +130,11 @@ class Item(proto.Message): to its specific details. installed_package (google.cloud.osconfig_v1alpha.types.Inventory.SoftwarePackage): Software package present on the VM instance. + This field is a member of `oneof`_ ``details``. available_package (google.cloud.osconfig_v1alpha.types.Inventory.SoftwarePackage): Software package available to be installed on the VM instance. + This field is a member of `oneof`_ ``details``. """ class OriginType(proto.Enum): @@ -166,41 +175,57 @@ class Type(proto.Enum): class SoftwarePackage(proto.Message): r"""Software package information of the operating system. + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + Attributes: yum_package (google.cloud.osconfig_v1alpha.types.Inventory.VersionedPackage): Yum package info. For details about the yum package manager, see https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/deployment_guide/ch-yum. + This field is a member of `oneof`_ ``details``. apt_package (google.cloud.osconfig_v1alpha.types.Inventory.VersionedPackage): Details of an APT package. For details about the apt package manager, see https://wiki.debian.org/Apt. + This field is a member of `oneof`_ ``details``. zypper_package (google.cloud.osconfig_v1alpha.types.Inventory.VersionedPackage): Details of a Zypper package. For details about the Zypper package manager, see https://en.opensuse.org/SDB:Zypper_manual. + This field is a member of `oneof`_ ``details``. googet_package (google.cloud.osconfig_v1alpha.types.Inventory.VersionedPackage): Details of a Googet package. For details about the googet package manager, see https://github.com/google/googet. + This field is a member of `oneof`_ ``details``. zypper_patch (google.cloud.osconfig_v1alpha.types.Inventory.ZypperPatch): Details of a Zypper patch. For details about the Zypper package manager, see https://en.opensuse.org/SDB:Zypper_manual. + This field is a member of `oneof`_ ``details``. wua_package (google.cloud.osconfig_v1alpha.types.Inventory.WindowsUpdatePackage): Details of a Windows Update package. See https://docs.microsoft.com/en-us/windows/win32/api/_wua/ for information about Windows Update. + This field is a member of `oneof`_ ``details``. qfe_package (google.cloud.osconfig_v1alpha.types.Inventory.WindowsQuickFixEngineeringPackage): Details of a Windows Quick Fix engineering package. See https://docs.microsoft.com/en- us/windows/win32/cimwin32prov/win32-quickfixengineering for info in Windows Quick Fix Engineering. + This field is a member of `oneof`_ ``details``. cos_package (google.cloud.osconfig_v1alpha.types.Inventory.VersionedPackage): Details of a COS package. + This field is a member of `oneof`_ ``details``. windows_application (google.cloud.osconfig_v1alpha.types.Inventory.WindowsApplication): Details of Windows Application. + This field is a member of `oneof`_ ``details``. """ yum_package = proto.Field( diff --git a/google/cloud/osconfig_v1alpha/types/os_policy.py b/google/cloud/osconfig_v1alpha/types/os_policy.py index 02f86c8..39f9dc6 100644 --- a/google/cloud/osconfig_v1alpha/types/os_policy.py +++ b/google/cloud/osconfig_v1alpha/types/os_policy.py @@ -95,6 +95,13 @@ class Resource(proto.Message): state by taking necessary actions if they have drifted from their desired state. + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + Attributes: id (str): Required. The id of the resource with the following @@ -108,24 +115,38 @@ class Resource(proto.Message): - Must be unique within the OS policy. pkg (google.cloud.osconfig_v1alpha.types.OSPolicy.Resource.PackageResource): Package resource + This field is a member of `oneof`_ ``resource_type``. repository (google.cloud.osconfig_v1alpha.types.OSPolicy.Resource.RepositoryResource): Package repository resource + This field is a member of `oneof`_ ``resource_type``. exec_ (google.cloud.osconfig_v1alpha.types.OSPolicy.Resource.ExecResource): Exec resource + This field is a member of `oneof`_ ``resource_type``. file (google.cloud.osconfig_v1alpha.types.OSPolicy.Resource.FileResource): File resource + This field is a member of `oneof`_ ``resource_type``. """ class File(proto.Message): r"""A remote or local file. + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + Attributes: remote (google.cloud.osconfig_v1alpha.types.OSPolicy.Resource.File.Remote): A generic remote file. + This field is a member of `oneof`_ ``type``. gcs (google.cloud.osconfig_v1alpha.types.OSPolicy.Resource.File.Gcs): A Cloud Storage object. + This field is a member of `oneof`_ ``type``. local_path (str): A local path within the VM to use. + This field is a member of `oneof`_ ``type``. allow_insecure (bool): Defaults to false. When false, files are subject to validations based on the file type: @@ -184,24 +205,38 @@ class Gcs(proto.Message): class PackageResource(proto.Message): r"""A resource that manages a system package. + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + Attributes: desired_state (google.cloud.osconfig_v1alpha.types.OSPolicy.Resource.PackageResource.DesiredState): Required. The desired state the agent should maintain for this package. apt (google.cloud.osconfig_v1alpha.types.OSPolicy.Resource.PackageResource.APT): A package managed by Apt. + This field is a member of `oneof`_ ``system_package``. deb (google.cloud.osconfig_v1alpha.types.OSPolicy.Resource.PackageResource.Deb): A deb package file. + This field is a member of `oneof`_ ``system_package``. yum (google.cloud.osconfig_v1alpha.types.OSPolicy.Resource.PackageResource.YUM): A package managed by YUM. + This field is a member of `oneof`_ ``system_package``. zypper (google.cloud.osconfig_v1alpha.types.OSPolicy.Resource.PackageResource.Zypper): A package managed by Zypper. + This field is a member of `oneof`_ ``system_package``. rpm (google.cloud.osconfig_v1alpha.types.OSPolicy.Resource.PackageResource.RPM): An rpm package file. + This field is a member of `oneof`_ ``system_package``. googet (google.cloud.osconfig_v1alpha.types.OSPolicy.Resource.PackageResource.GooGet): A package managed by GooGet. + This field is a member of `oneof`_ ``system_package``. msi (google.cloud.osconfig_v1alpha.types.OSPolicy.Resource.PackageResource.MSI): An MSI package. + This field is a member of `oneof`_ ``system_package``. """ class DesiredState(proto.Enum): @@ -373,15 +408,26 @@ class MSI(proto.Message): class RepositoryResource(proto.Message): r"""A resource that manages a package repository. + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + Attributes: apt (google.cloud.osconfig_v1alpha.types.OSPolicy.Resource.RepositoryResource.AptRepository): An Apt Repository. + This field is a member of `oneof`_ ``repository``. yum (google.cloud.osconfig_v1alpha.types.OSPolicy.Resource.RepositoryResource.YumRepository): A Yum Repository. + This field is a member of `oneof`_ ``repository``. zypper (google.cloud.osconfig_v1alpha.types.OSPolicy.Resource.RepositoryResource.ZypperRepository): A Zypper Repository. + This field is a member of `oneof`_ ``repository``. goo (google.cloud.osconfig_v1alpha.types.OSPolicy.Resource.RepositoryResource.GooRepository): A Goo Repository. + This field is a member of `oneof`_ ``repository``. """ class AptRepository(proto.Message): @@ -561,13 +607,22 @@ class ExecResource(proto.Message): class Exec(proto.Message): r"""A file or script to execute. + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + Attributes: file (google.cloud.osconfig_v1alpha.types.OSPolicy.Resource.File): A remote or local file. + This field is a member of `oneof`_ ``source``. script (str): An inline script. The size of the script is limited to 1024 characters. + This field is a member of `oneof`_ ``source``. args (Sequence[str]): Optional arguments to pass to the source during execution. @@ -615,13 +670,22 @@ class Interpreter(proto.Enum): class FileResource(proto.Message): r"""A resource that manages the state of a file. + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + Attributes: file (google.cloud.osconfig_v1alpha.types.OSPolicy.Resource.File): A remote or local source. + This field is a member of `oneof`_ ``source``. content (str): A a file with this content. The size of the content is limited to 1024 characters. + This field is a member of `oneof`_ ``source``. path (str): Required. The absolute path of the file within the VM. diff --git a/google/cloud/osconfig_v1alpha/types/osconfig_common.py b/google/cloud/osconfig_v1alpha/types/osconfig_common.py index 22d3005..30ebe04 100644 --- a/google/cloud/osconfig_v1alpha/types/osconfig_common.py +++ b/google/cloud/osconfig_v1alpha/types/osconfig_common.py @@ -25,13 +25,22 @@ class FixedOrPercent(proto.Message): r"""Message encapsulating a value that can be either absolute ("fixed") or relative ("percent") to a value. + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + Attributes: fixed (int): Specifies a fixed value. + This field is a member of `oneof`_ ``mode``. percent (int): Specifies the relative value defined as a percentage, which will be multiplied by a reference value. + This field is a member of `oneof`_ ``mode``. """ fixed = proto.Field(proto.INT32, number=1, oneof="mode",) diff --git a/setup.py b/setup.py index 36c83c9..b7534cc 100644 --- a/setup.py +++ b/setup.py @@ -34,9 +34,8 @@ # NOTE: Maintainers, please do not require google-api-core>=2.x.x # Until this issue is closed # https://github.com/googleapis/google-cloud-python/issues/10566 - "google-api-core[grpc] >= 1.26.0, <3.0.0dev", + "google-api-core[grpc] >= 1.28.0, <3.0.0dev", "proto-plus >= 1.10.0", - "packaging >= 14.3", ] extras = {} diff --git a/testing/constraints-3.6.txt b/testing/constraints-3.6.txt index 3ba086c..da8c573 100644 --- a/testing/constraints-3.6.txt +++ b/testing/constraints-3.6.txt @@ -5,6 +5,5 @@ # # 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.26.0 +google-api-core==1.28.0 proto-plus==1.10.0 -packaging==14.3 diff --git a/tests/unit/gapic/osconfig_v1/test_os_config_service.py b/tests/unit/gapic/osconfig_v1/test_os_config_service.py index 8e370a3..808a543 100644 --- a/tests/unit/gapic/osconfig_v1/test_os_config_service.py +++ b/tests/unit/gapic/osconfig_v1/test_os_config_service.py @@ -15,7 +15,6 @@ # import os import mock -import packaging.version import grpc from grpc.experimental import aio @@ -38,9 +37,6 @@ from google.cloud.osconfig_v1.services.os_config_service import OsConfigServiceClient from google.cloud.osconfig_v1.services.os_config_service import pagers from google.cloud.osconfig_v1.services.os_config_service import transports -from google.cloud.osconfig_v1.services.os_config_service.transports.base import ( - _GOOGLE_AUTH_VERSION, -) from google.cloud.osconfig_v1.types import osconfig_common from google.cloud.osconfig_v1.types import patch_deployments from google.cloud.osconfig_v1.types import patch_jobs @@ -53,20 +49,6 @@ import google.auth -# TODO(busunkim): Once google-auth >= 1.25.0 is required transitively -# through google-api-core: -# - Delete the auth "less than" test cases -# - Delete these pytest markers (Make the "greater than or equal to" tests the default). -requires_google_auth_lt_1_25_0 = pytest.mark.skipif( - packaging.version.parse(_GOOGLE_AUTH_VERSION) >= packaging.version.parse("1.25.0"), - reason="This test requires google-auth < 1.25.0", -) -requires_google_auth_gte_1_25_0 = pytest.mark.skipif( - packaging.version.parse(_GOOGLE_AUTH_VERSION) < packaging.version.parse("1.25.0"), - reason="This test requires google-auth >= 1.25.0", -) - - def client_cert_source_callback(): return b"cert bytes", b"key bytes" @@ -223,7 +205,7 @@ def test_os_config_service_client_client_options( options = client_options.ClientOptions(api_endpoint="squid.clam.whelk") with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(client_options=options) + client = client_class(transport=transport_name, client_options=options) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -240,7 +222,7 @@ def test_os_config_service_client_client_options( with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class() + client = client_class(transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -257,7 +239,7 @@ def test_os_config_service_client_client_options( with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class() + client = client_class(transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -286,7 +268,7 @@ def test_os_config_service_client_client_options( options = client_options.ClientOptions(quota_project_id="octopus") with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(client_options=options) + client = client_class(transport=transport_name, client_options=options) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -355,7 +337,7 @@ def test_os_config_service_client_mtls_env_auto( ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(client_options=options) + client = client_class(transport=transport_name, client_options=options) if use_client_cert_env == "false": expected_client_cert_source = None @@ -397,7 +379,7 @@ def test_os_config_service_client_mtls_env_auto( expected_client_cert_source = client_cert_source_callback patched.return_value = None - client = client_class() + client = client_class(transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -419,7 +401,7 @@ def test_os_config_service_client_mtls_env_auto( return_value=False, ): patched.return_value = None - client = client_class() + client = client_class(transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -450,7 +432,7 @@ def test_os_config_service_client_client_options_scopes( options = client_options.ClientOptions(scopes=["1", "2"],) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(client_options=options) + client = client_class(transport=transport_name, client_options=options) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -481,7 +463,7 @@ def test_os_config_service_client_client_options_credentials_file( options = client_options.ClientOptions(credentials_file="credentials.json") with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(client_options=options) + client = client_class(transport=transport_name, client_options=options) patched.assert_called_once_with( credentials=None, credentials_file="credentials.json", @@ -3020,7 +3002,6 @@ def test_os_config_service_base_transport(): transport.close() -@requires_google_auth_gte_1_25_0 def test_os_config_service_base_transport_with_credentials_file(): # Instantiate the base transport with a credentials file with mock.patch.object( @@ -3041,26 +3022,6 @@ def test_os_config_service_base_transport_with_credentials_file(): ) -@requires_google_auth_lt_1_25_0 -def test_os_config_service_base_transport_with_credentials_file_old_google_auth(): - # Instantiate the base transport with a credentials file - with mock.patch.object( - google.auth, "load_credentials_from_file", autospec=True - ) as load_creds, mock.patch( - "google.cloud.osconfig_v1.services.os_config_service.transports.OsConfigServiceTransport._prep_wrapped_messages" - ) as Transport: - Transport.return_value = None - load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) - transport = transports.OsConfigServiceTransport( - credentials_file="credentials.json", quota_project_id="octopus", - ) - load_creds.assert_called_once_with( - "credentials.json", - scopes=("https://www.googleapis.com/auth/cloud-platform",), - quota_project_id="octopus", - ) - - def test_os_config_service_base_transport_with_adc(): # Test the default credentials are used if credentials and credentials_file are None. with mock.patch.object(google.auth, "default", autospec=True) as adc, mock.patch( @@ -3072,7 +3033,6 @@ def test_os_config_service_base_transport_with_adc(): adc.assert_called_once() -@requires_google_auth_gte_1_25_0 def test_os_config_service_auth_adc(): # If no credentials are provided, we should use ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: @@ -3085,18 +3045,6 @@ def test_os_config_service_auth_adc(): ) -@requires_google_auth_lt_1_25_0 -def test_os_config_service_auth_adc_old_google_auth(): - # If no credentials are provided, we should use ADC credentials. - with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (ga_credentials.AnonymousCredentials(), None) - OsConfigServiceClient() - adc.assert_called_once_with( - scopes=("https://www.googleapis.com/auth/cloud-platform",), - quota_project_id=None, - ) - - @pytest.mark.parametrize( "transport_class", [ @@ -3104,7 +3052,6 @@ def test_os_config_service_auth_adc_old_google_auth(): transports.OsConfigServiceGrpcAsyncIOTransport, ], ) -@requires_google_auth_gte_1_25_0 def test_os_config_service_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use # ADC credentials. @@ -3118,26 +3065,6 @@ def test_os_config_service_transport_auth_adc(transport_class): ) -@pytest.mark.parametrize( - "transport_class", - [ - transports.OsConfigServiceGrpcTransport, - transports.OsConfigServiceGrpcAsyncIOTransport, - ], -) -@requires_google_auth_lt_1_25_0 -def test_os_config_service_transport_auth_adc_old_google_auth(transport_class): - # If credentials and host are not provided, the transport class should use - # ADC credentials. - with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (ga_credentials.AnonymousCredentials(), None) - transport_class(quota_project_id="octopus") - adc.assert_called_once_with( - scopes=("https://www.googleapis.com/auth/cloud-platform",), - quota_project_id="octopus", - ) - - @pytest.mark.parametrize( "transport_class,grpc_helpers", [ diff --git a/tests/unit/gapic/osconfig_v1/test_os_config_zonal_service.py b/tests/unit/gapic/osconfig_v1/test_os_config_zonal_service.py index 0ec8bbe..a7c2157 100644 --- a/tests/unit/gapic/osconfig_v1/test_os_config_zonal_service.py +++ b/tests/unit/gapic/osconfig_v1/test_os_config_zonal_service.py @@ -15,7 +15,6 @@ # import os import mock -import packaging.version import grpc from grpc.experimental import aio @@ -40,9 +39,6 @@ ) from google.cloud.osconfig_v1.services.os_config_zonal_service import pagers from google.cloud.osconfig_v1.services.os_config_zonal_service import transports -from google.cloud.osconfig_v1.services.os_config_zonal_service.transports.base import ( - _GOOGLE_AUTH_VERSION, -) from google.cloud.osconfig_v1.types import inventory from google.cloud.osconfig_v1.types import vulnerability from google.oauth2 import service_account @@ -50,20 +46,6 @@ import google.auth -# TODO(busunkim): Once google-auth >= 1.25.0 is required transitively -# through google-api-core: -# - Delete the auth "less than" test cases -# - Delete these pytest markers (Make the "greater than or equal to" tests the default). -requires_google_auth_lt_1_25_0 = pytest.mark.skipif( - packaging.version.parse(_GOOGLE_AUTH_VERSION) >= packaging.version.parse("1.25.0"), - reason="This test requires google-auth < 1.25.0", -) -requires_google_auth_gte_1_25_0 = pytest.mark.skipif( - packaging.version.parse(_GOOGLE_AUTH_VERSION) < packaging.version.parse("1.25.0"), - reason="This test requires google-auth >= 1.25.0", -) - - def client_cert_source_callback(): return b"cert bytes", b"key bytes" @@ -225,7 +207,7 @@ def test_os_config_zonal_service_client_client_options( options = client_options.ClientOptions(api_endpoint="squid.clam.whelk") with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(client_options=options) + client = client_class(transport=transport_name, client_options=options) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -242,7 +224,7 @@ def test_os_config_zonal_service_client_client_options( with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class() + client = client_class(transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -259,7 +241,7 @@ def test_os_config_zonal_service_client_client_options( with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class() + client = client_class(transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -288,7 +270,7 @@ def test_os_config_zonal_service_client_client_options( options = client_options.ClientOptions(quota_project_id="octopus") with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(client_options=options) + client = client_class(transport=transport_name, client_options=options) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -357,7 +339,7 @@ def test_os_config_zonal_service_client_mtls_env_auto( ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(client_options=options) + client = client_class(transport=transport_name, client_options=options) if use_client_cert_env == "false": expected_client_cert_source = None @@ -399,7 +381,7 @@ def test_os_config_zonal_service_client_mtls_env_auto( expected_client_cert_source = client_cert_source_callback patched.return_value = None - client = client_class() + client = client_class(transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -421,7 +403,7 @@ def test_os_config_zonal_service_client_mtls_env_auto( return_value=False, ): patched.return_value = None - client = client_class() + client = client_class(transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -456,7 +438,7 @@ def test_os_config_zonal_service_client_client_options_scopes( options = client_options.ClientOptions(scopes=["1", "2"],) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(client_options=options) + client = client_class(transport=transport_name, client_options=options) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -491,7 +473,7 @@ def test_os_config_zonal_service_client_client_options_credentials_file( options = client_options.ClientOptions(credentials_file="credentials.json") with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(client_options=options) + client = client_class(transport=transport_name, client_options=options) patched.assert_called_once_with( credentials=None, credentials_file="credentials.json", @@ -1824,7 +1806,6 @@ def test_os_config_zonal_service_base_transport(): transport.close() -@requires_google_auth_gte_1_25_0 def test_os_config_zonal_service_base_transport_with_credentials_file(): # Instantiate the base transport with a credentials file with mock.patch.object( @@ -1845,26 +1826,6 @@ def test_os_config_zonal_service_base_transport_with_credentials_file(): ) -@requires_google_auth_lt_1_25_0 -def test_os_config_zonal_service_base_transport_with_credentials_file_old_google_auth(): - # Instantiate the base transport with a credentials file - with mock.patch.object( - google.auth, "load_credentials_from_file", autospec=True - ) as load_creds, mock.patch( - "google.cloud.osconfig_v1.services.os_config_zonal_service.transports.OsConfigZonalServiceTransport._prep_wrapped_messages" - ) as Transport: - Transport.return_value = None - load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) - transport = transports.OsConfigZonalServiceTransport( - credentials_file="credentials.json", quota_project_id="octopus", - ) - load_creds.assert_called_once_with( - "credentials.json", - scopes=("https://www.googleapis.com/auth/cloud-platform",), - quota_project_id="octopus", - ) - - def test_os_config_zonal_service_base_transport_with_adc(): # Test the default credentials are used if credentials and credentials_file are None. with mock.patch.object(google.auth, "default", autospec=True) as adc, mock.patch( @@ -1876,7 +1837,6 @@ def test_os_config_zonal_service_base_transport_with_adc(): adc.assert_called_once() -@requires_google_auth_gte_1_25_0 def test_os_config_zonal_service_auth_adc(): # If no credentials are provided, we should use ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: @@ -1889,18 +1849,6 @@ def test_os_config_zonal_service_auth_adc(): ) -@requires_google_auth_lt_1_25_0 -def test_os_config_zonal_service_auth_adc_old_google_auth(): - # If no credentials are provided, we should use ADC credentials. - with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (ga_credentials.AnonymousCredentials(), None) - OsConfigZonalServiceClient() - adc.assert_called_once_with( - scopes=("https://www.googleapis.com/auth/cloud-platform",), - quota_project_id=None, - ) - - @pytest.mark.parametrize( "transport_class", [ @@ -1908,7 +1856,6 @@ def test_os_config_zonal_service_auth_adc_old_google_auth(): transports.OsConfigZonalServiceGrpcAsyncIOTransport, ], ) -@requires_google_auth_gte_1_25_0 def test_os_config_zonal_service_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use # ADC credentials. @@ -1922,26 +1869,6 @@ def test_os_config_zonal_service_transport_auth_adc(transport_class): ) -@pytest.mark.parametrize( - "transport_class", - [ - transports.OsConfigZonalServiceGrpcTransport, - transports.OsConfigZonalServiceGrpcAsyncIOTransport, - ], -) -@requires_google_auth_lt_1_25_0 -def test_os_config_zonal_service_transport_auth_adc_old_google_auth(transport_class): - # If credentials and host are not provided, the transport class should use - # ADC credentials. - with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (ga_credentials.AnonymousCredentials(), None) - transport_class(quota_project_id="octopus") - adc.assert_called_once_with( - scopes=("https://www.googleapis.com/auth/cloud-platform",), - quota_project_id="octopus", - ) - - @pytest.mark.parametrize( "transport_class,grpc_helpers", [ diff --git a/tests/unit/gapic/osconfig_v1alpha/test_os_config_zonal_service.py b/tests/unit/gapic/osconfig_v1alpha/test_os_config_zonal_service.py index b1070e7..00527a8 100644 --- a/tests/unit/gapic/osconfig_v1alpha/test_os_config_zonal_service.py +++ b/tests/unit/gapic/osconfig_v1alpha/test_os_config_zonal_service.py @@ -15,7 +15,6 @@ # import os import mock -import packaging.version import grpc from grpc.experimental import aio @@ -43,9 +42,6 @@ ) from google.cloud.osconfig_v1alpha.services.os_config_zonal_service import pagers from google.cloud.osconfig_v1alpha.services.os_config_zonal_service import transports -from google.cloud.osconfig_v1alpha.services.os_config_zonal_service.transports.base import ( - _GOOGLE_AUTH_VERSION, -) from google.cloud.osconfig_v1alpha.types import config_common from google.cloud.osconfig_v1alpha.types import instance_os_policies_compliance from google.cloud.osconfig_v1alpha.types import inventory @@ -61,20 +57,6 @@ import google.auth -# TODO(busunkim): Once google-auth >= 1.25.0 is required transitively -# through google-api-core: -# - Delete the auth "less than" test cases -# - Delete these pytest markers (Make the "greater than or equal to" tests the default). -requires_google_auth_lt_1_25_0 = pytest.mark.skipif( - packaging.version.parse(_GOOGLE_AUTH_VERSION) >= packaging.version.parse("1.25.0"), - reason="This test requires google-auth < 1.25.0", -) -requires_google_auth_gte_1_25_0 = pytest.mark.skipif( - packaging.version.parse(_GOOGLE_AUTH_VERSION) < packaging.version.parse("1.25.0"), - reason="This test requires google-auth >= 1.25.0", -) - - def client_cert_source_callback(): return b"cert bytes", b"key bytes" @@ -236,7 +218,7 @@ def test_os_config_zonal_service_client_client_options( options = client_options.ClientOptions(api_endpoint="squid.clam.whelk") with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(client_options=options) + client = client_class(transport=transport_name, client_options=options) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -253,7 +235,7 @@ def test_os_config_zonal_service_client_client_options( with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class() + client = client_class(transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -270,7 +252,7 @@ def test_os_config_zonal_service_client_client_options( with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class() + client = client_class(transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -299,7 +281,7 @@ def test_os_config_zonal_service_client_client_options( options = client_options.ClientOptions(quota_project_id="octopus") with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(client_options=options) + client = client_class(transport=transport_name, client_options=options) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -368,7 +350,7 @@ def test_os_config_zonal_service_client_mtls_env_auto( ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(client_options=options) + client = client_class(transport=transport_name, client_options=options) if use_client_cert_env == "false": expected_client_cert_source = None @@ -410,7 +392,7 @@ def test_os_config_zonal_service_client_mtls_env_auto( expected_client_cert_source = client_cert_source_callback patched.return_value = None - client = client_class() + client = client_class(transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -432,7 +414,7 @@ def test_os_config_zonal_service_client_mtls_env_auto( return_value=False, ): patched.return_value = None - client = client_class() + client = client_class(transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -467,7 +449,7 @@ def test_os_config_zonal_service_client_client_options_scopes( options = client_options.ClientOptions(scopes=["1", "2"],) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(client_options=options) + client = client_class(transport=transport_name, client_options=options) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -502,7 +484,7 @@ def test_os_config_zonal_service_client_client_options_credentials_file( options = client_options.ClientOptions(credentials_file="credentials.json") with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(client_options=options) + client = client_class(transport=transport_name, client_options=options) patched.assert_called_once_with( credentials=None, credentials_file="credentials.json", @@ -4378,7 +4360,6 @@ def test_os_config_zonal_service_base_transport(): transport.operations_client -@requires_google_auth_gte_1_25_0 def test_os_config_zonal_service_base_transport_with_credentials_file(): # Instantiate the base transport with a credentials file with mock.patch.object( @@ -4399,26 +4380,6 @@ def test_os_config_zonal_service_base_transport_with_credentials_file(): ) -@requires_google_auth_lt_1_25_0 -def test_os_config_zonal_service_base_transport_with_credentials_file_old_google_auth(): - # Instantiate the base transport with a credentials file - with mock.patch.object( - google.auth, "load_credentials_from_file", autospec=True - ) as load_creds, mock.patch( - "google.cloud.osconfig_v1alpha.services.os_config_zonal_service.transports.OsConfigZonalServiceTransport._prep_wrapped_messages" - ) as Transport: - Transport.return_value = None - load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) - transport = transports.OsConfigZonalServiceTransport( - credentials_file="credentials.json", quota_project_id="octopus", - ) - load_creds.assert_called_once_with( - "credentials.json", - scopes=("https://www.googleapis.com/auth/cloud-platform",), - quota_project_id="octopus", - ) - - def test_os_config_zonal_service_base_transport_with_adc(): # Test the default credentials are used if credentials and credentials_file are None. with mock.patch.object(google.auth, "default", autospec=True) as adc, mock.patch( @@ -4430,7 +4391,6 @@ def test_os_config_zonal_service_base_transport_with_adc(): adc.assert_called_once() -@requires_google_auth_gte_1_25_0 def test_os_config_zonal_service_auth_adc(): # If no credentials are provided, we should use ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: @@ -4443,18 +4403,6 @@ def test_os_config_zonal_service_auth_adc(): ) -@requires_google_auth_lt_1_25_0 -def test_os_config_zonal_service_auth_adc_old_google_auth(): - # If no credentials are provided, we should use ADC credentials. - with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (ga_credentials.AnonymousCredentials(), None) - OsConfigZonalServiceClient() - adc.assert_called_once_with( - scopes=("https://www.googleapis.com/auth/cloud-platform",), - quota_project_id=None, - ) - - @pytest.mark.parametrize( "transport_class", [ @@ -4462,7 +4410,6 @@ def test_os_config_zonal_service_auth_adc_old_google_auth(): transports.OsConfigZonalServiceGrpcAsyncIOTransport, ], ) -@requires_google_auth_gte_1_25_0 def test_os_config_zonal_service_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use # ADC credentials. @@ -4476,26 +4423,6 @@ def test_os_config_zonal_service_transport_auth_adc(transport_class): ) -@pytest.mark.parametrize( - "transport_class", - [ - transports.OsConfigZonalServiceGrpcTransport, - transports.OsConfigZonalServiceGrpcAsyncIOTransport, - ], -) -@requires_google_auth_lt_1_25_0 -def test_os_config_zonal_service_transport_auth_adc_old_google_auth(transport_class): - # If credentials and host are not provided, the transport class should use - # ADC credentials. - with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (ga_credentials.AnonymousCredentials(), None) - transport_class(quota_project_id="octopus") - adc.assert_called_once_with( - scopes=("https://www.googleapis.com/auth/cloud-platform",), - quota_project_id="octopus", - ) - - @pytest.mark.parametrize( "transport_class,grpc_helpers", [