Skip to content
This repository has been archived by the owner on Oct 31, 2023. It is now read-only.

Commit

Permalink
chore: use gapic-generator-python 0.53.4 (#91)
Browse files Browse the repository at this point in the history
- [ ] Regenerate this pull request now.

docs: list oneofs in docstring
fix(deps): require google-api-core >= 1.28.0
fix(deps): drop packaging dependency

committer: busunkim96@
PiperOrigin-RevId: 406468269

Source-Link: googleapis/googleapis@83d81b0

Source-Link: https://github.com/googleapis/googleapis-gen/commit/2ff001fbacb9e77e71d734de5f955c05fdae8526
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMmZmMDAxZmJhY2I5ZTc3ZTcxZDczNGRlNWY5NTVjMDVmZGFlODUyNiJ9
  • Loading branch information
gcf-owl-bot[bot] authored Nov 1, 2021
1 parent fbb3821 commit d02c2fd
Show file tree
Hide file tree
Showing 25 changed files with 161 additions and 545 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@
from typing import Dict, Sequence, Tuple, Type, Union
import pkg_resources

import google.api_core.client_options as ClientOptions # type: ignore
from google.api_core.client_options import ClientOptions # type: ignore
from google.api_core import exceptions as core_exceptions # type: ignore
from google.api_core import gapic_v1 # type: ignore
from google.api_core import retry as retries # type: ignore
from google.auth import credentials as ga_credentials # type: ignore
from google.oauth2 import service_account # type: ignore

OptionalRetry = Union[retries.Retry, object]

from google.cloud.binaryauthorization_v1.services.binauthz_management_service_v1 import (
pagers,
)
Expand Down Expand Up @@ -187,10 +189,10 @@ def __init__(

async def get_policy(
self,
request: service.GetPolicyRequest = None,
request: Union[service.GetPolicyRequest, dict] = None,
*,
name: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> resources.Policy:
Expand All @@ -207,7 +209,7 @@ async def get_policy(
project does not have one.
Args:
request (:class:`google.cloud.binaryauthorization_v1.types.GetPolicyRequest`):
request (Union[google.cloud.binaryauthorization_v1.types.GetPolicyRequest, dict]):
The request object. Request message for
[BinauthzManagementService.GetPolicy][].
name (:class:`str`):
Expand Down Expand Up @@ -279,10 +281,10 @@ async def get_policy(

async def update_policy(
self,
request: service.UpdatePolicyRequest = None,
request: Union[service.UpdatePolicyRequest, dict] = None,
*,
policy: resources.Policy = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> resources.Policy:
Expand All @@ -296,7 +298,7 @@ async def update_policy(
request is malformed.
Args:
request (:class:`google.cloud.binaryauthorization_v1.types.UpdatePolicyRequest`):
request (Union[google.cloud.binaryauthorization_v1.types.UpdatePolicyRequest, dict]):
The request object. Request message for
[BinauthzManagementService.UpdatePolicy][].
policy (:class:`google.cloud.binaryauthorization_v1.types.Policy`):
Expand Down Expand Up @@ -373,12 +375,12 @@ async def update_policy(

async def create_attestor(
self,
request: service.CreateAttestorRequest = None,
request: Union[service.CreateAttestorRequest, dict] = None,
*,
parent: str = None,
attestor_id: str = None,
attestor: resources.Attestor = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> resources.Attestor:
Expand All @@ -392,7 +394,7 @@ async def create_attestor(
already exists.
Args:
request (:class:`google.cloud.binaryauthorization_v1.types.CreateAttestorRequest`):
request (Union[google.cloud.binaryauthorization_v1.types.CreateAttestorRequest, dict]):
The request object. Request message for
[BinauthzManagementService.CreateAttestor][].
parent (:class:`str`):
Expand Down Expand Up @@ -477,10 +479,10 @@ async def create_attestor(

async def get_attestor(
self,
request: service.GetAttestorRequest = None,
request: Union[service.GetAttestorRequest, dict] = None,
*,
name: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> resources.Attestor:
Expand All @@ -491,7 +493,7 @@ async def get_attestor(
not exist.
Args:
request (:class:`google.cloud.binaryauthorization_v1.types.GetAttestorRequest`):
request (Union[google.cloud.binaryauthorization_v1.types.GetAttestorRequest, dict]):
The request object. Request message for
[BinauthzManagementService.GetAttestor][].
name (:class:`str`):
Expand Down Expand Up @@ -564,10 +566,10 @@ async def get_attestor(

async def update_attestor(
self,
request: service.UpdateAttestorRequest = None,
request: Union[service.UpdateAttestorRequest, dict] = None,
*,
attestor: resources.Attestor = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> resources.Attestor:
Expand All @@ -578,7 +580,7 @@ async def update_attestor(
not exist.
Args:
request (:class:`google.cloud.binaryauthorization_v1.types.UpdateAttestorRequest`):
request (Union[google.cloud.binaryauthorization_v1.types.UpdateAttestorRequest, dict]):
The request object. Request message for
[BinauthzManagementService.UpdateAttestor][].
attestor (:class:`google.cloud.binaryauthorization_v1.types.Attestor`):
Expand Down Expand Up @@ -656,18 +658,18 @@ async def update_attestor(

async def list_attestors(
self,
request: service.ListAttestorsRequest = None,
request: Union[service.ListAttestorsRequest, dict] = None,
*,
parent: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> pagers.ListAttestorsAsyncPager:
r"""Lists [attestors][google.cloud.binaryauthorization.v1.Attestor].
Returns INVALID_ARGUMENT if the project does not exist.
Args:
request (:class:`google.cloud.binaryauthorization_v1.types.ListAttestorsRequest`):
request (Union[google.cloud.binaryauthorization_v1.types.ListAttestorsRequest, dict]):
The request object. Request message for
[BinauthzManagementService.ListAttestors][].
parent (:class:`str`):
Expand Down Expand Up @@ -749,10 +751,10 @@ async def list_attestors(

async def delete_attestor(
self,
request: service.DeleteAttestorRequest = None,
request: Union[service.DeleteAttestorRequest, dict] = None,
*,
name: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> None:
Expand All @@ -763,7 +765,7 @@ async def delete_attestor(
not exist.
Args:
request (:class:`google.cloud.binaryauthorization_v1.types.DeleteAttestorRequest`):
request (Union[google.cloud.binaryauthorization_v1.types.DeleteAttestorRequest, dict]):
The request object. Request message for
[BinauthzManagementService.DeleteAttestor][].
name (:class:`str`):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
from google.auth.exceptions import MutualTLSChannelError # type: ignore
from google.oauth2 import service_account # type: ignore

OptionalRetry = Union[retries.Retry, object]

from google.cloud.binaryauthorization_v1.services.binauthz_management_service_v1 import (
pagers,
)
Expand Down Expand Up @@ -377,7 +379,7 @@ def get_policy(
request: Union[service.GetPolicyRequest, dict] = None,
*,
name: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> resources.Policy:
Expand Down Expand Up @@ -459,7 +461,7 @@ def update_policy(
request: Union[service.UpdatePolicyRequest, dict] = None,
*,
policy: resources.Policy = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> resources.Policy:
Expand Down Expand Up @@ -545,7 +547,7 @@ def create_attestor(
parent: str = None,
attestor_id: str = None,
attestor: resources.Attestor = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> resources.Attestor:
Expand Down Expand Up @@ -647,7 +649,7 @@ def get_attestor(
request: Union[service.GetAttestorRequest, dict] = None,
*,
name: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> resources.Attestor:
Expand Down Expand Up @@ -724,7 +726,7 @@ def update_attestor(
request: Union[service.UpdateAttestorRequest, dict] = None,
*,
attestor: resources.Attestor = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> resources.Attestor:
Expand Down Expand Up @@ -806,7 +808,7 @@ def list_attestors(
request: Union[service.ListAttestorsRequest, dict] = None,
*,
parent: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> pagers.ListAttestorsPager:
Expand Down Expand Up @@ -889,7 +891,7 @@ def delete_attestor(
request: Union[service.DeleteAttestorRequest, dict] = None,
*,
name: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#
import abc
from typing import Awaitable, Callable, Dict, Optional, Sequence, Union
import packaging.version
import pkg_resources

import google.auth # type: ignore
Expand All @@ -39,15 +38,6 @@
except pkg_resources.DistributionNotFound:
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()

try:
# google.auth.__version__ was added in 1.26.0
_GOOGLE_AUTH_VERSION = google.auth.__version__
except AttributeError:
try: # try pkg_resources if it is available
_GOOGLE_AUTH_VERSION = pkg_resources.get_distribution("google-auth").version
except pkg_resources.DistributionNotFound: # pragma: NO COVER
_GOOGLE_AUTH_VERSION = None


class BinauthzManagementServiceV1Transport(abc.ABC):
"""Abstract transport class for BinauthzManagementServiceV1."""
Expand Down Expand Up @@ -97,7 +87,7 @@ def __init__(
host += ":443"
self._host = host

scopes_kwargs = self._get_scopes_kwargs(self._host, scopes)
scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES}

# Save the scopes.
self._scopes = scopes
Expand Down Expand Up @@ -130,29 +120,6 @@ def __init__(
# Save the credentials.
self._credentials = credentials

# TODO(busunkim): This method is in the base transport
# to avoid duplicating code across the transport classes. These functions
# should be deleted once the minimum required versions of google-auth is increased.

# TODO: Remove this function once google-auth >= 1.25.0 is required
@classmethod
def _get_scopes_kwargs(
cls, host: str, scopes: Optional[Sequence[str]]
) -> Dict[str, Optional[Sequence[str]]]:
"""Returns scopes kwargs to pass to google-auth methods depending on the google-auth version"""

scopes_kwargs = {}

if _GOOGLE_AUTH_VERSION and (
packaging.version.parse(_GOOGLE_AUTH_VERSION)
>= packaging.version.parse("1.25.0")
):
scopes_kwargs = {"scopes": scopes, "default_scopes": cls.AUTH_SCOPES}
else:
scopes_kwargs = {"scopes": scopes or cls.AUTH_SCOPES}

return scopes_kwargs

def _prep_wrapped_messages(self, client_info):
# Precompute the wrapped methods.
self._wrapped_methods = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
from google.api_core import grpc_helpers_async # type: ignore
from google.auth import credentials as ga_credentials # type: ignore
from google.auth.transport.grpc import SslCredentials # type: ignore
import packaging.version

import grpc # type: ignore
from grpc.experimental import aio # type: ignore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@
from typing import Dict, Sequence, Tuple, Type, Union
import pkg_resources

import google.api_core.client_options as ClientOptions # type: ignore
from google.api_core.client_options import ClientOptions # type: ignore
from google.api_core import exceptions as core_exceptions # type: ignore
from google.api_core import gapic_v1 # type: ignore
from google.api_core import retry as retries # type: ignore
from google.auth import credentials as ga_credentials # type: ignore
from google.oauth2 import service_account # type: ignore

OptionalRetry = Union[retries.Retry, object]

from google.cloud.binaryauthorization_v1.types import resources
from google.cloud.binaryauthorization_v1.types import service
from google.protobuf import timestamp_pb2 # type: ignore
Expand Down Expand Up @@ -164,18 +166,18 @@ def __init__(

async def get_system_policy(
self,
request: service.GetSystemPolicyRequest = None,
request: Union[service.GetSystemPolicyRequest, dict] = None,
*,
name: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> resources.Policy:
r"""Gets the current system policy in the specified
location.
Args:
request (:class:`google.cloud.binaryauthorization_v1.types.GetSystemPolicyRequest`):
request (Union[google.cloud.binaryauthorization_v1.types.GetSystemPolicyRequest, dict]):
The request object. Request to read the current system
policy.
name (:class:`str`):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
from google.auth.exceptions import MutualTLSChannelError # type: ignore
from google.oauth2 import service_account # type: ignore

OptionalRetry = Union[retries.Retry, object]

from google.cloud.binaryauthorization_v1.types import resources
from google.cloud.binaryauthorization_v1.types import service
from google.protobuf import timestamp_pb2 # type: ignore
Expand Down Expand Up @@ -348,7 +350,7 @@ def get_system_policy(
request: Union[service.GetSystemPolicyRequest, dict] = None,
*,
name: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> resources.Policy:
Expand Down
Loading

0 comments on commit d02c2fd

Please sign in to comment.