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

Commit

Permalink
Browse files Browse the repository at this point in the history
chore: use gapic-generator-python 0.53.4 (#128)
- [ ] 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: googleapis/googleapis-gen@2ff001f
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMmZmMDAxZmJhY2I5ZTc3ZTcxZDczNGRlNWY5NTVjMDVmZGFlODUyNiJ9
  • Loading branch information
gcf-owl-bot[bot] committed Nov 1, 2021
1 parent 190d478 commit 9c8f587
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 156 deletions.
40 changes: 21 additions & 19 deletions google/cloud/oslogin_v1/services/os_login_service/async_client.py
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.oslogin_v1 import common # type: ignore
from google.cloud.oslogin_v1.types import oslogin
from google.protobuf import field_mask_pb2 # type: ignore
Expand Down Expand Up @@ -174,17 +176,17 @@ def __init__(

async def delete_posix_account(
self,
request: oslogin.DeletePosixAccountRequest = None,
request: Union[oslogin.DeletePosixAccountRequest, dict] = None,
*,
name: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> None:
r"""Deletes a POSIX account.
Args:
request (:class:`google.cloud.oslogin_v1.types.DeletePosixAccountRequest`):
request (Union[google.cloud.oslogin_v1.types.DeletePosixAccountRequest, dict]):
The request object. A request message for deleting a
POSIX account entry.
name (:class:`str`):
Expand Down Expand Up @@ -250,17 +252,17 @@ async def delete_posix_account(

async def delete_ssh_public_key(
self,
request: oslogin.DeleteSshPublicKeyRequest = None,
request: Union[oslogin.DeleteSshPublicKeyRequest, dict] = None,
*,
name: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> None:
r"""Deletes an SSH public key.
Args:
request (:class:`google.cloud.oslogin_v1.types.DeleteSshPublicKeyRequest`):
request (Union[google.cloud.oslogin_v1.types.DeleteSshPublicKeyRequest, dict]):
The request object. A request message for deleting an
SSH public key.
name (:class:`str`):
Expand Down Expand Up @@ -326,18 +328,18 @@ async def delete_ssh_public_key(

async def get_login_profile(
self,
request: oslogin.GetLoginProfileRequest = None,
request: Union[oslogin.GetLoginProfileRequest, 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]] = (),
) -> oslogin.LoginProfile:
r"""Retrieves the profile information used for logging in
to a virtual machine on Google Compute Engine.
Args:
request (:class:`google.cloud.oslogin_v1.types.GetLoginProfileRequest`):
request (Union[google.cloud.oslogin_v1.types.GetLoginProfileRequest, dict]):
The request object. A request message for retrieving the
login profile information for a user.
name (:class:`str`):
Expand Down Expand Up @@ -409,17 +411,17 @@ async def get_login_profile(

async def get_ssh_public_key(
self,
request: oslogin.GetSshPublicKeyRequest = None,
request: Union[oslogin.GetSshPublicKeyRequest, 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]] = (),
) -> common.SshPublicKey:
r"""Retrieves an SSH public key.
Args:
request (:class:`google.cloud.oslogin_v1.types.GetSshPublicKeyRequest`):
request (Union[google.cloud.oslogin_v1.types.GetSshPublicKeyRequest, dict]):
The request object. A request message for retrieving an
SSH public key.
name (:class:`str`):
Expand Down Expand Up @@ -492,12 +494,12 @@ async def get_ssh_public_key(

async def import_ssh_public_key(
self,
request: oslogin.ImportSshPublicKeyRequest = None,
request: Union[oslogin.ImportSshPublicKeyRequest, dict] = None,
*,
parent: str = None,
ssh_public_key: common.SshPublicKey = None,
project_id: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> oslogin.ImportSshPublicKeyResponse:
Expand All @@ -507,7 +509,7 @@ async def import_ssh_public_key(
profile.
Args:
request (:class:`google.cloud.oslogin_v1.types.ImportSshPublicKeyRequest`):
request (Union[google.cloud.oslogin_v1.types.ImportSshPublicKeyRequest, dict]):
The request object. A request message for importing an
SSH public key.
parent (:class:`str`):
Expand Down Expand Up @@ -596,20 +598,20 @@ async def import_ssh_public_key(

async def update_ssh_public_key(
self,
request: oslogin.UpdateSshPublicKeyRequest = None,
request: Union[oslogin.UpdateSshPublicKeyRequest, dict] = None,
*,
name: str = None,
ssh_public_key: common.SshPublicKey = None,
update_mask: field_mask_pb2.FieldMask = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> common.SshPublicKey:
r"""Updates an SSH public key and returns the profile
information. This method supports patch semantics.
Args:
request (:class:`google.cloud.oslogin_v1.types.UpdateSshPublicKeyRequest`):
request (Union[google.cloud.oslogin_v1.types.UpdateSshPublicKeyRequest, dict]):
The request object. A request message for updating an
SSH public key.
name (:class:`str`):
Expand Down
14 changes: 8 additions & 6 deletions google/cloud/oslogin_v1/services/os_login_service/client.py
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.oslogin_v1 import common # type: ignore
from google.cloud.oslogin_v1.types import oslogin
from google.protobuf import field_mask_pb2 # type: ignore
Expand Down Expand Up @@ -365,7 +367,7 @@ def delete_posix_account(
request: Union[oslogin.DeletePosixAccountRequest, 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 Expand Up @@ -431,7 +433,7 @@ def delete_ssh_public_key(
request: Union[oslogin.DeleteSshPublicKeyRequest, 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 Expand Up @@ -497,7 +499,7 @@ def get_login_profile(
request: Union[oslogin.GetLoginProfileRequest, 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]] = (),
) -> oslogin.LoginProfile:
Expand Down Expand Up @@ -570,7 +572,7 @@ def get_ssh_public_key(
request: Union[oslogin.GetSshPublicKeyRequest, 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]] = (),
) -> common.SshPublicKey:
Expand Down Expand Up @@ -645,7 +647,7 @@ def import_ssh_public_key(
parent: str = None,
ssh_public_key: common.SshPublicKey = None,
project_id: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> oslogin.ImportSshPublicKeyResponse:
Expand Down Expand Up @@ -739,7 +741,7 @@ def update_ssh_public_key(
name: str = None,
ssh_public_key: common.SshPublicKey = None,
update_mask: field_mask_pb2.FieldMask = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> common.SshPublicKey:
Expand Down
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 @@ -37,15 +36,6 @@
except pkg_resources.DistributionNotFound:
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()

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


class OsLoginServiceTransport(abc.ABC):
"""Abstract transport class for OsLoginService."""
Expand Down Expand Up @@ -98,7 +88,7 @@ def __init__(
host += ":443"
self._host = host

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

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

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

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

scopes_kwargs = {}

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

return scopes_kwargs

def _prep_wrapped_messages(self, client_info):
# Precompute the wrapped methods.
self._wrapped_methods = {
Expand Down
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
3 changes: 1 addition & 2 deletions setup.py
Expand Up @@ -32,10 +32,9 @@
# NOTE: Maintainers, please do not require google-api-core>=2.x.x
# Until this issue is closed
# https://github.com/googleapis/google-cloud-python/issues/10566
"google-api-core[grpc] >= 1.26.0, <3.0.0dev",
"google-api-core[grpc] >= 1.28.0, <3.0.0dev",
"proto-plus >= 1.4.0",
"libcst >= 0.2.5",
"packaging >= 14.3",
]
extras = {}

Expand Down
4 changes: 1 addition & 3 deletions testing/constraints-3.6.txt
Expand Up @@ -5,8 +5,6 @@
#
# e.g., if setup.py has "foo >= 1.14.0, < 2.0.0dev",
# Then this file should have foo==1.14.0
google-api-core==1.26.0
google-api-core==1.28.0
proto-plus==1.4.0
libcst==0.2.5
packaging==14.3
google-auth==1.24.0 # TODO: remove when google-auth>=1.25.0 is transitively required through google-api-core

0 comments on commit 9c8f587

Please sign in to comment.