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

chore: use gapic-generator-python 0.53.4 #83

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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.api_core import operation as gac_operation # type: ignore
from google.api_core import operation_async # type: ignore
from google.cloud.appengine_admin_v1.types import appengine
Expand Down Expand Up @@ -161,16 +163,16 @@ def __init__(

async def get_application(
self,
request: appengine.GetApplicationRequest = None,
request: Union[appengine.GetApplicationRequest, dict] = None,
*,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> application.Application:
r"""Gets information about an application.

Args:
request (:class:`google.cloud.appengine_admin_v1.types.GetApplicationRequest`):
request (Union[google.cloud.appengine_admin_v1.types.GetApplicationRequest, dict]):
The request object. Request message for
`Applications.GetApplication`.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
Expand Down Expand Up @@ -211,9 +213,9 @@ async def get_application(

async def create_application(
self,
request: appengine.CreateApplicationRequest = None,
request: Union[appengine.CreateApplicationRequest, dict] = None,
*,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> operation_async.AsyncOperation:
Expand All @@ -230,7 +232,7 @@ async def create_application(
Billing <https://cloud.google.com/appengine/docs/standard/python/console/>`__.

Args:
request (:class:`google.cloud.appengine_admin_v1.types.CreateApplicationRequest`):
request (Union[google.cloud.appengine_admin_v1.types.CreateApplicationRequest, dict]):
The request object. Request message for
`Applications.CreateApplication`.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
Expand Down Expand Up @@ -274,9 +276,9 @@ async def create_application(

async def update_application(
self,
request: appengine.UpdateApplicationRequest = None,
request: Union[appengine.UpdateApplicationRequest, dict] = None,
*,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> operation_async.AsyncOperation:
Expand All @@ -289,7 +291,7 @@ async def update_application(
the application.

Args:
request (:class:`google.cloud.appengine_admin_v1.types.UpdateApplicationRequest`):
request (Union[google.cloud.appengine_admin_v1.types.UpdateApplicationRequest, dict]):
The request object. Request message for
`Applications.UpdateApplication`.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
Expand Down Expand Up @@ -339,9 +341,9 @@ async def update_application(

async def repair_application(
self,
request: appengine.RepairApplicationRequest = None,
request: Union[appengine.RepairApplicationRequest, dict] = None,
*,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> operation_async.AsyncOperation:
Expand All @@ -358,7 +360,7 @@ async def repair_application(
Cloud Console Activity Log.

Args:
request (:class:`google.cloud.appengine_admin_v1.types.RepairApplicationRequest`):
request (Union[google.cloud.appengine_admin_v1.types.RepairApplicationRequest, dict]):
The request object. Request message for
'Applications.RepairApplication'.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
Expand Down
10 changes: 6 additions & 4 deletions google/cloud/appengine_admin_v1/services/applications/client.py
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.api_core import operation as gac_operation # type: ignore
from google.api_core import operation_async # type: ignore
from google.cloud.appengine_admin_v1.types import appengine
Expand Down Expand Up @@ -337,7 +339,7 @@ def get_application(
self,
request: Union[appengine.GetApplicationRequest, dict] = None,
*,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> application.Application:
Expand Down Expand Up @@ -388,7 +390,7 @@ def create_application(
self,
request: Union[appengine.CreateApplicationRequest, dict] = None,
*,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> gac_operation.Operation:
Expand Down Expand Up @@ -452,7 +454,7 @@ def update_application(
self,
request: Union[appengine.UpdateApplicationRequest, dict] = None,
*,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> gac_operation.Operation:
Expand Down Expand Up @@ -518,7 +520,7 @@ def repair_application(
self,
request: Union[appengine.RepairApplicationRequest, dict] = None,
*,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> gac_operation.Operation:
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 @@ -40,15 +39,6 @@
except pkg_resources.DistributionNotFound:
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()

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


class ApplicationsTransport(abc.ABC):
"""Abstract transport class for Applications."""
Expand Down Expand Up @@ -102,7 +92,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 @@ -135,29 +125,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 Expand Up @@ -185,7 +152,7 @@ def close(self):
raise NotImplementedError()

@property
def operations_client(self) -> operations_v1.OperationsClient:
def operations_client(self):
"""Return the client designed to process long-running operations."""
raise NotImplementedError()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def __init__(
self._grpc_channel = None
self._ssl_channel_credentials = ssl_channel_credentials
self._stubs: Dict[str, Callable] = {}
self._operations_client = None
self._operations_client: Optional[operations_v1.OperationsClient] = None

if api_mtls_endpoint:
warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
from google.api_core import operations_v1 # type: ignore
from google.auth import credentials as ga_credentials # type: ignore
from google.auth.transport.grpc import SslCredentials # type: ignore
import packaging.version

import grpc # type: ignore
from grpc.experimental import aio # type: ignore
Expand Down Expand Up @@ -160,7 +159,7 @@ def __init__(
self._grpc_channel = None
self._ssl_channel_credentials = ssl_channel_credentials
self._stubs: Dict[str, Callable] = {}
self._operations_client = None
self._operations_client: Optional[operations_v1.OperationsAsyncClient] = None

if api_mtls_endpoint:
warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning)
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.appengine_admin_v1.services.authorized_certificates import pagers
from google.cloud.appengine_admin_v1.types import appengine
from google.cloud.appengine_admin_v1.types import certificate
Expand Down Expand Up @@ -169,17 +171,17 @@ def __init__(

async def list_authorized_certificates(
self,
request: appengine.ListAuthorizedCertificatesRequest = None,
request: Union[appengine.ListAuthorizedCertificatesRequest, dict] = None,
*,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> pagers.ListAuthorizedCertificatesAsyncPager:
r"""Lists all SSL certificates the user is authorized to
administer.

Args:
request (:class:`google.cloud.appengine_admin_v1.types.ListAuthorizedCertificatesRequest`):
request (Union[google.cloud.appengine_admin_v1.types.ListAuthorizedCertificatesRequest, dict]):
The request object. Request message for
`AuthorizedCertificates.ListAuthorizedCertificates`.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
Expand Down Expand Up @@ -228,16 +230,16 @@ async def list_authorized_certificates(

async def get_authorized_certificate(
self,
request: appengine.GetAuthorizedCertificateRequest = None,
request: Union[appengine.GetAuthorizedCertificateRequest, dict] = None,
*,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> certificate.AuthorizedCertificate:
r"""Gets the specified SSL certificate.

Args:
request (:class:`google.cloud.appengine_admin_v1.types.GetAuthorizedCertificateRequest`):
request (Union[google.cloud.appengine_admin_v1.types.GetAuthorizedCertificateRequest, dict]):
The request object. Request message for
`AuthorizedCertificates.GetAuthorizedCertificate`.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
Expand Down Expand Up @@ -280,16 +282,16 @@ async def get_authorized_certificate(

async def create_authorized_certificate(
self,
request: appengine.CreateAuthorizedCertificateRequest = None,
request: Union[appengine.CreateAuthorizedCertificateRequest, dict] = None,
*,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> certificate.AuthorizedCertificate:
r"""Uploads the specified SSL certificate.

Args:
request (:class:`google.cloud.appengine_admin_v1.types.CreateAuthorizedCertificateRequest`):
request (Union[google.cloud.appengine_admin_v1.types.CreateAuthorizedCertificateRequest, dict]):
The request object. Request message for
`AuthorizedCertificates.CreateAuthorizedCertificate`.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
Expand Down Expand Up @@ -332,9 +334,9 @@ async def create_authorized_certificate(

async def update_authorized_certificate(
self,
request: appengine.UpdateAuthorizedCertificateRequest = None,
request: Union[appengine.UpdateAuthorizedCertificateRequest, dict] = None,
*,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> certificate.AuthorizedCertificate:
Expand All @@ -346,7 +348,7 @@ async def update_authorized_certificate(
updated.

Args:
request (:class:`google.cloud.appengine_admin_v1.types.UpdateAuthorizedCertificateRequest`):
request (Union[google.cloud.appengine_admin_v1.types.UpdateAuthorizedCertificateRequest, dict]):
The request object. Request message for
`AuthorizedCertificates.UpdateAuthorizedCertificate`.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
Expand Down Expand Up @@ -389,16 +391,16 @@ async def update_authorized_certificate(

async def delete_authorized_certificate(
self,
request: appengine.DeleteAuthorizedCertificateRequest = None,
request: Union[appengine.DeleteAuthorizedCertificateRequest, dict] = None,
*,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> None:
r"""Deletes the specified SSL certificate.

Args:
request (:class:`google.cloud.appengine_admin_v1.types.DeleteAuthorizedCertificateRequest`):
request (Union[google.cloud.appengine_admin_v1.types.DeleteAuthorizedCertificateRequest, dict]):
The request object. Request message for
`AuthorizedCertificates.DeleteAuthorizedCertificate`.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
Expand Down