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

Commit

Permalink
chore: use gapic-generator-python 0.53.4 (#296)
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 73b87f1 commit d4919c0
Show file tree
Hide file tree
Showing 37 changed files with 369 additions and 731 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.dataproc_v1.services.autoscaling_policy_service import pagers
from google.cloud.dataproc_v1.types import autoscaling_policies
from .transports.base import AutoscalingPolicyServiceTransport, DEFAULT_CLIENT_INFO
Expand Down Expand Up @@ -174,18 +176,20 @@ def __init__(

async def create_autoscaling_policy(
self,
request: autoscaling_policies.CreateAutoscalingPolicyRequest = None,
request: Union[
autoscaling_policies.CreateAutoscalingPolicyRequest, dict
] = None,
*,
parent: str = None,
policy: autoscaling_policies.AutoscalingPolicy = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> autoscaling_policies.AutoscalingPolicy:
r"""Creates new autoscaling policy.
Args:
request (:class:`google.cloud.dataproc_v1.types.CreateAutoscalingPolicyRequest`):
request (Union[google.cloud.dataproc_v1.types.CreateAutoscalingPolicyRequest, dict]):
The request object. A request to create an autoscaling
policy.
parent (:class:`str`):
Expand Down Expand Up @@ -266,10 +270,12 @@ async def create_autoscaling_policy(

async def update_autoscaling_policy(
self,
request: autoscaling_policies.UpdateAutoscalingPolicyRequest = None,
request: Union[
autoscaling_policies.UpdateAutoscalingPolicyRequest, dict
] = None,
*,
policy: autoscaling_policies.AutoscalingPolicy = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> autoscaling_policies.AutoscalingPolicy:
Expand All @@ -279,7 +285,7 @@ async def update_autoscaling_policy(
replacements.
Args:
request (:class:`google.cloud.dataproc_v1.types.UpdateAutoscalingPolicyRequest`):
request (Union[google.cloud.dataproc_v1.types.UpdateAutoscalingPolicyRequest, dict]):
The request object. A request to update an autoscaling
policy.
policy (:class:`google.cloud.dataproc_v1.types.AutoscalingPolicy`):
Expand Down Expand Up @@ -352,17 +358,17 @@ async def update_autoscaling_policy(

async def get_autoscaling_policy(
self,
request: autoscaling_policies.GetAutoscalingPolicyRequest = None,
request: Union[autoscaling_policies.GetAutoscalingPolicyRequest, 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]] = (),
) -> autoscaling_policies.AutoscalingPolicy:
r"""Retrieves autoscaling policy.
Args:
request (:class:`google.cloud.dataproc_v1.types.GetAutoscalingPolicyRequest`):
request (Union[google.cloud.dataproc_v1.types.GetAutoscalingPolicyRequest, dict]):
The request object. A request to fetch an autoscaling
policy.
name (:class:`str`):
Expand Down Expand Up @@ -443,17 +449,19 @@ async def get_autoscaling_policy(

async def list_autoscaling_policies(
self,
request: autoscaling_policies.ListAutoscalingPoliciesRequest = None,
request: Union[
autoscaling_policies.ListAutoscalingPoliciesRequest, 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.ListAutoscalingPoliciesAsyncPager:
r"""Lists autoscaling policies in the project.
Args:
request (:class:`google.cloud.dataproc_v1.types.ListAutoscalingPoliciesRequest`):
request (Union[google.cloud.dataproc_v1.types.ListAutoscalingPoliciesRequest, dict]):
The request object. A request to list autoscaling
policies in a project.
parent (:class:`str`):
Expand Down Expand Up @@ -543,10 +551,12 @@ async def list_autoscaling_policies(

async def delete_autoscaling_policy(
self,
request: autoscaling_policies.DeleteAutoscalingPolicyRequest = None,
request: Union[
autoscaling_policies.DeleteAutoscalingPolicyRequest, 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 @@ -555,7 +565,7 @@ async def delete_autoscaling_policy(
more clusters.
Args:
request (:class:`google.cloud.dataproc_v1.types.DeleteAutoscalingPolicyRequest`):
request (Union[google.cloud.dataproc_v1.types.DeleteAutoscalingPolicyRequest, dict]):
The request object. A request to delete an autoscaling
policy.
Autoscaling policies in use by one or more clusters will
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.dataproc_v1.services.autoscaling_policy_service import pagers
from google.cloud.dataproc_v1.types import autoscaling_policies
from .transports.base import AutoscalingPolicyServiceTransport, DEFAULT_CLIENT_INFO
Expand Down Expand Up @@ -361,7 +363,7 @@ def create_autoscaling_policy(
*,
parent: str = None,
policy: autoscaling_policies.AutoscalingPolicy = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> autoscaling_policies.AutoscalingPolicy:
Expand Down Expand Up @@ -456,7 +458,7 @@ def update_autoscaling_policy(
] = None,
*,
policy: autoscaling_policies.AutoscalingPolicy = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> autoscaling_policies.AutoscalingPolicy:
Expand Down Expand Up @@ -534,7 +536,7 @@ def get_autoscaling_policy(
request: Union[autoscaling_policies.GetAutoscalingPolicyRequest, 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]] = (),
) -> autoscaling_policies.AutoscalingPolicy:
Expand Down Expand Up @@ -617,7 +619,7 @@ def list_autoscaling_policies(
] = 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.ListAutoscalingPoliciesPager:
Expand Down Expand Up @@ -711,7 +713,7 @@ def delete_autoscaling_policy(
] = 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 @@ -36,15 +35,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 AutoscalingPolicyServiceTransport(abc.ABC):
"""Abstract transport class for AutoscalingPolicyService."""
Expand Down Expand Up @@ -94,7 +84,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 @@ -127,29 +117,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
28 changes: 15 additions & 13 deletions google/cloud/dataproc_v1/services/batch_controller/async_client.py
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 # type: ignore
from google.api_core import operation_async # type: ignore
from google.cloud.dataproc_v1.services.batch_controller import pagers
Expand Down Expand Up @@ -170,20 +172,20 @@ def __init__(

async def create_batch(
self,
request: batches.CreateBatchRequest = None,
request: Union[batches.CreateBatchRequest, dict] = None,
*,
parent: str = None,
batch: batches.Batch = None,
batch_id: str = 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:
r"""Creates a batch workload that executes
asynchronously.
Args:
request (:class:`google.cloud.dataproc_v1.types.CreateBatchRequest`):
request (Union[google.cloud.dataproc_v1.types.CreateBatchRequest, dict]):
The request object. A request to create a batch
workload.
parent (:class:`str`):
Expand Down Expand Up @@ -274,17 +276,17 @@ async def create_batch(

async def get_batch(
self,
request: batches.GetBatchRequest = None,
request: Union[batches.GetBatchRequest, 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]] = (),
) -> batches.Batch:
r"""Gets the batch workload resource representation.
Args:
request (:class:`google.cloud.dataproc_v1.types.GetBatchRequest`):
request (Union[google.cloud.dataproc_v1.types.GetBatchRequest, dict]):
The request object. A request to get the resource
representation for a batch workload.
name (:class:`str`):
Expand Down Expand Up @@ -345,17 +347,17 @@ async def get_batch(

async def list_batches(
self,
request: batches.ListBatchesRequest = None,
request: Union[batches.ListBatchesRequest, 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.ListBatchesAsyncPager:
r"""Lists batch workloads.
Args:
request (:class:`google.cloud.dataproc_v1.types.ListBatchesRequest`):
request (Union[google.cloud.dataproc_v1.types.ListBatchesRequest, dict]):
The request object. A request to list batch workloads in
a project.
parent (:class:`str`):
Expand Down Expand Up @@ -424,10 +426,10 @@ async def list_batches(

async def delete_batch(
self,
request: batches.DeleteBatchRequest = None,
request: Union[batches.DeleteBatchRequest, 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 @@ -436,7 +438,7 @@ async def delete_batch(
``FAILED_PRECONDITION``.
Args:
request (:class:`google.cloud.dataproc_v1.types.DeleteBatchRequest`):
request (Union[google.cloud.dataproc_v1.types.DeleteBatchRequest, dict]):
The request object. A request to delete a batch
workload.
name (:class:`str`):
Expand Down
Loading

0 comments on commit d4919c0

Please sign in to comment.