From 2df0de1accecdb7c72d054fe53aaf3fe4af5846f Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Mon, 21 Nov 2022 14:04:42 -0500 Subject: [PATCH] chore: Update gapic-generator-python to v1.6.1 (#186) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: update to gapic-generator-python 1.5.0 feat: add support for `google.cloud..__version__` PiperOrigin-RevId: 484665853 Source-Link: https://github.com/googleapis/googleapis/commit/8eb249a19db926c2fbc4ecf1dc09c0e521a88b22 Source-Link: https://github.com/googleapis/googleapis-gen/commit/c8aa327b5f478865fc3fd91e3c2768e54e26ad44 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYzhhYTMyN2I1ZjQ3ODg2NWZjM2ZkOTFlM2MyNzY4ZTU0ZTI2YWQ0NCJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * update version in gapic_version.py * add .release-please-manifest.json with correct version * set manifest to true in .github/release-please.yml * add release-please-config.json * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * chore: Update to gapic-generator-python 1.6.0 feat(python): Add typing to proto.Message based class attributes feat(python): Snippetgen handling of repeated enum field PiperOrigin-RevId: 487326846 Source-Link: https://github.com/googleapis/googleapis/commit/da380c77bb87ba0f752baf07605dd1db30e1f7e1 Source-Link: https://github.com/googleapis/googleapis-gen/commit/61ef5762ee6731a0cbbfea22fd0eecee51ab1c8e Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNjFlZjU3NjJlZTY3MzFhMGNiYmZlYTIyZmQwZWVjZWU1MWFiMWM4ZSJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * feat: new APIs added to reflect updates to the filestore service - Add ENTERPRISE Tier - Add snapshot APIs: RevertInstance, ListSnapshots, CreateSnapshot, DeleteSnapshot, UpdateSnapshot - Add multi-share APIs: ListShares, GetShare, CreateShare, DeleteShare, UpdateShare - Add ConnectMode to NetworkConfig (for Private Service Access support) - New status codes (SUSPENDED/SUSPENDING, REVERTING/RESUMING) - Add SuspensionReason (for KMS related suspension) - Add new fields to Instance information: max_capacity_gb, capacity_step_size_gb, max_share_count, capacity_gb, multi_share_enabled PiperOrigin-RevId: 487492758 Source-Link: https://github.com/googleapis/googleapis/commit/5be5981f50322cf0c7388595e0f31ac5d0693469 Source-Link: https://github.com/googleapis/googleapis-gen/commit/ab0e217f560cc2c1afc11441c2eab6b6950efd2b Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYWIwZTIxN2Y1NjBjYzJjMWFmYzExNDQxYzJlYWI2YjY5NTBlZmQyYiJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * update path to snippet metadata json * chore: Update gapic-generator-python to v1.6.1 PiperOrigin-RevId: 488036204 Source-Link: https://github.com/googleapis/googleapis/commit/08f275f5c1c0d99056e1cb68376323414459ee19 Source-Link: https://github.com/googleapis/googleapis-gen/commit/555c0945e60649e38739ae64bc45719cdf72178f Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNTU1YzA5NDVlNjA2NDllMzg3MzlhZTY0YmM0NTcxOWNkZjcyMTc4ZiJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * use templated owlbot.py * use templated setup.py * run nox format session * update replacement in owlbot.py Co-authored-by: Owl Bot Co-authored-by: Anthonios Partheniou --- .github/release-please.yml | 1 + .release-please-manifest.json | 3 + docs/binaryauthorization_v1/types.rst | 1 - docs/binaryauthorization_v1beta1/types.rst | 1 - docs/conf.py | 2 +- docs/index.rst | 8 +- google/cloud/binaryauthorization/__init__.py | 51 ++++++----- .../binaryauthorization/gapic_version.py | 16 ++++ .../cloud/binaryauthorization_v1/__init__.py | 56 +++++++----- .../__init__.py | 2 +- .../async_client.py | 91 +++++++++++-------- .../binauthz_management_service_v1/client.py | 81 ++++++++++------- .../binauthz_management_service_v1/pagers.py | 7 +- .../transports/__init__.py | 1 - .../transports/base.py | 11 +-- .../transports/grpc.py | 34 ++++--- .../transports/grpc_asyncio.py | 30 +++--- .../services/system_policy_v1/__init__.py | 2 +- .../services/system_policy_v1/async_client.py | 37 +++++--- .../services/system_policy_v1/client.py | 39 +++++--- .../system_policy_v1/transports/__init__.py | 1 - .../system_policy_v1/transports/base.py | 9 +- .../system_policy_v1/transports/grpc.py | 32 +++---- .../transports/grpc_asyncio.py | 28 +++--- .../services/validation_helper_v1/__init__.py | 2 +- .../validation_helper_v1/async_client.py | 33 +++++-- .../services/validation_helper_v1/client.py | 35 +++++-- .../transports/__init__.py | 1 - .../validation_helper_v1/transports/base.py | 6 +- .../validation_helper_v1/transports/grpc.py | 29 +++--- .../transports/grpc_asyncio.py | 25 +++-- .../binaryauthorization_v1/types/resources.py | 80 ++++++++-------- .../binaryauthorization_v1/types/service.py | 51 ++++++----- .../binaryauthorization_v1beta1/__init__.py | 49 +++++----- .../__init__.py | 2 +- .../async_client.py | 91 +++++++++++-------- .../client.py | 83 ++++++++++------- .../pagers.py | 7 +- .../transports/__init__.py | 1 - .../transports/base.py | 11 +-- .../transports/grpc.py | 34 ++++--- .../transports/grpc_asyncio.py | 30 +++--- .../system_policy_v1_beta1/__init__.py | 2 +- .../system_policy_v1_beta1/async_client.py | 37 +++++--- .../services/system_policy_v1_beta1/client.py | 39 +++++--- .../transports/__init__.py | 1 - .../system_policy_v1_beta1/transports/base.py | 9 +- .../system_policy_v1_beta1/transports/grpc.py | 32 +++---- .../transports/grpc_asyncio.py | 28 +++--- .../types/__init__.py | 4 +- .../types/continuous_validation_logging.py | 32 ++++--- .../types/resources.py | 80 ++++++++-------- .../types/service.py | 33 +++---- noxfile.py | 1 + owlbot.py | 56 ++++++++---- release-please-config.json | 28 ++++++ ..._google.cloud.binaryauthorization.v1.json} | 3 +- ...le.cloud.binaryauthorization.v1beta1.json} | 3 +- setup.py | 74 ++++++++++----- testing/constraints-3.10.txt | 6 ++ testing/constraints-3.11.txt | 6 ++ testing/constraints-3.7.txt | 3 +- testing/constraints-3.8.txt | 8 +- testing/constraints-3.9.txt | 8 +- .../test_binauthz_management_service_v1.py | 31 +++---- .../test_system_policy_v1.py | 29 +++--- .../test_validation_helper_v1.py | 28 +++--- ...st_binauthz_management_service_v1_beta1.py | 31 +++---- .../test_system_policy_v1_beta1.py | 29 +++--- 69 files changed, 984 insertions(+), 771 deletions(-) create mode 100644 .release-please-manifest.json create mode 100644 google/cloud/binaryauthorization/gapic_version.py create mode 100644 release-please-config.json rename samples/generated_samples/{snippet_metadata_binaryauthorization_v1.json => snippet_metadata_google.cloud.binaryauthorization.v1.json} (99%) rename samples/generated_samples/{snippet_metadata_binaryauthorization_v1beta1.json => snippet_metadata_google.cloud.binaryauthorization.v1beta1.json} (99%) diff --git a/.github/release-please.yml b/.github/release-please.yml index 6def37a..e9a4f00 100644 --- a/.github/release-please.yml +++ b/.github/release-please.yml @@ -1,5 +1,6 @@ releaseType: python handleGHRelease: true +manifest: true # NOTE: this section is generated by synthtool.languages.python # See https://github.com/googleapis/synthtool/blob/master/synthtool/languages/python.py branches: diff --git a/.release-please-manifest.json b/.release-please-manifest.json new file mode 100644 index 0000000..b3e3395 --- /dev/null +++ b/.release-please-manifest.json @@ -0,0 +1,3 @@ +{ + ".": "1.3.3" +} diff --git a/docs/binaryauthorization_v1/types.rst b/docs/binaryauthorization_v1/types.rst index f693b22..31fd1da 100644 --- a/docs/binaryauthorization_v1/types.rst +++ b/docs/binaryauthorization_v1/types.rst @@ -3,5 +3,4 @@ Types for Google Cloud Binaryauthorization v1 API .. automodule:: google.cloud.binaryauthorization_v1.types :members: - :undoc-members: :show-inheritance: diff --git a/docs/binaryauthorization_v1beta1/types.rst b/docs/binaryauthorization_v1beta1/types.rst index aa0d435..3b8ecee 100644 --- a/docs/binaryauthorization_v1beta1/types.rst +++ b/docs/binaryauthorization_v1beta1/types.rst @@ -3,5 +3,4 @@ Types for Google Cloud Binaryauthorization v1beta1 API .. automodule:: google.cloud.binaryauthorization_v1beta1.types :members: - :undoc-members: :show-inheritance: diff --git a/docs/conf.py b/docs/conf.py index 3551c21..f3875f9 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -24,9 +24,9 @@ # All configuration values have a default; values that are commented out # serve to show the default. -import sys import os import shlex +import sys # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the diff --git a/docs/index.rst b/docs/index.rst index d55ac54..a05d77b 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -3,7 +3,8 @@ .. include:: multiprocessing.rst This package includes clients for multiple versions of Binary Authorization. -By default, you will get version ``v1``. +By default, you will get version ``binaryauthorization_v1``. + API Reference ------------- @@ -21,12 +22,13 @@ API Reference binaryauthorization_v1beta1/services binaryauthorization_v1beta1/types + Changelog --------- For a list of all ``google-cloud-binary-authorization`` releases: .. toctree:: - :maxdepth: 2 + :maxdepth: 2 - changelog \ No newline at end of file + changelog diff --git a/google/cloud/binaryauthorization/__init__.py b/google/cloud/binaryauthorization/__init__.py index daddba4..52abbc0 100644 --- a/google/cloud/binaryauthorization/__init__.py +++ b/google/cloud/binaryauthorization/__init__.py @@ -13,48 +13,49 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from google.cloud.binaryauthorization import gapic_version as package_version + +__version__ = package_version.__version__ + -from google.cloud.binaryauthorization_v1.services.binauthz_management_service_v1.client import ( - BinauthzManagementServiceV1Client, -) from google.cloud.binaryauthorization_v1.services.binauthz_management_service_v1.async_client import ( BinauthzManagementServiceV1AsyncClient, ) -from google.cloud.binaryauthorization_v1.services.system_policy_v1.client import ( - SystemPolicyV1Client, +from google.cloud.binaryauthorization_v1.services.binauthz_management_service_v1.client import ( + BinauthzManagementServiceV1Client, ) from google.cloud.binaryauthorization_v1.services.system_policy_v1.async_client import ( SystemPolicyV1AsyncClient, ) -from google.cloud.binaryauthorization_v1.services.validation_helper_v1.client import ( - ValidationHelperV1Client, +from google.cloud.binaryauthorization_v1.services.system_policy_v1.client import ( + SystemPolicyV1Client, ) from google.cloud.binaryauthorization_v1.services.validation_helper_v1.async_client import ( ValidationHelperV1AsyncClient, ) - -from google.cloud.binaryauthorization_v1.types.resources import AdmissionRule +from google.cloud.binaryauthorization_v1.services.validation_helper_v1.client import ( + ValidationHelperV1Client, +) from google.cloud.binaryauthorization_v1.types.resources import ( + AdmissionRule, AdmissionWhitelistPattern, + Attestor, + AttestorPublicKey, + PkixPublicKey, + Policy, + UserOwnedGrafeasNote, ) -from google.cloud.binaryauthorization_v1.types.resources import Attestor -from google.cloud.binaryauthorization_v1.types.resources import AttestorPublicKey -from google.cloud.binaryauthorization_v1.types.resources import PkixPublicKey -from google.cloud.binaryauthorization_v1.types.resources import Policy -from google.cloud.binaryauthorization_v1.types.resources import UserOwnedGrafeasNote -from google.cloud.binaryauthorization_v1.types.service import CreateAttestorRequest -from google.cloud.binaryauthorization_v1.types.service import DeleteAttestorRequest -from google.cloud.binaryauthorization_v1.types.service import GetAttestorRequest -from google.cloud.binaryauthorization_v1.types.service import GetPolicyRequest -from google.cloud.binaryauthorization_v1.types.service import GetSystemPolicyRequest -from google.cloud.binaryauthorization_v1.types.service import ListAttestorsRequest -from google.cloud.binaryauthorization_v1.types.service import ListAttestorsResponse -from google.cloud.binaryauthorization_v1.types.service import UpdateAttestorRequest -from google.cloud.binaryauthorization_v1.types.service import UpdatePolicyRequest from google.cloud.binaryauthorization_v1.types.service import ( + CreateAttestorRequest, + DeleteAttestorRequest, + GetAttestorRequest, + GetPolicyRequest, + GetSystemPolicyRequest, + ListAttestorsRequest, + ListAttestorsResponse, + UpdateAttestorRequest, + UpdatePolicyRequest, ValidateAttestationOccurrenceRequest, -) -from google.cloud.binaryauthorization_v1.types.service import ( ValidateAttestationOccurrenceResponse, ) diff --git a/google/cloud/binaryauthorization/gapic_version.py b/google/cloud/binaryauthorization/gapic_version.py new file mode 100644 index 0000000..e370372 --- /dev/null +++ b/google/cloud/binaryauthorization/gapic_version.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +__version__ = "1.3.3" # {x-release-please-version} diff --git a/google/cloud/binaryauthorization_v1/__init__.py b/google/cloud/binaryauthorization_v1/__init__.py index feb79fb..a4b47c1 100644 --- a/google/cloud/binaryauthorization_v1/__init__.py +++ b/google/cloud/binaryauthorization_v1/__init__.py @@ -13,34 +13,42 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from google.cloud.binaryauthorization import gapic_version as package_version + +__version__ = package_version.__version__ + -from .services.binauthz_management_service_v1 import BinauthzManagementServiceV1Client from .services.binauthz_management_service_v1 import ( BinauthzManagementServiceV1AsyncClient, + BinauthzManagementServiceV1Client, +) +from .services.system_policy_v1 import SystemPolicyV1AsyncClient, SystemPolicyV1Client +from .services.validation_helper_v1 import ( + ValidationHelperV1AsyncClient, + ValidationHelperV1Client, +) +from .types.resources import ( + AdmissionRule, + AdmissionWhitelistPattern, + Attestor, + AttestorPublicKey, + PkixPublicKey, + Policy, + UserOwnedGrafeasNote, +) +from .types.service import ( + CreateAttestorRequest, + DeleteAttestorRequest, + GetAttestorRequest, + GetPolicyRequest, + GetSystemPolicyRequest, + ListAttestorsRequest, + ListAttestorsResponse, + UpdateAttestorRequest, + UpdatePolicyRequest, + ValidateAttestationOccurrenceRequest, + ValidateAttestationOccurrenceResponse, ) -from .services.system_policy_v1 import SystemPolicyV1Client -from .services.system_policy_v1 import SystemPolicyV1AsyncClient -from .services.validation_helper_v1 import ValidationHelperV1Client -from .services.validation_helper_v1 import ValidationHelperV1AsyncClient - -from .types.resources import AdmissionRule -from .types.resources import AdmissionWhitelistPattern -from .types.resources import Attestor -from .types.resources import AttestorPublicKey -from .types.resources import PkixPublicKey -from .types.resources import Policy -from .types.resources import UserOwnedGrafeasNote -from .types.service import CreateAttestorRequest -from .types.service import DeleteAttestorRequest -from .types.service import GetAttestorRequest -from .types.service import GetPolicyRequest -from .types.service import GetSystemPolicyRequest -from .types.service import ListAttestorsRequest -from .types.service import ListAttestorsResponse -from .types.service import UpdateAttestorRequest -from .types.service import UpdatePolicyRequest -from .types.service import ValidateAttestationOccurrenceRequest -from .types.service import ValidateAttestationOccurrenceResponse __all__ = ( "BinauthzManagementServiceV1AsyncClient", diff --git a/google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/__init__.py b/google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/__init__.py index cb4f207..098c3c4 100644 --- a/google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/__init__.py +++ b/google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/__init__.py @@ -13,8 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # -from .client import BinauthzManagementServiceV1Client from .async_client import BinauthzManagementServiceV1AsyncClient +from .client import BinauthzManagementServiceV1Client __all__ = ( "BinauthzManagementServiceV1Client", diff --git a/google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/async_client.py b/google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/async_client.py index ad73716..9f9e820 100644 --- a/google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/async_client.py +++ b/google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/async_client.py @@ -16,30 +16,41 @@ from collections import OrderedDict import functools import re -from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union -import pkg_resources +from typing import ( + Dict, + Mapping, + MutableMapping, + MutableSequence, + Optional, + Sequence, + Tuple, + Type, + Union, +) -from google.api_core.client_options import ClientOptions from google.api_core import exceptions as core_exceptions from google.api_core import gapic_v1 from google.api_core import retry as retries +from google.api_core.client_options import ClientOptions from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore +import pkg_resources try: OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] except AttributeError: # pragma: NO COVER OptionalRetry = Union[retries.Retry, object] # type: ignore +from google.protobuf import timestamp_pb2 # type: ignore + from google.cloud.binaryauthorization_v1.services.binauthz_management_service_v1 import ( pagers, ) -from google.cloud.binaryauthorization_v1.types import resources -from google.cloud.binaryauthorization_v1.types import service -from google.protobuf import timestamp_pb2 # type: ignore -from .transports.base import BinauthzManagementServiceV1Transport, DEFAULT_CLIENT_INFO -from .transports.grpc_asyncio import BinauthzManagementServiceV1GrpcAsyncIOTransport +from google.cloud.binaryauthorization_v1.types import resources, service + from .client import BinauthzManagementServiceV1Client +from .transports.base import DEFAULT_CLIENT_INFO, BinauthzManagementServiceV1Transport +from .transports.grpc_asyncio import BinauthzManagementServiceV1GrpcAsyncIOTransport class BinauthzManagementServiceV1AsyncClient: @@ -182,9 +193,9 @@ def transport(self) -> BinauthzManagementServiceV1Transport: def __init__( self, *, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, transport: Union[str, BinauthzManagementServiceV1Transport] = "grpc_asyncio", - client_options: ClientOptions = None, + client_options: Optional[ClientOptions] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiates the binauthz management service v1 client. @@ -228,11 +239,11 @@ def __init__( async def get_policy( self, - request: Union[service.GetPolicyRequest, dict] = None, + request: Optional[Union[service.GetPolicyRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> resources.Policy: r"""A [policy][google.cloud.binaryauthorization.v1.Policy] specifies @@ -274,7 +285,7 @@ async def sample_get_policy(): print(response) Args: - request (Union[google.cloud.binaryauthorization_v1.types.GetPolicyRequest, dict]): + request (Optional[Union[google.cloud.binaryauthorization_v1.types.GetPolicyRequest, dict]]): The request object. Request message for [BinauthzManagementService.GetPolicy][]. name (:class:`str`): @@ -351,11 +362,11 @@ async def sample_get_policy(): async def update_policy( self, - request: Union[service.UpdatePolicyRequest, dict] = None, + request: Optional[Union[service.UpdatePolicyRequest, dict]] = None, *, - policy: resources.Policy = None, + policy: Optional[resources.Policy] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> resources.Policy: r"""Creates or updates a project's @@ -398,7 +409,7 @@ async def sample_update_policy(): print(response) Args: - request (Union[google.cloud.binaryauthorization_v1.types.UpdatePolicyRequest, dict]): + request (Optional[Union[google.cloud.binaryauthorization_v1.types.UpdatePolicyRequest, dict]]): The request object. Request message for [BinauthzManagementService.UpdatePolicy][]. policy (:class:`google.cloud.binaryauthorization_v1.types.Policy`): @@ -480,13 +491,13 @@ async def sample_update_policy(): async def create_attestor( self, - request: Union[service.CreateAttestorRequest, dict] = None, + request: Optional[Union[service.CreateAttestorRequest, dict]] = None, *, - parent: str = None, - attestor_id: str = None, - attestor: resources.Attestor = None, + parent: Optional[str] = None, + attestor_id: Optional[str] = None, + attestor: Optional[resources.Attestor] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> resources.Attestor: r"""Creates an @@ -531,7 +542,7 @@ async def sample_create_attestor(): print(response) Args: - request (Union[google.cloud.binaryauthorization_v1.types.CreateAttestorRequest, dict]): + request (Optional[Union[google.cloud.binaryauthorization_v1.types.CreateAttestorRequest, dict]]): The request object. Request message for [BinauthzManagementService.CreateAttestor][]. parent (:class:`str`): @@ -621,11 +632,11 @@ async def sample_create_attestor(): async def get_attestor( self, - request: Union[service.GetAttestorRequest, dict] = None, + request: Optional[Union[service.GetAttestorRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> resources.Attestor: r"""Gets an @@ -661,7 +672,7 @@ async def sample_get_attestor(): print(response) Args: - request (Union[google.cloud.binaryauthorization_v1.types.GetAttestorRequest, dict]): + request (Optional[Union[google.cloud.binaryauthorization_v1.types.GetAttestorRequest, dict]]): The request object. Request message for [BinauthzManagementService.GetAttestor][]. name (:class:`str`): @@ -739,11 +750,11 @@ async def sample_get_attestor(): async def update_attestor( self, - request: Union[service.UpdateAttestorRequest, dict] = None, + request: Optional[Union[service.UpdateAttestorRequest, dict]] = None, *, - attestor: resources.Attestor = None, + attestor: Optional[resources.Attestor] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> resources.Attestor: r"""Updates an @@ -783,7 +794,7 @@ async def sample_update_attestor(): print(response) Args: - request (Union[google.cloud.binaryauthorization_v1.types.UpdateAttestorRequest, dict]): + request (Optional[Union[google.cloud.binaryauthorization_v1.types.UpdateAttestorRequest, dict]]): The request object. Request message for [BinauthzManagementService.UpdateAttestor][]. attestor (:class:`google.cloud.binaryauthorization_v1.types.Attestor`): @@ -866,11 +877,11 @@ async def sample_update_attestor(): async def list_attestors( self, - request: Union[service.ListAttestorsRequest, dict] = None, + request: Optional[Union[service.ListAttestorsRequest, dict]] = None, *, - parent: str = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListAttestorsAsyncPager: r"""Lists [attestors][google.cloud.binaryauthorization.v1.Attestor]. @@ -904,7 +915,7 @@ async def sample_list_attestors(): print(response) Args: - request (Union[google.cloud.binaryauthorization_v1.types.ListAttestorsRequest, dict]): + request (Optional[Union[google.cloud.binaryauthorization_v1.types.ListAttestorsRequest, dict]]): The request object. Request message for [BinauthzManagementService.ListAttestors][]. parent (:class:`str`): @@ -994,11 +1005,11 @@ async def sample_list_attestors(): async def delete_attestor( self, - request: Union[service.DeleteAttestorRequest, dict] = None, + request: Optional[Union[service.DeleteAttestorRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Deletes an @@ -1031,7 +1042,7 @@ async def sample_delete_attestor(): await client.delete_attestor(request=request) Args: - request (Union[google.cloud.binaryauthorization_v1.types.DeleteAttestorRequest, dict]): + request (Optional[Union[google.cloud.binaryauthorization_v1.types.DeleteAttestorRequest, dict]]): The request object. Request message for [BinauthzManagementService.DeleteAttestor][]. name (:class:`str`): diff --git a/google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/client.py b/google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/client.py index b3a9fc5..c88c0b0 100644 --- a/google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/client.py +++ b/google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/client.py @@ -16,31 +16,43 @@ from collections import OrderedDict import os import re -from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union -import pkg_resources +from typing import ( + Dict, + Mapping, + MutableMapping, + MutableSequence, + Optional, + Sequence, + Tuple, + Type, + Union, + cast, +) from google.api_core import client_options as client_options_lib from google.api_core import exceptions as core_exceptions from google.api_core import gapic_v1 from google.api_core import retry as retries from google.auth import credentials as ga_credentials # type: ignore +from google.auth.exceptions import MutualTLSChannelError # type: ignore from google.auth.transport import mtls # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore from google.oauth2 import service_account # type: ignore +import pkg_resources try: OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] except AttributeError: # pragma: NO COVER OptionalRetry = Union[retries.Retry, object] # type: ignore +from google.protobuf import timestamp_pb2 # type: ignore + from google.cloud.binaryauthorization_v1.services.binauthz_management_service_v1 import ( pagers, ) -from google.cloud.binaryauthorization_v1.types import resources -from google.cloud.binaryauthorization_v1.types import service -from google.protobuf import timestamp_pb2 # type: ignore -from .transports.base import BinauthzManagementServiceV1Transport, DEFAULT_CLIENT_INFO +from google.cloud.binaryauthorization_v1.types import resources, service + +from .transports.base import DEFAULT_CLIENT_INFO, BinauthzManagementServiceV1Transport from .transports.grpc import BinauthzManagementServiceV1GrpcTransport from .transports.grpc_asyncio import BinauthzManagementServiceV1GrpcAsyncIOTransport @@ -63,7 +75,7 @@ class BinauthzManagementServiceV1ClientMeta(type): def get_transport_class( cls, - label: str = None, + label: Optional[str] = None, ) -> Type[BinauthzManagementServiceV1Transport]: """Returns an appropriate transport class. @@ -357,8 +369,8 @@ def __init__( self, *, credentials: Optional[ga_credentials.Credentials] = None, - transport: Union[str, BinauthzManagementServiceV1Transport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, + transport: Optional[Union[str, BinauthzManagementServiceV1Transport]] = None, + client_options: Optional[Union[client_options_lib.ClientOptions, dict]] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiates the binauthz management service v1 client. @@ -372,7 +384,7 @@ def __init__( transport (Union[str, BinauthzManagementServiceV1Transport]): The transport to use. If set to None, a transport is chosen automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the + client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]): Custom options for the client. It won't take effect if a ``transport`` instance is provided. (1) The ``api_endpoint`` property can be used to override the default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT @@ -402,6 +414,7 @@ def __init__( client_options = client_options_lib.from_dict(client_options) if client_options is None: client_options = client_options_lib.ClientOptions() + client_options = cast(client_options_lib.ClientOptions, client_options) api_endpoint, client_cert_source_func = self.get_mtls_endpoint_and_cert_source( client_options @@ -454,11 +467,11 @@ def __init__( def get_policy( self, - request: Union[service.GetPolicyRequest, dict] = None, + request: Optional[Union[service.GetPolicyRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> resources.Policy: r"""A [policy][google.cloud.binaryauthorization.v1.Policy] specifies @@ -567,11 +580,11 @@ def sample_get_policy(): def update_policy( self, - request: Union[service.UpdatePolicyRequest, dict] = None, + request: Optional[Union[service.UpdatePolicyRequest, dict]] = None, *, - policy: resources.Policy = None, + policy: Optional[resources.Policy] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> resources.Policy: r"""Creates or updates a project's @@ -686,13 +699,13 @@ def sample_update_policy(): def create_attestor( self, - request: Union[service.CreateAttestorRequest, dict] = None, + request: Optional[Union[service.CreateAttestorRequest, dict]] = None, *, - parent: str = None, - attestor_id: str = None, - attestor: resources.Attestor = None, + parent: Optional[str] = None, + attestor_id: Optional[str] = None, + attestor: Optional[resources.Attestor] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> resources.Attestor: r"""Creates an @@ -827,11 +840,11 @@ def sample_create_attestor(): def get_attestor( self, - request: Union[service.GetAttestorRequest, dict] = None, + request: Optional[Union[service.GetAttestorRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> resources.Attestor: r"""Gets an @@ -935,11 +948,11 @@ def sample_get_attestor(): def update_attestor( self, - request: Union[service.UpdateAttestorRequest, dict] = None, + request: Optional[Union[service.UpdateAttestorRequest, dict]] = None, *, - attestor: resources.Attestor = None, + attestor: Optional[resources.Attestor] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> resources.Attestor: r"""Updates an @@ -1052,11 +1065,11 @@ def sample_update_attestor(): def list_attestors( self, - request: Union[service.ListAttestorsRequest, dict] = None, + request: Optional[Union[service.ListAttestorsRequest, dict]] = None, *, - parent: str = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListAttestorsPager: r"""Lists [attestors][google.cloud.binaryauthorization.v1.Attestor]. @@ -1170,11 +1183,11 @@ def sample_list_attestors(): def delete_attestor( self, - request: Union[service.DeleteAttestorRequest, dict] = None, + request: Optional[Union[service.DeleteAttestorRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Deletes an diff --git a/google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/pagers.py b/google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/pagers.py index 8bf9786..b3ea5d9 100644 --- a/google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/pagers.py +++ b/google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/pagers.py @@ -18,14 +18,13 @@ AsyncIterator, Awaitable, Callable, + Iterator, + Optional, Sequence, Tuple, - Optional, - Iterator, ) -from google.cloud.binaryauthorization_v1.types import resources -from google.cloud.binaryauthorization_v1.types import service +from google.cloud.binaryauthorization_v1.types import resources, service class ListAttestorsPager: diff --git a/google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/transports/__init__.py b/google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/transports/__init__.py index f5730ee..4f62838 100644 --- a/google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/transports/__init__.py +++ b/google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/transports/__init__.py @@ -20,7 +20,6 @@ from .grpc import BinauthzManagementServiceV1GrpcTransport from .grpc_asyncio import BinauthzManagementServiceV1GrpcAsyncIOTransport - # Compile a registry of transports. _transport_registry = ( OrderedDict() diff --git a/google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/transports/base.py b/google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/transports/base.py index f17da23..bd2258e 100644 --- a/google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/transports/base.py +++ b/google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/transports/base.py @@ -15,19 +15,18 @@ # import abc from typing import Awaitable, Callable, Dict, Optional, Sequence, Union -import pkg_resources -import google.auth # type: ignore import google.api_core from google.api_core import exceptions as core_exceptions from google.api_core import gapic_v1 from google.api_core import retry as retries +import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore - -from google.cloud.binaryauthorization_v1.types import resources -from google.cloud.binaryauthorization_v1.types import service from google.protobuf import empty_pb2 # type: ignore +import pkg_resources + +from google.cloud.binaryauthorization_v1.types import resources, service try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( @@ -50,7 +49,7 @@ def __init__( self, *, host: str = DEFAULT_HOST, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, diff --git a/google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/transports/grpc.py b/google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/transports/grpc.py index 744a941..baf0fda 100644 --- a/google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/transports/grpc.py +++ b/google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/transports/grpc.py @@ -13,21 +13,19 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union +import warnings -from google.api_core import grpc_helpers -from google.api_core import gapic_v1 +from google.api_core import gapic_v1, grpc_helpers import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore - +from google.protobuf import empty_pb2 # type: ignore import grpc # type: ignore -from google.cloud.binaryauthorization_v1.types import resources -from google.cloud.binaryauthorization_v1.types import service -from google.protobuf import empty_pb2 # type: ignore -from .base import BinauthzManagementServiceV1Transport, DEFAULT_CLIENT_INFO +from google.cloud.binaryauthorization_v1.types import resources, service + +from .base import DEFAULT_CLIENT_INFO, BinauthzManagementServiceV1Transport class BinauthzManagementServiceV1GrpcTransport(BinauthzManagementServiceV1Transport): @@ -55,14 +53,14 @@ def __init__( self, *, host: str = "binaryauthorization.googleapis.com", - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + channel: Optional[grpc.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, @@ -189,8 +187,8 @@ def __init__( def create_channel( cls, host: str = "binaryauthorization.googleapis.com", - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, **kwargs, diff --git a/google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/transports/grpc_asyncio.py b/google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/transports/grpc_asyncio.py index 5f53f03..8e69dde 100644 --- a/google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/transports/grpc_asyncio.py +++ b/google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/transports/grpc_asyncio.py @@ -13,21 +13,19 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union +import warnings -from google.api_core import gapic_v1 -from google.api_core import grpc_helpers_async +from google.api_core import gapic_v1, grpc_helpers_async from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore - +from google.protobuf import empty_pb2 # type: ignore import grpc # type: ignore from grpc.experimental import aio # type: ignore -from google.cloud.binaryauthorization_v1.types import resources -from google.cloud.binaryauthorization_v1.types import service -from google.protobuf import empty_pb2 # type: ignore -from .base import BinauthzManagementServiceV1Transport, DEFAULT_CLIENT_INFO +from google.cloud.binaryauthorization_v1.types import resources, service + +from .base import DEFAULT_CLIENT_INFO, BinauthzManagementServiceV1Transport from .grpc import BinauthzManagementServiceV1GrpcTransport @@ -59,7 +57,7 @@ class BinauthzManagementServiceV1GrpcAsyncIOTransport( def create_channel( cls, host: str = "binaryauthorization.googleapis.com", - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, @@ -102,15 +100,15 @@ def __init__( self, *, host: str = "binaryauthorization.googleapis.com", - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, - channel: aio.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, - quota_project_id=None, + channel: Optional[aio.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, api_audience: Optional[str] = None, diff --git a/google/cloud/binaryauthorization_v1/services/system_policy_v1/__init__.py b/google/cloud/binaryauthorization_v1/services/system_policy_v1/__init__.py index 9d04ee9..baf062f 100644 --- a/google/cloud/binaryauthorization_v1/services/system_policy_v1/__init__.py +++ b/google/cloud/binaryauthorization_v1/services/system_policy_v1/__init__.py @@ -13,8 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # -from .client import SystemPolicyV1Client from .async_client import SystemPolicyV1AsyncClient +from .client import SystemPolicyV1Client __all__ = ( "SystemPolicyV1Client", diff --git a/google/cloud/binaryauthorization_v1/services/system_policy_v1/async_client.py b/google/cloud/binaryauthorization_v1/services/system_policy_v1/async_client.py index eb00372..8229320 100644 --- a/google/cloud/binaryauthorization_v1/services/system_policy_v1/async_client.py +++ b/google/cloud/binaryauthorization_v1/services/system_policy_v1/async_client.py @@ -16,27 +16,38 @@ from collections import OrderedDict import functools import re -from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union -import pkg_resources +from typing import ( + Dict, + Mapping, + MutableMapping, + MutableSequence, + Optional, + Sequence, + Tuple, + Type, + Union, +) -from google.api_core.client_options import ClientOptions from google.api_core import exceptions as core_exceptions from google.api_core import gapic_v1 from google.api_core import retry as retries +from google.api_core.client_options import ClientOptions from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore +import pkg_resources try: OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] except AttributeError: # pragma: NO COVER OptionalRetry = Union[retries.Retry, object] # type: ignore -from google.cloud.binaryauthorization_v1.types import resources -from google.cloud.binaryauthorization_v1.types import service from google.protobuf import timestamp_pb2 # type: ignore -from .transports.base import SystemPolicyV1Transport, DEFAULT_CLIENT_INFO -from .transports.grpc_asyncio import SystemPolicyV1GrpcAsyncIOTransport + +from google.cloud.binaryauthorization_v1.types import resources, service + from .client import SystemPolicyV1Client +from .transports.base import DEFAULT_CLIENT_INFO, SystemPolicyV1Transport +from .transports.grpc_asyncio import SystemPolicyV1GrpcAsyncIOTransport class SystemPolicyV1AsyncClient: @@ -159,9 +170,9 @@ def transport(self) -> SystemPolicyV1Transport: def __init__( self, *, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, transport: Union[str, SystemPolicyV1Transport] = "grpc_asyncio", - client_options: ClientOptions = None, + client_options: Optional[ClientOptions] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiates the system policy v1 client. @@ -205,11 +216,11 @@ def __init__( async def get_system_policy( self, - request: Union[service.GetSystemPolicyRequest, dict] = None, + request: Optional[Union[service.GetSystemPolicyRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> resources.Policy: r"""Gets the current system policy in the specified @@ -242,7 +253,7 @@ async def sample_get_system_policy(): print(response) Args: - request (Union[google.cloud.binaryauthorization_v1.types.GetSystemPolicyRequest, dict]): + request (Optional[Union[google.cloud.binaryauthorization_v1.types.GetSystemPolicyRequest, dict]]): The request object. Request to read the current system policy. name (:class:`str`): diff --git a/google/cloud/binaryauthorization_v1/services/system_policy_v1/client.py b/google/cloud/binaryauthorization_v1/services/system_policy_v1/client.py index 48391fa..6340a90 100644 --- a/google/cloud/binaryauthorization_v1/services/system_policy_v1/client.py +++ b/google/cloud/binaryauthorization_v1/services/system_policy_v1/client.py @@ -16,28 +16,40 @@ from collections import OrderedDict import os import re -from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union -import pkg_resources +from typing import ( + Dict, + Mapping, + MutableMapping, + MutableSequence, + Optional, + Sequence, + Tuple, + Type, + Union, + cast, +) from google.api_core import client_options as client_options_lib from google.api_core import exceptions as core_exceptions from google.api_core import gapic_v1 from google.api_core import retry as retries from google.auth import credentials as ga_credentials # type: ignore +from google.auth.exceptions import MutualTLSChannelError # type: ignore from google.auth.transport import mtls # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore from google.oauth2 import service_account # type: ignore +import pkg_resources try: OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] except AttributeError: # pragma: NO COVER OptionalRetry = Union[retries.Retry, object] # type: ignore -from google.cloud.binaryauthorization_v1.types import resources -from google.cloud.binaryauthorization_v1.types import service from google.protobuf import timestamp_pb2 # type: ignore -from .transports.base import SystemPolicyV1Transport, DEFAULT_CLIENT_INFO + +from google.cloud.binaryauthorization_v1.types import resources, service + +from .transports.base import DEFAULT_CLIENT_INFO, SystemPolicyV1Transport from .transports.grpc import SystemPolicyV1GrpcTransport from .transports.grpc_asyncio import SystemPolicyV1GrpcAsyncIOTransport @@ -58,7 +70,7 @@ class SystemPolicyV1ClientMeta(type): def get_transport_class( cls, - label: str = None, + label: Optional[str] = None, ) -> Type[SystemPolicyV1Transport]: """Returns an appropriate transport class. @@ -326,8 +338,8 @@ def __init__( self, *, credentials: Optional[ga_credentials.Credentials] = None, - transport: Union[str, SystemPolicyV1Transport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, + transport: Optional[Union[str, SystemPolicyV1Transport]] = None, + client_options: Optional[Union[client_options_lib.ClientOptions, dict]] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiates the system policy v1 client. @@ -341,7 +353,7 @@ def __init__( transport (Union[str, SystemPolicyV1Transport]): The transport to use. If set to None, a transport is chosen automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the + client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]): Custom options for the client. It won't take effect if a ``transport`` instance is provided. (1) The ``api_endpoint`` property can be used to override the default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT @@ -371,6 +383,7 @@ def __init__( client_options = client_options_lib.from_dict(client_options) if client_options is None: client_options = client_options_lib.ClientOptions() + client_options = cast(client_options_lib.ClientOptions, client_options) api_endpoint, client_cert_source_func = self.get_mtls_endpoint_and_cert_source( client_options @@ -423,11 +436,11 @@ def __init__( def get_system_policy( self, - request: Union[service.GetSystemPolicyRequest, dict] = None, + request: Optional[Union[service.GetSystemPolicyRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> resources.Policy: r"""Gets the current system policy in the specified diff --git a/google/cloud/binaryauthorization_v1/services/system_policy_v1/transports/__init__.py b/google/cloud/binaryauthorization_v1/services/system_policy_v1/transports/__init__.py index 991750c..d136089 100644 --- a/google/cloud/binaryauthorization_v1/services/system_policy_v1/transports/__init__.py +++ b/google/cloud/binaryauthorization_v1/services/system_policy_v1/transports/__init__.py @@ -20,7 +20,6 @@ from .grpc import SystemPolicyV1GrpcTransport from .grpc_asyncio import SystemPolicyV1GrpcAsyncIOTransport - # Compile a registry of transports. _transport_registry = OrderedDict() # type: Dict[str, Type[SystemPolicyV1Transport]] _transport_registry["grpc"] = SystemPolicyV1GrpcTransport diff --git a/google/cloud/binaryauthorization_v1/services/system_policy_v1/transports/base.py b/google/cloud/binaryauthorization_v1/services/system_policy_v1/transports/base.py index 1bd6378..19f4f14 100644 --- a/google/cloud/binaryauthorization_v1/services/system_policy_v1/transports/base.py +++ b/google/cloud/binaryauthorization_v1/services/system_policy_v1/transports/base.py @@ -15,18 +15,17 @@ # import abc from typing import Awaitable, Callable, Dict, Optional, Sequence, Union -import pkg_resources -import google.auth # type: ignore import google.api_core from google.api_core import exceptions as core_exceptions from google.api_core import gapic_v1 from google.api_core import retry as retries +import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore +import pkg_resources -from google.cloud.binaryauthorization_v1.types import resources -from google.cloud.binaryauthorization_v1.types import service +from google.cloud.binaryauthorization_v1.types import resources, service try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( @@ -49,7 +48,7 @@ def __init__( self, *, host: str = DEFAULT_HOST, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, diff --git a/google/cloud/binaryauthorization_v1/services/system_policy_v1/transports/grpc.py b/google/cloud/binaryauthorization_v1/services/system_policy_v1/transports/grpc.py index 83441d4..59aa689 100644 --- a/google/cloud/binaryauthorization_v1/services/system_policy_v1/transports/grpc.py +++ b/google/cloud/binaryauthorization_v1/services/system_policy_v1/transports/grpc.py @@ -13,20 +13,18 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union +import warnings -from google.api_core import grpc_helpers -from google.api_core import gapic_v1 +from google.api_core import gapic_v1, grpc_helpers import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore - import grpc # type: ignore -from google.cloud.binaryauthorization_v1.types import resources -from google.cloud.binaryauthorization_v1.types import service -from .base import SystemPolicyV1Transport, DEFAULT_CLIENT_INFO +from google.cloud.binaryauthorization_v1.types import resources, service + +from .base import DEFAULT_CLIENT_INFO, SystemPolicyV1Transport class SystemPolicyV1GrpcTransport(SystemPolicyV1Transport): @@ -48,14 +46,14 @@ def __init__( self, *, host: str = "binaryauthorization.googleapis.com", - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + channel: Optional[grpc.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, @@ -182,8 +180,8 @@ def __init__( def create_channel( cls, host: str = "binaryauthorization.googleapis.com", - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, **kwargs, diff --git a/google/cloud/binaryauthorization_v1/services/system_policy_v1/transports/grpc_asyncio.py b/google/cloud/binaryauthorization_v1/services/system_policy_v1/transports/grpc_asyncio.py index 3c3231f..61ed6c7 100644 --- a/google/cloud/binaryauthorization_v1/services/system_policy_v1/transports/grpc_asyncio.py +++ b/google/cloud/binaryauthorization_v1/services/system_policy_v1/transports/grpc_asyncio.py @@ -13,20 +13,18 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union +import warnings -from google.api_core import gapic_v1 -from google.api_core import grpc_helpers_async +from google.api_core import gapic_v1, grpc_helpers_async from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore - import grpc # type: ignore from grpc.experimental import aio # type: ignore -from google.cloud.binaryauthorization_v1.types import resources -from google.cloud.binaryauthorization_v1.types import service -from .base import SystemPolicyV1Transport, DEFAULT_CLIENT_INFO +from google.cloud.binaryauthorization_v1.types import resources, service + +from .base import DEFAULT_CLIENT_INFO, SystemPolicyV1Transport from .grpc import SystemPolicyV1GrpcTransport @@ -50,7 +48,7 @@ class SystemPolicyV1GrpcAsyncIOTransport(SystemPolicyV1Transport): def create_channel( cls, host: str = "binaryauthorization.googleapis.com", - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, @@ -93,15 +91,15 @@ def __init__( self, *, host: str = "binaryauthorization.googleapis.com", - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, - channel: aio.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, - quota_project_id=None, + channel: Optional[aio.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, api_audience: Optional[str] = None, diff --git a/google/cloud/binaryauthorization_v1/services/validation_helper_v1/__init__.py b/google/cloud/binaryauthorization_v1/services/validation_helper_v1/__init__.py index 699db16..ea286c6 100644 --- a/google/cloud/binaryauthorization_v1/services/validation_helper_v1/__init__.py +++ b/google/cloud/binaryauthorization_v1/services/validation_helper_v1/__init__.py @@ -13,8 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # -from .client import ValidationHelperV1Client from .async_client import ValidationHelperV1AsyncClient +from .client import ValidationHelperV1Client __all__ = ( "ValidationHelperV1Client", diff --git a/google/cloud/binaryauthorization_v1/services/validation_helper_v1/async_client.py b/google/cloud/binaryauthorization_v1/services/validation_helper_v1/async_client.py index 911fe13..6dbde77 100644 --- a/google/cloud/binaryauthorization_v1/services/validation_helper_v1/async_client.py +++ b/google/cloud/binaryauthorization_v1/services/validation_helper_v1/async_client.py @@ -16,15 +16,25 @@ from collections import OrderedDict import functools import re -from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union -import pkg_resources +from typing import ( + Dict, + Mapping, + MutableMapping, + MutableSequence, + Optional, + Sequence, + Tuple, + Type, + Union, +) -from google.api_core.client_options import ClientOptions from google.api_core import exceptions as core_exceptions from google.api_core import gapic_v1 from google.api_core import retry as retries +from google.api_core.client_options import ClientOptions from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore +import pkg_resources try: OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] @@ -32,9 +42,10 @@ OptionalRetry = Union[retries.Retry, object] # type: ignore from google.cloud.binaryauthorization_v1.types import service -from .transports.base import ValidationHelperV1Transport, DEFAULT_CLIENT_INFO -from .transports.grpc_asyncio import ValidationHelperV1GrpcAsyncIOTransport + from .client import ValidationHelperV1Client +from .transports.base import DEFAULT_CLIENT_INFO, ValidationHelperV1Transport +from .transports.grpc_asyncio import ValidationHelperV1GrpcAsyncIOTransport class ValidationHelperV1AsyncClient: @@ -156,9 +167,9 @@ def transport(self) -> ValidationHelperV1Transport: def __init__( self, *, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, transport: Union[str, ValidationHelperV1Transport] = "grpc_asyncio", - client_options: ClientOptions = None, + client_options: Optional[ClientOptions] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiates the validation helper v1 client. @@ -202,10 +213,12 @@ def __init__( async def validate_attestation_occurrence( self, - request: Union[service.ValidateAttestationOccurrenceRequest, dict] = None, + request: Optional[ + Union[service.ValidateAttestationOccurrenceRequest, dict] + ] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> service.ValidateAttestationOccurrenceResponse: r"""Returns whether the given Attestation for the given @@ -240,7 +253,7 @@ async def sample_validate_attestation_occurrence(): print(response) Args: - request (Union[google.cloud.binaryauthorization_v1.types.ValidateAttestationOccurrenceRequest, dict]): + request (Optional[Union[google.cloud.binaryauthorization_v1.types.ValidateAttestationOccurrenceRequest, dict]]): The request object. Request message for [ValidationHelperV1.ValidateAttestationOccurrence][google.cloud.binaryauthorization.v1.ValidationHelperV1.ValidateAttestationOccurrence]. retry (google.api_core.retry.Retry): Designation of what errors, if any, diff --git a/google/cloud/binaryauthorization_v1/services/validation_helper_v1/client.py b/google/cloud/binaryauthorization_v1/services/validation_helper_v1/client.py index 2d53264..ad09622 100644 --- a/google/cloud/binaryauthorization_v1/services/validation_helper_v1/client.py +++ b/google/cloud/binaryauthorization_v1/services/validation_helper_v1/client.py @@ -16,18 +16,29 @@ from collections import OrderedDict import os import re -from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union -import pkg_resources +from typing import ( + Dict, + Mapping, + MutableMapping, + MutableSequence, + Optional, + Sequence, + Tuple, + Type, + Union, + cast, +) from google.api_core import client_options as client_options_lib from google.api_core import exceptions as core_exceptions from google.api_core import gapic_v1 from google.api_core import retry as retries from google.auth import credentials as ga_credentials # type: ignore +from google.auth.exceptions import MutualTLSChannelError # type: ignore from google.auth.transport import mtls # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore from google.oauth2 import service_account # type: ignore +import pkg_resources try: OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] @@ -35,7 +46,8 @@ OptionalRetry = Union[retries.Retry, object] # type: ignore from google.cloud.binaryauthorization_v1.types import service -from .transports.base import ValidationHelperV1Transport, DEFAULT_CLIENT_INFO + +from .transports.base import DEFAULT_CLIENT_INFO, ValidationHelperV1Transport from .transports.grpc import ValidationHelperV1GrpcTransport from .transports.grpc_asyncio import ValidationHelperV1GrpcAsyncIOTransport @@ -56,7 +68,7 @@ class ValidationHelperV1ClientMeta(type): def get_transport_class( cls, - label: str = None, + label: Optional[str] = None, ) -> Type[ValidationHelperV1Transport]: """Returns an appropriate transport class. @@ -309,8 +321,8 @@ def __init__( self, *, credentials: Optional[ga_credentials.Credentials] = None, - transport: Union[str, ValidationHelperV1Transport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, + transport: Optional[Union[str, ValidationHelperV1Transport]] = None, + client_options: Optional[Union[client_options_lib.ClientOptions, dict]] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiates the validation helper v1 client. @@ -324,7 +336,7 @@ def __init__( transport (Union[str, ValidationHelperV1Transport]): The transport to use. If set to None, a transport is chosen automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the + client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]): Custom options for the client. It won't take effect if a ``transport`` instance is provided. (1) The ``api_endpoint`` property can be used to override the default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT @@ -354,6 +366,7 @@ def __init__( client_options = client_options_lib.from_dict(client_options) if client_options is None: client_options = client_options_lib.ClientOptions() + client_options = cast(client_options_lib.ClientOptions, client_options) api_endpoint, client_cert_source_func = self.get_mtls_endpoint_and_cert_source( client_options @@ -406,10 +419,12 @@ def __init__( def validate_attestation_occurrence( self, - request: Union[service.ValidateAttestationOccurrenceRequest, dict] = None, + request: Optional[ + Union[service.ValidateAttestationOccurrenceRequest, dict] + ] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> service.ValidateAttestationOccurrenceResponse: r"""Returns whether the given Attestation for the given diff --git a/google/cloud/binaryauthorization_v1/services/validation_helper_v1/transports/__init__.py b/google/cloud/binaryauthorization_v1/services/validation_helper_v1/transports/__init__.py index 22a9059..f7b1990 100644 --- a/google/cloud/binaryauthorization_v1/services/validation_helper_v1/transports/__init__.py +++ b/google/cloud/binaryauthorization_v1/services/validation_helper_v1/transports/__init__.py @@ -20,7 +20,6 @@ from .grpc import ValidationHelperV1GrpcTransport from .grpc_asyncio import ValidationHelperV1GrpcAsyncIOTransport - # Compile a registry of transports. _transport_registry = ( OrderedDict() diff --git a/google/cloud/binaryauthorization_v1/services/validation_helper_v1/transports/base.py b/google/cloud/binaryauthorization_v1/services/validation_helper_v1/transports/base.py index 1bb8bb9..c499205 100644 --- a/google/cloud/binaryauthorization_v1/services/validation_helper_v1/transports/base.py +++ b/google/cloud/binaryauthorization_v1/services/validation_helper_v1/transports/base.py @@ -15,15 +15,15 @@ # import abc from typing import Awaitable, Callable, Dict, Optional, Sequence, Union -import pkg_resources -import google.auth # type: ignore import google.api_core from google.api_core import exceptions as core_exceptions from google.api_core import gapic_v1 from google.api_core import retry as retries +import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore +import pkg_resources from google.cloud.binaryauthorization_v1.types import service @@ -48,7 +48,7 @@ def __init__( self, *, host: str = DEFAULT_HOST, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, diff --git a/google/cloud/binaryauthorization_v1/services/validation_helper_v1/transports/grpc.py b/google/cloud/binaryauthorization_v1/services/validation_helper_v1/transports/grpc.py index 2ef2d11..0b3dcf8 100644 --- a/google/cloud/binaryauthorization_v1/services/validation_helper_v1/transports/grpc.py +++ b/google/cloud/binaryauthorization_v1/services/validation_helper_v1/transports/grpc.py @@ -13,19 +13,18 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union +import warnings -from google.api_core import grpc_helpers -from google.api_core import gapic_v1 +from google.api_core import gapic_v1, grpc_helpers import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore - import grpc # type: ignore from google.cloud.binaryauthorization_v1.types import service -from .base import ValidationHelperV1Transport, DEFAULT_CLIENT_INFO + +from .base import DEFAULT_CLIENT_INFO, ValidationHelperV1Transport class ValidationHelperV1GrpcTransport(ValidationHelperV1Transport): @@ -47,14 +46,14 @@ def __init__( self, *, host: str = "binaryauthorization.googleapis.com", - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + channel: Optional[grpc.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, @@ -181,8 +180,8 @@ def __init__( def create_channel( cls, host: str = "binaryauthorization.googleapis.com", - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, **kwargs, diff --git a/google/cloud/binaryauthorization_v1/services/validation_helper_v1/transports/grpc_asyncio.py b/google/cloud/binaryauthorization_v1/services/validation_helper_v1/transports/grpc_asyncio.py index 92ac31f..75a20c1 100644 --- a/google/cloud/binaryauthorization_v1/services/validation_helper_v1/transports/grpc_asyncio.py +++ b/google/cloud/binaryauthorization_v1/services/validation_helper_v1/transports/grpc_asyncio.py @@ -13,19 +13,18 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union +import warnings -from google.api_core import gapic_v1 -from google.api_core import grpc_helpers_async +from google.api_core import gapic_v1, grpc_helpers_async from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore - import grpc # type: ignore from grpc.experimental import aio # type: ignore from google.cloud.binaryauthorization_v1.types import service -from .base import ValidationHelperV1Transport, DEFAULT_CLIENT_INFO + +from .base import DEFAULT_CLIENT_INFO, ValidationHelperV1Transport from .grpc import ValidationHelperV1GrpcTransport @@ -49,7 +48,7 @@ class ValidationHelperV1GrpcAsyncIOTransport(ValidationHelperV1Transport): def create_channel( cls, host: str = "binaryauthorization.googleapis.com", - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, @@ -92,15 +91,15 @@ def __init__( self, *, host: str = "binaryauthorization.googleapis.com", - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, - channel: aio.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, - quota_project_id=None, + channel: Optional[aio.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, api_audience: Optional[str] = None, diff --git a/google/cloud/binaryauthorization_v1/types/resources.py b/google/cloud/binaryauthorization_v1/types/resources.py index 9bbfb50..92294ca 100644 --- a/google/cloud/binaryauthorization_v1/types/resources.py +++ b/google/cloud/binaryauthorization_v1/types/resources.py @@ -13,10 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import proto # type: ignore +from typing import MutableMapping, MutableSequence from google.protobuf import timestamp_pb2 # type: ignore - +import proto # type: ignore __protobuf__ = proto.module( package="google.cloud.binaryauthorization.v1", @@ -51,27 +51,27 @@ class Policy(proto.Message): project admission policy. This setting has no effect when specified inside a global admission policy. - admission_whitelist_patterns (Sequence[google.cloud.binaryauthorization_v1.types.AdmissionWhitelistPattern]): + admission_whitelist_patterns (MutableSequence[google.cloud.binaryauthorization_v1.types.AdmissionWhitelistPattern]): Optional. Admission policy allowlisting. A matching admission request will always be permitted. This feature is typically used to exclude Google or third-party infrastructure images from Binary Authorization policies. - cluster_admission_rules (Mapping[str, google.cloud.binaryauthorization_v1.types.AdmissionRule]): + cluster_admission_rules (MutableMapping[str, google.cloud.binaryauthorization_v1.types.AdmissionRule]): Optional. Per-cluster admission rules. Cluster spec format: ``location.clusterId``. There can be at most one admission rule per cluster spec. A ``location`` is either a compute zone (e.g. us-central1-a) or a region (e.g. us-central1). For ``clusterId`` syntax restrictions see https://cloud.google.com/container-engine/reference/rest/v1/projects.zones.clusters. - kubernetes_namespace_admission_rules (Mapping[str, google.cloud.binaryauthorization_v1.types.AdmissionRule]): + kubernetes_namespace_admission_rules (MutableMapping[str, google.cloud.binaryauthorization_v1.types.AdmissionRule]): Optional. Per-kubernetes-namespace admission rules. K8s namespace spec format: [a-z.-]+, e.g. 'some-namespace' - kubernetes_service_account_admission_rules (Mapping[str, google.cloud.binaryauthorization_v1.types.AdmissionRule]): + kubernetes_service_account_admission_rules (MutableMapping[str, google.cloud.binaryauthorization_v1.types.AdmissionRule]): Optional. Per-kubernetes-service-account admission rules. Service account spec format: ``namespace:serviceaccount``. e.g. 'test-ns:default' - istio_service_identity_admission_rules (Mapping[str, google.cloud.binaryauthorization_v1.types.AdmissionRule]): + istio_service_identity_admission_rules (MutableMapping[str, google.cloud.binaryauthorization_v1.types.AdmissionRule]): Optional. Per-istio-service-identity admission rules. Istio service identity spec format: @@ -94,54 +94,62 @@ class GlobalPolicyEvaluationMode(proto.Enum): ENABLE = 1 DISABLE = 2 - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - description = proto.Field( + description: str = proto.Field( proto.STRING, number=6, ) - global_policy_evaluation_mode = proto.Field( + global_policy_evaluation_mode: GlobalPolicyEvaluationMode = proto.Field( proto.ENUM, number=7, enum=GlobalPolicyEvaluationMode, ) - admission_whitelist_patterns = proto.RepeatedField( + admission_whitelist_patterns: MutableSequence[ + "AdmissionWhitelistPattern" + ] = proto.RepeatedField( proto.MESSAGE, number=2, message="AdmissionWhitelistPattern", ) - cluster_admission_rules = proto.MapField( + cluster_admission_rules: MutableMapping[str, "AdmissionRule"] = proto.MapField( proto.STRING, proto.MESSAGE, number=3, message="AdmissionRule", ) - kubernetes_namespace_admission_rules = proto.MapField( + kubernetes_namespace_admission_rules: MutableMapping[ + str, "AdmissionRule" + ] = proto.MapField( proto.STRING, proto.MESSAGE, number=10, message="AdmissionRule", ) - kubernetes_service_account_admission_rules = proto.MapField( + kubernetes_service_account_admission_rules: MutableMapping[ + str, "AdmissionRule" + ] = proto.MapField( proto.STRING, proto.MESSAGE, number=8, message="AdmissionRule", ) - istio_service_identity_admission_rules = proto.MapField( + istio_service_identity_admission_rules: MutableMapping[ + str, "AdmissionRule" + ] = proto.MapField( proto.STRING, proto.MESSAGE, number=9, message="AdmissionRule", ) - default_admission_rule = proto.Field( + default_admission_rule: "AdmissionRule" = proto.Field( proto.MESSAGE, number=4, message="AdmissionRule", ) - update_time = proto.Field( + update_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=5, message=timestamp_pb2.Timestamp, @@ -163,7 +171,7 @@ class AdmissionWhitelistPattern(proto.Message): wildcard which matches subdirectories of a given entry. """ - name_pattern = proto.Field( + name_pattern: str = proto.Field( proto.STRING, number=1, ) @@ -187,7 +195,7 @@ class AdmissionRule(proto.Message): evaluation_mode (google.cloud.binaryauthorization_v1.types.AdmissionRule.EvaluationMode): Required. How this admission rule will be evaluated. - require_attestations_by (Sequence[str]): + require_attestations_by (MutableSequence[str]): Optional. The resource names of the attestors that must attest to a container image, in the format ``projects/*/attestors/*``. Each attestor must exist before @@ -218,16 +226,16 @@ class EnforcementMode(proto.Enum): ENFORCED_BLOCK_AND_AUDIT_LOG = 1 DRYRUN_AUDIT_LOG_ONLY = 2 - evaluation_mode = proto.Field( + evaluation_mode: EvaluationMode = proto.Field( proto.ENUM, number=1, enum=EvaluationMode, ) - require_attestations_by = proto.RepeatedField( + require_attestations_by: MutableSequence[str] = proto.RepeatedField( proto.STRING, number=2, ) - enforcement_mode = proto.Field( + enforcement_mode: EnforcementMode = proto.Field( proto.ENUM, number=3, enum=EnforcementMode, @@ -261,21 +269,21 @@ class Attestor(proto.Message): updated. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - description = proto.Field( + description: str = proto.Field( proto.STRING, number=6, ) - user_owned_grafeas_note = proto.Field( + user_owned_grafeas_note: "UserOwnedGrafeasNote" = proto.Field( proto.MESSAGE, number=3, oneof="attestor_type", message="UserOwnedGrafeasNote", ) - update_time = proto.Field( + update_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=4, message=timestamp_pb2.Timestamp, @@ -298,7 +306,7 @@ class UserOwnedGrafeasNote(proto.Message): Attestation.Authority Occurrence that names a container image and that links to this Note. Grafeas is an external dependency. - public_keys (Sequence[google.cloud.binaryauthorization_v1.types.AttestorPublicKey]): + public_keys (MutableSequence[google.cloud.binaryauthorization_v1.types.AttestorPublicKey]): Optional. Public keys that verify attestations signed by this attestor. This field may be updated. @@ -323,16 +331,16 @@ class UserOwnedGrafeasNote(proto.Message): email based on a different naming pattern. """ - note_reference = proto.Field( + note_reference: str = proto.Field( proto.STRING, number=1, ) - public_keys = proto.RepeatedField( + public_keys: MutableSequence["AttestorPublicKey"] = proto.RepeatedField( proto.MESSAGE, number=2, message="AttestorPublicKey", ) - delegation_service_account_email = proto.Field( + delegation_service_account_email: str = proto.Field( proto.STRING, number=3, ) @@ -382,11 +390,11 @@ class SignatureAlgorithm(proto.Enum): ECDSA_P521_SHA512 = 11 EC_SIGN_P521_SHA512 = 11 - public_key_pem = proto.Field( + public_key_pem: str = proto.Field( proto.STRING, number=1, ) - signature_algorithm = proto.Field( + signature_algorithm: SignatureAlgorithm = proto.Field( proto.ENUM, number=2, enum=SignatureAlgorithm, @@ -440,20 +448,20 @@ class AttestorPublicKey(proto.Message): This field is a member of `oneof`_ ``public_key``. """ - comment = proto.Field( + comment: str = proto.Field( proto.STRING, number=1, ) - id = proto.Field( + id: str = proto.Field( proto.STRING, number=2, ) - ascii_armored_pgp_public_key = proto.Field( + ascii_armored_pgp_public_key: str = proto.Field( proto.STRING, number=3, oneof="public_key", ) - pkix_public_key = proto.Field( + pkix_public_key: "PkixPublicKey" = proto.Field( proto.MESSAGE, number=5, oneof="public_key", diff --git a/google/cloud/binaryauthorization_v1/types/service.py b/google/cloud/binaryauthorization_v1/types/service.py index eaf253c..03c4383 100644 --- a/google/cloud/binaryauthorization_v1/types/service.py +++ b/google/cloud/binaryauthorization_v1/types/service.py @@ -13,11 +13,12 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + +import grafeas.grafeas_v1.types # type: ignore import proto # type: ignore from google.cloud.binaryauthorization_v1.types import resources -from grafeas.grafeas_v1.types import attestation # type: ignore - __protobuf__ = proto.module( package="google.cloud.binaryauthorization.v1", @@ -47,7 +48,7 @@ class GetPolicyRequest(proto.Message): retrieve, in the format ``projects/*/policy``. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -66,7 +67,7 @@ class UpdatePolicyRequest(proto.Message): ``projects/*/policy``. """ - policy = proto.Field( + policy: resources.Policy = proto.Field( proto.MESSAGE, number=1, message=resources.Policy, @@ -93,15 +94,15 @@ class CreateAttestorRequest(proto.Message): ``projects/*/attestors/*``. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - attestor_id = proto.Field( + attestor_id: str = proto.Field( proto.STRING, number=2, ) - attestor = proto.Field( + attestor: resources.Attestor = proto.Field( proto.MESSAGE, number=3, message=resources.Attestor, @@ -118,7 +119,7 @@ class GetAttestorRequest(proto.Message): retrieve, in the format ``projects/*/attestors/*``. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -137,7 +138,7 @@ class UpdateAttestorRequest(proto.Message): format ``projects/*/attestors/*``. """ - attestor = proto.Field( + attestor: resources.Attestor = proto.Field( proto.MESSAGE, number=1, message=resources.Attestor, @@ -165,15 +166,15 @@ class ListAttestorsRequest(proto.Message): method. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - page_size = proto.Field( + page_size: int = proto.Field( proto.INT32, number=2, ) - page_token = proto.Field( + page_token: str = proto.Field( proto.STRING, number=3, ) @@ -183,7 +184,7 @@ class ListAttestorsResponse(proto.Message): r"""Response message for [BinauthzManagementService.ListAttestors][]. Attributes: - attestors (Sequence[google.cloud.binaryauthorization_v1.types.Attestor]): + attestors (MutableSequence[google.cloud.binaryauthorization_v1.types.Attestor]): The list of [attestors][google.cloud.binaryauthorization.v1.Attestor]. next_page_token (str): @@ -198,12 +199,12 @@ class ListAttestorsResponse(proto.Message): def raw_page(self): return self - attestors = proto.RepeatedField( + attestors: MutableSequence[resources.Attestor] = proto.RepeatedField( proto.MESSAGE, number=1, message=resources.Attestor, ) - next_page_token = proto.Field( + next_page_token: str = proto.Field( proto.STRING, number=2, ) @@ -219,7 +220,7 @@ class DeleteAttestorRequest(proto.Message): delete, in the format ``projects/*/attestors/*``. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -235,7 +236,7 @@ class GetSystemPolicyRequest(proto.Message): associated with a project. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -251,7 +252,7 @@ class ValidateAttestationOccurrenceRequest(proto.Message): [Attestor][google.cloud.binaryauthorization.v1.Attestor] of the [occurrence][grafeas.v1.Occurrence], in the format ``projects/*/attestors/*``. - attestation (grafeas.grafeas_v1.types.attestation.AttestationOccurrence): + attestation (grafeas.grafeas_v1.types.AttestationOccurrence): Required. An [AttestationOccurrence][grafeas.v1.AttestationOccurrence] to be checked that it can be verified by the Attestor. It does @@ -267,20 +268,20 @@ class ValidateAttestationOccurrenceRequest(proto.Message): [Occurrence][grafeas.v1.Occurrence]. """ - attestor = proto.Field( + attestor: str = proto.Field( proto.STRING, number=1, ) - attestation = proto.Field( + attestation: grafeas.grafeas_v1.types.AttestationOccurrence = proto.Field( proto.MESSAGE, number=2, - message=attestation.AttestationOccurrence, + message=grafeas.grafeas_v1.types.AttestationOccurrence, ) - occurrence_note = proto.Field( + occurrence_note: str = proto.Field( proto.STRING, number=3, ) - occurrence_resource_uri = proto.Field( + occurrence_resource_uri: str = proto.Field( proto.STRING, number=4, ) @@ -304,12 +305,12 @@ class Result(proto.Enum): VERIFIED = 1 ATTESTATION_NOT_VERIFIABLE = 2 - result = proto.Field( + result: Result = proto.Field( proto.ENUM, number=1, enum=Result, ) - denial_reason = proto.Field( + denial_reason: str = proto.Field( proto.STRING, number=2, ) diff --git a/google/cloud/binaryauthorization_v1beta1/__init__.py b/google/cloud/binaryauthorization_v1beta1/__init__.py index 22b6788..bf3e972 100644 --- a/google/cloud/binaryauthorization_v1beta1/__init__.py +++ b/google/cloud/binaryauthorization_v1beta1/__init__.py @@ -13,33 +13,40 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from google.cloud.binaryauthorization import gapic_version as package_version + +__version__ = package_version.__version__ + from .services.binauthz_management_service_v1_beta1 import ( + BinauthzManagementServiceV1Beta1AsyncClient, BinauthzManagementServiceV1Beta1Client, ) -from .services.binauthz_management_service_v1_beta1 import ( - BinauthzManagementServiceV1Beta1AsyncClient, +from .services.system_policy_v1_beta1 import ( + SystemPolicyV1Beta1AsyncClient, + SystemPolicyV1Beta1Client, ) -from .services.system_policy_v1_beta1 import SystemPolicyV1Beta1Client -from .services.system_policy_v1_beta1 import SystemPolicyV1Beta1AsyncClient - from .types.continuous_validation_logging import ContinuousValidationEvent -from .types.resources import AdmissionRule -from .types.resources import AdmissionWhitelistPattern -from .types.resources import Attestor -from .types.resources import AttestorPublicKey -from .types.resources import PkixPublicKey -from .types.resources import Policy -from .types.resources import UserOwnedDrydockNote -from .types.service import CreateAttestorRequest -from .types.service import DeleteAttestorRequest -from .types.service import GetAttestorRequest -from .types.service import GetPolicyRequest -from .types.service import GetSystemPolicyRequest -from .types.service import ListAttestorsRequest -from .types.service import ListAttestorsResponse -from .types.service import UpdateAttestorRequest -from .types.service import UpdatePolicyRequest +from .types.resources import ( + AdmissionRule, + AdmissionWhitelistPattern, + Attestor, + AttestorPublicKey, + PkixPublicKey, + Policy, + UserOwnedDrydockNote, +) +from .types.service import ( + CreateAttestorRequest, + DeleteAttestorRequest, + GetAttestorRequest, + GetPolicyRequest, + GetSystemPolicyRequest, + ListAttestorsRequest, + ListAttestorsResponse, + UpdateAttestorRequest, + UpdatePolicyRequest, +) __all__ = ( "BinauthzManagementServiceV1Beta1AsyncClient", diff --git a/google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/__init__.py b/google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/__init__.py index 6e7af7c..40e7346 100644 --- a/google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/__init__.py +++ b/google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/__init__.py @@ -13,8 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # -from .client import BinauthzManagementServiceV1Beta1Client from .async_client import BinauthzManagementServiceV1Beta1AsyncClient +from .client import BinauthzManagementServiceV1Beta1Client __all__ = ( "BinauthzManagementServiceV1Beta1Client", diff --git a/google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/async_client.py b/google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/async_client.py index 2c591a7..11d7945 100644 --- a/google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/async_client.py +++ b/google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/async_client.py @@ -16,35 +16,46 @@ from collections import OrderedDict import functools import re -from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union -import pkg_resources +from typing import ( + Dict, + Mapping, + MutableMapping, + MutableSequence, + Optional, + Sequence, + Tuple, + Type, + Union, +) -from google.api_core.client_options import ClientOptions from google.api_core import exceptions as core_exceptions from google.api_core import gapic_v1 from google.api_core import retry as retries +from google.api_core.client_options import ClientOptions from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore +import pkg_resources try: OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] except AttributeError: # pragma: NO COVER OptionalRetry = Union[retries.Retry, object] # type: ignore +from google.protobuf import timestamp_pb2 # type: ignore + from google.cloud.binaryauthorization_v1beta1.services.binauthz_management_service_v1_beta1 import ( pagers, ) -from google.cloud.binaryauthorization_v1beta1.types import resources -from google.cloud.binaryauthorization_v1beta1.types import service -from google.protobuf import timestamp_pb2 # type: ignore +from google.cloud.binaryauthorization_v1beta1.types import resources, service + +from .client import BinauthzManagementServiceV1Beta1Client from .transports.base import ( - BinauthzManagementServiceV1Beta1Transport, DEFAULT_CLIENT_INFO, + BinauthzManagementServiceV1Beta1Transport, ) from .transports.grpc_asyncio import ( BinauthzManagementServiceV1Beta1GrpcAsyncIOTransport, ) -from .client import BinauthzManagementServiceV1Beta1Client class BinauthzManagementServiceV1Beta1AsyncClient: @@ -187,11 +198,11 @@ def transport(self) -> BinauthzManagementServiceV1Beta1Transport: def __init__( self, *, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, transport: Union[ str, BinauthzManagementServiceV1Beta1Transport ] = "grpc_asyncio", - client_options: ClientOptions = None, + client_options: Optional[ClientOptions] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiates the binauthz management service v1 beta1 client. @@ -235,11 +246,11 @@ def __init__( async def get_policy( self, - request: Union[service.GetPolicyRequest, dict] = None, + request: Optional[Union[service.GetPolicyRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> resources.Policy: r"""A [policy][google.cloud.binaryauthorization.v1beta1.Policy] @@ -283,7 +294,7 @@ async def sample_get_policy(): print(response) Args: - request (Union[google.cloud.binaryauthorization_v1beta1.types.GetPolicyRequest, dict]): + request (Optional[Union[google.cloud.binaryauthorization_v1beta1.types.GetPolicyRequest, dict]]): The request object. Request message for [BinauthzManagementService.GetPolicy][]. name (:class:`str`): @@ -361,11 +372,11 @@ async def sample_get_policy(): async def update_policy( self, - request: Union[service.UpdatePolicyRequest, dict] = None, + request: Optional[Union[service.UpdatePolicyRequest, dict]] = None, *, - policy: resources.Policy = None, + policy: Optional[resources.Policy] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> resources.Policy: r"""Creates or updates a project's @@ -408,7 +419,7 @@ async def sample_update_policy(): print(response) Args: - request (Union[google.cloud.binaryauthorization_v1beta1.types.UpdatePolicyRequest, dict]): + request (Optional[Union[google.cloud.binaryauthorization_v1beta1.types.UpdatePolicyRequest, dict]]): The request object. Request message for [BinauthzManagementService.UpdatePolicy][]. policy (:class:`google.cloud.binaryauthorization_v1beta1.types.Policy`): @@ -491,13 +502,13 @@ async def sample_update_policy(): async def create_attestor( self, - request: Union[service.CreateAttestorRequest, dict] = None, + request: Optional[Union[service.CreateAttestorRequest, dict]] = None, *, - parent: str = None, - attestor_id: str = None, - attestor: resources.Attestor = None, + parent: Optional[str] = None, + attestor_id: Optional[str] = None, + attestor: Optional[resources.Attestor] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> resources.Attestor: r"""Creates an @@ -543,7 +554,7 @@ async def sample_create_attestor(): print(response) Args: - request (Union[google.cloud.binaryauthorization_v1beta1.types.CreateAttestorRequest, dict]): + request (Optional[Union[google.cloud.binaryauthorization_v1beta1.types.CreateAttestorRequest, dict]]): The request object. Request message for [BinauthzManagementService.CreateAttestor][]. parent (:class:`str`): @@ -633,11 +644,11 @@ async def sample_create_attestor(): async def get_attestor( self, - request: Union[service.GetAttestorRequest, dict] = None, + request: Optional[Union[service.GetAttestorRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> resources.Attestor: r"""Gets an @@ -673,7 +684,7 @@ async def sample_get_attestor(): print(response) Args: - request (Union[google.cloud.binaryauthorization_v1beta1.types.GetAttestorRequest, dict]): + request (Optional[Union[google.cloud.binaryauthorization_v1beta1.types.GetAttestorRequest, dict]]): The request object. Request message for [BinauthzManagementService.GetAttestor][]. name (:class:`str`): @@ -751,11 +762,11 @@ async def sample_get_attestor(): async def update_attestor( self, - request: Union[service.UpdateAttestorRequest, dict] = None, + request: Optional[Union[service.UpdateAttestorRequest, dict]] = None, *, - attestor: resources.Attestor = None, + attestor: Optional[resources.Attestor] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> resources.Attestor: r"""Updates an @@ -795,7 +806,7 @@ async def sample_update_attestor(): print(response) Args: - request (Union[google.cloud.binaryauthorization_v1beta1.types.UpdateAttestorRequest, dict]): + request (Optional[Union[google.cloud.binaryauthorization_v1beta1.types.UpdateAttestorRequest, dict]]): The request object. Request message for [BinauthzManagementService.UpdateAttestor][]. attestor (:class:`google.cloud.binaryauthorization_v1beta1.types.Attestor`): @@ -878,11 +889,11 @@ async def sample_update_attestor(): async def list_attestors( self, - request: Union[service.ListAttestorsRequest, dict] = None, + request: Optional[Union[service.ListAttestorsRequest, dict]] = None, *, - parent: str = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListAttestorsAsyncPager: r"""Lists @@ -917,7 +928,7 @@ async def sample_list_attestors(): print(response) Args: - request (Union[google.cloud.binaryauthorization_v1beta1.types.ListAttestorsRequest, dict]): + request (Optional[Union[google.cloud.binaryauthorization_v1beta1.types.ListAttestorsRequest, dict]]): The request object. Request message for [BinauthzManagementService.ListAttestors][]. parent (:class:`str`): @@ -1007,11 +1018,11 @@ async def sample_list_attestors(): async def delete_attestor( self, - request: Union[service.DeleteAttestorRequest, dict] = None, + request: Optional[Union[service.DeleteAttestorRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Deletes an @@ -1044,7 +1055,7 @@ async def sample_delete_attestor(): await client.delete_attestor(request=request) Args: - request (Union[google.cloud.binaryauthorization_v1beta1.types.DeleteAttestorRequest, dict]): + request (Optional[Union[google.cloud.binaryauthorization_v1beta1.types.DeleteAttestorRequest, dict]]): The request object. Request message for [BinauthzManagementService.DeleteAttestor][]. name (:class:`str`): diff --git a/google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/client.py b/google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/client.py index fc9784a..ef780e2 100644 --- a/google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/client.py +++ b/google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/client.py @@ -16,33 +16,45 @@ from collections import OrderedDict import os import re -from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union -import pkg_resources +from typing import ( + Dict, + Mapping, + MutableMapping, + MutableSequence, + Optional, + Sequence, + Tuple, + Type, + Union, + cast, +) from google.api_core import client_options as client_options_lib from google.api_core import exceptions as core_exceptions from google.api_core import gapic_v1 from google.api_core import retry as retries from google.auth import credentials as ga_credentials # type: ignore +from google.auth.exceptions import MutualTLSChannelError # type: ignore from google.auth.transport import mtls # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore from google.oauth2 import service_account # type: ignore +import pkg_resources try: OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] except AttributeError: # pragma: NO COVER OptionalRetry = Union[retries.Retry, object] # type: ignore +from google.protobuf import timestamp_pb2 # type: ignore + from google.cloud.binaryauthorization_v1beta1.services.binauthz_management_service_v1_beta1 import ( pagers, ) -from google.cloud.binaryauthorization_v1beta1.types import resources -from google.cloud.binaryauthorization_v1beta1.types import service -from google.protobuf import timestamp_pb2 # type: ignore +from google.cloud.binaryauthorization_v1beta1.types import resources, service + from .transports.base import ( - BinauthzManagementServiceV1Beta1Transport, DEFAULT_CLIENT_INFO, + BinauthzManagementServiceV1Beta1Transport, ) from .transports.grpc import BinauthzManagementServiceV1Beta1GrpcTransport from .transports.grpc_asyncio import ( @@ -68,7 +80,7 @@ class BinauthzManagementServiceV1Beta1ClientMeta(type): def get_transport_class( cls, - label: str = None, + label: Optional[str] = None, ) -> Type[BinauthzManagementServiceV1Beta1Transport]: """Returns an appropriate transport class. @@ -362,8 +374,10 @@ def __init__( self, *, credentials: Optional[ga_credentials.Credentials] = None, - transport: Union[str, BinauthzManagementServiceV1Beta1Transport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, + transport: Optional[ + Union[str, BinauthzManagementServiceV1Beta1Transport] + ] = None, + client_options: Optional[Union[client_options_lib.ClientOptions, dict]] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiates the binauthz management service v1 beta1 client. @@ -377,7 +391,7 @@ def __init__( transport (Union[str, BinauthzManagementServiceV1Beta1Transport]): The transport to use. If set to None, a transport is chosen automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the + client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]): Custom options for the client. It won't take effect if a ``transport`` instance is provided. (1) The ``api_endpoint`` property can be used to override the default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT @@ -407,6 +421,7 @@ def __init__( client_options = client_options_lib.from_dict(client_options) if client_options is None: client_options = client_options_lib.ClientOptions() + client_options = cast(client_options_lib.ClientOptions, client_options) api_endpoint, client_cert_source_func = self.get_mtls_endpoint_and_cert_source( client_options @@ -459,11 +474,11 @@ def __init__( def get_policy( self, - request: Union[service.GetPolicyRequest, dict] = None, + request: Optional[Union[service.GetPolicyRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> resources.Policy: r"""A [policy][google.cloud.binaryauthorization.v1beta1.Policy] @@ -575,11 +590,11 @@ def sample_get_policy(): def update_policy( self, - request: Union[service.UpdatePolicyRequest, dict] = None, + request: Optional[Union[service.UpdatePolicyRequest, dict]] = None, *, - policy: resources.Policy = None, + policy: Optional[resources.Policy] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> resources.Policy: r"""Creates or updates a project's @@ -695,13 +710,13 @@ def sample_update_policy(): def create_attestor( self, - request: Union[service.CreateAttestorRequest, dict] = None, + request: Optional[Union[service.CreateAttestorRequest, dict]] = None, *, - parent: str = None, - attestor_id: str = None, - attestor: resources.Attestor = None, + parent: Optional[str] = None, + attestor_id: Optional[str] = None, + attestor: Optional[resources.Attestor] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> resources.Attestor: r"""Creates an @@ -837,11 +852,11 @@ def sample_create_attestor(): def get_attestor( self, - request: Union[service.GetAttestorRequest, dict] = None, + request: Optional[Union[service.GetAttestorRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> resources.Attestor: r"""Gets an @@ -945,11 +960,11 @@ def sample_get_attestor(): def update_attestor( self, - request: Union[service.UpdateAttestorRequest, dict] = None, + request: Optional[Union[service.UpdateAttestorRequest, dict]] = None, *, - attestor: resources.Attestor = None, + attestor: Optional[resources.Attestor] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> resources.Attestor: r"""Updates an @@ -1062,11 +1077,11 @@ def sample_update_attestor(): def list_attestors( self, - request: Union[service.ListAttestorsRequest, dict] = None, + request: Optional[Union[service.ListAttestorsRequest, dict]] = None, *, - parent: str = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListAttestorsPager: r"""Lists @@ -1181,11 +1196,11 @@ def sample_list_attestors(): def delete_attestor( self, - request: Union[service.DeleteAttestorRequest, dict] = None, + request: Optional[Union[service.DeleteAttestorRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Deletes an diff --git a/google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/pagers.py b/google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/pagers.py index cc8d97b..066e4a6 100644 --- a/google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/pagers.py +++ b/google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/pagers.py @@ -18,14 +18,13 @@ AsyncIterator, Awaitable, Callable, + Iterator, + Optional, Sequence, Tuple, - Optional, - Iterator, ) -from google.cloud.binaryauthorization_v1beta1.types import resources -from google.cloud.binaryauthorization_v1beta1.types import service +from google.cloud.binaryauthorization_v1beta1.types import resources, service class ListAttestorsPager: diff --git a/google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/transports/__init__.py b/google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/transports/__init__.py index 19d288a..407a4a5 100644 --- a/google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/transports/__init__.py +++ b/google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/transports/__init__.py @@ -20,7 +20,6 @@ from .grpc import BinauthzManagementServiceV1Beta1GrpcTransport from .grpc_asyncio import BinauthzManagementServiceV1Beta1GrpcAsyncIOTransport - # Compile a registry of transports. _transport_registry = ( OrderedDict() diff --git a/google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/transports/base.py b/google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/transports/base.py index 12e3d05..2cd1fac 100644 --- a/google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/transports/base.py +++ b/google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/transports/base.py @@ -15,19 +15,18 @@ # import abc from typing import Awaitable, Callable, Dict, Optional, Sequence, Union -import pkg_resources -import google.auth # type: ignore import google.api_core from google.api_core import exceptions as core_exceptions from google.api_core import gapic_v1 from google.api_core import retry as retries +import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore - -from google.cloud.binaryauthorization_v1beta1.types import resources -from google.cloud.binaryauthorization_v1beta1.types import service from google.protobuf import empty_pb2 # type: ignore +import pkg_resources + +from google.cloud.binaryauthorization_v1beta1.types import resources, service try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( @@ -50,7 +49,7 @@ def __init__( self, *, host: str = DEFAULT_HOST, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, diff --git a/google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/transports/grpc.py b/google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/transports/grpc.py index 392f45e..4af92bd 100644 --- a/google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/transports/grpc.py +++ b/google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/transports/grpc.py @@ -13,21 +13,19 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union +import warnings -from google.api_core import grpc_helpers -from google.api_core import gapic_v1 +from google.api_core import gapic_v1, grpc_helpers import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore - +from google.protobuf import empty_pb2 # type: ignore import grpc # type: ignore -from google.cloud.binaryauthorization_v1beta1.types import resources -from google.cloud.binaryauthorization_v1beta1.types import service -from google.protobuf import empty_pb2 # type: ignore -from .base import BinauthzManagementServiceV1Beta1Transport, DEFAULT_CLIENT_INFO +from google.cloud.binaryauthorization_v1beta1.types import resources, service + +from .base import DEFAULT_CLIENT_INFO, BinauthzManagementServiceV1Beta1Transport class BinauthzManagementServiceV1Beta1GrpcTransport( @@ -57,14 +55,14 @@ def __init__( self, *, host: str = "binaryauthorization.googleapis.com", - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + channel: Optional[grpc.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, @@ -191,8 +189,8 @@ def __init__( def create_channel( cls, host: str = "binaryauthorization.googleapis.com", - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, **kwargs, diff --git a/google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/transports/grpc_asyncio.py b/google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/transports/grpc_asyncio.py index a0f5a6f..edb10c1 100644 --- a/google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/transports/grpc_asyncio.py +++ b/google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/transports/grpc_asyncio.py @@ -13,21 +13,19 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union +import warnings -from google.api_core import gapic_v1 -from google.api_core import grpc_helpers_async +from google.api_core import gapic_v1, grpc_helpers_async from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore - +from google.protobuf import empty_pb2 # type: ignore import grpc # type: ignore from grpc.experimental import aio # type: ignore -from google.cloud.binaryauthorization_v1beta1.types import resources -from google.cloud.binaryauthorization_v1beta1.types import service -from google.protobuf import empty_pb2 # type: ignore -from .base import BinauthzManagementServiceV1Beta1Transport, DEFAULT_CLIENT_INFO +from google.cloud.binaryauthorization_v1beta1.types import resources, service + +from .base import DEFAULT_CLIENT_INFO, BinauthzManagementServiceV1Beta1Transport from .grpc import BinauthzManagementServiceV1Beta1GrpcTransport @@ -59,7 +57,7 @@ class BinauthzManagementServiceV1Beta1GrpcAsyncIOTransport( def create_channel( cls, host: str = "binaryauthorization.googleapis.com", - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, @@ -102,15 +100,15 @@ def __init__( self, *, host: str = "binaryauthorization.googleapis.com", - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, - channel: aio.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, - quota_project_id=None, + channel: Optional[aio.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, api_audience: Optional[str] = None, diff --git a/google/cloud/binaryauthorization_v1beta1/services/system_policy_v1_beta1/__init__.py b/google/cloud/binaryauthorization_v1beta1/services/system_policy_v1_beta1/__init__.py index a248343..0760b52 100644 --- a/google/cloud/binaryauthorization_v1beta1/services/system_policy_v1_beta1/__init__.py +++ b/google/cloud/binaryauthorization_v1beta1/services/system_policy_v1_beta1/__init__.py @@ -13,8 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # -from .client import SystemPolicyV1Beta1Client from .async_client import SystemPolicyV1Beta1AsyncClient +from .client import SystemPolicyV1Beta1Client __all__ = ( "SystemPolicyV1Beta1Client", diff --git a/google/cloud/binaryauthorization_v1beta1/services/system_policy_v1_beta1/async_client.py b/google/cloud/binaryauthorization_v1beta1/services/system_policy_v1_beta1/async_client.py index f98eb60..7e56b8d 100644 --- a/google/cloud/binaryauthorization_v1beta1/services/system_policy_v1_beta1/async_client.py +++ b/google/cloud/binaryauthorization_v1beta1/services/system_policy_v1_beta1/async_client.py @@ -16,27 +16,38 @@ from collections import OrderedDict import functools import re -from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union -import pkg_resources +from typing import ( + Dict, + Mapping, + MutableMapping, + MutableSequence, + Optional, + Sequence, + Tuple, + Type, + Union, +) -from google.api_core.client_options import ClientOptions from google.api_core import exceptions as core_exceptions from google.api_core import gapic_v1 from google.api_core import retry as retries +from google.api_core.client_options import ClientOptions from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore +import pkg_resources try: OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] except AttributeError: # pragma: NO COVER OptionalRetry = Union[retries.Retry, object] # type: ignore -from google.cloud.binaryauthorization_v1beta1.types import resources -from google.cloud.binaryauthorization_v1beta1.types import service from google.protobuf import timestamp_pb2 # type: ignore -from .transports.base import SystemPolicyV1Beta1Transport, DEFAULT_CLIENT_INFO -from .transports.grpc_asyncio import SystemPolicyV1Beta1GrpcAsyncIOTransport + +from google.cloud.binaryauthorization_v1beta1.types import resources, service + from .client import SystemPolicyV1Beta1Client +from .transports.base import DEFAULT_CLIENT_INFO, SystemPolicyV1Beta1Transport +from .transports.grpc_asyncio import SystemPolicyV1Beta1GrpcAsyncIOTransport class SystemPolicyV1Beta1AsyncClient: @@ -160,9 +171,9 @@ def transport(self) -> SystemPolicyV1Beta1Transport: def __init__( self, *, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, transport: Union[str, SystemPolicyV1Beta1Transport] = "grpc_asyncio", - client_options: ClientOptions = None, + client_options: Optional[ClientOptions] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiates the system policy v1 beta1 client. @@ -206,11 +217,11 @@ def __init__( async def get_system_policy( self, - request: Union[service.GetSystemPolicyRequest, dict] = None, + request: Optional[Union[service.GetSystemPolicyRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> resources.Policy: r"""Gets the current system policy in the specified @@ -243,7 +254,7 @@ async def sample_get_system_policy(): print(response) Args: - request (Union[google.cloud.binaryauthorization_v1beta1.types.GetSystemPolicyRequest, dict]): + request (Optional[Union[google.cloud.binaryauthorization_v1beta1.types.GetSystemPolicyRequest, dict]]): The request object. Request to read the current system policy. name (:class:`str`): diff --git a/google/cloud/binaryauthorization_v1beta1/services/system_policy_v1_beta1/client.py b/google/cloud/binaryauthorization_v1beta1/services/system_policy_v1_beta1/client.py index f841e79..735adf9 100644 --- a/google/cloud/binaryauthorization_v1beta1/services/system_policy_v1_beta1/client.py +++ b/google/cloud/binaryauthorization_v1beta1/services/system_policy_v1_beta1/client.py @@ -16,28 +16,40 @@ from collections import OrderedDict import os import re -from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union -import pkg_resources +from typing import ( + Dict, + Mapping, + MutableMapping, + MutableSequence, + Optional, + Sequence, + Tuple, + Type, + Union, + cast, +) from google.api_core import client_options as client_options_lib from google.api_core import exceptions as core_exceptions from google.api_core import gapic_v1 from google.api_core import retry as retries from google.auth import credentials as ga_credentials # type: ignore +from google.auth.exceptions import MutualTLSChannelError # type: ignore from google.auth.transport import mtls # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore from google.oauth2 import service_account # type: ignore +import pkg_resources try: OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] except AttributeError: # pragma: NO COVER OptionalRetry = Union[retries.Retry, object] # type: ignore -from google.cloud.binaryauthorization_v1beta1.types import resources -from google.cloud.binaryauthorization_v1beta1.types import service from google.protobuf import timestamp_pb2 # type: ignore -from .transports.base import SystemPolicyV1Beta1Transport, DEFAULT_CLIENT_INFO + +from google.cloud.binaryauthorization_v1beta1.types import resources, service + +from .transports.base import DEFAULT_CLIENT_INFO, SystemPolicyV1Beta1Transport from .transports.grpc import SystemPolicyV1Beta1GrpcTransport from .transports.grpc_asyncio import SystemPolicyV1Beta1GrpcAsyncIOTransport @@ -58,7 +70,7 @@ class SystemPolicyV1Beta1ClientMeta(type): def get_transport_class( cls, - label: str = None, + label: Optional[str] = None, ) -> Type[SystemPolicyV1Beta1Transport]: """Returns an appropriate transport class. @@ -326,8 +338,8 @@ def __init__( self, *, credentials: Optional[ga_credentials.Credentials] = None, - transport: Union[str, SystemPolicyV1Beta1Transport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, + transport: Optional[Union[str, SystemPolicyV1Beta1Transport]] = None, + client_options: Optional[Union[client_options_lib.ClientOptions, dict]] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiates the system policy v1 beta1 client. @@ -341,7 +353,7 @@ def __init__( transport (Union[str, SystemPolicyV1Beta1Transport]): The transport to use. If set to None, a transport is chosen automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the + client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]): Custom options for the client. It won't take effect if a ``transport`` instance is provided. (1) The ``api_endpoint`` property can be used to override the default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT @@ -371,6 +383,7 @@ def __init__( client_options = client_options_lib.from_dict(client_options) if client_options is None: client_options = client_options_lib.ClientOptions() + client_options = cast(client_options_lib.ClientOptions, client_options) api_endpoint, client_cert_source_func = self.get_mtls_endpoint_and_cert_source( client_options @@ -423,11 +436,11 @@ def __init__( def get_system_policy( self, - request: Union[service.GetSystemPolicyRequest, dict] = None, + request: Optional[Union[service.GetSystemPolicyRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> resources.Policy: r"""Gets the current system policy in the specified diff --git a/google/cloud/binaryauthorization_v1beta1/services/system_policy_v1_beta1/transports/__init__.py b/google/cloud/binaryauthorization_v1beta1/services/system_policy_v1_beta1/transports/__init__.py index ee82c9f..31c6c6c 100644 --- a/google/cloud/binaryauthorization_v1beta1/services/system_policy_v1_beta1/transports/__init__.py +++ b/google/cloud/binaryauthorization_v1beta1/services/system_policy_v1_beta1/transports/__init__.py @@ -20,7 +20,6 @@ from .grpc import SystemPolicyV1Beta1GrpcTransport from .grpc_asyncio import SystemPolicyV1Beta1GrpcAsyncIOTransport - # Compile a registry of transports. _transport_registry = ( OrderedDict() diff --git a/google/cloud/binaryauthorization_v1beta1/services/system_policy_v1_beta1/transports/base.py b/google/cloud/binaryauthorization_v1beta1/services/system_policy_v1_beta1/transports/base.py index 15802ec..dc8fb44 100644 --- a/google/cloud/binaryauthorization_v1beta1/services/system_policy_v1_beta1/transports/base.py +++ b/google/cloud/binaryauthorization_v1beta1/services/system_policy_v1_beta1/transports/base.py @@ -15,18 +15,17 @@ # import abc from typing import Awaitable, Callable, Dict, Optional, Sequence, Union -import pkg_resources -import google.auth # type: ignore import google.api_core from google.api_core import exceptions as core_exceptions from google.api_core import gapic_v1 from google.api_core import retry as retries +import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore +import pkg_resources -from google.cloud.binaryauthorization_v1beta1.types import resources -from google.cloud.binaryauthorization_v1beta1.types import service +from google.cloud.binaryauthorization_v1beta1.types import resources, service try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( @@ -49,7 +48,7 @@ def __init__( self, *, host: str = DEFAULT_HOST, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, diff --git a/google/cloud/binaryauthorization_v1beta1/services/system_policy_v1_beta1/transports/grpc.py b/google/cloud/binaryauthorization_v1beta1/services/system_policy_v1_beta1/transports/grpc.py index e56b9d7..2a9e3f2 100644 --- a/google/cloud/binaryauthorization_v1beta1/services/system_policy_v1_beta1/transports/grpc.py +++ b/google/cloud/binaryauthorization_v1beta1/services/system_policy_v1_beta1/transports/grpc.py @@ -13,20 +13,18 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union +import warnings -from google.api_core import grpc_helpers -from google.api_core import gapic_v1 +from google.api_core import gapic_v1, grpc_helpers import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore - import grpc # type: ignore -from google.cloud.binaryauthorization_v1beta1.types import resources -from google.cloud.binaryauthorization_v1beta1.types import service -from .base import SystemPolicyV1Beta1Transport, DEFAULT_CLIENT_INFO +from google.cloud.binaryauthorization_v1beta1.types import resources, service + +from .base import DEFAULT_CLIENT_INFO, SystemPolicyV1Beta1Transport class SystemPolicyV1Beta1GrpcTransport(SystemPolicyV1Beta1Transport): @@ -48,14 +46,14 @@ def __init__( self, *, host: str = "binaryauthorization.googleapis.com", - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + channel: Optional[grpc.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, @@ -182,8 +180,8 @@ def __init__( def create_channel( cls, host: str = "binaryauthorization.googleapis.com", - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, **kwargs, diff --git a/google/cloud/binaryauthorization_v1beta1/services/system_policy_v1_beta1/transports/grpc_asyncio.py b/google/cloud/binaryauthorization_v1beta1/services/system_policy_v1_beta1/transports/grpc_asyncio.py index f65c114..fc122e9 100644 --- a/google/cloud/binaryauthorization_v1beta1/services/system_policy_v1_beta1/transports/grpc_asyncio.py +++ b/google/cloud/binaryauthorization_v1beta1/services/system_policy_v1_beta1/transports/grpc_asyncio.py @@ -13,20 +13,18 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union +import warnings -from google.api_core import gapic_v1 -from google.api_core import grpc_helpers_async +from google.api_core import gapic_v1, grpc_helpers_async from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore - import grpc # type: ignore from grpc.experimental import aio # type: ignore -from google.cloud.binaryauthorization_v1beta1.types import resources -from google.cloud.binaryauthorization_v1beta1.types import service -from .base import SystemPolicyV1Beta1Transport, DEFAULT_CLIENT_INFO +from google.cloud.binaryauthorization_v1beta1.types import resources, service + +from .base import DEFAULT_CLIENT_INFO, SystemPolicyV1Beta1Transport from .grpc import SystemPolicyV1Beta1GrpcTransport @@ -50,7 +48,7 @@ class SystemPolicyV1Beta1GrpcAsyncIOTransport(SystemPolicyV1Beta1Transport): def create_channel( cls, host: str = "binaryauthorization.googleapis.com", - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, @@ -93,15 +91,15 @@ def __init__( self, *, host: str = "binaryauthorization.googleapis.com", - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, - channel: aio.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, - quota_project_id=None, + channel: Optional[aio.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, api_audience: Optional[str] = None, diff --git a/google/cloud/binaryauthorization_v1beta1/types/__init__.py b/google/cloud/binaryauthorization_v1beta1/types/__init__.py index 25e8b6c..30b8ea4 100644 --- a/google/cloud/binaryauthorization_v1beta1/types/__init__.py +++ b/google/cloud/binaryauthorization_v1beta1/types/__init__.py @@ -13,9 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # -from .continuous_validation_logging import ( - ContinuousValidationEvent, -) +from .continuous_validation_logging import ContinuousValidationEvent from .resources import ( AdmissionRule, AdmissionWhitelistPattern, diff --git a/google/cloud/binaryauthorization_v1beta1/types/continuous_validation_logging.py b/google/cloud/binaryauthorization_v1beta1/types/continuous_validation_logging.py index 9f6ad54..0c00a48 100644 --- a/google/cloud/binaryauthorization_v1beta1/types/continuous_validation_logging.py +++ b/google/cloud/binaryauthorization_v1beta1/types/continuous_validation_logging.py @@ -13,10 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import proto # type: ignore +from typing import MutableMapping, MutableSequence from google.protobuf import timestamp_pb2 # type: ignore - +import proto # type: ignore __protobuf__ = proto.module( package="google.cloud.binaryauthorization.v1beta1", @@ -62,7 +62,7 @@ class ContinuousValidationPodEvent(proto.Message): nothing if still running. verdict (google.cloud.binaryauthorization_v1beta1.types.ContinuousValidationEvent.ContinuousValidationPodEvent.PolicyConformanceVerdict): Auditing verdict for this Pod. - images (Sequence[google.cloud.binaryauthorization_v1beta1.types.ContinuousValidationEvent.ContinuousValidationPodEvent.ImageDetails]): + images (MutableSequence[google.cloud.binaryauthorization_v1beta1.types.ContinuousValidationEvent.ContinuousValidationPodEvent.ImageDetails]): List of images with auditing details. """ @@ -89,44 +89,46 @@ class AuditResult(proto.Enum): ALLOW = 1 DENY = 2 - image = proto.Field( + image: str = proto.Field( proto.STRING, number=1, ) - result = proto.Field( + result: "ContinuousValidationEvent.ContinuousValidationPodEvent.ImageDetails.AuditResult" = proto.Field( proto.ENUM, number=2, enum="ContinuousValidationEvent.ContinuousValidationPodEvent.ImageDetails.AuditResult", ) - description = proto.Field( + description: str = proto.Field( proto.STRING, number=3, ) - pod_namespace = proto.Field( + pod_namespace: str = proto.Field( proto.STRING, number=7, ) - pod = proto.Field( + pod: str = proto.Field( proto.STRING, number=1, ) - deploy_time = proto.Field( + deploy_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=2, message=timestamp_pb2.Timestamp, ) - end_time = proto.Field( + end_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=3, message=timestamp_pb2.Timestamp, ) - verdict = proto.Field( + verdict: "ContinuousValidationEvent.ContinuousValidationPodEvent.PolicyConformanceVerdict" = proto.Field( proto.ENUM, number=4, enum="ContinuousValidationEvent.ContinuousValidationPodEvent.PolicyConformanceVerdict", ) - images = proto.RepeatedField( + images: MutableSequence[ + "ContinuousValidationEvent.ContinuousValidationPodEvent.ImageDetails" + ] = proto.RepeatedField( proto.MESSAGE, number=5, message="ContinuousValidationEvent.ContinuousValidationPodEvent.ImageDetails", @@ -141,18 +143,18 @@ class UnsupportedPolicyEvent(proto.Message): A description of the unsupported policy. """ - description = proto.Field( + description: str = proto.Field( proto.STRING, number=1, ) - pod_event = proto.Field( + pod_event: ContinuousValidationPodEvent = proto.Field( proto.MESSAGE, number=1, oneof="event_type", message=ContinuousValidationPodEvent, ) - unsupported_policy_event = proto.Field( + unsupported_policy_event: UnsupportedPolicyEvent = proto.Field( proto.MESSAGE, number=2, oneof="event_type", diff --git a/google/cloud/binaryauthorization_v1beta1/types/resources.py b/google/cloud/binaryauthorization_v1beta1/types/resources.py index 0fd403e..3b88e73 100644 --- a/google/cloud/binaryauthorization_v1beta1/types/resources.py +++ b/google/cloud/binaryauthorization_v1beta1/types/resources.py @@ -13,10 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import proto # type: ignore +from typing import MutableMapping, MutableSequence from google.protobuf import timestamp_pb2 # type: ignore - +import proto # type: ignore __protobuf__ = proto.module( package="google.cloud.binaryauthorization.v1beta1", @@ -51,27 +51,27 @@ class Policy(proto.Message): project admission policy. This setting has no effect when specified inside a global admission policy. - admission_whitelist_patterns (Sequence[google.cloud.binaryauthorization_v1beta1.types.AdmissionWhitelistPattern]): + admission_whitelist_patterns (MutableSequence[google.cloud.binaryauthorization_v1beta1.types.AdmissionWhitelistPattern]): Optional. Admission policy allowlisting. A matching admission request will always be permitted. This feature is typically used to exclude Google or third-party infrastructure images from Binary Authorization policies. - cluster_admission_rules (Mapping[str, google.cloud.binaryauthorization_v1beta1.types.AdmissionRule]): + cluster_admission_rules (MutableMapping[str, google.cloud.binaryauthorization_v1beta1.types.AdmissionRule]): Optional. Per-cluster admission rules. Cluster spec format: ``location.clusterId``. There can be at most one admission rule per cluster spec. A ``location`` is either a compute zone (e.g. us-central1-a) or a region (e.g. us-central1). For ``clusterId`` syntax restrictions see https://cloud.google.com/container-engine/reference/rest/v1/projects.zones.clusters. - kubernetes_namespace_admission_rules (Mapping[str, google.cloud.binaryauthorization_v1beta1.types.AdmissionRule]): + kubernetes_namespace_admission_rules (MutableMapping[str, google.cloud.binaryauthorization_v1beta1.types.AdmissionRule]): Optional. Per-kubernetes-namespace admission rules. K8s namespace spec format: ``[a-z.-]+``, e.g. ``some-namespace`` - kubernetes_service_account_admission_rules (Mapping[str, google.cloud.binaryauthorization_v1beta1.types.AdmissionRule]): + kubernetes_service_account_admission_rules (MutableMapping[str, google.cloud.binaryauthorization_v1beta1.types.AdmissionRule]): Optional. Per-kubernetes-service-account admission rules. Service account spec format: ``namespace:serviceaccount``. e.g. ``test-ns:default`` - istio_service_identity_admission_rules (Mapping[str, google.cloud.binaryauthorization_v1beta1.types.AdmissionRule]): + istio_service_identity_admission_rules (MutableMapping[str, google.cloud.binaryauthorization_v1beta1.types.AdmissionRule]): Optional. Per-istio-service-identity admission rules. Istio service identity spec format: ``spiffe:///ns//sa/`` or @@ -93,54 +93,62 @@ class GlobalPolicyEvaluationMode(proto.Enum): ENABLE = 1 DISABLE = 2 - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - description = proto.Field( + description: str = proto.Field( proto.STRING, number=6, ) - global_policy_evaluation_mode = proto.Field( + global_policy_evaluation_mode: GlobalPolicyEvaluationMode = proto.Field( proto.ENUM, number=7, enum=GlobalPolicyEvaluationMode, ) - admission_whitelist_patterns = proto.RepeatedField( + admission_whitelist_patterns: MutableSequence[ + "AdmissionWhitelistPattern" + ] = proto.RepeatedField( proto.MESSAGE, number=2, message="AdmissionWhitelistPattern", ) - cluster_admission_rules = proto.MapField( + cluster_admission_rules: MutableMapping[str, "AdmissionRule"] = proto.MapField( proto.STRING, proto.MESSAGE, number=3, message="AdmissionRule", ) - kubernetes_namespace_admission_rules = proto.MapField( + kubernetes_namespace_admission_rules: MutableMapping[ + str, "AdmissionRule" + ] = proto.MapField( proto.STRING, proto.MESSAGE, number=10, message="AdmissionRule", ) - kubernetes_service_account_admission_rules = proto.MapField( + kubernetes_service_account_admission_rules: MutableMapping[ + str, "AdmissionRule" + ] = proto.MapField( proto.STRING, proto.MESSAGE, number=8, message="AdmissionRule", ) - istio_service_identity_admission_rules = proto.MapField( + istio_service_identity_admission_rules: MutableMapping[ + str, "AdmissionRule" + ] = proto.MapField( proto.STRING, proto.MESSAGE, number=9, message="AdmissionRule", ) - default_admission_rule = proto.Field( + default_admission_rule: "AdmissionRule" = proto.Field( proto.MESSAGE, number=4, message="AdmissionRule", ) - update_time = proto.Field( + update_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=5, message=timestamp_pb2.Timestamp, @@ -165,7 +173,7 @@ class AdmissionWhitelistPattern(proto.Message): i.e., ``gcr.io/nginx**`` matches ``gcr.io/nginx/image``. """ - name_pattern = proto.Field( + name_pattern: str = proto.Field( proto.STRING, number=1, ) @@ -189,7 +197,7 @@ class AdmissionRule(proto.Message): evaluation_mode (google.cloud.binaryauthorization_v1beta1.types.AdmissionRule.EvaluationMode): Required. How this admission rule will be evaluated. - require_attestations_by (Sequence[str]): + require_attestations_by (MutableSequence[str]): Optional. The resource names of the attestors that must attest to a container image, in the format ``projects/*/attestors/*``. Each attestor must exist before @@ -220,16 +228,16 @@ class EnforcementMode(proto.Enum): ENFORCED_BLOCK_AND_AUDIT_LOG = 1 DRYRUN_AUDIT_LOG_ONLY = 2 - evaluation_mode = proto.Field( + evaluation_mode: EvaluationMode = proto.Field( proto.ENUM, number=1, enum=EvaluationMode, ) - require_attestations_by = proto.RepeatedField( + require_attestations_by: MutableSequence[str] = proto.RepeatedField( proto.STRING, number=2, ) - enforcement_mode = proto.Field( + enforcement_mode: EnforcementMode = proto.Field( proto.ENUM, number=3, enum=EnforcementMode, @@ -261,21 +269,21 @@ class Attestor(proto.Message): updated. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - description = proto.Field( + description: str = proto.Field( proto.STRING, number=6, ) - user_owned_drydock_note = proto.Field( + user_owned_drydock_note: "UserOwnedDrydockNote" = proto.Field( proto.MESSAGE, number=3, oneof="attestor_type", message="UserOwnedDrydockNote", ) - update_time = proto.Field( + update_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=4, message=timestamp_pb2.Timestamp, @@ -298,7 +306,7 @@ class UserOwnedDrydockNote(proto.Message): ATTESTATION_AUTHORITY Occurrence that names a container image and that links to this Note. Drydock is an external dependency. - public_keys (Sequence[google.cloud.binaryauthorization_v1beta1.types.AttestorPublicKey]): + public_keys (MutableSequence[google.cloud.binaryauthorization_v1beta1.types.AttestorPublicKey]): Optional. Public keys that verify attestations signed by this attestor. This field may be updated. @@ -323,16 +331,16 @@ class UserOwnedDrydockNote(proto.Message): email based on a different naming pattern. """ - note_reference = proto.Field( + note_reference: str = proto.Field( proto.STRING, number=1, ) - public_keys = proto.RepeatedField( + public_keys: MutableSequence["AttestorPublicKey"] = proto.RepeatedField( proto.MESSAGE, number=2, message="AttestorPublicKey", ) - delegation_service_account_email = proto.Field( + delegation_service_account_email: str = proto.Field( proto.STRING, number=3, ) @@ -382,11 +390,11 @@ class SignatureAlgorithm(proto.Enum): ECDSA_P521_SHA512 = 11 EC_SIGN_P521_SHA512 = 11 - public_key_pem = proto.Field( + public_key_pem: str = proto.Field( proto.STRING, number=1, ) - signature_algorithm = proto.Field( + signature_algorithm: SignatureAlgorithm = proto.Field( proto.ENUM, number=2, enum=SignatureAlgorithm, @@ -440,20 +448,20 @@ class AttestorPublicKey(proto.Message): This field is a member of `oneof`_ ``public_key``. """ - comment = proto.Field( + comment: str = proto.Field( proto.STRING, number=1, ) - id = proto.Field( + id: str = proto.Field( proto.STRING, number=2, ) - ascii_armored_pgp_public_key = proto.Field( + ascii_armored_pgp_public_key: str = proto.Field( proto.STRING, number=3, oneof="public_key", ) - pkix_public_key = proto.Field( + pkix_public_key: "PkixPublicKey" = proto.Field( proto.MESSAGE, number=5, oneof="public_key", diff --git a/google/cloud/binaryauthorization_v1beta1/types/service.py b/google/cloud/binaryauthorization_v1beta1/types/service.py index a2ea946..b20e6e1 100644 --- a/google/cloud/binaryauthorization_v1beta1/types/service.py +++ b/google/cloud/binaryauthorization_v1beta1/types/service.py @@ -13,11 +13,12 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + import proto # type: ignore from google.cloud.binaryauthorization_v1beta1.types import resources - __protobuf__ = proto.module( package="google.cloud.binaryauthorization.v1beta1", manifest={ @@ -44,7 +45,7 @@ class GetPolicyRequest(proto.Message): retrieve, in the format ``projects/*/policy``. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -63,7 +64,7 @@ class UpdatePolicyRequest(proto.Message): format ``projects/*/policy``. """ - policy = proto.Field( + policy: resources.Policy = proto.Field( proto.MESSAGE, number=1, message=resources.Policy, @@ -90,15 +91,15 @@ class CreateAttestorRequest(proto.Message): ``projects/*/attestors/*``. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - attestor_id = proto.Field( + attestor_id: str = proto.Field( proto.STRING, number=2, ) - attestor = proto.Field( + attestor: resources.Attestor = proto.Field( proto.MESSAGE, number=3, message=resources.Attestor, @@ -115,7 +116,7 @@ class GetAttestorRequest(proto.Message): to retrieve, in the format ``projects/*/attestors/*``. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -134,7 +135,7 @@ class UpdateAttestorRequest(proto.Message): format ``projects/*/attestors/*``. """ - attestor = proto.Field( + attestor: resources.Attestor = proto.Field( proto.MESSAGE, number=1, message=resources.Attestor, @@ -162,15 +163,15 @@ class ListAttestorsRequest(proto.Message): method. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - page_size = proto.Field( + page_size: int = proto.Field( proto.INT32, number=2, ) - page_token = proto.Field( + page_token: str = proto.Field( proto.STRING, number=3, ) @@ -180,7 +181,7 @@ class ListAttestorsResponse(proto.Message): r"""Response message for [BinauthzManagementService.ListAttestors][]. Attributes: - attestors (Sequence[google.cloud.binaryauthorization_v1beta1.types.Attestor]): + attestors (MutableSequence[google.cloud.binaryauthorization_v1beta1.types.Attestor]): The list of [attestors][google.cloud.binaryauthorization.v1beta1.Attestor]. next_page_token (str): @@ -195,12 +196,12 @@ class ListAttestorsResponse(proto.Message): def raw_page(self): return self - attestors = proto.RepeatedField( + attestors: MutableSequence[resources.Attestor] = proto.RepeatedField( proto.MESSAGE, number=1, message=resources.Attestor, ) - next_page_token = proto.Field( + next_page_token: str = proto.Field( proto.STRING, number=2, ) @@ -216,7 +217,7 @@ class DeleteAttestorRequest(proto.Message): to delete, in the format ``projects/*/attestors/*``. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -232,7 +233,7 @@ class GetSystemPolicyRequest(proto.Message): associated with a project. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) diff --git a/noxfile.py b/noxfile.py index d752b54..d8440c0 100644 --- a/noxfile.py +++ b/noxfile.py @@ -17,6 +17,7 @@ # Generated by synthtool. DO NOT EDIT! from __future__ import absolute_import + import os import pathlib import re diff --git a/owlbot.py b/owlbot.py index 4b3d533..cf12e24 100644 --- a/owlbot.py +++ b/owlbot.py @@ -1,10 +1,10 @@ -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # -# http://www.apache.org/licenses/LICENSE-2.0 +# http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, @@ -12,18 +12,32 @@ # See the License for the specific language governing permissions and # limitations under the License. -"""This script is used to synthesize generated parts of this library.""" +import json +from pathlib import Path +import shutil import synthtool as s import synthtool.gcp as gcp from synthtool.languages import python -common = gcp.CommonTemplates() +# ---------------------------------------------------------------------------- +# Copy the generated client from the owl-bot staging directory +# ---------------------------------------------------------------------------- -default_version = "v1" +clean_up_generated_samples = True + +# Load the default version defined in .repo-metadata.json. +default_version = json.load(open(".repo-metadata.json", "rt")).get( + "default_version" +) for library in s.get_staging_dirs(default_version): + if clean_up_generated_samples: + shutil.rmtree("samples/generated_samples", ignore_errors=True) + clean_up_generated_samples = False + # Rename package to 'google-cloud-binary-authorization' + # Remove once cl/490002122 is submitted s.replace( [library / "google/**/*.py", library / "tests/**/*.py"], "google-cloud-binaryauthorization", @@ -41,7 +55,7 @@ s.replace( [library / "google/**/*.py", library / "tests/**/*.py"], "from grafeas.grafeas_v1 import attestation_pb2", - "from grafeas.grafeas_v1.types import attestation", + "import grafeas.grafeas_v1.types", ) s.replace( @@ -53,30 +67,36 @@ s.replace( [library / "google/**/*.py", library / "tests/**/*.py"], "message=attestation_pb2", - "message=attestation", + "message=grafeas.grafeas_v1.types", ) s.replace( [library / "google/**/*.py", library / "tests/**/*.py"], - "grafeas.v1.attestation_pb2.AttestationOccurrence", - "grafeas.grafeas_v1.types.attestation.AttestationOccurrence", + "attestation: attestation_pb2.AttestationOccurrence", + "attestation: grafeas.grafeas_v1.types.AttestationOccurrence", ) - s.move(library, excludes=["setup.py", "README.rst", "docs/index.rst"]) - + s.replace( + [library / "google/**/*.py", library / "tests/**/*.py"], + "grafeas.v1.attestation_pb2.AttestationOccurrence", + "grafeas.grafeas_v1.types.AttestationOccurrence", + ) + s.move(library, excludes=["setup.py", "**/gapic_version.py"]) s.remove_staging_dirs() # ---------------------------------------------------------------------------- # Add templated files # ---------------------------------------------------------------------------- -templated_files = common.py_library(cov_level=100, microgenerator=True) -python.py_samples(skip_readmes=True) -s.move( - templated_files, - excludes=[".coveragerc"], # the microgenerator has a good coveragerc file +templated_files = gcp.CommonTemplates().py_library( + cov_level=100, + microgenerator=True, + versions=gcp.common.detect_versions(path="./google", default_first=True), ) +s.move(templated_files, excludes=[".coveragerc", ".github/release-please.yml"]) -python.configure_previous_major_version_branches() +python.py_samples(skip_readmes=True) -s.shell.run(["nox", "-s", "blacken"], hide_output=False) +# run format session for all directories which have a noxfile +for noxfile in Path(".").glob("**/noxfile.py"): + s.shell.run(["nox", "-s", "format"], cwd=noxfile.parent, hide_output=False) diff --git a/release-please-config.json b/release-please-config.json new file mode 100644 index 0000000..c81cf44 --- /dev/null +++ b/release-please-config.json @@ -0,0 +1,28 @@ +{ + "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json", + "packages": { + ".": { + "release-type": "python", + "extra-files": [ + "google/cloud/binaryauthorization/gapic_version.py", + { + "type": "json", + "path": "samples/generated_samples/snippet_metadata_google.cloud.binaryauthorization.v1.json", + "jsonpath": "$.clientLibrary.version" + }, + { + "type": "json", + "path": "samples/generated_samples/snippet_metadata_google.cloud.binaryauthorization.v1beta1.json", + "jsonpath": "$.clientLibrary.version" + } + ] + } + }, + "release-type": "python", + "plugins": [ + { + "type": "sentence-case" + } + ], + "initial-version": "0.1.0" +} diff --git a/samples/generated_samples/snippet_metadata_binaryauthorization_v1.json b/samples/generated_samples/snippet_metadata_google.cloud.binaryauthorization.v1.json similarity index 99% rename from samples/generated_samples/snippet_metadata_binaryauthorization_v1.json rename to samples/generated_samples/snippet_metadata_google.cloud.binaryauthorization.v1.json index 5e15984..6d29a4e 100644 --- a/samples/generated_samples/snippet_metadata_binaryauthorization_v1.json +++ b/samples/generated_samples/snippet_metadata_google.cloud.binaryauthorization.v1.json @@ -7,7 +7,8 @@ } ], "language": "PYTHON", - "name": "google-cloud-binaryauthorization" + "name": "google-cloud-binaryauthorization", + "version": "0.1.0" }, "snippets": [ { diff --git a/samples/generated_samples/snippet_metadata_binaryauthorization_v1beta1.json b/samples/generated_samples/snippet_metadata_google.cloud.binaryauthorization.v1beta1.json similarity index 99% rename from samples/generated_samples/snippet_metadata_binaryauthorization_v1beta1.json rename to samples/generated_samples/snippet_metadata_google.cloud.binaryauthorization.v1beta1.json index e73dca4..c59b49a 100644 --- a/samples/generated_samples/snippet_metadata_binaryauthorization_v1beta1.json +++ b/samples/generated_samples/snippet_metadata_google.cloud.binaryauthorization.v1beta1.json @@ -7,7 +7,8 @@ } ], "language": "PYTHON", - "name": "google-cloud-binaryauthorization" + "name": "google-cloud-binaryauthorization", + "version": "0.1.0" }, "snippets": [ { diff --git a/setup.py b/setup.py index 94a5072..9190b9a 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,5 @@ # -*- coding: utf-8 -*- - -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,13 +13,37 @@ # See the License for the specific language governing permissions and # limitations under the License. # - import io import os import setuptools # type: ignore -version = "1.3.3" +package_root = os.path.abspath(os.path.dirname(__file__)) + +name = "google-cloud-binary-authorization" + + +description = "Google Cloud Binaryauthorization API client library" + +version = {} +with open( + os.path.join(package_root, "google/cloud/binaryauthorization/gapic_version.py") +) as fp: + exec(fp.read(), version) +version = version["__version__"] + +if version[0] == "0": + release_status = "Development Status :: 4 - Beta" +else: + release_status = "Development Status :: 5 - Production/Stable" + +dependencies = [ + "google-api-core[grpc] >= 1.33.2, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*", + "proto-plus >= 1.22.0, <2.0.0dev", + "protobuf>=3.19.5,<5.0.0dev,!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5", + "grafeas >= 1.1.2, <2.0dev", +] +url = "https://github.com/googleapis/python-binary-authorization" package_root = os.path.abspath(os.path.dirname(__file__)) @@ -28,40 +51,43 @@ with io.open(readme_filename, encoding="utf-8") as readme_file: readme = readme_file.read() +packages = [ + package + for package in setuptools.PEP420PackageFinder.find() + if package.startswith("google") +] + +namespaces = ["google"] +if "google.cloud" in packages: + namespaces.append("google.cloud") setuptools.setup( - name="google-cloud-binary-authorization", + name=name, version=version, + description=description, long_description=readme, author="Google LLC", author_email="googleapis-packages@google.com", license="Apache 2.0", - url="https://github.com/googleapis/python-binary-authorization", - packages=[ - package - for package in setuptools.PEP420PackageFinder.find() - if package.startswith("google") - ], - namespace_packages=("google", "google.cloud"), - platforms="Posix; MacOS X; Windows", - include_package_data=True, - install_requires=( - "google-api-core[grpc] >= 1.32.0, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*", - "proto-plus >= 1.22.0, <2.0.0dev", - "protobuf>=3.19.5,<5.0.0dev,!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5", - "grafeas >= 1.1.2, <2.0dev", - ), - python_requires=">=3.7", + url=url, classifiers=[ - "Development Status :: 5 - Production/Stable", + release_status, "Intended Audience :: Developers", - "Operating System :: OS Independent", + "License :: OSI Approved :: Apache Software License", + "Programming Language :: Python", + "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", + "Operating System :: OS Independent", "Topic :: Internet", - "Topic :: Software Development :: Libraries :: Python Modules", ], + platforms="Posix; MacOS X; Windows", + packages=packages, + python_requires=">=3.7", + namespace_packages=namespaces, + install_requires=dependencies, + include_package_data=True, zip_safe=False, ) diff --git a/testing/constraints-3.10.txt b/testing/constraints-3.10.txt index e69de29..ed7f9ae 100644 --- a/testing/constraints-3.10.txt +++ b/testing/constraints-3.10.txt @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +# This constraints file is required for unit tests. +# List all library dependencies and extras in this file. +google-api-core +proto-plus +protobuf diff --git a/testing/constraints-3.11.txt b/testing/constraints-3.11.txt index e69de29..ed7f9ae 100644 --- a/testing/constraints-3.11.txt +++ b/testing/constraints-3.11.txt @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +# This constraints file is required for unit tests. +# List all library dependencies and extras in this file. +google-api-core +proto-plus +protobuf diff --git a/testing/constraints-3.7.txt b/testing/constraints-3.7.txt index 0e52024..6f3158c 100644 --- a/testing/constraints-3.7.txt +++ b/testing/constraints-3.7.txt @@ -4,7 +4,6 @@ # Pin the version to the lower bound. # e.g., if setup.py has "google-cloud-foo >= 1.14.0, < 2.0.0dev", # Then this file should have google-cloud-foo==1.14.0 -google-api-core==1.32.0 +google-api-core==1.33.2 proto-plus==1.22.0 -grafeas==1.1.2 protobuf==3.19.5 diff --git a/testing/constraints-3.8.txt b/testing/constraints-3.8.txt index da93009..ed7f9ae 100644 --- a/testing/constraints-3.8.txt +++ b/testing/constraints-3.8.txt @@ -1,2 +1,6 @@ -# This constraints file is left inentionally empty -# so the latest version of dependencies is installed \ No newline at end of file +# -*- coding: utf-8 -*- +# This constraints file is required for unit tests. +# List all library dependencies and extras in this file. +google-api-core +proto-plus +protobuf diff --git a/testing/constraints-3.9.txt b/testing/constraints-3.9.txt index da93009..ed7f9ae 100644 --- a/testing/constraints-3.9.txt +++ b/testing/constraints-3.9.txt @@ -1,2 +1,6 @@ -# This constraints file is left inentionally empty -# so the latest version of dependencies is installed \ No newline at end of file +# -*- coding: utf-8 -*- +# This constraints file is required for unit tests. +# List all library dependencies and extras in this file. +google-api-core +proto-plus +protobuf diff --git a/tests/unit/gapic/binaryauthorization_v1/test_binauthz_management_service_v1.py b/tests/unit/gapic/binaryauthorization_v1/test_binauthz_management_service_v1.py index d39660e..83b869e 100644 --- a/tests/unit/gapic/binaryauthorization_v1/test_binauthz_management_service_v1.py +++ b/tests/unit/gapic/binaryauthorization_v1/test_binauthz_management_service_v1.py @@ -22,38 +22,29 @@ except ImportError: # pragma: NO COVER import mock -import grpc -from grpc.experimental import aio import math -import pytest -from proto.marshal.rules.dates import DurationRule, TimestampRule -from proto.marshal.rules import wrappers +from google.api_core import gapic_v1, grpc_helpers, grpc_helpers_async, path_template from google.api_core import client_options from google.api_core import exceptions as core_exceptions -from google.api_core import gapic_v1 -from google.api_core import grpc_helpers -from google.api_core import grpc_helpers_async -from google.api_core import path_template +import google.auth from google.auth import credentials as ga_credentials from google.auth.exceptions import MutualTLSChannelError +from google.oauth2 import service_account +from google.protobuf import timestamp_pb2 # type: ignore +import grpc +from grpc.experimental import aio +from proto.marshal.rules import wrappers +from proto.marshal.rules.dates import DurationRule, TimestampRule +import pytest + from google.cloud.binaryauthorization_v1.services.binauthz_management_service_v1 import ( BinauthzManagementServiceV1AsyncClient, -) -from google.cloud.binaryauthorization_v1.services.binauthz_management_service_v1 import ( BinauthzManagementServiceV1Client, -) -from google.cloud.binaryauthorization_v1.services.binauthz_management_service_v1 import ( pagers, -) -from google.cloud.binaryauthorization_v1.services.binauthz_management_service_v1 import ( transports, ) -from google.cloud.binaryauthorization_v1.types import resources -from google.cloud.binaryauthorization_v1.types import service -from google.oauth2 import service_account -from google.protobuf import timestamp_pb2 # type: ignore -import google.auth +from google.cloud.binaryauthorization_v1.types import resources, service def client_cert_source_callback(): diff --git a/tests/unit/gapic/binaryauthorization_v1/test_system_policy_v1.py b/tests/unit/gapic/binaryauthorization_v1/test_system_policy_v1.py index 6434861..5bc9fe8 100644 --- a/tests/unit/gapic/binaryauthorization_v1/test_system_policy_v1.py +++ b/tests/unit/gapic/binaryauthorization_v1/test_system_policy_v1.py @@ -22,33 +22,28 @@ except ImportError: # pragma: NO COVER import mock -import grpc -from grpc.experimental import aio import math -import pytest -from proto.marshal.rules.dates import DurationRule, TimestampRule -from proto.marshal.rules import wrappers +from google.api_core import gapic_v1, grpc_helpers, grpc_helpers_async, path_template from google.api_core import client_options from google.api_core import exceptions as core_exceptions -from google.api_core import gapic_v1 -from google.api_core import grpc_helpers -from google.api_core import grpc_helpers_async -from google.api_core import path_template +import google.auth from google.auth import credentials as ga_credentials from google.auth.exceptions import MutualTLSChannelError +from google.oauth2 import service_account +from google.protobuf import timestamp_pb2 # type: ignore +import grpc +from grpc.experimental import aio +from proto.marshal.rules import wrappers +from proto.marshal.rules.dates import DurationRule, TimestampRule +import pytest + from google.cloud.binaryauthorization_v1.services.system_policy_v1 import ( SystemPolicyV1AsyncClient, -) -from google.cloud.binaryauthorization_v1.services.system_policy_v1 import ( SystemPolicyV1Client, + transports, ) -from google.cloud.binaryauthorization_v1.services.system_policy_v1 import transports -from google.cloud.binaryauthorization_v1.types import resources -from google.cloud.binaryauthorization_v1.types import service -from google.oauth2 import service_account -from google.protobuf import timestamp_pb2 # type: ignore -import google.auth +from google.cloud.binaryauthorization_v1.types import resources, service def client_cert_source_callback(): diff --git a/tests/unit/gapic/binaryauthorization_v1/test_validation_helper_v1.py b/tests/unit/gapic/binaryauthorization_v1/test_validation_helper_v1.py index 0589a7d..5d39eef 100644 --- a/tests/unit/gapic/binaryauthorization_v1/test_validation_helper_v1.py +++ b/tests/unit/gapic/binaryauthorization_v1/test_validation_helper_v1.py @@ -22,33 +22,29 @@ except ImportError: # pragma: NO COVER import mock -import grpc -from grpc.experimental import aio import math -import pytest -from proto.marshal.rules.dates import DurationRule, TimestampRule -from proto.marshal.rules import wrappers +from google.api_core import gapic_v1, grpc_helpers, grpc_helpers_async, path_template from google.api_core import client_options from google.api_core import exceptions as core_exceptions -from google.api_core import gapic_v1 -from google.api_core import grpc_helpers -from google.api_core import grpc_helpers_async -from google.api_core import path_template +import google.auth from google.auth import credentials as ga_credentials from google.auth.exceptions import MutualTLSChannelError +from google.oauth2 import service_account +import grafeas.grafeas_v1.types # type: ignore +from grafeas.grafeas_v1.types import common # type: ignore +import grpc +from grpc.experimental import aio +from proto.marshal.rules import wrappers +from proto.marshal.rules.dates import DurationRule, TimestampRule +import pytest + from google.cloud.binaryauthorization_v1.services.validation_helper_v1 import ( ValidationHelperV1AsyncClient, -) -from google.cloud.binaryauthorization_v1.services.validation_helper_v1 import ( ValidationHelperV1Client, + transports, ) -from google.cloud.binaryauthorization_v1.services.validation_helper_v1 import transports from google.cloud.binaryauthorization_v1.types import service -from google.oauth2 import service_account -from grafeas.grafeas_v1.types import attestation # type: ignore -from grafeas.grafeas_v1.types import common # type: ignore -import google.auth def client_cert_source_callback(): diff --git a/tests/unit/gapic/binaryauthorization_v1beta1/test_binauthz_management_service_v1_beta1.py b/tests/unit/gapic/binaryauthorization_v1beta1/test_binauthz_management_service_v1_beta1.py index d01c71a..4d9426e 100644 --- a/tests/unit/gapic/binaryauthorization_v1beta1/test_binauthz_management_service_v1_beta1.py +++ b/tests/unit/gapic/binaryauthorization_v1beta1/test_binauthz_management_service_v1_beta1.py @@ -22,38 +22,29 @@ except ImportError: # pragma: NO COVER import mock -import grpc -from grpc.experimental import aio import math -import pytest -from proto.marshal.rules.dates import DurationRule, TimestampRule -from proto.marshal.rules import wrappers +from google.api_core import gapic_v1, grpc_helpers, grpc_helpers_async, path_template from google.api_core import client_options from google.api_core import exceptions as core_exceptions -from google.api_core import gapic_v1 -from google.api_core import grpc_helpers -from google.api_core import grpc_helpers_async -from google.api_core import path_template +import google.auth from google.auth import credentials as ga_credentials from google.auth.exceptions import MutualTLSChannelError +from google.oauth2 import service_account +from google.protobuf import timestamp_pb2 # type: ignore +import grpc +from grpc.experimental import aio +from proto.marshal.rules import wrappers +from proto.marshal.rules.dates import DurationRule, TimestampRule +import pytest + from google.cloud.binaryauthorization_v1beta1.services.binauthz_management_service_v1_beta1 import ( BinauthzManagementServiceV1Beta1AsyncClient, -) -from google.cloud.binaryauthorization_v1beta1.services.binauthz_management_service_v1_beta1 import ( BinauthzManagementServiceV1Beta1Client, -) -from google.cloud.binaryauthorization_v1beta1.services.binauthz_management_service_v1_beta1 import ( pagers, -) -from google.cloud.binaryauthorization_v1beta1.services.binauthz_management_service_v1_beta1 import ( transports, ) -from google.cloud.binaryauthorization_v1beta1.types import resources -from google.cloud.binaryauthorization_v1beta1.types import service -from google.oauth2 import service_account -from google.protobuf import timestamp_pb2 # type: ignore -import google.auth +from google.cloud.binaryauthorization_v1beta1.types import resources, service def client_cert_source_callback(): diff --git a/tests/unit/gapic/binaryauthorization_v1beta1/test_system_policy_v1_beta1.py b/tests/unit/gapic/binaryauthorization_v1beta1/test_system_policy_v1_beta1.py index 118f909..17449a1 100644 --- a/tests/unit/gapic/binaryauthorization_v1beta1/test_system_policy_v1_beta1.py +++ b/tests/unit/gapic/binaryauthorization_v1beta1/test_system_policy_v1_beta1.py @@ -22,35 +22,28 @@ except ImportError: # pragma: NO COVER import mock -import grpc -from grpc.experimental import aio import math -import pytest -from proto.marshal.rules.dates import DurationRule, TimestampRule -from proto.marshal.rules import wrappers +from google.api_core import gapic_v1, grpc_helpers, grpc_helpers_async, path_template from google.api_core import client_options from google.api_core import exceptions as core_exceptions -from google.api_core import gapic_v1 -from google.api_core import grpc_helpers -from google.api_core import grpc_helpers_async -from google.api_core import path_template +import google.auth from google.auth import credentials as ga_credentials from google.auth.exceptions import MutualTLSChannelError +from google.oauth2 import service_account +from google.protobuf import timestamp_pb2 # type: ignore +import grpc +from grpc.experimental import aio +from proto.marshal.rules import wrappers +from proto.marshal.rules.dates import DurationRule, TimestampRule +import pytest + from google.cloud.binaryauthorization_v1beta1.services.system_policy_v1_beta1 import ( SystemPolicyV1Beta1AsyncClient, -) -from google.cloud.binaryauthorization_v1beta1.services.system_policy_v1_beta1 import ( SystemPolicyV1Beta1Client, -) -from google.cloud.binaryauthorization_v1beta1.services.system_policy_v1_beta1 import ( transports, ) -from google.cloud.binaryauthorization_v1beta1.types import resources -from google.cloud.binaryauthorization_v1beta1.types import service -from google.oauth2 import service_account -from google.protobuf import timestamp_pb2 # type: ignore -import google.auth +from google.cloud.binaryauthorization_v1beta1.types import resources, service def client_cert_source_callback():