8000 fix: Reintroduce deprecated field/enum `ServiceTier` for backward com… · googleapis/python-monitoring@eeb0534 · GitHub
[go: up one dir, main page]

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

Commit eeb0534

Browse files
fix: Reintroduce deprecated field/enum ServiceTier for backward compatibility (#240)
- [ ] Regenerate this pull request now. The deprecated elements are still deprecated and should not be used; they're solely being reintroduced to avoid breaking changes in client libraries. PiperOrigin-RevId: 402864419 Source-Link: googleapis/googleapis@4a5dad7 Source-Link: https://github.com/googleapis/googleapis-gen/commit/70d1ff4f9e9a217a2216f39101588717ebfe549d Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNzBkMWZmNGY5ZTlhMjE3YTIyMTZmMzkxMDE1ODg3MTdlYmZlNTQ5ZCJ9 docs: Use absolute link targets in comments
1 parent 452bef8 commit eeb0534

File tree

9 files changed

+41
-4
lines changed

9 files changed

+41
-4
lines changed

google/cloud/monitoring/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
from google.cloud.monitoring_v3.types.common import TimeInterval
6565
from google.cloud.monitoring_v3.types.common import TypedValue
6666
from google.cloud.monitoring_v3.types.common import ComparisonType
67+
from google.cloud.monitoring_v3.types.common import ServiceTier
6768
from google.cloud.monitoring_v3.types.dropped_labels import DroppedLabels
6869
from google.cloud.monitoring_v3.types.group import Group
6970
from google.cloud.monitoring_v3.types.group_service import CreateGroupRequest
@@ -235,6 +236,7 @@
235236
"TimeInterval",
236237
"TypedValue",
237238
"ComparisonType",
239+
"ServiceTier",
238240
"DroppedLabels",
239241
"Group",
240242
"CreateGroupRequest",

google/cloud/monitoring_v3/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
from .types.common import TimeInterval
4141
from .types.common import TypedValue
4242
from .types.common import ComparisonType
43+
from .types.common import ServiceTier
4344
from .types.dropped_labels import DroppedLabels
4445
from .types.group import Group
4546
from .types.group_service import CreateGroupRequest
@@ -215,6 +216,7 @@
215216
"ServiceLevelIndicator",
216217
"ServiceLevelObjective",
217218
"ServiceMonitoringServiceClient",
219+
"ServiceTier",
218220
"SpanContext",
219221
"TextLocator",
220222
"TimeInterval",

google/cloud/monitoring_v3/services/notification_channel_service/async_client.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
from google.api import label_pb2 # type: ignore
3030
from google.api import launch_stage_pb2 # type: ignore
3131
from google.cloud.monitoring_v3.services.notification_channel_service import pagers
32+
from google.cloud.monitoring_v3.types import common
3233
from google.cloud.monitoring_v3.types import mutation_record
3334
from google.cloud.monitoring_v3.types import notification
3435
from google.cloud.monitoring_v3.types import notification_service

google/cloud/monitoring_v3/services/notification_channel_service/client.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
from google.api import label_pb2 # type: ignore
3434
from google.api import launch_stage_pb2 # type: ignore
3535
from google.cloud.monitoring_v3.services.notification_channel_service import pagers
36+
from google.cloud.monitoring_v3.types import common
3637
from google.cloud.monitoring_v3.types import mutation_record
3738
from google.cloud.monitoring_v3.types import notification
3839
from google.cloud.monitoring_v3.types import notification_service

google/cloud/monitoring_v3/types/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
TimeInterval,
2828
TypedValue,
2929
ComparisonType,
30+
ServiceTier,
3031
)
3132
from .dropped_labels import DroppedLabels
3233
from .group import Group
@@ -143,6 +144,7 @@
143144
"TimeInterval",
144145
"TypedValue",
145146
"ComparisonType",
147+
"ServiceTier",
146148
"DroppedLabels",
147149
"Group",
148150
"CreateGroupRequest",

