google-cloud-monitoring 1.8.3 → 1.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8a8f7e6fc75668c0e608b3a3ca7aa72a9ac51e9aa17e4430d662028656c6de47
4
- data.tar.gz: db2f85f0c6e60ced1fbd2df5f68aa5d9a399aa847ba8a7f065d84e8d2165a334
3
+ metadata.gz: 3c7883d607efc40f2e8be5e799b25bf26e440a54fa3cab06f8a63d2285d796bd
4
+ data.tar.gz: f3139eb1a8de0e31ab25412390605d9e7185ac25a33e85d61c1ed068a167fe61
5
5
  SHA512:
6
- metadata.gz: 4cc72a4ebbaa7d952e715d1f4e54b27c621382a37a6678dafd85e42f179ac1bb011301f6dc82c11fc853be230ae16e26dc3314029e84b81c655660c52155999e
7
- data.tar.gz: 45dbeb7f9740d9f8ff1267072bd8c785de985451457a7b7cdcf2d335a57c72f36f7c2e5278396fbe7044882903cb7407537429f2bb06e0eca62b542896896249
6
+ metadata.gz: 30d2c787dea613a1beacf45736fe804241f844637d82b5e78d49c04fd81ca1c2832f14a91efe954b894c51b599a9671a4379b91d372be09542d3dbdb582ee9ef
7
+ data.tar.gz: 6dfc35086c47d807289234aa7bab486687e09ec0b28ba8aababb441f40ef93d394aba887dbf7195407a968567fbefa196adfc032cfcfd269c998b7cffa56d72f
data/README.md CHANGED
@@ -18,6 +18,8 @@ themselves can be found in the client library documentation for the versioned
18
18
  client gems:
