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

Commit 6044b1b

Browse files
chore: use gapic-generator-python 0.53.4 (#129)
- [ ] 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: https://github.com/googleapis/googleapis-gen/commit/2ff001fbacb9e77e71d734de5f955c05fdae8526 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMmZmMDAxZmJhY2I5ZTc3ZTcxZDczNGRlNWY5NTVjMDVmZGFlODUyNiJ9
1 parent c1d74f0 commit 6044b1b

11 files changed

Lines changed: 97 additions & 158 deletions

File tree

google/cloud/monitoring_dashboard_v1/services/dashboards_service/async_client.py

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,15 @@
1919
from typing import Dict, Sequence, Tuple, Type, Union
2020
import pkg_resources
2121

22-
import google.api_core.client_options as ClientOptions # type: ignore
22+
from google.api_core.client_options import ClientOptions # type: ignore
2323
from google.api_core import exceptions as core_exceptions # type: ignore
2424
from google.api_core import gapic_v1 # type: ignore
2525
from google.api_core import retry as retries # type: ignore
2626
from google.auth import credentials as ga_credentials # type: ignore
2727
from google.oauth2 import service_account # type: ignore
2828

29+
OptionalRetry = Union[retries.Retry, object]
30+
2931
from google.cloud.monitoring_dashboard_v1.services.dashboards_service import pagers
3032
from google.cloud.monitoring_dashboard_v1.types import dashboard
3133
from google.cloud.monitoring_dashboard_v1.types import dashboards_service
@@ -171,9 +173,9 @@ def __init__(
171173

172174
async def create_dashboard(
173175
self,
174-
request: dashboards_service.CreateDashboardRequest = None,
176+
request: Union[dashboards_service.CreateDashboardRequest, dict] = None,
175177
*,
176-
retry: retries.Retry = gapic_v1.method.DEFAULT,
178+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
177179
timeout: float = None,
178180
metadata: Sequence[Tuple[str, str]] = (),
179181
) -> dashboard.Dashboard:
@@ -186,7 +188,7 @@ async def create_dashboard(
186188
Management <https://cloud.google.com/iam>`__.
187189
188190
Args:
189-
request (:class:`google.cloud.monitoring_dashboard_v1.types.CreateDashboardRequest`):
191+
request (Union[google.cloud.monitoring_dashboard_v1.types.CreateDashboardRequest, dict]):
190192
The request object. The `CreateDashboard` request.
191193
retry (google.api_core.retry.Retry): Designation of what errors, if any,
192194
should be retried.
@@ -227,9 +229,9 @@ async def create_dashboard(
227229

228230
async def list_dashboards(
229231
self,
230-
request: dashboards_service.ListDashboardsRequest = None,
232+
request: Union[dashboards_service.ListDashboardsRequest, dict] = None,
231233
*,
232-
retry: retries.Retry = gapic_v1.method.DEFAULT,
234+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
233235
timeout: float = None,
234236
metadata: Sequence[Tuple[str, str]] = (),
235237
) -> pagers.ListDashboardsAsyncPager:
@@ -241,7 +243,7 @@ async def list_dashboards(
241243
Management <https://cloud.google.com/iam>`__.
242244
243245
Args:
244-
request (:class:`google.cloud.monitoring_dashboard_v1.types.ListDashboardsRequest`):
246+
request (Union[google.cloud.monitoring_dashboard_v1.types.ListDashboardsRequest, dict]):
245247
The request object. The `ListDashboards` request.
246248
retry (google.api_core.retry.Retry): Designation of what errors, if any,
247249
should be retried.
@@ -288,9 +290,9 @@ async def list_dashboards(
288290

289291
async def get_dashboard(
290292
self,
291-
request: dashboards_service.GetDashboardRequest = None,
293+
request: Union[dashboards_service.GetDashboardRequest, dict] = None,
292294
*,
293-
retry: retries.Retry = gapic_v1.method.DEFAULT,
295+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
294296
timeout: float = None,
295297
metadata: Sequence[Tuple[str, str]] = (),
296298
) -> dashboard.Dashboard:
@@ -302,7 +304,7 @@ async def get_dashboard(
302304
Management <https://cloud.google.com/iam>`__.
303305
304306
Args:
305-
request (:class:`google.cloud.monitoring_dashboard_v1.types.GetDashboardRequest`):
307+
request (Union[google.cloud.monitoring_dashboard_v1.types.GetDashboardRequest, dict]):
306308
The request object. The `GetDashboard` request.
307309
retry (google.api_core.retry.Retry): Designation of what errors, if any,
308310
should be retried.
@@ -343,9 +345,9 @@ async def get_dashboard(
343345

344346
async def delete_dashboard(
345347
self,
346-
request: dashboards_service.DeleteDashboardRequest = None,
348+
request: Union[dashboards_service.DeleteDashboardRequest, dict] = None,
347349
*,
348-
retry: retries.Retry = gapic_v1.method.DEFAULT,
350+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
349351
timeout: float = None,
350352
metadata: Sequence[Tuple[str, str]] = (),
351353
) -> None:
@@ -357,7 +359,7 @@ async def delete_dashboard(
357359
Management <https://cloud.google.com/iam>`__.
358360
359361
Args:
360-
request (:class:`google.cloud.monitoring_dashboard_v1.types.DeleteDashboardRequest`):
362+
request (Union[google.cloud.monitoring_dashboard_v1.types.DeleteDashboardRequest, dict]):
361363
The request object. The `DeleteDashboard` request.
362364
retry (google.api_core.retry.Retry): Designation of what errors, if any,
363365
should be retried.
@@ -389,9 +391,9 @@ async def delete_dashboard(
389391

390392
async def update_dashboard(
391393
self,
392-
request: dashboards_service.UpdateDashboardRequest = None,
394+
request: Union[dashboards_service.UpdateDashboardRequest, dict] = None,
393395
*,
394-
retry: retries.Retry = gapic_v1.method.DEFAULT,
396+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
395397
timeout: float = None,
396398
metadata: Sequence[Tuple[str, str]] = (),
397399
) -> dashboard.Dashboard:
@@ -403,7 +405,7 @@ async def update_dashboard(
403405
Management <https://cloud.google.com/iam>`__.
404406
405407
Args:
406-
request (:class:`google.cloud.monitoring_dashboard_v1.types.UpdateDashboardRequest`):
408+
request (Union[google.cloud.monitoring_dashboard_v1.types.UpdateDashboardRequest, dict]):
407409
The request object. The `UpdateDashboard` request.
408410
retry (google.api_core.retry.Retry): Designation of what errors, if any,
409411
should be retried.

google/cloud/monitoring_dashboard_v1/services/dashboards_service/client.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
from google.auth.exceptions import MutualTLSChannelError # type: ignore
3131
from google.oauth2 import service_account # type: ignore
3232

33+
OptionalRetry = Union[retries.Retry, object]
34+
3335
from google.cloud.monitoring_dashboard_v1.services.dashboards_service import pagers
3436
from google.cloud.monitoring_dashboard_v1.types import dashboard
3537
from google.cloud.monitoring_dashboard_v1.types import dashboards_service
@@ -369,7 +371,7 @@ def create_dashboard(
369371
self,
370372
request: Union[dashboards_service.CreateDashboardRequest, dict] = None,
371373
*,
372-
retry: retries.Retry = gapic_v1.method.DEFAULT,
374+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
373375
timeout: float = None,
374376
metadata: Sequence[Tuple[str, str]] = (),
375377
) -> dashboard.Dashboard:
@@ -426,7 +428,7 @@ def list_dashboards(
426428
self,
427429
request: Union[dashboards_service.ListDashboardsRequest, dict] = None,
428430
*,
429-
retry: retries.Retry = gapic_v1.method.DEFAULT,
431+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
430432
timeout: float = None,
431433
metadata: Sequence[Tuple[str, str]] = (),
432434
) -> pagers.ListDashboardsPager:
@@ -488,7 +490,7 @@ def get_dashboard(
488490
self,
489491
request: Union[dashboards_service.GetDashboardRequest, dict] = None,
490492
*,
491-
retry: retries.Retry = gapic_v1.method.DEFAULT,
493+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
492494
timeout: float = None,
493495
metadata: Sequence[Tuple[str, str]] = (),
494496
) -> dashboard.Dashboard:
@@ -544,7 +546,7 @@ def delete_dashboard(
544546
self,
545547
request: Union[dashboards_service.DeleteDashboardRequest, dict] = None,
546548
*,
547-
retry: retries.Retry = gapic_v1.method.DEFAULT,
549+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
548550
timeout: float = None,
549551
metadata: Sequence[Tuple[str, str]] = (),
550552
) -> None:
@@ -591,7 +593,7 @@ def update_dashboard(
591593
self,
592594
request: Union[dashboards_service.UpdateDashboardRequest, dict] = None,
593595
*,
594-
retry: retries.Retry = gapic_v1.method.DEFAULT,
596+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
595597
timeout: float = None,
596598
metadata: Sequence[Tuple[str, str]] = (),
597599
) -> dashboard.Dashboard:

google/cloud/monitoring_dashboard_v1/services/dashboards_service/transports/base.py

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
#
1616
import abc
1717
from typing import Awaitable, Callable, Dict, Optional, Sequence, Union
18-
import packaging.version
1918
import pkg_resources
2019

2120
import google.auth # type: ignore
@@ -39,15 +38,6 @@
3938
except pkg_resources.DistributionNotFound:
4039
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
4140

42-
try:
43-
# google.auth.__version__ was added in 1.26.0
44-
_GOOGLE_AUTH_VERSION = google.auth.__version__
45-
except AttributeError:
46-
try: # try pkg_resources if it is available
47-
_GOOGLE_AUTH_VERSION = pkg_resources.get_distribution("google-auth").version
48-
except pkg_resources.DistributionNotFound: # pragma: NO COVER
49-
_GOOGLE_AUTH_VERSION = None
50-
5141

5242
class DashboardsServiceTransport(abc.ABC):
5343
"""Abstract transport class for DashboardsService."""
@@ -102,7 +92,7 @@ def __init__(
10292
host += ":443"
10393
self._host = host
10494

105-
scopes_kwargs = self._get_scopes_kwargs(self._host, scopes)
95+
scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES}
10696

10797
# Save the scopes.
10898
self._scopes = scopes
@@ -135,29 +125,6 @@ def __init__(
135125
# Save the credentials.
136126
self._credentials = credentials
137127

138-
# TODO(busunkim): This method is in the base transport
139-
# to avoid duplicating code across the transport classes. These functions
140-
# should be deleted once the minimum required versions of google-auth is increased.
141-
142-
# TODO: Remove this function once google-auth >= 1.25.0 is required
143-
@classmethod
144-
def _get_scopes_kwargs(
145-
cls, host: str, scopes: Optional[Sequence[str]]
146-
) -> Dict[str, Optional[Sequence[str]]]:
147-
"""Returns scopes kwargs to pass to google-auth methods depending on the google-auth version"""
148-
149-
scopes_kwargs = {}
150-
151-
if _GOOGLE_AUTH_VERSION and (
152-
packaging.version.parse(_GOOGLE_AUTH_VERSION)
153-
>= packaging.version.parse("1.25.0")
154-
):
155-
scopes_kwargs = {"scopes": scopes, "default_scopes": cls.AUTH_SCOPES}
156-
else:
157-
scopes_kwargs = {"scopes": scopes or cls.AUTH_SCOPES}
158-
159-
return scopes_kwargs
160-
161128
def _prep_wrapped_messages(self, client_info):
162129
# Precompute the wrapped methods.
163130
self._wrapped_methods = {

google/cloud/monitoring_dashboard_v1/services/dashboards_service/transports/grpc_asyncio.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
from google.api_core import grpc_helpers_async # type: ignore
2121
from google.auth import credentials as ga_credentials # type: ignore
2222
from google.auth.transport.grpc import SslCredentials # type: ignore
23-
import packaging.version
2423

2524
import grpc # type: ignore
2625
from grpc.experimental import aio # type: ignore

google/cloud/monitoring_dashboard_v1/types/dashboard.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,13 @@ class Dashboard(proto.Message):
2727
r"""A Google Stackdriver dashboard. Dashboards define the content
2828
and layout of pages in the Stackdriver web application.
2929
30+
This message has `oneof`_ fields (mutually exclusive fields).
31+
For each oneof, at most one member field can be set at the same time.
32+
Setting any member of the oneof automatically clears all other
33+
members.
34+
35+
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
36+
3037
Attributes:
3138
name (str):
3239
Immutable. The resource name of the
@@ -46,16 +53,20 @@ class Dashboard(proto.Message):
4653
Content is arranged with a basic layout that
4754
re-flows a simple list of informational elements
4855
like widgets or tiles.
56+
This field is a member of `oneof`_ ``layout``.
4957
mosaic_layout (google.cloud.monitoring_dashboard_v1.types.MosaicLayout):
5058
The content is arranged as a grid of tiles,
5159
with each content widget occupying one or more
5260
grid blocks.
61+
This field is a member of `oneof`_ ``layout``.
5362
row_layout (google.cloud.monitoring_dashboard_v1.types.RowLayout):
5463
The content is divided into equally spaced
5564
rows and the widgets are arranged horizontally.
65+
This field is a member of `oneof`_ ``layout``.
5666
column_layout (google.cloud.monitoring_dashboard_v1.types.ColumnLayout):
5767
The content is divided into equally spaced
5868
columns and the widgets are arranged vertically.
69+
This field is a member of `oneof`_ ``layout``.
5970
"""
6071

6172
name = proto.Field(proto.STRING, number=1,)

google/cloud/monitoring_dashboard_v1/types/metrics.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,24 @@ class TimeSeriesQuery(proto.Message):
4343
r"""TimeSeriesQuery collects the set of supported methods for
4444
querying time series data from the Stackdriver metrics API.
4545
46+
This message has `oneof`_ fields (mutually exclusive fields).
47+
For each oneof, at most one member field can be set at the same time.
48+
Setting any member of the oneof automatically clears all other
49+
members.
50+
51+
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
52+
4653
Attributes:
4754
time_series_filter (google.cloud.monitoring_dashboard_v1.types.TimeSeriesFilter):
4855
Filter parameters to fetch time series.
56+
This field is a member of `oneof`_ ``source``.
4957
time_series_filter_ratio (google.cloud.monitoring_dashboard_v1.types.TimeSeriesFilterRatio):
5058
Parameters to fetch a ratio between two time
5159
series filters.
60+
This field is a member of `oneof`_ ``source``.
5261
time_series_query_language (str):
5362
A query used to fetch time series.
63+
This field is a member of `oneof`_ ``source``.
5464
unit_override (str):
5565
The unit of data contained in fetched time series. If
5666
non-empty, this unit will override any unit that accompanies
@@ -75,6 +85,13 @@ class TimeSeriesFilter(proto.Message):
7585
```ListTimeSeries`` <https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list>`__
7686
method.
7787
88+
This message has `oneof`_ fields (mutually exclusive fields).
89+
For each oneof, at most one member field can be set at the same time.
90+
Setting any member of the oneof automatically clears all other
91+
members.
92+
93+
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
94+
7895
Attributes:
7996
filter (str):
8097
Required. The `monitoring
@@ -89,10 +106,12 @@ class TimeSeriesFilter(proto.Message):
89106
Apply a second aggregation after ``aggregation`` is applied.
90107
pick_time_series_filter (google.cloud.monitoring_dashboard_v1.types.PickTimeSeriesFilter):
91108
Ranking based time series filter.
109+
This field is a member of `oneof`_ ``output_filter``.
92110
statistical_time_series_filter (google.cloud.monitoring_dashboard_v1.types.StatisticalTimeSeriesFilter):
93111
Statistics based time series filter.
94112
Note: This field is deprecated and completely
95113
ignored by the API.
114+
This field is a member of `oneof`_ ``output_filter``.
96115
"""
97116

98117
filter = proto.Field(proto.STRING, number=1,)
@@ -120,6 +139,13 @@ class TimeSeriesFilterRatio(proto.Message):
120139
each aligned element from the numerator and denominator time
121140
series.
122141
142+
This message has `oneof`_ fields (mutually exclusive fields).
143+
For each oneof, at most one member field can be set at the same time.
144+
Setting any member of the oneof automatically clears all other
145+
members.
146+
147+
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
148+
123149
Attributes:
124150
numerator (google.cloud.monitoring_dashboard_v1.types.TimeSeriesFilterRatio.RatioPart):
125151
The numerator of the ratio.
@@ -130,10 +156,12 @@ class TimeSeriesFilterRatio(proto.Message):
130156
computed.
131157
pick_time_series_filter (google.cloud.monitoring_dashboard_v1.types.PickTimeSeriesFilter):
132158
Ranking based time series filter.
159+
This field is a member of `oneof`_ ``output_filter``.
133160
statistical_time_series_filter (google.cloud.monitoring_dashboard_v1.types.StatisticalTimeSeriesFilter):
134161
Statistics based time series filter.
135162
Note: This field is deprecated and completely
136163
ignored by the API.
164+
This field is a member of `oneof`_ ``output_filter``.
137165
"""
138166

139167
class RatioPart(proto.Message):

google/cloud/monitoring_dashboard_v1/types/scorecard.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,25 @@ class Scorecard(proto.Message):
2828
r"""A widget showing the latest value of a metric, and how this
2929
value relates to one or more thresholds.
3030
31+
This message has `oneof`_ fields (mutually exclusive fields).
32+
For each oneof, at most one member field can be set at the same time.
33+
Setting any member of the oneof automatically clears all other
34+
members.
35+
36+
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
37+
3138
Attributes:
3239
time_series_query (google.cloud.monitoring_dashboard_v1.types.TimeSeriesQuery):
3340
Required. Fields for querying time series
3441
data from the Stackdriver metrics API.
3542
gauge_view (google.cloud.monitoring_dashboard_v1.types.Scorecard.GaugeView):
3643
Will cause the scorecard to show a gauge
3744
chart.
45+
This field is a member of `oneof`_ ``data_view``.
3846
spark_chart_view (google.cloud.monitoring_dashboard_v1.types.Scorecard.SparkChartView):
3947
Will cause the scorecard to show a spark
4048
chart.
49+
This field is a member of `oneof`_ ``data_view``.
4150
thresholds (Sequence[google.cloud.monitoring_dashboard_v1.types.Threshold]):
4251
The thresholds used to determine the state of
4352
the scorecard given the time series' current

0 commit comments

Comments
 (0)