Skip to content

Commit

Permalink
chore: use gapic-generator-python 0.53.4 (#156)
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] authored Nov 1, 2021
1 parent a120a56 commit a1f6c29
Show file tree
Hide file tree
Showing 16 changed files with 134 additions and 307 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.scheduler_v1.services.cloud_scheduler import pagers
from google.cloud.scheduler_v1.types import cloudscheduler
from google.cloud.scheduler_v1.types import job
Expand Down Expand Up @@ -174,17 +176,17 @@ def __init__(

async def list_jobs(
self,
request: cloudscheduler.ListJobsRequest = None,
request: Union[cloudscheduler.ListJobsRequest, 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.ListJobsAsyncPager:
r"""Lists jobs.
Args:
request (:class:`google.cloud.scheduler_v1.types.ListJobsRequest`):
request (Union[google.cloud.scheduler_v1.types.ListJobsRequest, dict]):
The request object. Request message for listing jobs
using
[ListJobs][google.cloud.scheduler.v1.CloudScheduler.ListJobs].
Expand Down Expand Up @@ -265,17 +267,17 @@ async def list_jobs(

async def get_job(
self,
request: cloudscheduler.GetJobRequest = None,
request: Union[cloudscheduler.GetJobRequest, 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]] = (),
) -> job.Job:
r"""Gets a job.
Args:
request (:class:`google.cloud.scheduler_v1.types.GetJobRequest`):
request (Union[google.cloud.scheduler_v1.types.GetJobRequest, dict]):
The request object. Request message for
[GetJob][google.cloud.scheduler.v1.CloudScheduler.GetJob].
name (:class:`str`):
Expand Down Expand Up @@ -347,18 +349,18 @@ async def get_job(

async def create_job(
self,
request: cloudscheduler.CreateJobRequest = None,
request: Union[cloudscheduler.CreateJobRequest, dict] = None,
*,
parent: str = None,
job: gcs_job.Job = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> gcs_job.Job:
r"""Creates a job.
Args:
request (:class:`google.cloud.scheduler_v1.types.CreateJobRequest`):
request (Union[google.cloud.scheduler_v1.types.CreateJobRequest, dict]):
The request object. Request message for
[CreateJob][google.cloud.scheduler.v1.CloudScheduler.CreateJob].
parent (:class:`str`):
Expand Down Expand Up @@ -435,11 +437,11 @@ async def create_job(

async def update_job(
self,
request: cloudscheduler.UpdateJobRequest = None,
request: Union[cloudscheduler.UpdateJobRequest, dict] = None,
*,
job: gcs_job.Job = 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]] = (),
) -> gcs_job.Job:
Expand All @@ -457,7 +459,7 @@ async def update_job(
received.
Args:
request (:class:`google.cloud.scheduler_v1.types.UpdateJobRequest`):
request (Union[google.cloud.scheduler_v1.types.UpdateJobRequest, dict]):
The request object. Request message for
[UpdateJob][google.cloud.scheduler.v1.CloudScheduler.UpdateJob].
job (:class:`google.cloud.scheduler_v1.types.Job`):
Expand Down Expand Up @@ -533,17 +535,17 @@ async def update_job(

async def delete_job(
self,
request: cloudscheduler.DeleteJobRequest = None,
request: Union[cloudscheduler.DeleteJobRequest, 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 job.
Args:
request (:class:`google.cloud.scheduler_v1.types.DeleteJobRequest`):
request (Union[google.cloud.scheduler_v1.types.DeleteJobRequest, dict]):
The request object. Request message for deleting a job
using
[DeleteJob][google.cloud.scheduler.v1.CloudScheduler.DeleteJob].
Expand Down Expand Up @@ -608,10 +610,10 @@ async def delete_job(

async def pause_job(
self,
request: cloudscheduler.PauseJobRequest = None,
request: Union[cloudscheduler.PauseJobRequest, 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]] = (),
) -> job.Job:
Expand All @@ -629,7 +631,7 @@ async def pause_job(
to be paused.
Args:
request (:class:`google.cloud.scheduler_v1.types.PauseJobRequest`):
request (Union[google.cloud.scheduler_v1.types.PauseJobRequest, dict]):
The request object. Request message for
[PauseJob][google.cloud.scheduler.v1.CloudScheduler.PauseJob].
name (:class:`str`):
Expand Down Expand Up @@ -691,10 +693,10 @@ async def pause_job(

async def resume_job(
self,
request: cloudscheduler.ResumeJobRequest = None,
request: Union[cloudscheduler.ResumeJobRequest, 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]] = (),
) -> job.Job:
Expand All @@ -711,7 +713,7 @@ async def resume_job(
to be resumed.
Args:
request (:class:`google.cloud.scheduler_v1.types.ResumeJobRequest`):
request (Union[google.cloud.scheduler_v1.types.ResumeJobRequest, dict]):
The request object. Request message for
[ResumeJob][google.cloud.scheduler.v1.CloudScheduler.ResumeJob].
name (:class:`str`):
Expand Down Expand Up @@ -773,10 +775,10 @@ async def resume_job(

async def run_job(
self,
request: cloudscheduler.RunJobRequest = None,
request: Union[cloudscheduler.RunJobRequest, 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]] = (),
) -> job.Job:
Expand All @@ -785,7 +787,7 @@ async def run_job(
dispatch the job, even if the job is already running.
Args:
request (:class:`google.cloud.scheduler_v1.types.RunJobRequest`):
request (Union[google.cloud.scheduler_v1.types.RunJobRequest, dict]):
The request object. Request message for forcing a job to
run now using
[RunJob][google.cloud.scheduler.v1.CloudScheduler.RunJob].
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.scheduler_v1.services.cloud_scheduler import pagers
from google.cloud.scheduler_v1.types import cloudscheduler
from google.cloud.scheduler_v1.types import job
Expand Down Expand Up @@ -372,7 +374,7 @@ def list_jobs(
request: Union[cloudscheduler.ListJobsRequest, 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.ListJobsPager:
Expand Down Expand Up @@ -453,7 +455,7 @@ def get_job(
request: Union[cloudscheduler.GetJobRequest, 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]] = (),
) -> job.Job:
Expand Down Expand Up @@ -526,7 +528,7 @@ def create_job(
*,
parent: str = None,
job: gcs_job.Job = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> gcs_job.Job:
Expand Down Expand Up @@ -614,7 +616,7 @@ def update_job(
*,
job: gcs_job.Job = 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]] = (),
) -> gcs_job.Job:
Expand Down Expand Up @@ -711,7 +713,7 @@ def delete_job(
request: Union[cloudscheduler.DeleteJobRequest, 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 @@ -776,7 +778,7 @@ def pause_job(
request: Union[cloudscheduler.PauseJobRequest, 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]] = (),
) -> job.Job:
Expand Down Expand Up @@ -859,7 +861,7 @@ def resume_job(
request: Union[cloudscheduler.ResumeJobRequest, 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]] = (),
) -> job.Job:
Expand Down Expand Up @@ -941,7 +943,7 @@ def run_job(
request: Union[cloudscheduler.RunJobRequest, 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]] = (),
) -> job.Job:
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 @@ -38,15 +37,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 CloudSchedulerTransport(abc.ABC):
"""Abstract transport class for CloudScheduler."""
Expand Down Expand Up @@ -96,7 +86,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 @@ -129,29 +119,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 @@ -30,6 +30,13 @@ class Job(proto.Message):
r"""Configuration for a job.
The maximum allowed size for a job is 100KB.
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:
name (str):
Optionally caller-specified in
Expand Down Expand Up @@ -62,10 +69,13 @@ class Job(proto.Message):
not contain more than 500 characters.
pubsub_target (google.cloud.scheduler_v1.types.PubsubTarget):
Pub/Sub target.
This field is a member of `oneof`_ ``target``.
app_engine_http_target (google.cloud.scheduler_v1.types.AppEngineHttpTarget):
App Engine HTTP target.
This field is a member of `oneof`_ ``target``.
http_target (google.cloud.scheduler_v1.types.HttpTarget):
HTTP target.
This field is a member of `oneof`_ ``target``.
schedule (str):
Required, except when used with
[UpdateJob][google.cloud.scheduler.v1.CloudScheduler.UpdateJob].
Expand Down
Loading

0 comments on commit a1f6c29

Please sign in to comment.