19
19
  [google-cloud-monitoring-v3](https://cloud.google.com/ruby/docs/reference/google-cloud-monitoring-v3/latest),
20
20
  [google-cloud-monitoring-dashboard-v1](https://cloud.google.com/ruby/docs/reference/google-cloud-monitoring-dashboard-v1/latest),
21
+ [google-cloud-monitoring-dashboard-v1](https://cloud.google.com/ruby/docs/reference/google-cloud-monitoring-dashboard-v1/latest),
22
+ [google-cloud-monitoring-metrics_scope-v1](https://cloud.google.com/ruby/docs/reference/google-cloud-monitoring-metrics_scope-v1/latest),
21
23
  [google-cloud-monitoring-metrics_scope-v1](https://cloud.google.com/ruby/docs/reference/google-cloud-monitoring-metrics_scope-v1/latest).
22
24
 
23
25
  See also the [Product Documentation](https://cloud.google.com/monitoring)
@@ -44,35 +46,39 @@ and includes substantial interface changes. Existing code written for earlier
44
46
  versions of this library will likely require updates to use this version.
45
47
  See the {file:MIGRATING.md MIGRATING.md} document for more information.
46
48
 
47
- ## Enabling Logging
48
-
49
- To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
50
- The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/current/stdlibs/logger/Logger.html) as shown below,
51
- or a [`Google::Cloud::Logging::Logger`](https://cloud.google.com/ruby/docs/reference/google-cloud-logging/latest)
52
- that will write logs to [Cloud Logging](https://cloud.google.com/logging/). See [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb)
53
- and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
54
-
55
- Configuring a Ruby stdlib logger:
56
-
57
- ```ruby
58
- require "logger"
59
-
60
- module MyLogger
61
- LOGGER = Logger.new $stderr, level: Logger::WARN
62
- def logger
63
- LOGGER
64
- end
65
- end
66
-
67
- # Define a gRPC module-level logger method before grpc/logconfig.rb loads.
68
- module GRPC
69
- extend MyLogger
70
- end
71
- ```
49
+ ## Debug Logging
50
+
51
+ This library comes with opt-in Debug Logging that can help you troubleshoot
52
+ your application's integration with the API. When logging is activated, key
53
+ events such as requests and responses, along with data payloads and metadata
54
+ such as headers and client configuration, are logged to the standard error
55
+ stream.
56
+
57
+ **WARNING:** Client Library Debug Logging includes your data payloads in
58
+ plaintext, which could include sensitive data such as PII for yourself or your
59
+ customers, private keys, or other security data that could be compromising if
60
+ leaked. Always practice good data hygiene with your application logs, and follow
61
+ the principle of least access. Google also recommends that Client Library Debug
62
+ Logging be enabled only temporarily during active debugging, and not used
63
+ permanently in production.
64
+
65
+ To enable logging, set the environment variable `GOOGLE_SDK_RUBY_LOGGING_GEMS`
66
+ to the value `all`. Alternatively, you can set the value to a comma-delimited
67
+ list of client library gem names. This will select the default logging behavior,
68
+ which writes logs to the standard error stream. On a local workstation, this may
69
+ result in logs appearing on the console. When running on a Google Cloud hosting
70
+ service such as [Google Cloud Run](https://cloud.google.com/run), this generally
71
+ results in logs appearing alongside your application logs in the
72
+ [Google Cloud Logging](https://cloud.google.com/logging/) service.
73
+
74
+ Debug logging also requires that the versioned clients for this service be
75
+ sufficiently recent, released after about Dec 10, 2024. If logging is not
76
+ working, try updating the versioned clients in your bundle or installed gems:
77
+ [google-cloud-monitoring-v3](https://cloud.google.com/ruby/docs/reference/google-cloud-monitoring-v3/latest).
72
78
 
73
79
  ## Supported Ruby Versions
74
80
 
75
- This library is supported on Ruby 2.7+.
81
+ This library is supported on Ruby 3.0+.
76
82
 
77
83
  Google provides official support for Ruby versions that are actively supported
78
84
  by Ruby Core—that is, Ruby versions that are either in normal maintenance or
@@ -59,6 +59,11 @@ module Google
59
59
  # You can also specify a different transport by passing `:rest` or `:grpc` in
60
60
  # the `transport` parameter.
61
61
  #
62
+ # Raises an exception if the currently installed versioned client gem for the
63
+ # given API version does not support the given transport of the DashboardsService service.
64
+ # You can determine whether the method will succeed by calling
65
+ # {Google::Cloud::Monitoring::Dashboard.dashboards_service_available?}.
66
+ #
62
67
  # ## About DashboardsService
63
68
  #
64
69
  # Manages Stackdriver dashboards. A dashboard is an arrangement of data display
@@ -81,6 +86,37 @@ module Google
81
86
  service_module.const_get(:Client).new(&block)
82
87
  end
83
88
 
89
+ ##
90
+ # Determines whether the DashboardsService service is supported by the current client.
91
+ # If true, you can retrieve a client object by calling {Google::Cloud::Monitoring::Dashboard.dashboards_service}.
92
+ # If false, that method will raise an exception. This could happen if the given
93
+ # API version does not exist or does not support the DashboardsService service,
94
+ # or if the versioned client gem needs an update to support the DashboardsService service.
95
+ #
96
+ # @param version [::String, ::Symbol] The API version to connect to. Optional.
97
+ # Defaults to `:v1`.
98
+ # @param transport [:grpc, :rest] The transport to use. Defaults to `:grpc`.
99
+ # @return [boolean] Whether the service is available.
100
+ #
101
+ def self.dashboards_service_available? version: :v1, transport: :grpc
102
+ require "google/cloud/monitoring/dashboard/#{version.to_s.downcase}"
103
+ package_name = Google::Cloud::Monitoring::Dashboard
104
+ .constants
105
+ .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
106
+ .first
107
+ return false unless package_name
108
+ service_module = Google::Cloud::Monitoring::Dashboard.const_get package_name
109
+ return false unless service_module.const_defined? :DashboardsService
110
+ service_module = service_module.const_get :DashboardsService
111
+ if transport == :rest
112
+ return false unless service_module.const_defined? :Rest
113
+ service_module = service_module.const_get :Rest
114
+ end
115
+ service_module.const_defined? :Client
116
+ rescue ::LoadError
117
+ false
118
+ end
119
+
84
120
  ##
85
121
  # Configure the google-cloud-monitoring-dashboard library.
86
122
  #
@@ -57,6 +57,11 @@ module Google
57
57
  # supported by that API version, and the corresponding gem is available, the
58
58
  # appropriate versioned client will be returned.
59
59
  #
60
+ # Raises an exception if the currently installed versioned client gem for the
61
+ # given API version does not support the MetricsScopes service.
62
+ # You can determine whether the method will succeed by calling
63
+ # {Google::Cloud::Monitoring::MetricsScope.metrics_scopes_available?}.
64
+ #
60
65
  # ## About MetricsScopes
61
66
  #
62
67
  # Manages Cloud Monitoring Metrics Scopes, and the monitoring of Google Cloud
@@ -77,6 +82,32 @@ module Google
77
82
  service_module.const_get(:Client).new(&block)
78
83
  end
79
84
 
85
+ ##
86
+ # Determines whether the MetricsScopes service is supported by the current client.
87
+ # If true, you can retrieve a client object by calling {Google::Cloud::Monitoring::MetricsScope.metrics_scopes}.
88
+ # If false, that method will raise an exception. This could happen if the given
89
+ # API version does not exist or does not support the MetricsScopes service,
90
+ # or if the versioned client gem needs an update to support the MetricsScopes service.
91
+ #
92
+ # @param version [::String, ::Symbol] The API version to connect to. Optional.
93
+ # Defaults to `:v1`.
94
+ # @return [boolean] Whether the service is available.
95
+ #
96
+ def self.metrics_scopes_available? version: :v1
97
+ require "google/cloud/monitoring/metrics_scope/#{version.to_s.downcase}"
98
+ package_name = Google::Cloud::Monitoring::MetricsScope
99
+ .constants
100
+ .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
101
+ .first
102
+ return false unless package_name
103
+ service_module = Google::Cloud::Monitoring::MetricsScope.const_get package_name
104
+ return false unless service_module.const_defined? :MetricsScopes
105
+ service_module = service_module.const_get :MetricsScopes
106
+ service_module.const_defined? :Client
107
+ rescue ::LoadError
108
+ false
109
+ end
110
+
80
111
  ##
81
112
  # Configure the google-cloud-monitoring-metrics_scope library.
82
113
  #
@@ -20,7 +20,7 @@
20
20
  module Google
21
21
  module Cloud
22
22
  module Monitoring
23
- VERSION = "1.8.3"
23
+ VERSION = "1.9.0"
24
24
  end
25
25
  end
26
26
  end
@@ -56,6 +56,11 @@ module Google
56
56
  # supported by that API version, and the corresponding gem is available, the
57
57
  # appropriate versioned client will be returned.
58
58
  #
59
+ # Raises an exception if the currently installed versioned client gem for the
60
+ # given API version does not support the AlertPolicyService service.
61
+ # You can determine whether the method will succeed by calling
62
+ # {Google::Cloud::Monitoring.alert_policy_service_available?}.
63
+ #
59
64
  # ## About AlertPolicyService
60
65
  #
61
66
  # The AlertPolicyService API is used to manage (list, create, delete,
@@ -83,6 +88,32 @@ module Google
83
88
  service_module.const_get(:Client).new(&block)
84
89
  end
85
90
 
91
+ ##
92
+ # Determines whether the AlertPolicyService service is supported by the current client.
93
+ # If true, you can retrieve a client object by calling {Google::Cloud::Monitoring.alert_policy_service}.
94
+ # If false, that method will raise an exception. This could happen if the given
95
+ # API version does not exist or does not support the AlertPolicyService service,
96
+ # or if the versioned client gem needs an update to support the AlertPolicyService service.
97
+ #
98
+ # @param version [::String, ::Symbol] The API version to connect to. Optional.
99
+ # Defaults to `:v3`.
100
+ # @return [boolean] Whether the service is available.
101
+ #
102
+ def self.alert_policy_service_available? version: :v3
103
+ require "google/cloud/monitoring/#{version.to_s.downcase}"
104
+ package_name = Google::Cloud::Monitoring
105
+ .constants
106
+ .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
107
+ .first
108
+ return false unless package_name
109
+ service_module = Google::Cloud::Monitoring.const_get package_name
110
+ return false unless service_module.const_defined? :AlertPolicyService
111
+ service_module = service_module.const_get :AlertPolicyService
112
+ service_module.const_defined? :Client
113
+ rescue ::LoadError
114
+ false
115
+ end
116
+
86
117
  ##
87
118
  # Create a new client object for GroupService.
88
119
  #
@@ -94,6 +125,11 @@ module Google
94
125
  # supported by that API version, and the corresponding gem is available, the
95
126
  # appropriate versioned client will be returned.
96
127
  #
128
+ # Raises an exception if the currently installed versioned client gem for the
129
+ # given API version does not support the GroupService service.
130
+ # You can determine whether the method will succeed by calling
131
+ # {Google::Cloud::Monitoring.group_service_available?}.
132
+ #
97
133
  # ## About GroupService
98
134
  #
99
135
  # The Group API lets you inspect and manage your
@@ -124,6 +160,32 @@ module Google
124
160
  service_module.const_get(:Client).new(&block)
125
161
  end
126
162
 
163
+ ##
164
+ # Determines whether the GroupService service is supported by the current client.
165
+ # If true, you can retrieve a client object by calling {Google::Cloud::Monitoring.group_service}.
166
+ # If false, that method will raise an exception. This could happen if the given
167
+ # API version does not exist or does not support the GroupService service,
168
+ # or if the versioned client gem needs an update to support the GroupService service.
169
+ #
170
+ # @param version [::String, ::Symbol] The API version to connect to. Optional.
171
+ # Defaults to `:v3`.
172
+ # @return [boolean] Whether the service is available.
173
+ #
174
+ def self.group_service_available? version: :v3
175
+ require "google/cloud/monitoring/#{version.to_s.downcase}"
176
+ package_name = Google::Cloud::Monitoring
177
+ .constants
178
+ .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
179
+ .first
180
+ return false unless package_name
181
+ service_module = Google::Cloud::Monitoring.const_get package_name
182
+ return false unless service_module.const_defined? :GroupService
183
+ service_module = service_module.const_get :GroupService
184
+ service_module.const_defined? :Client
185
+ rescue ::LoadError
186
+ false
187
+ end
188
+
127
189
  ##
128
190
  # Create a new client object for MetricService.
129
191
  #
@@ -135,6 +197,11 @@ module Google
135
197
  # supported by that API version, and the corresponding gem is available, the
136
198
  # appropriate versioned client will be returned.
137
199
  #
200
+ # Raises an exception if the currently installed versioned client gem for the
201
+ # given API version does not support the MetricService service.
202
+ # You can determine whether the method will succeed by calling
203
+ # {Google::Cloud::Monitoring.metric_service_available?}.
204
+ #
138
205
  # ## About MetricService
139
206
  #
140
207
  # Manages metric descriptors, monitored resource descriptors, and
@@ -155,6 +222,32 @@ module Google
155
222
  service_module.const_get(:Client).new(&block)
156
223
  end
157
224
 
225
+ ##
226
+ # Determines whether the MetricService service is supported by the current client.
227
+ # If true, you can retrieve a client object by calling {Google::Cloud::Monitoring.metric_service}.
228
+ # If false, that method will raise an exception. This could happen if the given
229
+ # API version does not exist or does not support the MetricService service,
230
+ # or if the versioned client gem needs an update to support the MetricService service.
231
+ #
232
+ # @param version [::String, ::Symbol] The API version to connect to. Optional.
233
+ # Defaults to `:v3`.
234
+ # @return [boolean] Whether the service is available.
235
+ #
236
+ def self.metric_service_available? version: :v3
237
+ require "google/cloud/monitoring/#{version.to_s.downcase}"
238
+ package_name = Google::Cloud::Monitoring
239
+ .constants
240
+ .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
241
+ .first
242
+ return false unless package_name
243
+ service_module = Google::Cloud::Monitoring.const_get package_name
244
+ return false unless service_module.const_defined? :MetricService
245
+ service_module = service_module.const_get :MetricService
246
+ service_module.const_defined? :Client
247
+ rescue ::LoadError
248
+ false
249
+ end
250
+
158
251
  ##
159
252
  # Create a new client object for NotificationChannelService.
160
253
  #
@@ -166,6 +259,11 @@ module Google
166
259
  # supported by that API version, and the corresponding gem is available, the
167
260
  # appropriate versioned client will be returned.
168
261
  #
262
+ # Raises an exception if the currently installed versioned client gem for the
263
+ # given API version does not support the NotificationChannelService service.
264
+ # You can determine whether the method will succeed by calling
265
+ # {Google::Cloud::Monitoring.notification_channel_service_available?}.
266
+ #
169
267
  # ## About NotificationChannelService
170
268
  #
171
269
  # The Notification Channel API provides access to configuration that
@@ -186,6 +284,32 @@ module Google
186
284
  service_module.const_get(:Client).new(&block)
187
285
  end
188
286
 
287
+ ##
288
+ # Determines whether the NotificationChannelService service is supported by the current client.
289
+ # If true, you can retrieve a client object by calling {Google::Cloud::Monitoring.notification_channel_service}.
290
+ # If false, that method will raise an exception. This could happen if the given
291
+ # API version does not exist or does not support the NotificationChannelService service,
292
+ # or if the versioned client gem needs an update to support the NotificationChannelService service.
293
+ #
294
+ # @param version [::String, ::Symbol] The API version to connect to. Optional.
295
+ # Defaults to `:v3`.
296
+ # @return [boolean] Whether the service is available.
297
+ #
298
+ def self.notification_channel_service_available? version: :v3
299
+ require "google/cloud/monitoring/#{version.to_s.downcase}"
300
+ package_name = Google::Cloud::Monitoring
301
+ .constants
302
+ .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
303
+ .first
304
+ return false unless package_name
305
+ service_module = Google::Cloud::Monitoring.const_get package_name
306
+ return false unless service_module.const_defined? :NotificationChannelService
307
+ service_module = service_module.const_get :NotificationChannelService
308
+ service_module.const_defined? :Client
309
+ rescue ::LoadError
310
+ false
311
+ end
312
+
189
313
  ##
190
314
  # Create a new client object for QueryService.
191
315
  #
@@ -197,6 +321,11 @@ module Google
197
321
  # supported by that API version, and the corresponding gem is available, the
198
322
  # appropriate versioned client will be returned.
199
323
  #
324
+ # Raises an exception if the currently installed versioned client gem for the
325
+ # given API version does not support the QueryService service.
326
+ # You can determine whether the method will succeed by calling
327
+ # {Google::Cloud::Monitoring.query_service_available?}.
328
+ #
200
329
  # ## About QueryService
201
330
  #
202
331
  # The QueryService API is used to manage time series data in Cloud
@@ -218,6 +347,32 @@ module Google
218
347
  service_module.const_get(:Client).new(&block)
219
348
  end
220
349
 
350
+ ##
351
+ # Determines whether the QueryService service is supported by the current client.
352
+ # If true, you can retrieve a client object by calling {Google::Cloud::Monitoring.query_service}.
353
+ # If false, that method will raise an exception. This could happen if the given
354
+ # API version does not exist or does not support the QueryService service,
355
+ # or if the versioned client gem needs an update to support the QueryService service.
356
+ #
357
+ # @param version [::String, ::Symbol] The API version to connect to. Optional.
358
+ # Defaults to `:v3`.
359
+ # @return [boolean] Whether the service is available.
360
+ #
361
+ def self.query_service_available? version: :v3
362
+ require "google/cloud/monitoring/#{version.to_s.downcase}"
363
+ package_name = Google::Cloud::Monitoring
364
+ .constants
365
+ .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
366
+ .first
367
+ return false unless package_name
368
+ service_module = Google::Cloud::Monitoring.const_get package_name
369
+ return false unless service_module.const_defined? :QueryService
370
+ service_module = service_module.const_get :QueryService
371
+ service_module.const_defined? :Client
372
+ rescue ::LoadError
373
+ false
374
+ end
375
+
221
376
  ##
222
377
  # Create a new client object for ServiceMonitoringService.
223
378
  #
@@ -229,6 +384,11 @@ module Google
229
384
  # supported by that API version, and the corresponding gem is available, the
230
385
  # appropriate versioned client will be returned.
231
386
  #
387
+ # Raises an exception if the currently installed versioned client gem for the
388
+ # given API version does not support the ServiceMonitoringService service.
389
+ # You can determine whether the method will succeed by calling
390
+ # {Google::Cloud::Monitoring.service_monitoring_service_available?}.
391
+ #
232
392
  # ## About ServiceMonitoringService
233
393
  #
234
394
  # The Cloud Monitoring Service-Oriented Monitoring API has endpoints for
@@ -251,6 +411,32 @@ module Google
251
411
  service_module.const_get(:Client).new(&block)
252
412
  end
253
413
 
414
+ ##
415
+ # Determines whether the ServiceMonitoringService service is supported by the current client.
416
+ # If true, you can retrieve a client object by calling {Google::Cloud::Monitoring.service_monitoring_service}.
417
+ # If false, that method will raise an exception. This could happen if the given
418
+ # API version does not exist or does not support the ServiceMonitoringService service,
419
+ # or if the versioned client gem needs an update to support the ServiceMonitoringService service.
420
+ #
421
+ # @param version [::String, ::Symbol] The API version to connect to. Optional.
422
+ # Defaults to `:v3`.
423
+ # @return [boolean] Whether the service is available.
424
+ #
425
+ def self.service_monitoring_service_available? version: :v3
426
+ require "google/cloud/monitoring/#{version.to_s.downcase}"
427
+ package_name = Google::Cloud::Monitoring
428
+ .constants
429
+ .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
430
+ .first
431
+ return false unless package_name
432
+ service_module = Google::Cloud::Monitoring.const_get package_name
433
+ return false unless service_module.const_defined? :ServiceMonitoringService
434
+ service_module = service_module.const_get :ServiceMonitoringService
435
+ service_module.const_defined? :Client
436
+ rescue ::LoadError
437
+ false
438
+ end
439
+
254
440
  ##
255
441
  # Create a new client object for SnoozeService.
256
442
  #
@@ -262,6 +448,11 @@ module Google
262
448
  # supported by that API version, and the corresponding gem is available, the
263
449
  # appropriate versioned client will be returned.
264
450
  #
451
+ # Raises an exception if the currently installed versioned client gem for the
452
+ # given API version does not support the SnoozeService service.
453
+ # You can determine whether the method will succeed by calling
454
+ # {Google::Cloud::Monitoring.snooze_service_available?}.
455
+ #
265
456
  # ## About SnoozeService
266
457
  #
267
458
  # The SnoozeService API is used to temporarily prevent an alert policy from
@@ -283,6 +474,32 @@ module Google
283
474
  service_module.const_get(:Client).new(&block)
284
475
  end
285
476
 
477
+ ##
478
+ # Determines whether the SnoozeService service is supported by the current client.
479
+ # If true, you can retrieve a client object by calling {Google::Cloud::Monitoring.snooze_service}.
480
+ # If false, that method will raise an exception. This could happen if the given
481
+ # API version does not exist or does not support the SnoozeService service,
482
+ # or if the versioned client gem needs an update to support the SnoozeService service.
483
+ #
484
+ # @param version [::String, ::Symbol] The API version to connect to. Optional.
485
+ # Defaults to `:v3`.
486
+ # @return [boolean] Whether the service is available.
487
+ #
488
+ def self.snooze_service_available? version: :v3
489
+ require "google/cloud/monitoring/#{version.to_s.downcase}"
490
+ package_name = Google::Cloud::Monitoring
491
+ .constants
492
+ .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
493
+ .first
494
+ return false unless package_name
495
+ service_module = Google::Cloud::Monitoring.const_get package_name
496
+ return false unless service_module.const_defined? :SnoozeService
497
+ service_module = service_module.const_get :SnoozeService
498
+ service_module.const_defined? :Client
499
+ rescue ::LoadError
500
+ false
501
+ end
502
+
286
503
  ##
287
504
  # Create a new client object for UptimeCheckService.
288
505
  #
@@ -294,6 +511,11 @@ module Google
294
511
  # supported by that API version, and the corresponding gem is available, the
295
512
  # appropriate versioned client will be returned.
296
513
  #
514
+ # Raises an exception if the currently installed versioned client gem for the
515
+ # given API version does not support the UptimeCheckService service.
516
+ # You can determine whether the method will succeed by calling
517
+ # {Google::Cloud::Monitoring.uptime_check_service_available?}.
518
+ #
297
519
  # ## About UptimeCheckService
298
520
  #
299
521
  # The UptimeCheckService API is used to manage (list, create, delete, edit)
@@ -320,6 +542,32 @@ module Google
320
542
  service_module.const_get(:Client).new(&block)
321
543
  end
322
544
 
545
+ ##
546
+ # Determines whether the UptimeCheckService service is supported by the current client.
547
+ # If true, you can retrieve a client object by calling {Google::Cloud::Monitoring.uptime_check_service}.
548
+ # If false, that method will raise an exception. This could happen if the given
549
+ # API version does not exist or does not support the UptimeCheckService service,
550
+ # or if the versioned client gem needs an update to support the UptimeCheckService service.
551
+ #
552
+ # @param version [::String, ::Symbol] The API version to connect to. Optional.
553
+ # Defaults to `:v3`.
554
+ # @return [boolean] Whether the service is available.
555
+ #
556
+ def self.uptime_check_service_available? version: :v3
557
+ require "google/cloud/monitoring/#{version.to_s.downcase}"
558
+ package_name = Google::Cloud::Monitoring
559
+ .constants
560
+ .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
561
+ .first
562
+ return false unless package_name
563
+ service_module = Google::Cloud::Monitoring.const_get package_name
564
+ return false unless service_module.const_defined? :UptimeCheckService
565
+ service_module = service_module.const_get :UptimeCheckService
566
+ service_module.const_defined? :Client
567
+ rescue ::LoadError
568
+ false
569
+ end
570
+
323
571
  ##
324
572
  # Configure the google-cloud-monitoring library.
325
573
  #
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-cloud-monitoring
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.3
4
+ version: 1.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Google LLC
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-08-09 00:00:00.000000000 Z
10
+ date: 2025-01-29 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: google-cloud-core
@@ -107,7 +106,6 @@ homepage: https://github.com/googleapis/google-cloud-ruby
107
106
  licenses:
108
107
  - Apache-2.0
109
108
  metadata: {}
110
- post_install_message:
111
109
  rdoc_options: []
112
110
  require_paths:
113
111
  - lib
@@ -115,15 +113,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
115
113
  requirements:
116
114
  - - ">="
117
115
  - !ruby/object:Gem::Version
118
- version: '2.7'
116
+ version: '3.0'
119
117
  required_rubygems_version: !ruby/object:Gem::Requirement
120
118
  requirements:
121
119
  - - ">="
122
120
  - !ruby/object:Gem::Version
123
121
  version: '0'
124
122
  requirements: []
125
- rubygems_version: 3.5.6
126
- signing_key:
123
+ rubygems_version: 3.6.2
127
124
  specification_version: 4
128
125
  summary: API Client library for the Cloud Monitoring API
129
126
  test_files: []