google-cloud-monitoring 0.37.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (101) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +2 -1
  3. data/AUTHENTICATION.md +51 -59
  4. data/LICENSE.md +203 -0
  5. data/MIGRATING.md +361 -0
  6. data/README.md +34 -50
  7. data/lib/google-cloud-monitoring.rb +6 -5
  8. data/lib/google/cloud/monitoring.rb +255 -443
  9. data/lib/google/cloud/monitoring/dashboard.rb +88 -117
  10. data/lib/google/cloud/monitoring/{v3/doc/google/protobuf/wrappers.rb → dashboard/version.rb} +12 -9
  11. data/lib/google/cloud/monitoring/version.rb +6 -2
  12. metadata +72 -129
  13. data/LICENSE +0 -201
  14. data/lib/google/cloud/monitoring/dashboard/v1.rb +0 -148
  15. data/lib/google/cloud/monitoring/dashboard/v1/credentials.rb +0 -46
  16. data/lib/google/cloud/monitoring/dashboard/v1/dashboards_service_client.rb +0 -457
  17. data/lib/google/cloud/monitoring/dashboard/v1/dashboards_service_client_config.json +0 -51
  18. data/lib/google/cloud/monitoring/dashboard/v1/doc/google/monitoring/dashboard/v1/common.rb +0 -394
  19. data/lib/google/cloud/monitoring/dashboard/v1/doc/google/monitoring/dashboard/v1/dashboard.rb +0 -53
  20. data/lib/google/cloud/monitoring/dashboard/v1/doc/google/monitoring/dashboard/v1/dashboards_service.rb +0 -82
  21. data/lib/google/cloud/monitoring/dashboard/v1/doc/google/monitoring/dashboard/v1/layouts.rb +0 -71
  22. data/lib/google/cloud/monitoring/dashboard/v1/doc/google/monitoring/dashboard/v1/metrics.rb +0 -151
  23. data/lib/google/cloud/monitoring/dashboard/v1/doc/google/monitoring/dashboard/v1/scorecard.rb +0 -102
  24. data/lib/google/cloud/monitoring/dashboard/v1/doc/google/monitoring/dashboard/v1/text.rb +0 -43
  25. data/lib/google/cloud/monitoring/dashboard/v1/doc/google/monitoring/dashboard/v1/widget.rb +0 -41
  26. data/lib/google/cloud/monitoring/dashboard/v1/doc/google/monitoring/dashboard/v1/xychart.rb +0 -141
  27. data/lib/google/cloud/monitoring/dashboard/v1/doc/google/protobuf/duration.rb +0 -91
  28. data/lib/google/cloud/monitoring/dashboard/v1/doc/google/protobuf/empty.rb +0 -29
  29. data/lib/google/cloud/monitoring/v3.rb +0 -532
  30. data/lib/google/cloud/monitoring/v3/alert_policy_service_client.rb +0 -553
  31. data/lib/google/cloud/monitoring/v3/alert_policy_service_client_config.json +0 -51
  32. data/lib/google/cloud/monitoring/v3/credentials.rb +0 -44
  33. data/lib/google/cloud/monitoring/v3/doc/google/api/distribution.rb +0 -200
  34. data/lib/google/cloud/monitoring/v3/doc/google/api/label.rb +0 -42
  35. data/lib/google/cloud/monitoring/v3/doc/google/api/metric.rb +0 -245
  36. data/lib/google/cloud/monitoring/v3/doc/google/api/monitored_resource.rb +0 -108
  37. data/lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/alert.rb +0 -345
  38. data/lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/alert_service.rb +0 -138
  39. data/lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/common.rb +0 -461
  40. data/lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/group.rb +0 -75
  41. data/lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/group_service.rb +0 -167
  42. data/lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/metric.rb +0 -85
  43. data/lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/metric_service.rb +0 -230
  44. data/lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/mutation_record.rb +0 -29
  45. data/lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/notification.rb +0 -156
  46. data/lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/notification_service.rb +0 -221
  47. data/lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/service.rb +0 -361
  48. data/lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/service_service.rb +0 -197
  49. data/lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/uptime.rb +0 -326
  50. data/lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/uptime_service.rb +0 -136
  51. data/lib/google/cloud/monitoring/v3/doc/google/protobuf/any.rb +0 -131
  52. data/lib/google/cloud/monitoring/v3/doc/google/protobuf/duration.rb +0 -91
  53. data/lib/google/cloud/monitoring/v3/doc/google/protobuf/empty.rb +0 -29
  54. data/lib/google/cloud/monitoring/v3/doc/google/protobuf/field_mask.rb +0 -222
  55. data/lib/google/cloud/monitoring/v3/doc/google/protobuf/struct.rb +0 -74
  56. data/lib/google/cloud/monitoring/v3/doc/google/protobuf/timestamp.rb +0 -113
  57. data/lib/google/cloud/monitoring/v3/doc/google/rpc/status.rb +0 -39
  58. data/lib/google/cloud/monitoring/v3/group_service_client.rb +0 -606
  59. data/lib/google/cloud/monitoring/v3/group_service_client_config.json +0 -56
  60. data/lib/google/cloud/monitoring/v3/metric_service_client.rb +0 -750
  61. data/lib/google/cloud/monitoring/v3/metric_service_client_config.json +0 -66
  62. data/lib/google/cloud/monitoring/v3/notification_channel_service_client.rb +0 -811
  63. data/lib/google/cloud/monitoring/v3/notification_channel_service_client_config.json +0 -76
  64. data/lib/google/cloud/monitoring/v3/service_monitoring_service_client.rb +0 -788
  65. data/lib/google/cloud/monitoring/v3/service_monitoring_service_client_config.json +0 -76
  66. data/lib/google/cloud/monitoring/v3/uptime_check_service_client.rb +0 -550
  67. data/lib/google/cloud/monitoring/v3/uptime_check_service_client_config.json +0 -56
  68. data/lib/google/monitoring/dashboard/v1/common_pb.rb +0 -95
  69. data/lib/google/monitoring/dashboard/v1/dashboard_pb.rb +0 -29
  70. data/lib/google/monitoring/dashboard/v1/dashboards_service_pb.rb +0 -51
  71. data/lib/google/monitoring/dashboard/v1/dashboards_service_services_pb.rb +0 -76
  72. data/lib/google/monitoring/dashboard/v1/drilldowns_pb.rb +0 -17
  73. data/lib/google/monitoring/dashboard/v1/layouts_pb.rb +0 -41
  74. data/lib/google/monitoring/dashboard/v1/metrics_pb.rb +0 -76
  75. data/lib/google/monitoring/dashboard/v1/scorecard_pb.rb +0 -38
  76. data/lib/google/monitoring/dashboard/v1/service_pb.rb +0 -17
  77. data/lib/google/monitoring/dashboard/v1/text_pb.rb +0 -28
  78. data/lib/google/monitoring/dashboard/v1/widget_pb.rb +0 -32
  79. data/lib/google/monitoring/dashboard/v1/xychart_pb.rb +0 -66
  80. data/lib/google/monitoring/v3/alert_pb.rb +0 -87
  81. data/lib/google/monitoring/v3/alert_service_pb.rb +0 -53
  82. data/lib/google/monitoring/v3/alert_service_services_pb.rb +0 -63
  83. data/lib/google/monitoring/v3/common_pb.rb +0 -95
  84. data/lib/google/monitoring/v3/dropped_labels_pb.rb +0 -19
  85. data/lib/google/monitoring/v3/group_pb.rb +0 -24
  86. data/lib/google/monitoring/v3/group_service_pb.rb +0 -73
  87. data/lib/google/monitoring/v3/group_service_services_pb.rb +0 -66
  88. data/lib/google/monitoring/v3/metric_pb.rb +0 -82
  89. data/lib/google/monitoring/v3/metric_service_pb.rb +0 -130
  90. data/lib/google/monitoring/v3/metric_service_services_pb.rb +0 -66
  91. data/lib/google/monitoring/v3/mutation_record_pb.rb +0 -21
  92. data/lib/google/monitoring/v3/notification_pb.rb +0 -47
  93. data/lib/google/monitoring/v3/notification_service_pb.rb +0 -90
  94. data/lib/google/monitoring/v3/notification_service_services_pb.rb +0 -94
  95. data/lib/google/monitoring/v3/service_pb.rb +0 -149
  96. data/lib/google/monitoring/v3/service_service_pb.rb +0 -86
  97. data/lib/google/monitoring/v3/service_service_services_pb.rb +0 -65
  98. data/lib/google/monitoring/v3/span_context_pb.rb +0 -19
  99. data/lib/google/monitoring/v3/uptime_pb.rb +0 -109
  100. data/lib/google/monitoring/v3/uptime_service_pb.rb +0 -63
  101. data/lib/google/monitoring/v3/uptime_service_services_pb.rb +0 -67
