Skip to content

Commit 769c703

Browse files
authored
chore!: promote Monitoring to v2 (#7892)
1 parent d007922 commit 769c703

File tree

275 files changed

+1190
-14376
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

275 files changed

+1190
-14376
lines changed

Monitoring/owlbot.py

Lines changed: 21 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2018 Google LLC
1+
# Copyright 2024 Google LLC
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -30,84 +30,27 @@
3030
# Added so that we can pass copy_excludes in the owlbot_main() call
3131
_tracked_paths.add(src)
3232

33-
php.owlbot_main(
34-
src=src,
35-
dest=dest,
36-
copy_excludes=[
37-
src / "*/src/V3/AlertPolicyServiceClient.php",
38-
src / "*/src/V3/GroupServiceClient.php",
39-
src / "*/src/V3/NotificationChannelServiceClient.php",
40-
src / "*/src/V3/ServiceMonitoringServiceClient.php",
41-
src / "*/src/V3/UptimeCheckServiceClient.php",
42-
]
43-
)
33+
php.owlbot_main(src=src, dest=dest)
4434

45-
46-
# V3 is GA, so remove @experimental tags
35+
# remove class_alias code
4736
s.replace(
48-
'src/V3/**/*Client.php',
49-
r'^(\s+\*\n)?\s+\*\s@experimental\n',
37+
"src/V*/**/*.php",
38+
r"^// Adding a class alias for backwards compatibility with the previous class name.$"
39+
+ "\n"
40+
+ r"^class_alias\(.*\);$"
41+
+ "\n",
5042
'')
5143

52-
for client in ['AlertPolicyService', 'NotificationChannelService']:
53-
s.replace(
54-
f'**/Gapic/{client}GapicClient.php',
55-
r'Copyright \d{4}',
56-
'Copyright 2018')
57-
s.replace(
58-
f'**/V3/{client}Client.php',
59-
r'Copyright \d{4}',
60-
'Copyright 2018')
61-
62-
s.replace(
63-
'tests/**/V3/*Test.php',
64-
r'Copyright \d{4}',
65-
'Copyright 2018')
66-
67-
# Fix class references in gapic samples
68-
for version in ['V3']:
69-
pathExpr = 'src/' + version + '/Gapic/*GapicClient.php'
70-
71-
types = {
72-
'= new Alert': r'= new Google\\Cloud\\Monitoring\\'+ version + r'\\Alert',
73-
'= new Group': r'= new Google\\Cloud\\Monitoring\\'+ version + r'\\Group',
74-
'= new Metric': r'= new Google\\Cloud\\Monitoring\\'+ version + r'\\Metric',
75-
'= new TimeInterval': r'= new Google\\Cloud\\Monitoring\\'+ version + r'\\TimeInterval',
76-
'= TimeSeriesView::': r'= Google\\Cloud\\Monitoring\\'+ version + r'\\ListTimeSeriesRequest\\TimeSeriesView::',
77-
'= new Notification': r'= new Google\\Cloud\\Monitoring\\'+ version + r'\\Notification',
78-
'= new UptimeCheck': r'= new Google\\Cloud\\Monitoring\\'+ version + r'\\UptimeCheck',
79-
80-
}
81-
82-
for search, replace in types.items():
83-
s.replace(
84-
pathExpr,
85-
search,
86-
replace
87-
)
88-
89-
### [START] protoc backwards compatibility fixes
90-
91-
# roll back to private properties.
92-
s.replace(
93-
"src/**/V*/**/*.php",
94-
r"Generated from protobuf field ([^\n]{0,})\n\s{5}\*/\n\s{4}protected \$",
95-
r"""Generated from protobuf field \1
96-
*/
97-
private $""")
98-
99-
# Replace "Unwrapped" with "Value" for method names.
100-
s.replace(
101-
"src/**/V*/**/*.php",
102-
r"public function ([s|g]\w{3,})Unwrapped",
103-
r"public function \1Value"
104-
)
105-
106-
### [END] protoc backwards compatibility fixes
107-
108-
# fix relative cloud.google.com links
109-
s.replace(
110-
"src/**/V*/**/*.php",
111-
r"(.{0,})\]\((/.{0,})\)",
112-
r"\1](https://cloud.google.com\2)"
113-
)
44+
# format generated clients
45+
subprocess.run([
46+
'npm',
47+
'exec',
48+
'--yes',
49+
'--package=@prettier/plugin-php@^0.16',
50+
'--',
51+
'prettier',
52+
'**/Client/*',
53+
'--write',
54+
'--parser=php',
55+
'--single-quote',
56+
'--print-width=120'])

Monitoring/src/V3/Aggregation.php

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Monitoring/src/V3/Aggregation/Aligner.php

Lines changed: 0 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Monitoring/src/V3/Aggregation/Reducer.php

Lines changed: 0 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Monitoring/src/V3/Aggregation_Aligner.php

Lines changed: 0 additions & 16 deletions
This file was deleted.

Monitoring/src/V3/Aggregation_Reducer.php

Lines changed: 0 additions & 16 deletions
This file was deleted.

Monitoring/src/V3/AlertPolicy.php

Lines changed: 12 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Monitoring/src/V3/AlertPolicy/AlertStrategy.php

Lines changed: 2 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Monitoring/src/V3/AlertPolicy/AlertStrategy/NotificationChannelStrategy.php

Lines changed: 1 addition & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Monitoring/src/V3/AlertPolicy/AlertStrategy/NotificationPrompt.php

Lines changed: 0 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)