Skip to content
This repository has been archived by the owner on Jan 17, 2024. It is now read-only.

Commit

Permalink
chore: use gapic-generator-python 0.53.4 (#129)
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 c1d74f0 commit 6044b1b
Show file tree
Hide file tree
Showing 11 changed files with 97 additions and 158 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.monitoring_dashboard_v1.services.dashboards_service import pagers
from google.cloud.monitoring_dashboard_v1.types import dashboard
from google.cloud.monitoring_dashboard_v1.types import dashboards_service
Expand Down Expand Up @@ -171,9 +173,9 @@ def __init__(

async def create_dashboard(
self,
request: dashboards_service.CreateDashboardRequest = None,
request: Union[dashboards_service.CreateDashboardRequest, dict] = None,
*,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> dashboard.Dashboard:
Expand All @@ -186,7 +188,7 @@ async def create_dashboard(
Management <https://cloud.google.com/iam>`__.
Args:
request (:class:`google.cloud.monitoring_dashboard_v1.types.CreateDashboardRequest`):
request (Union[google.cloud.monitoring_dashboard_v1.types.CreateDashboardRequest, dict]):
The request object. The `CreateDashboard` request.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
should be retried.
Expand Down Expand Up @@ -227,9 +229,9 @@ async def create_dashboard(

async def list_dashboards(
self,
request: dashboards_service.ListDashboardsRequest = None,
request: Union[dashboards_service.ListDashboardsRequest, dict] = None,
*,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> pagers.ListDashboardsAsyncPager:
Expand All @@ -241,7 +243,7 @@ async def list_dashboards(
Management <https://cloud.google.com/iam>`__.
Args:
request (:class:`google.cloud.monitoring_dashboard_v1.types.ListDashboardsRequest`):
request (Union[google.cloud.monitoring_dashboard_v1.types.ListDashboardsRequest, dict]):
The request object. The `ListDashboards` request.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
should be retried.
Expand Down Expand Up @@ -288,9 +290,9 @@ async def list_dashboards(

async def get_dashboard(
self,
request: dashboards_service.GetDashboardRequest = None,
request: Union[dashboards_service.GetDashboardRequest, dict] = None,
*,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> dashboard.Dashboard:
Expand All @@ -302,7 +304,7 @@ async def get_dashboard(
Management <https://cloud.google.com/iam>`__.
Args:
request (:class:`google.cloud.monitoring_dashboard_v1.types.GetDashboardRequest`):
request (Union[google.cloud.monitoring_dashboard_v1.types.GetDashboardRequest, dict]):
The request object. The `GetDashboard` request.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
should be retried.
Expand Down Expand Up @@ -343,9 +345,9 @@ async def get_dashboard(

async def delete_dashboard(
self,
request: dashboards_service.DeleteDashboardRequest = None,
request: Union[dashboards_service.DeleteDashboardRequest, dict] = 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 @@ -357,7 +359,7 @@ async def delete_dashboard(
Management <https://cloud.google.com/iam>`__.
Args:
request (:class:`google.cloud.monitoring_dashboard_v1.types.DeleteDashboardRequest`):
request (Union[google.cloud.monitoring_dashboard_v1.types.DeleteDashboardRequest, dict]):
The request object. The `DeleteDashboard` request.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
should be retried.
Expand Down Expand Up @@ -389,9 +391,9 @@ async def delete_dashboard(

async def update_dashboard(
self,
request: dashboards_service.UpdateDashboardRequest = None,
request: Union[dashboards_service.UpdateDashboardRequest, dict] = None,
*,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> dashboard.Dashboard:
Expand All @@ -403,7 +405,7 @@ async def update_dashboard(
Management <https://cloud.google.com/iam>`__.
Args:
request (:class:`google.cloud.monitoring_dashboard_v1.types.UpdateDashboardRequest`):
request (Union[google.cloud.monitoring_dashboard_v1.types.UpdateDashboardRequest, dict]):
The request object. The `UpdateDashboard` request.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
should be retried.
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.monitoring_dashboard_v1.services.dashboards_service import pagers
from google.cloud.monitoring_dashboard_v1.types import dashboard
from google.cloud.monitoring_dashboard_v1.types import dashboards_service
Expand Down Expand Up @@ -369,7 +371,7 @@ def create_dashboard(
self,
request: Union[dashboards_service.CreateDashboardRequest, dict] = None,
*,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> dashboard.Dashboard:
Expand Down Expand Up @@ -426,7 +428,7 @@ def list_dashboards(
self,
request: Union[dashboards_service.ListDashboardsRequest, dict] = None,
*,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> pagers.ListDashboardsPager:
Expand Down Expand Up @@ -488,7 +490,7 @@ def get_dashboard(
self,
request: Union[dashboards_service.GetDashboardRequest, dict] = None,
*,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> dashboard.Dashboard:
Expand Down Expand Up @@ -544,7 +546,7 @@ def delete_dashboard(
self,
request: Union[dashboards_service.DeleteDashboardRequest, dict] = 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 @@ -591,7 +593,7 @@ def update_dashboard(
self,
request: Union[dashboards_service.UpdateDashboardRequest, dict] = None,
*,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> dashboard.Dashboard:
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 @@ -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 DashboardsServiceTransport(abc.ABC):
"""Abstract transport class for DashboardsService."""
Expand Down Expand Up @@ -102,7 +92,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 @@ -135,29 +125,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
11 changes: 11 additions & 0 deletions google/cloud/monitoring_dashboard_v1/types/dashboard.py
Expand Up @@ -27,6 +27,13 @@ class Dashboard(proto.Message):
r"""A Google Stackdriver dashboard. Dashboards define the content
and layout of pages in the Stackdriver web application.
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):
Immutable. The resource name of the
Expand All @@ -46,16 +53,20 @@ class Dashboard(proto.Message):
Content is arranged with a basic layout that
re-flows a simple list of informational elements
like widgets or tiles.
This field is a member of `oneof`_ ``layout``.
mosaic_layout (google.cloud.monitoring_dashboard_v1.types.MosaicLayout):
The content is arranged as a grid of tiles,
with each content widget occupying one or more
grid blocks.
This field is a member of `oneof`_ ``layout``.
row_layout (google.cloud.monitoring_dashboard_v1.types.RowLayout):
The content is divided into equally spaced
rows and the widgets are arranged horizontally.
This field is a member of `oneof`_ ``layout``.
column_layout (google.cloud.monitoring_dashboard_v1.types.ColumnLayout):
The content is divided into equally spaced
columns and the widgets are arranged vertically.
This field is a member of `oneof`_ ``layout``.
"""

name = proto.Field(proto.STRING, number=1,)
Expand Down
28 changes: 28 additions & 0 deletions google/cloud/monitoring_dashboard_v1/types/metrics.py
Expand Up @@ -43,14 +43,24 @@ class TimeSeriesQuery(proto.Message):
r"""TimeSeriesQuery collects the set of supported methods for
querying time series data from the Stackdriver metrics API.
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:
time_series_filter (google.cloud.monitoring_dashboard_v1.types.TimeSeriesFilter):
Filter parameters to fetch time series.
This field is a member of `oneof`_ ``source``.
time_series_filter_ratio (google.cloud.monitoring_dashboard_v1.types.TimeSeriesFilterRatio):
Parameters to fetch a ratio between two time
series filters.
This field is a member of `oneof`_ ``source``.
time_series_query_language (str):
A query used to fetch time series.
This field is a member of `oneof`_ ``source``.
unit_override (str):
The unit of data contained in fetched time series. If
non-empty, this unit will override any unit that accompanies
Expand All @@ -75,6 +85,13 @@ class TimeSeriesFilter(proto.Message):
```ListTimeSeries`` <https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list>`__
method.
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:
filter (str):
Required. The `monitoring
Expand All @@ -89,10 +106,12 @@ class TimeSeriesFilter(proto.Message):
Apply a second aggregation after ``aggregation`` is applied.
pick_time_series_filter (google.cloud.monitoring_dashboard_v1.types.PickTimeSeriesFilter):
Ranking based time series filter.
This field is a member of `oneof`_ ``output_filter``.
statistical_time_series_filter (google.cloud.monitoring_dashboard_v1.types.StatisticalTimeSeriesFilter):
Statistics based time series filter.
Note: This field is deprecated and completely
ignored by the API.
This field is a member of `oneof`_ ``output_filter``.
"""

filter = proto.Field(proto.STRING, number=1,)
Expand Down Expand Up @@ -120,6 +139,13 @@ class TimeSeriesFilterRatio(proto.Message):
each aligned element from the numerator and denominator time
series.
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:
numerator (google.cloud.monitoring_dashboard_v1.types.TimeSeriesFilterRatio.RatioPart):
The numerator of the ratio.
Expand All @@ -130,10 +156,12 @@ class TimeSeriesFilterRatio(proto.Message):
computed.
pick_time_series_filter (google.cloud.monitoring_dashboard_v1.types.PickTimeSeriesFilter):
Ranking based time series filter.
This field is a member of `oneof`_ ``output_filter``.
statistical_time_series_filter (google.cloud.monitoring_dashboard_v1.types.StatisticalTimeSeriesFilter):
Statistics based time series filter.
Note: This field is deprecated and completely
ignored by the API.
This field is a member of `oneof`_ ``output_filter``.
"""

class RatioPart(proto.Message):
Expand Down
9 changes: 9 additions & 0 deletions google/cloud/monitoring_dashboard_v1/types/scorecard.py
Expand Up @@ -28,16 +28,25 @@ class Scorecard(proto.Message):
r"""A widget showing the latest value of a metric, and how this
value relates to one or more thresholds.
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:
time_series_query (google.cloud.monitoring_dashboard_v1.types.TimeSeriesQuery):
Required. Fields for querying time series
data from the Stackdriver metrics API.
gauge_view (google.cloud.monitoring_dashboard_v1.types.Scorecard.GaugeView):
Will cause the scorecard to show a gauge
chart.
This field is a member of `oneof`_ ``data_view``.
spark_chart_view (google.cloud.monitoring_dashboard_v1.types.Scorecard.SparkChartView):
Will cause the scorecard to show a spark
chart.
This field is a member of `oneof`_ ``data_view``.
thresholds (Sequence[google.cloud.monitoring_dashboard_v1.types.Threshold]):
The thresholds used to determine the state of
the scorecard given the time series' current
Expand Down

0 comments on commit 6044b1b

Please sign in to comment.