@@ -1,66 +0,0 @@
1
- {
2
- "interfaces": {
3
- "google.monitoring.v3.MetricService": {
4
- "retry_codes": {
5
- "idempotent": [
6
- "DEADLINE_EXCEEDED",
7
- "UNAVAILABLE"
8
- ],
9
- "non_idempotent": []
10
- },
11
- "retry_params": {
12
- "default": {
13
- "initial_retry_delay_millis": 100,
14
- "retry_delay_multiplier": 1.3,
15
- "max_retry_delay_millis": 60000,
16
- "initial_rpc_timeout_millis": 30000,
17
- "rpc_timeout_multiplier": 1.3,
18
- "max_rpc_timeout_millis": 90000,
19
- "total_timeout_millis": 600000
20
- }
21
- },
22
- "methods": {
23
- "ListMonitoredResourceDescriptors": {
24
- "timeout_millis": 60000,
25
- "retry_codes_name": "idempotent",
26
- "retry_params_name": "default"
27
- },
28
- "GetMonitoredResourceDescriptor": {
29
- "timeout_millis": 60000,
30
- "retry_codes_name": "idempotent",
31
- "retry_params_name": "default"
32
- },
33
- "ListMetricDescriptors": {
34
- "timeout_millis": 60000,
35
- "retry_codes_name": "idempotent",
36
- "retry_params_name": "default"
37
- },
38
- "GetMetricDescriptor": {
39
- "timeout_millis": 60000,
40
- "retry_codes_name": "idempotent",
41
- "retry_params_name": "default"
42
- },
43
- "CreateMetricDescriptor": {
44
- "timeout_millis": 60000,
45
- "retry_codes_name": "non_idempotent",
46
- "retry_params_name": "default"
47
- },
48
- "DeleteMetricDescriptor": {
49
- "timeout_millis": 60000,
50
- "retry_codes_name": "idempotent",
51
- "retry_params_name": "default"
52
- },
53
- "ListTimeSeries": {
54
- "timeout_millis": 60000,
55
- "retry_codes_name": "idempotent",
56
- "retry_params_name": "default"
57
- },
58
- "CreateTimeSeries": {
59
- "timeout_millis": 12000,
60
- "retry_codes_name": "non_idempotent",
61
- "retry_params_name": "default"
62
- }
63
- }
64
- }
65
- }
66
- }
@@ -1,811 +0,0 @@
1
- # Copyright 2020 Google LLC
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # https://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
- #
15
- # EDITING INSTRUCTIONS
16
- # This file was generated from the file
17
- # https://github.com/googleapis/googleapis/blob/master/google/monitoring/v3/notification_service.proto,
18
- # and updates to that file get reflected here through a refresh process.
19
- # For the short term, the refresh process will only be runnable by Google
20
- # engineers.
21
-
22
-
23
- require "json"
24
- require "pathname"
25
-
26
- require "google/gax"
27
-
28
- require "google/monitoring/v3/notification_service_pb"
29
- require "google/cloud/monitoring/v3/credentials"
30
- require "google/cloud/monitoring/version"
31
-
32
- module Google
33
- module Cloud
34
- module Monitoring
35
- module V3
36
- # The Notification Channel API provides access to configuration that
37
- # controls how messages related to incidents are sent.
38
- #
39
- # @!attribute [r] notification_channel_service_stub
40
- # @return [Google::Monitoring::V3::NotificationChannelService::Stub]
41
- class NotificationChannelServiceClient
42
- # @private
43
- attr_reader :notification_channel_service_stub
44
-
45
- # The default address of the service.
46
- SERVICE_ADDRESS = "monitoring.googleapis.com".freeze
47
-
48
- # The default port of the service.
49
- DEFAULT_SERVICE_PORT = 443
50
-
51
- # The default set of gRPC interceptors.
52
- GRPC_INTERCEPTORS = []
53
-
54
- DEFAULT_TIMEOUT = 30
55
-
56
- PAGE_DESCRIPTORS = {
57
- "list_notification_channel_descriptors" => Google::Gax::PageDescriptor.new(
58
- "page_token",
59
- "next_page_token",
60
- "channel_descriptors"),
61
- "list_notification_channels" => Google::Gax::PageDescriptor.new(
62
- "page_token",
63
- "next_page_token",
64
- "notification_channels")
65
- }.freeze
66
-
67
- private_constant :PAGE_DESCRIPTORS
68
-
69
- # The scopes needed to make gRPC calls to all of the methods defined in
70
- # this service.
71
- ALL_SCOPES = [
72
- "https://www.googleapis.com/auth/cloud-platform",
73
- "https://www.googleapis.com/auth/monitoring",
74
- "https://www.googleapis.com/auth/monitoring.read",
75
- "https://www.googleapis.com/auth/monitoring.write"
76
- ].freeze
77
-
78
-
79
- NOTIFICATION_CHANNEL_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
80
- "projects/{project}/notificationChannels/{notification_channel}"
81
- )
82
-
83
- private_constant :NOTIFICATION_CHANNEL_PATH_TEMPLATE
84
-
85
- NOTIFICATION_CHANNEL_DESCRIPTOR_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
86
- "projects/{project}/notificationChannelDescriptors/{channel_descriptor}"
87
- )
88
-
89
- private_constant :NOTIFICATION_CHANNEL_DESCRIPTOR_PATH_TEMPLATE
90
-
91
- PROJECT_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
92
- "projects/{project}"
93
- )
94
-
95
- private_constant :PROJECT_PATH_TEMPLATE
96
-
97
- # Returns a fully-qualified notification_channel resource name string.
98
- # @param project [String]
99
- # @param notification_channel [String]
100
- # @return [String]
101
- def self.notification_channel_path project, notification_channel
102
- NOTIFICATION_CHANNEL_PATH_TEMPLATE.render(
103
- :"project" => project,
104
- :"notification_channel" => notification_channel
105
- )
106
- end
107
-
108
- # Returns a fully-qualified notification_channel_descriptor resource name string.
109
- # @param project [String]
110
- # @param channel_descriptor [String]
111
- # @return [String]
112
- def self.notification_channel_descriptor_path project, channel_descriptor
113
- NOTIFICATION_CHANNEL_DESCRIPTOR_PATH_TEMPLATE.render(
114
- :"project" => project,
115
- :"channel_descriptor" => channel_descriptor
116
- )
117
- end
118
-
119
- # Returns a fully-qualified project resource name string.
120
- # @param project [String]
121
- # @return [String]
122
- def self.project_path project
123
- PROJECT_PATH_TEMPLATE.render(
124
- :"project" => project
125
- )
126
- end
127
-
128
- # @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
129
- # Provides the means for authenticating requests made by the client. This parameter can
130
- # be many types.
131
- # A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
132
- # authenticating requests made by this client.
133
- # A `String` will be treated as the path to the keyfile to be used for the construction of
134
- # credentials for this client.
135
- # A `Hash` will be treated as the contents of a keyfile to be used for the construction of
136
- # credentials for this client.
137
- # A `GRPC::Core::Channel` will be used to make calls through.
138
- # A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
139
- # should already be composed with a `GRPC::Core::CallCredentials` object.
140
- # A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
141
- # metadata for requests, generally, to give OAuth credentials.
142
- # @param scopes [Array<String>]
143
- # The OAuth scopes for this service. This parameter is ignored if
144
- # an updater_proc is supplied.
145
- # @param client_config [Hash]
146
- # A Hash for call options for each method. See
147
- # Google::Gax#construct_settings for the structure of
148
- # this data. Falls back to the default config if not specified
149
- # or the specified config is missing data points.
150
- # @param timeout [Numeric]
151
- # The default timeout, in seconds, for calls made through this client.
152
- # @param metadata [Hash]
153
- # Default metadata to be sent with each request. This can be overridden on a per call basis.
154
- # @param service_address [String]
155
- # Override for the service hostname, or `nil` to leave as the default.
156
- # @param service_port [Integer]
157
- # Override for the service port, or `nil` to leave as the default.
158
- # @param exception_transformer [Proc]
159
- # An optional proc that intercepts any exceptions raised during an API call to inject
160
- # custom error handling.
161
- def initialize \
162
- credentials: nil,
163
- scopes: ALL_SCOPES,
164
- client_config: {},
165
- timeout: DEFAULT_TIMEOUT,
166
- metadata: nil,
167
- service_address: nil,
168
- service_port: nil,
169
- exception_transformer: nil,
170
- lib_name: nil,
171
- lib_version: ""
172
- # These require statements are intentionally placed here to initialize
173
- # the gRPC module only when it's required.
174
- # See https://github.com/googleapis/toolkit/issues/446
175
- require "google/gax/grpc"
176
- require "google/monitoring/v3/notification_service_services_pb"
177
-
178
- credentials ||= Google::Cloud::Monitoring::V3::Credentials.default
179
-
180
- if credentials.is_a?(String) || credentials.is_a?(Hash)
181
- updater_proc = Google::Cloud::Monitoring::V3::Credentials.new(credentials).updater_proc
182
- end
183
- if credentials.is_a?(GRPC::Core::Channel)
184
- channel = credentials
185
- end
186
- if credentials.is_a?(GRPC::Core::ChannelCredentials)
187
- chan_creds = credentials
188
- end
189
- if credentials.is_a?(Proc)
190
- updater_proc = credentials
191
- end
192
- if credentials.is_a?(Google::Auth::Credentials)
193
- updater_proc = credentials.updater_proc
194
- end
195
-
196
- package_version = Google::Cloud::Monitoring::VERSION
197
-
198
- google_api_client = "gl-ruby/#{RUBY_VERSION}"
199
- google_api_client << " #{lib_name}/#{lib_version}" if lib_name
200
- google_api_client << " gapic/#{package_version} gax/#{Google::Gax::VERSION}"
201
- google_api_client << " grpc/#{GRPC::VERSION}"
202
- google_api_client.freeze
203
-
204
- headers = { :"x-goog-api-client" => google_api_client }
205
- if credentials.respond_to?(:quota_project_id) && credentials.quota_project_id
206
- headers[:"x-goog-user-project"] = credentials.quota_project_id
207
- end
208
- headers.merge!(metadata) unless metadata.nil?
209
- client_config_file = Pathname.new(__dir__).join(
210
- "notification_channel_service_client_config.json"
211
- )
212
- defaults = client_config_file.open do |f|
213
- Google::Gax.construct_settings(
214
- "google.monitoring.v3.NotificationChannelService",
215
- JSON.parse(f.read),
216
- client_config,
217
- Google::Gax::Grpc::STATUS_CODE_NAMES,
218
- timeout,
219
- page_descriptors: PAGE_DESCRIPTORS,
220
- errors: Google::Gax::Grpc::API_ERRORS,
221
- metadata: headers
222
- )
223
- end
224
-
225
- # Allow overriding the service path/port in subclasses.
226
- service_path = service_address || self.class::SERVICE_ADDRESS
227
- port = service_port || self.class::DEFAULT_SERVICE_PORT
228
- interceptors = self.class::GRPC_INTERCEPTORS
229
- @notification_channel_service_stub = Google::Gax::Grpc.create_stub(
230
- service_path,
231
- port,
232
- chan_creds: chan_creds,
233
- channel: channel,
234
- updater_proc: updater_proc,
235
- scopes: scopes,
236
- interceptors: interceptors,
237
- &Google::Monitoring::V3::NotificationChannelService::Stub.method(:new)
238
- )
239
-
240
- @list_notification_channel_descriptors = Google::Gax.create_api_call(
241
- @notification_channel_service_stub.method(:list_notification_channel_descriptors),
242
- defaults["list_notification_channel_descriptors"],
243
- exception_transformer: exception_transformer,
244
- params_extractor: proc do |request|
245
- {'name' => request.name}
246
- end
247
- )
248
- @get_notification_channel_descriptor = Google::Gax.create_api_call(
249
- @notification_channel_service_stub.method(:get_notification_channel_descriptor),
250
- defaults["get_notification_channel_descriptor"],
251
- exception_transformer: exception_transformer,
252
- params_extractor: proc do |request|
253
- {'name' => request.name}
254
- end
255
- )
256
- @list_notification_channels = Google::Gax.create_api_call(
257
- @notification_channel_service_stub.method(:list_notification_channels),
258
- defaults["list_notification_channels"],
259
- exception_transformer: exception_transformer,
260
- params_extractor: proc do |request|
261
- {'name' => request.name}
262
- end
263
- )
264
- @get_notification_channel = Google::Gax.create_api_call(
265
- @notification_channel_service_stub.method(:get_notification_channel),
266
- defaults["get_notification_channel"],
267
- exception_transformer: exception_transformer,
268
- params_extractor: proc do |request|
269
- {'name' => request.name}
270
- end
271
- )
272
- @create_notification_channel = Google::Gax.create_api_call(
273
- @notification_channel_service_stub.method(:create_notification_channel),
274
- defaults["create_notification_channel"],
275
- exception_transformer: exception_transformer,
276
- params_extractor: proc do |request|
277
- {'name' => request.name}
278
- end
279
- )
280
- @update_notification_channel = Google::Gax.create_api_call(
281
- @notification_channel_service_stub.method(:update_notification_channel),
282
- defaults["update_notification_channel"],
283
- exception_transformer: exception_transformer,
284
- params_extractor: proc do |request|
285
- {'notification_channel.name' => request.notification_channel.name}
286
- end
287
- )
288
- @delete_notification_channel = Google::Gax.create_api_call(
289
- @notification_channel_service_stub.method(:delete_notification_channel),
290
- defaults["delete_notification_channel"],
291
- exception_transformer: exception_transformer,
292
- params_extractor: proc do |request|
293
- {'name' => request.name}
294
- end
295
- )
296
- @send_notification_channel_verification_code = Google::Gax.create_api_call(
297
- @notification_channel_service_stub.method(:send_notification_channel_verification_code),
298
- defaults["send_notification_channel_verification_code"],
299
- exception_transformer: exception_transformer,
300
- params_extractor: proc do |request|
301
- {'name' => request.name}
302
- end
303
- )
304
- @get_notification_channel_verification_code = Google::Gax.create_api_call(
305
- @notification_channel_service_stub.method(:get_notification_channel_verification_code),
306
- defaults["get_notification_channel_verification_code"],
307
- exception_transformer: exception_transformer,
308
- params_extractor: proc do |request|
309
- {'name' => request.name}
310
- end
311
- )
312
- @verify_notification_channel = Google::Gax.create_api_call(
313
- @notification_channel_service_stub.method(:verify_notification_channel),
314
- defaults["verify_notification_channel"],
315
- exception_transformer: exception_transformer,
316
- params_extractor: proc do |request|
317
- {'name' => request.name}
318
- end
319
- )
320
- end
321
-
322
- # Service calls
323
-
324
- # Lists the descriptors for supported channel types. The use of descriptors
325
- # makes it possible for new channel types to be dynamically added.
326
- #
327
- # @param name [String]
328
- # Required. The REST resource name of the parent from which to retrieve
329
- # the notification channel descriptors. The expected syntax is:
330
- #
331
- # projects/[PROJECT_ID_OR_NUMBER]
332
- #
333
- # Note that this names the parent container in which to look for the
334
- # descriptors; to retrieve a single descriptor by name, use the
335
- # {Google::Monitoring::V3::NotificationChannelService::GetNotificationChannelDescriptor GetNotificationChannelDescriptor}
336
- # operation, instead.
337
- # @param page_size [Integer]
338
- # The maximum number of resources contained in the underlying API
339
- # response. If page streaming is performed per-resource, this
340
- # parameter does not affect the return value. If page streaming is
341
- # performed per-page, this determines the maximum number of
342
- # resources in a page.
343
- # @param options [Google::Gax::CallOptions]
344
- # Overrides the default settings for this call, e.g, timeout,
345
- # retries, etc.
346
- # @yield [result, operation] Access the result along with the RPC operation
347
- # @yieldparam result [Google::Gax::PagedEnumerable<Google::Monitoring::V3::NotificationChannelDescriptor>]
348
- # @yieldparam operation [GRPC::ActiveCall::Operation]
349
- # @return [Google::Gax::PagedEnumerable<Google::Monitoring::V3::NotificationChannelDescriptor>]
350
- # An enumerable of Google::Monitoring::V3::NotificationChannelDescriptor instances.
351
- # See Google::Gax::PagedEnumerable documentation for other
352
- # operations such as per-page iteration or access to the response
353
- # object.
354
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
355
- # @example
356
- # require "google/cloud/monitoring"
357
- #
358
- # notification_channel_client = Google::Cloud::Monitoring::NotificationChannel.new(version: :v3)
359
- # formatted_name = Google::Cloud::Monitoring::V3::NotificationChannelServiceClient.project_path("[PROJECT]")
360
- #
361
- # # Iterate over all results.
362
- # notification_channel_client.list_notification_channel_descriptors(formatted_name).each do |element|
363
- # # Process element.
364
- # end
365
- #
366
- # # Or iterate over results one page at a time.
367
- # notification_channel_client.list_notification_channel_descriptors(formatted_name).each_page do |page|
368
- # # Process each page at a time.
369
- # page.each do |element|
370
- # # Process element.
371
- # end
372
- # end
373
-
374
- def list_notification_channel_descriptors \
375
- name,
376
- page_size: nil,
377
- options: nil,
378
- &block
379
- req = {
380
- name: name,
381
- page_size: page_size
382
- }.delete_if { |_, v| v.nil? }
383
- req = Google::Gax::to_proto(req, Google::Monitoring::V3::ListNotificationChannelDescriptorsRequest)
384
- @list_notification_channel_descriptors.call(req, options, &block)
385
- end
386
-
387
- # Gets a single channel descriptor. The descriptor indicates which fields
388
- # are expected / permitted for a notification channel of the given type.
389
- #
390
- # @param name [String]
391
- # Required. The channel type for which to execute the request. The format is:
392
- #
393
- # projects/[PROJECT_ID_OR_NUMBER]/notificationChannelDescriptors/[CHANNEL_TYPE]
394
- # @param options [Google::Gax::CallOptions]
395
- # Overrides the default settings for this call, e.g, timeout,
396
- # retries, etc.
397
- # @yield [result, operation] Access the result along with the RPC operation
398
- # @yieldparam result [Google::Monitoring::V3::NotificationChannelDescriptor]
399
- # @yieldparam operation [GRPC::ActiveCall::Operation]
400
- # @return [Google::Monitoring::V3::NotificationChannelDescriptor]
401
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
402
- # @example
403
- # require "google/cloud/monitoring"
404
- #
405
- # notification_channel_client = Google::Cloud::Monitoring::NotificationChannel.new(version: :v3)
406
- # formatted_name = Google::Cloud::Monitoring::V3::NotificationChannelServiceClient.notification_channel_descriptor_path("[PROJECT]", "[CHANNEL_DESCRIPTOR]")
407
- # response = notification_channel_client.get_notification_channel_descriptor(formatted_name)
408
-
409
- def get_notification_channel_descriptor \
410
- name,
411
- options: nil,
412
- &block
413
- req = {
414
- name: name
415
- }.delete_if { |_, v| v.nil? }
416
- req = Google::Gax::to_proto(req, Google::Monitoring::V3::GetNotificationChannelDescriptorRequest)
417
- @get_notification_channel_descriptor.call(req, options, &block)
418
- end
419
-
420
- # Lists the notification channels that have been created for the project.
421
- #
422
- # @param name [String]
423
- # Required. The project on which to execute the request. The format is:
424
- #
425
- # projects/[PROJECT_ID_OR_NUMBER]
426
- #
427
- # This names the container
428
- # in which to look for the notification channels; it does not name a
429
- # specific channel. To query a specific channel by REST resource name, use
430
- # the
431
- # {Google::Monitoring::V3::NotificationChannelService::GetNotificationChannel `GetNotificationChannel`}
432
- # operation.
433
- # @param filter [String]
434
- # If provided, this field specifies the criteria that must be met by
435
- # notification channels to be included in the response.
436
- #
437
- # For more details, see [sorting and
438
- # filtering](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering).
439
- # @param order_by [String]
440
- # A comma-separated list of fields by which to sort the result. Supports
441
- # the same set of fields as in `filter`. Entries can be prefixed with
442
- # a minus sign to sort in descending rather than ascending order.
443
- #
444
- # For more details, see [sorting and
445
- # filtering](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering).
446
- # @param page_size [Integer]
447
- # The maximum number of resources contained in the underlying API
448
- # response. If page streaming is performed per-resource, this
449
- # parameter does not affect the return value. If page streaming is
450
- # performed per-page, this determines the maximum number of
451
- # resources in a page.
452
- # @param options [Google::Gax::CallOptions]
453
- # Overrides the default settings for this call, e.g, timeout,
454
- # retries, etc.
455
- # @yield [result, operation] Access the result along with the RPC operation
456
- # @yieldparam result [Google::Gax::PagedEnumerable<Google::Monitoring::V3::NotificationChannel>]
457
- # @yieldparam operation [GRPC::ActiveCall::Operation]
458
- # @return [Google::Gax::PagedEnumerable<Google::Monitoring::V3::NotificationChannel>]
459
- # An enumerable of Google::Monitoring::V3::NotificationChannel instances.
460
- # See Google::Gax::PagedEnumerable documentation for other
461
- # operations such as per-page iteration or access to the response
462
- # object.
463
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
464
- # @example
465
- # require "google/cloud/monitoring"
466
- #
467
- # notification_channel_client = Google::Cloud::Monitoring::NotificationChannel.new(version: :v3)
468
- # formatted_name = Google::Cloud::Monitoring::V3::NotificationChannelServiceClient.project_path("[PROJECT]")
469
- #
470
- # # Iterate over all results.
471
- # notification_channel_client.list_notification_channels(formatted_name).each do |element|
472
- # # Process element.
473
- # end
474
- #
475
- # # Or iterate over results one page at a time.
476
- # notification_channel_client.list_notification_channels(formatted_name).each_page do |page|
477
- # # Process each page at a time.
478
- # page.each do |element|
479
- # # Process element.
480
- # end
481
- # end
482
-
483
- def list_notification_channels \
484
- name,
485
- filter: nil,
486
- order_by: nil,
487
- page_size: nil,
488
- options: nil,
489
- &block
490
- req = {
491
- name: name,
492
- filter: filter,
493
- order_by: order_by,
494
- page_size: page_size
495
- }.delete_if { |_, v| v.nil? }
496
- req = Google::Gax::to_proto(req, Google::Monitoring::V3::ListNotificationChannelsRequest)
497
- @list_notification_channels.call(req, options, &block)
498
- end
499
-
500
- # Gets a single notification channel. The channel includes the relevant
501
- # configuration details with which the channel was created. However, the
502
- # response may truncate or omit passwords, API keys, or other private key
503
- # matter and thus the response may not be 100% identical to the information
504
- # that was supplied in the call to the create method.
505
- #
506
- # @param name [String]
507
- # Required. The channel for which to execute the request. The format is:
508
- #
509
- # projects/[PROJECT_ID_OR_NUMBER]/notificationChannels/[CHANNEL_ID]
510
- # @param options [Google::Gax::CallOptions]
511
- # Overrides the default settings for this call, e.g, timeout,
512
- # retries, etc.
513
- # @yield [result, operation] Access the result along with the RPC operation
514
- # @yieldparam result [Google::Monitoring::V3::NotificationChannel]
515
- # @yieldparam operation [GRPC::ActiveCall::Operation]
516
- # @return [Google::Monitoring::V3::NotificationChannel]
517
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
518
- # @example
519
- # require "google/cloud/monitoring"
520
- #
521
- # notification_channel_client = Google::Cloud::Monitoring::NotificationChannel.new(version: :v3)
522
- # formatted_name = Google::Cloud::Monitoring::V3::NotificationChannelServiceClient.notification_channel_path("[PROJECT]", "[NOTIFICATION_CHANNEL]")
523
- # response = notification_channel_client.get_notification_channel(formatted_name)
524
-
525
- def get_notification_channel \
526
- name,
527
- options: nil,
528
- &block
529
- req = {
530
- name: name
531
- }.delete_if { |_, v| v.nil? }
532
- req = Google::Gax::to_proto(req, Google::Monitoring::V3::GetNotificationChannelRequest)
533
- @get_notification_channel.call(req, options, &block)
534
- end
535
-
536
- # Creates a new notification channel, representing a single notification
537
- # endpoint such as an email address, SMS number, or PagerDuty service.
538
- #
539
- # @param name [String]
540
- # Required. The project on which to execute the request. The format is:
541
- #
542
- # projects/[PROJECT_ID_OR_NUMBER]
543
- #
544
- # This names the container into which the channel will be
545
- # written, this does not name the newly created channel. The resulting
546
- # channel's name will have a normalized version of this field as a prefix,
547
- # but will add `/notificationChannels/[CHANNEL_ID]` to identify the channel.
548
- # @param notification_channel [Google::Monitoring::V3::NotificationChannel | Hash]
549
- # Required. The definition of the `NotificationChannel` to create.
550
- # A hash of the same form as `Google::Monitoring::V3::NotificationChannel`
551
- # can also be provided.
552
- # @param options [Google::Gax::CallOptions]
553
- # Overrides the default settings for this call, e.g, timeout,
554
- # retries, etc.
555
- # @yield [result, operation] Access the result along with the RPC operation
556
- # @yieldparam result [Google::Monitoring::V3::NotificationChannel]
557
- # @yieldparam operation [GRPC::ActiveCall::Operation]
558
- # @return [Google::Monitoring::V3::NotificationChannel]
559
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
560
- # @example
561
- # require "google/cloud/monitoring"
562
- #
563
- # notification_channel_client = Google::Cloud::Monitoring::NotificationChannel.new(version: :v3)
564
- # formatted_name = Google::Cloud::Monitoring::V3::NotificationChannelServiceClient.project_path("[PROJECT]")
565
- #
566
- # # TODO: Initialize `notification_channel`:
567
- # notification_channel = {}
568
- # response = notification_channel_client.create_notification_channel(formatted_name, notification_channel)
569
-
570
- def create_notification_channel \
571
- name,
572
- notification_channel,
573
- options: nil,
574
- &block
575
- req = {
576
- name: name,
577
- notification_channel: notification_channel
578
- }.delete_if { |_, v| v.nil? }
579
- req = Google::Gax::to_proto(req, Google::Monitoring::V3::CreateNotificationChannelRequest)
580
- @create_notification_channel.call(req, options, &block)
581
- end
582
-
583
- # Updates a notification channel. Fields not specified in the field mask
584
- # remain unchanged.
585
- #
586
- # @param notification_channel [Google::Monitoring::V3::NotificationChannel | Hash]
587
- # Required. A description of the changes to be applied to the specified
588
- # notification channel. The description must provide a definition for
589
- # fields to be updated; the names of these fields should also be
590
- # included in the `update_mask`.
591
- # A hash of the same form as `Google::Monitoring::V3::NotificationChannel`
592
- # can also be provided.
593
- # @param update_mask [Google::Protobuf::FieldMask | Hash]
594
- # The fields to update.
595
- # A hash of the same form as `Google::Protobuf::FieldMask`
596
- # can also be provided.
597
- # @param options [Google::Gax::CallOptions]
598
- # Overrides the default settings for this call, e.g, timeout,
599
- # retries, etc.
600
- # @yield [result, operation] Access the result along with the RPC operation
601
- # @yieldparam result [Google::Monitoring::V3::NotificationChannel]
602
- # @yieldparam operation [GRPC::ActiveCall::Operation]
603
- # @return [Google::Monitoring::V3::NotificationChannel]
604
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
605
- # @example
606
- # require "google/cloud/monitoring"
607
- #
608
- # notification_channel_client = Google::Cloud::Monitoring::NotificationChannel.new(version: :v3)
609
- #
610
- # # TODO: Initialize `notification_channel`:
611
- # notification_channel = {}
612
- # response = notification_channel_client.update_notification_channel(notification_channel)
613
-
614
- def update_notification_channel \
615
- notification_channel,
616
- update_mask: nil,
617
- options: nil,
618
- &block
619
- req = {
620
- notification_channel: notification_channel,
621
- update_mask: update_mask
622
- }.delete_if { |_, v| v.nil? }
623
- req = Google::Gax::to_proto(req, Google::Monitoring::V3::UpdateNotificationChannelRequest)
624
- @update_notification_channel.call(req, options, &block)
625
- end
626
-
627
- # Deletes a notification channel.
628
- #
629
- # @param name [String]
630
- # Required. The channel for which to execute the request. The format is:
631
- #
632
- # projects/[PROJECT_ID_OR_NUMBER]/notificationChannels/[CHANNEL_ID]
633
- # @param force [true, false]
634
- # If true, the notification channel will be deleted regardless of its
635
- # use in alert policies (the policies will be updated to remove the
636
- # channel). If false, channels that are still referenced by an existing
637
- # alerting policy will fail to be deleted in a delete operation.
638
- # @param options [Google::Gax::CallOptions]
639
- # Overrides the default settings for this call, e.g, timeout,
640
- # retries, etc.
641
- # @yield [result, operation] Access the result along with the RPC operation
642
- # @yieldparam result []
643
- # @yieldparam operation [GRPC::ActiveCall::Operation]
644
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
645
- # @example
646
- # require "google/cloud/monitoring"
647
- #
648
- # notification_channel_client = Google::Cloud::Monitoring::NotificationChannel.new(version: :v3)
649
- # formatted_name = Google::Cloud::Monitoring::V3::NotificationChannelServiceClient.notification_channel_path("[PROJECT]", "[NOTIFICATION_CHANNEL]")
650
- # notification_channel_client.delete_notification_channel(formatted_name)
651
-
652
- def delete_notification_channel \
653
- name,
654
- force: nil,
655
- options: nil,
656
- &block
657
- req = {
658
- name: name,
659
- force: force
660
- }.delete_if { |_, v| v.nil? }
661
- req = Google::Gax::to_proto(req, Google::Monitoring::V3::DeleteNotificationChannelRequest)
662
- @delete_notification_channel.call(req, options, &block)
663
- nil
664
- end
665
-
666
- # Causes a verification code to be delivered to the channel. The code
667
- # can then be supplied in `VerifyNotificationChannel` to verify the channel.
668
- #
669
- # @param name [String]
670
- # Required. The notification channel to which to send a verification code.
671
- # @param options [Google::Gax::CallOptions]
672
- # Overrides the default settings for this call, e.g, timeout,
673
- # retries, etc.
674
- # @yield [result, operation] Access the result along with the RPC operation
675
- # @yieldparam result []
676
- # @yieldparam operation [GRPC::ActiveCall::Operation]
677
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
678
- # @example
679
- # require "google/cloud/monitoring"
680
- #
681
- # notification_channel_client = Google::Cloud::Monitoring::NotificationChannel.new(version: :v3)
682
- # formatted_name = Google::Cloud::Monitoring::V3::NotificationChannelServiceClient.notification_channel_path("[PROJECT]", "[NOTIFICATION_CHANNEL]")
683
- # notification_channel_client.send_notification_channel_verification_code(formatted_name)
684
-
685
- def send_notification_channel_verification_code \
686
- name,
687
- options: nil,
688
- &block
689
- req = {
690
- name: name
691
- }.delete_if { |_, v| v.nil? }
692
- req = Google::Gax::to_proto(req, Google::Monitoring::V3::SendNotificationChannelVerificationCodeRequest)
693
- @send_notification_channel_verification_code.call(req, options, &block)
694
- nil
695
- end
696
-
697
- # Requests a verification code for an already verified channel that can then
698
- # be used in a call to VerifyNotificationChannel() on a different channel
699
- # with an equivalent identity in the same or in a different project. This
700
- # makes it possible to copy a channel between projects without requiring
701
- # manual reverification of the channel. If the channel is not in the
702
- # verified state, this method will fail (in other words, this may only be
703
- # used if the SendNotificationChannelVerificationCode and
704
- # VerifyNotificationChannel paths have already been used to put the given
705
- # channel into the verified state).
706
- #
707
- # There is no guarantee that the verification codes returned by this method
708
- # will be of a similar structure or form as the ones that are delivered
709
- # to the channel via SendNotificationChannelVerificationCode; while
710
- # VerifyNotificationChannel() will recognize both the codes delivered via
711
- # SendNotificationChannelVerificationCode() and returned from
712
- # GetNotificationChannelVerificationCode(), it is typically the case that
713
- # the verification codes delivered via
714
- # SendNotificationChannelVerificationCode() will be shorter and also
715
- # have a shorter expiration (e.g. codes such as "G-123456") whereas
716
- # GetVerificationCode() will typically return a much longer, websafe base
717
- # 64 encoded string that has a longer expiration time.
718
- #
719
- # @param name [String]
720
- # Required. The notification channel for which a verification code is to be generated
721
- # and retrieved. This must name a channel that is already verified; if
722
- # the specified channel is not verified, the request will fail.
723
- # @param expire_time [Google::Protobuf::Timestamp | Hash]
724
- # The desired expiration time. If specified, the API will guarantee that
725
- # the returned code will not be valid after the specified timestamp;
726
- # however, the API cannot guarantee that the returned code will be
727
- # valid for at least as long as the requested time (the API puts an upper
728
- # bound on the amount of time for which a code may be valid). If omitted,
729
- # a default expiration will be used, which may be less than the max
730
- # permissible expiration (so specifying an expiration may extend the
731
- # code's lifetime over omitting an expiration, even though the API does
732
- # impose an upper limit on the maximum expiration that is permitted).
733
- # A hash of the same form as `Google::Protobuf::Timestamp`
734
- # can also be provided.
735
- # @param options [Google::Gax::CallOptions]
736
- # Overrides the default settings for this call, e.g, timeout,
737
- # retries, etc.
738
- # @yield [result, operation] Access the result along with the RPC operation
739
- # @yieldparam result [Google::Monitoring::V3::GetNotificationChannelVerificationCodeResponse]
740
- # @yieldparam operation [GRPC::ActiveCall::Operation]
741
- # @return [Google::Monitoring::V3::GetNotificationChannelVerificationCodeResponse]
742
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
743
- # @example
744
- # require "google/cloud/monitoring"
745
- #
746
- # notification_channel_client = Google::Cloud::Monitoring::NotificationChannel.new(version: :v3)
747
- # formatted_name = Google::Cloud::Monitoring::V3::NotificationChannelServiceClient.notification_channel_path("[PROJECT]", "[NOTIFICATION_CHANNEL]")
748
- # response = notification_channel_client.get_notification_channel_verification_code(formatted_name)
749
-
750
- def get_notification_channel_verification_code \
751
- name,
752
- expire_time: nil,
753
- options: nil,
754
- &block
755
- req = {
756
- name: name,
757
- expire_time: expire_time
758
- }.delete_if { |_, v| v.nil? }
759
- req = Google::Gax::to_proto(req, Google::Monitoring::V3::GetNotificationChannelVerificationCodeRequest)
760
- @get_notification_channel_verification_code.call(req, options, &block)
761
- end
762
-
763
- # Verifies a `NotificationChannel` by proving receipt of the code
764
- # delivered to the channel as a result of calling
765
- # `SendNotificationChannelVerificationCode`.
766
- #
767
- # @param name [String]
768
- # Required. The notification channel to verify.
769
- # @param code [String]
770
- # Required. The verification code that was delivered to the channel as
771
- # a result of invoking the `SendNotificationChannelVerificationCode` API
772
- # method or that was retrieved from a verified channel via
773
- # `GetNotificationChannelVerificationCode`. For example, one might have
774
- # "G-123456" or "TKNZGhhd2EyN3I1MnRnMjRv" (in general, one is only
775
- # guaranteed that the code is valid UTF-8; one should not
776
- # make any assumptions regarding the structure or format of the code).
777
- # @param options [Google::Gax::CallOptions]
778
- # Overrides the default settings for this call, e.g, timeout,
779
- # retries, etc.
780
- # @yield [result, operation] Access the result along with the RPC operation
781
- # @yieldparam result [Google::Monitoring::V3::NotificationChannel]
782
- # @yieldparam operation [GRPC::ActiveCall::Operation]
783
- # @return [Google::Monitoring::V3::NotificationChannel]
784
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
785
- # @example
786
- # require "google/cloud/monitoring"
787
- #
788
- # notification_channel_client = Google::Cloud::Monitoring::NotificationChannel.new(version: :v3)
789
- # formatted_name = Google::Cloud::Monitoring::V3::NotificationChannelServiceClient.notification_channel_path("[PROJECT]", "[NOTIFICATION_CHANNEL]")
790
- #
791
- # # TODO: Initialize `code`:
792
- # code = ''
793
- # response = notification_channel_client.verify_notification_channel(formatted_name, code)
794
-
795
- def verify_notification_channel \
796
- name,
797
- code,
798
- options: nil,
799
- &block
800
- req = {
801
- name: name,
802
- code: code
803
- }.delete_if { |_, v| v.nil? }
804
- req = Google::Gax::to_proto(req, Google::Monitoring::V3::VerifyNotificationChannelRequest)
805
- @verify_notification_channel.call(req, options, &block)
806
- end
807
- end
808
- end
809
- end
810
- end
811
- end