google/cloud/monitoring_v3/types/alert.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -404,8 +404,8 @@ class LogMatch(proto.Message):
404404
Attributes:
405405
filter (str):
406406
Required. A logs-based filter. See `Advanced Logs
407-
Queries </logging/docs/view/advanced-queries>`__ for how
408-
this filter should be constructed.
407+
Queries <https://cloud.google.com/logging/docs/view/advanced-queries>`__
408+
for how this filter should be constructed.
409409
label_extractors (Sequence[google.cloud.monitoring_v3.types.AlertPolicy.Condition.LogMatch.LabelExtractorsEntry]):
410410
Optional. A map from a label key to an extractor expression,
411411
which is used to extract the value for this label key. Each
@@ -417,7 +417,7 @@ class LogMatch(proto.Message):
417417
generated by this condition.
418418
419419
Please see `the documentation on logs-based metric
420-
``valueExtractor``\ s </logging/docs/reference/v2/rest/v2/projects.metrics#LogMetric.FIELDS.value_extractor>`__
420+
``valueExtractor``\ s <https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.metrics#LogMetric.FIELDS.value_extractor>`__
421421
for syntax and examples.
422422
"""
423423

google/cloud/monitoring_v3/types/common.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,13 @@
2222

2323
__protobuf__ = proto.module(
2424
package="google.monitoring.v3",
25-
manifest={"ComparisonType", "TypedValue", "TimeInterval", "Aggregation",},
25+
manifest={
26+
"ComparisonType",
27+
"ServiceTier",
28+
"TypedValue",
29+
"TimeInterval",
30+
"Aggregation",
31+
},
2632
)
2733

2834

@@ -39,6 +45,17 @@ class ComparisonType(proto.Enum):
3945
COMPARISON_NE = 6
4046

4147

48+
class ServiceTier(proto.Enum):
49+
r"""The tier of service for a Workspace. Please see the `service tiers
50+
documentation <https://cloud.google.com/monitoring/workspaces/tiers>`__
51+
for more details.
52+
"""
53+
_pb_options = {"deprecated": True}
54+
SERVICE_TIER_UNSPECIFIED = 0
55+
SERVICE_TIER_BASIC = 1
56+
SERVICE_TIER_PREMIUM = 2
57+
58+
4259
class TypedValue(proto.Message):
4360
r"""A single strongly-typed value.
4461

google/cloud/monitoring_v3/types/notification.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
from google.api import label_pb2 # type: ignore
1919
from google.api import launch_stage_pb2 # type: ignore
20+
from google.cloud.monitoring_v3.types import common
2021
from google.cloud.monitoring_v3.types import mutation_record
2122
from google.protobuf import wrappers_pb2 # type: ignore
2223

@@ -63,6 +64,9 @@ class NotificationChannelDescriptor(proto.Message):
6364
corresponding type. Each label includes a
6465
description for how that field should be
6566
populated.
67+
supported_tiers (Sequence[google.cloud.monitoring_v3.types.ServiceTier]):
68+
The tiers that support this notification channel; the
69+
project service tier must be one of the supported_tiers.
6670
launch_stage (google.api.launch_stage_pb2.LaunchStage):
6771
The product launch stage for channels of this
6872
type.
@@ -75,6 +79,9 @@ class NotificationChannelDescriptor(proto.Message):
7579
labels = proto.RepeatedField(
7680
proto.MESSAGE, number=4, message=label_pb2.LabelDescriptor,
7781
)
82+
supported_tiers = proto.RepeatedField(
83+
proto.ENUM, number=5, enum=common.ServiceTier,
84+
)
7885
launch_stage = proto.Field(proto.ENUM, number=7, enum=launch_stage_pb2.LaunchStage,)
7986

8087

tests/unit/gapic/monitoring_v3/test_notification_channel_service.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
from google.cloud.monitoring_v3.services.notification_channel_service.transports.base import (
4646
_GOOGLE_AUTH_VERSION,
4747
)
48+
from google.cloud.monitoring_v3.types import common
4849
from google.cloud.monitoring_v3.types import mutation_record
4950
from google.cloud.monitoring_v3.types import notification
5051
from google.cloud.monitoring_v3.types import notification_service
@@ -987,6 +988,7 @@ def test_get_notification_channel_descriptor(
987988
type_="type__value",
988989
display_name="display_name_value",
989990
description="description_value",
991+
supported_tiers=[common.ServiceTier.SERVICE_TIER_BASIC],
990992
)
991993
response = client.get_notification_channel_descriptor(request)
992994

@@ -1001,6 +1003,7 @@ def test_get_notification_channel_descriptor(
10011003
assert response.type_ == "type__value"
10021004
assert response.display_name == "display_name_value"
10031005
assert response.description == "description_value"
1006+
assert response.supported_tiers == [common.ServiceTier.SERVICE_TIER_BASIC]
10041007

10051008

10061009
def test_get_notification_channel_descriptor_from_dict():
@@ -1048,6 +1051,7 @@ async def test_get_notification_channel_descriptor_async(
10481051
type_="type__value",
10491052
display_name="display_name_value",
10501053
description="description_value",
1054+
supported_tiers=[common.ServiceTier.SERVICE_TIER_BASIC],
10511055
)
10521056
)
10531057
response = await client.get_notification_channel_descriptor(request)
@@ -1063,6 +1067,7 @@ async def test_get_notification_channel_descriptor_async(
10631067
assert response.type_ == "type__value"
10641068
assert response.display_name == "display_name_value"
10651069
assert response.description == "description_value"
1070+
assert response.supported_tiers == [common.ServiceTier.SERVICE_TIER_BASIC]
10661071

10671072

10681073
@pytest.mark.asyncio

0 commit comments

Comments
 (0)
0