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

Commit

Permalink
chore: use gapic-generator-python 0.53.4 (#243)
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 9e8aeeb commit 22d4eab
Show file tree
Hide file tree
Showing 44 changed files with 450 additions and 1,109 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.monitoring_v3.services.alert_policy_service import pagers
from google.cloud.monitoring_v3.types import alert
from google.cloud.monitoring_v3.types import alert_service
Expand Down Expand Up @@ -186,18 +188,18 @@ def __init__(

async def list_alert_policies(
self,
request: alert_service.ListAlertPoliciesRequest = None,
request: Union[alert_service.ListAlertPoliciesRequest, 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]] = (),
) -> pagers.ListAlertPoliciesAsyncPager:
r"""Lists the existing alerting policies for the
workspace.
Args:
request (:class:`google.cloud.monitoring_v3.types.ListAlertPoliciesRequest`):
request (Union[google.cloud.monitoring_v3.types.ListAlertPoliciesRequest, dict]):
The request object. The protocol for the
`ListAlertPolicies` request.
name (:class:`str`):
Expand Down Expand Up @@ -286,17 +288,17 @@ async def list_alert_policies(

async def get_alert_policy(
self,
request: alert_service.GetAlertPolicyRequest = None,
request: Union[alert_service.GetAlertPolicyRequest, 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]] = (),
) -> alert.AlertPolicy:
r"""Gets a single alerting policy.
Args:
request (:class:`google.cloud.monitoring_v3.types.GetAlertPolicyRequest`):
request (Union[google.cloud.monitoring_v3.types.GetAlertPolicyRequest, dict]):
The request object. The protocol for the
`GetAlertPolicy` request.
name (:class:`str`):
Expand Down Expand Up @@ -373,18 +375,18 @@ async def get_alert_policy(

async def create_alert_policy(
self,
request: alert_service.CreateAlertPolicyRequest = None,
request: Union[alert_service.CreateAlertPolicyRequest, dict] = None,
*,
name: str = None,
alert_policy: alert.AlertPolicy = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> alert.AlertPolicy:
r"""Creates a new alerting policy.
Args:
request (:class:`google.cloud.monitoring_v3.types.CreateAlertPolicyRequest`):
request (Union[google.cloud.monitoring_v3.types.CreateAlertPolicyRequest, dict]):
The request object. The protocol for the
`CreateAlertPolicy` request.
name (:class:`str`):
Expand Down Expand Up @@ -474,17 +476,17 @@ async def create_alert_policy(

async def delete_alert_policy(
self,
request: alert_service.DeleteAlertPolicyRequest = None,
request: Union[alert_service.DeleteAlertPolicyRequest, 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 alerting policy.
Args:
request (:class:`google.cloud.monitoring_v3.types.DeleteAlertPolicyRequest`):
request (Union[google.cloud.monitoring_v3.types.DeleteAlertPolicyRequest, dict]):
The request object. The protocol for the
`DeleteAlertPolicy` request.
name (:class:`str`):
Expand Down Expand Up @@ -553,11 +555,11 @@ async def delete_alert_policy(

async def update_alert_policy(
self,
request: alert_service.UpdateAlertPolicyRequest = None,
request: Union[alert_service.UpdateAlertPolicyRequest, dict] = None,
*,
update_mask: field_mask_pb2.FieldMask = None,
alert_policy: alert.AlertPolicy = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> alert.AlertPolicy:
Expand All @@ -567,7 +569,7 @@ async def update_alert_policy(
via ``updateMask``. Returns the updated alerting policy.
Args:
request (:class:`google.cloud.monitoring_v3.types.UpdateAlertPolicyRequest`):
request (Union[google.cloud.monitoring_v3.types.UpdateAlertPolicyRequest, dict]):
The request object. The protocol for the
`UpdateAlertPolicy` request.
update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`):
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.monitoring_v3.services.alert_policy_service import pagers
from google.cloud.monitoring_v3.types import alert
from google.cloud.monitoring_v3.types import alert_service
Expand Down Expand Up @@ -385,7 +387,7 @@ def list_alert_policies(
request: Union[alert_service.ListAlertPoliciesRequest, 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]] = (),
) -> pagers.ListAlertPoliciesPager:
Expand Down Expand Up @@ -476,7 +478,7 @@ def get_alert_policy(
request: Union[alert_service.GetAlertPolicyRequest, 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]] = (),
) -> alert.AlertPolicy:
Expand Down Expand Up @@ -555,7 +557,7 @@ def create_alert_policy(
*,
name: str = None,
alert_policy: alert.AlertPolicy = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> alert.AlertPolicy:
Expand Down Expand Up @@ -655,7 +657,7 @@ def delete_alert_policy(
request: Union[alert_service.DeleteAlertPolicyRequest, 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 @@ -726,7 +728,7 @@ def update_alert_policy(
*,
update_mask: field_mask_pb2.FieldMask = None,
alert_policy: alert.AlertPolicy = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> alert.AlertPolicy:
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 @@ -39,15 +38,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 AlertPolicyServiceTransport(abc.ABC):
"""Abstract transport class for AlertPolicyService."""
Expand Down Expand Up @@ -101,7 +91,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 @@ -134,29 +124,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
40 changes: 21 additions & 19 deletions google/cloud/monitoring_v3/services/group_service/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 import monitored_resource_pb2 # type: ignore
from google.cloud.monitoring_v3.services.group_service import pagers
from google.cloud.monitoring_v3.types import group
Expand Down Expand Up @@ -174,17 +176,17 @@ def __init__(

async def list_groups(
self,
request: group_service.ListGroupsRequest = None,
request: Union[group_service.ListGroupsRequest, 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]] = (),
) -> pagers.ListGroupsAsyncPager:
r"""Lists the existing groups.
Args:
request (:class:`google.cloud.monitoring_v3.types.ListGroupsRequest`):
request (Union[google.cloud.monitoring_v3.types.ListGroupsRequest, dict]):
The request object. The `ListGroup` request.
name (:class:`str`):
Required. The
Expand Down Expand Up @@ -266,17 +268,17 @@ async def list_groups(

async def get_group(
self,
request: group_service.GetGroupRequest = None,
request: Union[group_service.GetGroupRequest, 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]] = (),
) -> group.Group:
r"""Gets a single group.
Args:
request (:class:`google.cloud.monitoring_v3.types.GetGroupRequest`):
request (Union[google.cloud.monitoring_v3.types.GetGroupRequest, dict]):
The request object. The `GetGroup` request.
name (:class:`str`):
Required. The group to retrieve. The format is:
Expand Down Expand Up @@ -379,18 +381,18 @@ async def get_group(

async def create_group(
self,
request: group_service.CreateGroupRequest = None,
request: Union[group_service.CreateGroupRequest, dict] = None,
*,
name: str = None,
group: gm_group.Group = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> gm_group.Group:
r"""Creates a new group.
Args:
request (:class:`google.cloud.monitoring_v3.types.CreateGroupRequest`):
request (Union[google.cloud.monitoring_v3.types.CreateGroupRequest, dict]):
The request object. The `CreateGroup` request.
name (:class:`str`):
Required. The
Expand Down Expand Up @@ -495,18 +497,18 @@ async def create_group(

async def update_group(
self,
request: group_service.UpdateGroupRequest = None,
request: Union[group_service.UpdateGroupRequest, dict] = None,
*,
group: gm_group.Group = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> gm_group.Group:
r"""Updates an existing group. You can change any group attributes
except ``name``.
Args:
request (:class:`google.cloud.monitoring_v3.types.UpdateGroupRequest`):
request (Union[google.cloud.monitoring_v3.types.UpdateGroupRequest, dict]):
The request object. The `UpdateGroup` request.
group (:class:`google.cloud.monitoring_v3.types.Group`):
Required. The new definition of the group. All fields of
Expand Down Expand Up @@ -609,17 +611,17 @@ async def update_group(

async def delete_group(
self,
request: group_service.DeleteGroupRequest = None,
request: Union[group_service.DeleteGroupRequest, 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 existing group.
Args:
request (:class:`google.cloud.monitoring_v3.types.DeleteGroupRequest`):
request (Union[google.cloud.monitoring_v3.types.DeleteGroupRequest, dict]):
The request object. The `DeleteGroup` request. The
default behavior is to be able to delete a single group
without any descendants.
Expand Down Expand Up @@ -686,18 +688,18 @@ async def delete_group(

async def list_group_members(
self,
request: group_service.ListGroupMembersRequest = None,
request: Union[group_service.ListGroupMembersRequest, 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]] = (),
) -> pagers.ListGroupMembersAsyncPager:
r"""Lists the monitored resources that are members of a
group.
Args:
request (:class:`google.cloud.monitoring_v3.types.ListGroupMembersRequest`):
request (Union[google.cloud.monitoring_v3.types.ListGroupMembersRequest, dict]):
The request object. The `ListGroupMembers` request.
name (:class:`str`):
Required. The group whose members are listed. The format
Expand Down

0 comments on commit 22d4eab

Please sign in to comment.