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 (#140)
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 a27e626 commit df69ccc
Show file tree
Hide file tree
Showing 26 changed files with 336 additions and 461 deletions.
58 changes: 30 additions & 28 deletions google/cloud/osconfig_v1/services/os_config_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.osconfig_v1.services.os_config_service import pagers
from google.cloud.osconfig_v1.types import patch_deployments
from google.cloud.osconfig_v1.types import patch_jobs
Expand Down Expand Up @@ -176,17 +178,17 @@ def __init__(

async def execute_patch_job(
self,
request: patch_jobs.ExecutePatchJobRequest = None,
request: Union[patch_jobs.ExecutePatchJobRequest, dict] = None,
*,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> patch_jobs.PatchJob:
r"""Patch VM instances by creating and running a patch
job.
Args:
request (:class:`google.cloud.osconfig_v1.types.ExecutePatchJobRequest`):
request (Union[google.cloud.osconfig_v1.types.ExecutePatchJobRequest, dict]):
The request object. A request message to initiate
patching across Compute Engine instances.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
Expand Down Expand Up @@ -234,10 +236,10 @@ async def execute_patch_job(

async def get_patch_job(
self,
request: patch_jobs.GetPatchJobRequest = None,
request: Union[patch_jobs.GetPatchJobRequest, 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]] = (),
) -> patch_jobs.PatchJob:
Expand All @@ -246,7 +248,7 @@ async def get_patch_job(
of completed jobs.
Args:
request (:class:`google.cloud.osconfig_v1.types.GetPatchJobRequest`):
request (Union[google.cloud.osconfig_v1.types.GetPatchJobRequest, dict]):
The request object. Request to get an active or
completed patch job.
name (:class:`str`):
Expand Down Expand Up @@ -315,17 +317,17 @@ async def get_patch_job(

async def cancel_patch_job(
self,
request: patch_jobs.CancelPatchJobRequest = None,
request: Union[patch_jobs.CancelPatchJobRequest, dict] = None,
*,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> patch_jobs.PatchJob:
r"""Cancel a patch job. The patch job must be active.
Canceled patch jobs cannot be restarted.
Args:
request (:class:`google.cloud.osconfig_v1.types.CancelPatchJobRequest`):
request (Union[google.cloud.osconfig_v1.types.CancelPatchJobRequest, dict]):
The request object. Message for canceling a patch job.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
should be retried.
Expand Down Expand Up @@ -372,17 +374,17 @@ async def cancel_patch_job(

async def list_patch_jobs(
self,
request: patch_jobs.ListPatchJobsRequest = None,
request: Union[patch_jobs.ListPatchJobsRequest, 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.ListPatchJobsAsyncPager:
r"""Get a list of patch jobs.
Args:
request (:class:`google.cloud.osconfig_v1.types.ListPatchJobsRequest`):
request (Union[google.cloud.osconfig_v1.types.ListPatchJobsRequest, dict]):
The request object. A request message for listing patch
jobs.
parent (:class:`str`):
Expand Down Expand Up @@ -450,17 +452,17 @@ async def list_patch_jobs(

async def list_patch_job_instance_details(
self,
request: patch_jobs.ListPatchJobInstanceDetailsRequest = None,
request: Union[patch_jobs.ListPatchJobInstanceDetailsRequest, 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.ListPatchJobInstanceDetailsAsyncPager:
r"""Get a list of instance details for a given patch job.
Args:
request (:class:`google.cloud.osconfig_v1.types.ListPatchJobInstanceDetailsRequest`):
request (Union[google.cloud.osconfig_v1.types.ListPatchJobInstanceDetailsRequest, dict]):
The request object. Request to list details for all
instances that are part of a patch job.
parent (:class:`str`):
Expand Down Expand Up @@ -530,19 +532,19 @@ async def list_patch_job_instance_details(

async def create_patch_deployment(
self,
request: patch_deployments.CreatePatchDeploymentRequest = None,
request: Union[patch_deployments.CreatePatchDeploymentRequest, dict] = None,
*,
parent: str = None,
patch_deployment: patch_deployments.PatchDeployment = None,
patch_deployment_id: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> patch_deployments.PatchDeployment:
r"""Create an OS Config patch deployment.
Args:
request (:class:`google.cloud.osconfig_v1.types.CreatePatchDeploymentRequest`):
request (Union[google.cloud.osconfig_v1.types.CreatePatchDeploymentRequest, dict]):
The request object. A request message for creating a
patch deployment.
parent (:class:`str`):
Expand Down Expand Up @@ -633,17 +635,17 @@ async def create_patch_deployment(

async def get_patch_deployment(
self,
request: patch_deployments.GetPatchDeploymentRequest = None,
request: Union[patch_deployments.GetPatchDeploymentRequest, 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]] = (),
) -> patch_deployments.PatchDeployment:
r"""Get an OS Config patch deployment.
Args:
request (:class:`google.cloud.osconfig_v1.types.GetPatchDeploymentRequest`):
request (Union[google.cloud.osconfig_v1.types.GetPatchDeploymentRequest, dict]):
The request object. A request message for retrieving a
patch deployment.
name (:class:`str`):
Expand Down Expand Up @@ -708,17 +710,17 @@ async def get_patch_deployment(

async def list_patch_deployments(
self,
request: patch_deployments.ListPatchDeploymentsRequest = None,
request: Union[patch_deployments.ListPatchDeploymentsRequest, 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.ListPatchDeploymentsAsyncPager:
r"""Get a page of OS Config patch deployments.
Args:
request (:class:`google.cloud.osconfig_v1.types.ListPatchDeploymentsRequest`):
request (Union[google.cloud.osconfig_v1.types.ListPatchDeploymentsRequest, dict]):
The request object. A request message for listing patch
deployments.
parent (:class:`str`):
Expand Down Expand Up @@ -788,17 +790,17 @@ async def list_patch_deployments(

async def delete_patch_deployment(
self,
request: patch_deployments.DeletePatchDeploymentRequest = None,
request: Union[patch_deployments.DeletePatchDeploymentRequest, 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"""Delete an OS Config patch deployment.
Args:
request (:class:`google.cloud.osconfig_v1.types.DeletePatchDeploymentRequest`):
request (Union[google.cloud.osconfig_v1.types.DeletePatchDeploymentRequest, dict]):
The request object. A request message for deleting a
patch deployment.
name (:class:`str`):
Expand Down
20 changes: 11 additions & 9 deletions google/cloud/osconfig_v1/services/os_config_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.osconfig_v1.services.os_config_service import pagers
from google.cloud.osconfig_v1.types import patch_deployments
from google.cloud.osconfig_v1.types import patch_jobs
Expand Down Expand Up @@ -387,7 +389,7 @@ def execute_patch_job(
self,
request: Union[patch_jobs.ExecutePatchJobRequest, dict] = None,
*,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> patch_jobs.PatchJob:
Expand Down Expand Up @@ -447,7 +449,7 @@ def get_patch_job(
request: Union[patch_jobs.GetPatchJobRequest, 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]] = (),
) -> patch_jobs.PatchJob:
Expand Down Expand Up @@ -527,7 +529,7 @@ def cancel_patch_job(
self,
request: Union[patch_jobs.CancelPatchJobRequest, dict] = None,
*,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> patch_jobs.PatchJob:
Expand Down Expand Up @@ -586,7 +588,7 @@ def list_patch_jobs(
request: Union[patch_jobs.ListPatchJobsRequest, 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.ListPatchJobsPager:
Expand Down Expand Up @@ -664,7 +666,7 @@ def list_patch_job_instance_details(
request: Union[patch_jobs.ListPatchJobInstanceDetailsRequest, 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.ListPatchJobInstanceDetailsPager:
Expand Down Expand Up @@ -748,7 +750,7 @@ def create_patch_deployment(
parent: str = None,
patch_deployment: patch_deployments.PatchDeployment = None,
patch_deployment_id: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> patch_deployments.PatchDeployment:
Expand Down Expand Up @@ -849,7 +851,7 @@ def get_patch_deployment(
request: Union[patch_deployments.GetPatchDeploymentRequest, 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]] = (),
) -> patch_deployments.PatchDeployment:
Expand Down Expand Up @@ -924,7 +926,7 @@ def list_patch_deployments(
request: Union[patch_deployments.ListPatchDeploymentsRequest, 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.ListPatchDeploymentsPager:
Expand Down Expand Up @@ -1004,7 +1006,7 @@ def delete_patch_deployment(
request: Union[patch_deployments.DeletePatchDeploymentRequest, 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 @@ -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 OsConfigServiceTransport(abc.ABC):
"""Abstract transport class for OsConfigService."""
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

0 comments on commit df69ccc

Please sign in to comment.