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

Commit

Permalink
chore: use gapic-generator-python 0.53.4 (#63)
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: googleapis/googleapis-gen@2ff001f
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMmZmMDAxZmJhY2I5ZTc3ZTcxZDczNGRlNWY5NTVjMDVmZGFlODUyNiJ9
  • Loading branch information
gcf-owl-bot[bot] committed Nov 1, 2021
1 parent 7abca8c commit 5f48f5b
Show file tree
Hide file tree
Showing 8 changed files with 49 additions and 137 deletions.
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.privatecatalog_v1beta1.services.private_catalog import pagers
from google.cloud.privatecatalog_v1beta1.types import private_catalog
from .transports.base import PrivateCatalogTransport, DEFAULT_CLIENT_INFO
Expand Down Expand Up @@ -189,9 +191,9 @@ def __init__(

async def search_catalogs(
self,
request: private_catalog.SearchCatalogsRequest = None,
request: Union[private_catalog.SearchCatalogsRequest, dict] = None,
*,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> pagers.SearchCatalogsAsyncPager:
Expand All @@ -200,7 +202,7 @@ async def search_catalogs(
consumer cloud resource hierarchy context.
Args:
request (:class:`google.cloud.privatecatalog_v1beta1.types.SearchCatalogsRequest`):
request (Union[google.cloud.privatecatalog_v1beta1.types.SearchCatalogsRequest, dict]):
The request object. Request message for
[PrivateCatalog.SearchCatalogs][google.cloud.privatecatalog.v1beta1.PrivateCatalog.SearchCatalogs].
retry (google.api_core.retry.Retry): Designation of what errors, if any,
Expand Down Expand Up @@ -249,9 +251,9 @@ async def search_catalogs(

async def search_products(
self,
request: private_catalog.SearchProductsRequest = None,
request: Union[private_catalog.SearchProductsRequest, dict] = None,
*,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> pagers.SearchProductsAsyncPager:
Expand All @@ -260,7 +262,7 @@ async def search_products(
consumer cloud resource hierarchy context.
Args:
request (:class:`google.cloud.privatecatalog_v1beta1.types.SearchProductsRequest`):
request (Union[google.cloud.privatecatalog_v1beta1.types.SearchProductsRequest, dict]):
The request object. Request message for
[PrivateCatalog.SearchProducts][google.cloud.privatecatalog.v1beta1.PrivateCatalog.SearchProducts].
retry (google.api_core.retry.Retry): Designation of what errors, if any,
Expand Down Expand Up @@ -309,9 +311,9 @@ async def search_products(

async def search_versions(
self,
request: private_catalog.SearchVersionsRequest = None,
request: Union[private_catalog.SearchVersionsRequest, dict] = None,
*,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> pagers.SearchVersionsAsyncPager:
Expand All @@ -320,7 +322,7 @@ async def search_versions(
consumer cloud resource hierarchy context.
Args:
request (:class:`google.cloud.privatecatalog_v1beta1.types.SearchVersionsRequest`):
request (Union[google.cloud.privatecatalog_v1beta1.types.SearchVersionsRequest, dict]):
The request object. Request message for
[PrivateCatalog.SearchVersions][google.cloud.privatecatalog.v1beta1.PrivateCatalog.SearchVersions].
retry (google.api_core.retry.Retry): Designation of what errors, if any,
Expand Down
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.privatecatalog_v1beta1.services.private_catalog import pagers
from google.cloud.privatecatalog_v1beta1.types import private_catalog
from .transports.base import PrivateCatalogTransport, DEFAULT_CLIENT_INFO
Expand Down Expand Up @@ -395,7 +397,7 @@ def search_catalogs(
self,
request: Union[private_catalog.SearchCatalogsRequest, dict] = None,
*,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> pagers.SearchCatalogsPager:
Expand Down Expand Up @@ -456,7 +458,7 @@ def search_products(
self,
request: Union[private_catalog.SearchProductsRequest, dict] = None,
*,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> pagers.SearchProductsPager:
Expand Down Expand Up @@ -517,7 +519,7 @@ def search_versions(
self,
request: Union[private_catalog.SearchVersionsRequest, dict] = None,
*,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> pagers.SearchVersionsPager:
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 PrivateCatalogTransport(abc.ABC):
"""Abstract transport class for PrivateCatalog."""
Expand Down Expand Up @@ -95,7 +85,7 @@ def __init__(
host += ":443"
self._host = host

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

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

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

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

scopes_kwargs = {}

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

return scopes_kwargs

def _prep_wrapped_messages(self, client_info):
# Precompute the wrapped methods.
self._wrapped_methods = {
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
20 changes: 20 additions & 0 deletions google/cloud/privatecatalog_v1beta1/types/private_catalog.py
Expand Up @@ -436,6 +436,13 @@ class Product(proto.Message):
class AssetReference(proto.Message):
r"""Defines the reference of an asset belonging to a product.
This message has `oneof`_ fields (mutually exclusive fields).
For each oneof, at most one member field can be set at the same time.
Setting any member of the oneof automatically clears all other
members.
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
Attributes:
id (str):
Output only. A unique identifier among asset
Expand All @@ -455,10 +462,13 @@ class AssetReference(proto.Message):
asset (str):
Output only. The asset resource name if an
asset is hosted by Private Catalog.
This field is a member of `oneof`_ ``source``.
gcs_path (str):
Output only. The cloud storage object path.
This field is a member of `oneof`_ ``source``.
git_source (google.cloud.privatecatalog_v1beta1.types.GitSource):
Output only. The git source.
This field is a member of `oneof`_ ``source``.
gcs_source (google.cloud.privatecatalog_v1beta1.types.GcsSource):
Output only. The cloud storage source.
create_time (google.protobuf.timestamp_pb2.Timestamp):
Expand Down Expand Up @@ -536,6 +546,13 @@ class GcsSource(proto.Message):
class GitSource(proto.Message):
r"""Defines how to access a Git Source.
This message has `oneof`_ fields (mutually exclusive fields).
For each oneof, at most one member field can be set at the same time.
Setting any member of the oneof automatically clears all other
members.
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
Attributes:
repo (str):
Location of the Git repo to build.
Expand All @@ -548,10 +565,13 @@ class GitSource(proto.Message):
that step's execution.
commit (str):
The revision commit to use.
This field is a member of `oneof`_ ``ref``.
branch (str):
The revision branch to use.
This field is a member of `oneof`_ ``ref``.
tag (str):
The revision tag to use.
This field is a member of `oneof`_ ``ref``.
"""

repo = proto.Field(proto.STRING, number=1,)
Expand Down
3 changes: 1 addition & 2 deletions setup.py
Expand Up @@ -25,9 +25,8 @@
# NOTE: Maintainers, please do not require google-api-core>=2.x.x
# Until this issue is closed
# https://github.com/googleapis/google-cloud-python/issues/10566
"google-api-core[grpc] >= 1.26.0, <3.0.0dev",
"google-api-core[grpc] >= 1.28.0, <3.0.0dev",
"proto-plus >= 1.15.0",
"packaging >= 14.3",
]

package_root = os.path.abspath(os.path.dirname(__file__))
Expand Down
6 changes: 1 addition & 5 deletions testing/constraints-3.6.txt
Expand Up @@ -4,9 +4,5 @@
# 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.26.0
google-api-core==1.28.0
proto-plus==1.15.0
packaging==14.3
# TODO: remove once google-auth>=1.25.0 is required transitively
# through google-api-core>=1.28.0
google-auth==1.24.0

0 comments on commit 5f48f5b

Please sign in to comment.