google-cloud-monitoring 0.38.0 → 1.2.0

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 -54
  4. data/LICENSE.md +201 -0
  5. data/MIGRATING.md +361 -0
  6. data/README.md +95 -52
  7. data/lib/google-cloud-monitoring.rb +6 -5
  8. data/lib/google/cloud/monitoring.rb +286 -442
  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 +73 -130
  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 -344
  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 -449
  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 -364
  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 -123
  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,76 +0,0 @@
1
- {
2
- "interfaces": {
3
- "google.monitoring.v3.NotificationChannelService": {
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": 20000,
17
- "rpc_timeout_multiplier": 1.0,
18
- "max_rpc_timeout_millis": 20000,
19
- "total_timeout_millis": 600000
20
- }
21
- },
22
- "methods": {
23
- "ListNotificationChannelDescriptors": {
24
- "timeout_millis": 60000,
25
- "retry_codes_name": "idempotent",
26
- "retry_params_name": "default"
27
- },
28
- "GetNotificationChannelDescriptor": {
29
- "timeout_millis": 60000,
30
- "retry_codes_name": "idempotent",
31
- "retry_params_name": "default"
32
- },
33
- "ListNotificationChannels": {
34
- "timeout_millis": 60000,
35
- "retry_codes_name": "idempotent",
36
- "retry_params_name": "default"
37
- },
38
- "GetNotificationChannel": {
39
- "timeout_millis": 60000,
40
- "retry_codes_name": "idempotent",
41
- "retry_params_name": "default"
42
- },
43
- "CreateNotificationChannel": {
44
- "timeout_millis": 60000,
45
- "retry_codes_name": "non_idempotent",
46
- "retry_params_name": "default"
47
- },
48
- "UpdateNotificationChannel": {
49
- "timeout_millis": 60000,
50
- "retry_codes_name": "non_idempotent",
51
- "retry_params_name": "default"
52
- },
53
- "DeleteNotificationChannel": {
54
- "timeout_millis": 60000,
55
- "retry_codes_name": "idempotent",
56
- "retry_params_name": "default"
57
- },
58
- "SendNotificationChannelVerificationCode": {
59
- "timeout_millis": 60000,
60
- "retry_codes_name": "non_idempotent",
61
- "retry_params_name": "default"
62
- },
63
- "GetNotificationChannelVerificationCode": {
64
- "timeout_millis": 60000,
65
- "retry_codes_name": "idempotent",
66
- "retry_params_name": "default"
67
- },
68
- "VerifyNotificationChannel": {
69
- "timeout_millis": 60000,
70
- "retry_codes_name": "idempotent",
71
- "retry_params_name": "default"
72
- }
73
- }
74
- }
75
- }
76
- }
@@ -1,788 +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/service_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/service_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 Cloud Monitoring Service-Oriented Monitoring API has endpoints for
37
- # managing and querying aspects of a workspace's services. These include the
38
- # `Service`'s monitored resources, its Service-Level Objectives, and a taxonomy
39
- # of categorized Health Metrics.
40
- #
41
- # @!attribute [r] service_monitoring_service_stub
42
- # @return [Google::Monitoring::V3::ServiceMonitoringService::Stub]
43
- class ServiceMonitoringServiceClient
44
- # @private
45
- attr_reader :service_monitoring_service_stub
46
-
47
- # The default address of the service.
48
- SERVICE_ADDRESS = "monitoring.googleapis.com".freeze
49
-
50
- # The default port of the service.
51
- DEFAULT_SERVICE_PORT = 443
52
-
53
- # The default set of gRPC interceptors.
54
- GRPC_INTERCEPTORS = []
55
-
56
- DEFAULT_TIMEOUT = 30
57
-
58
- PAGE_DESCRIPTORS = {
59
- "list_services" => Google::Gax::PageDescriptor.new(
60
- "page_token",
61
- "next_page_token",
62
- "services"),
63
- "list_service_level_objectives" => Google::Gax::PageDescriptor.new(
64
- "page_token",
65
- "next_page_token",
66
- "service_level_objectives")
67
- }.freeze
68
-
69
- private_constant :PAGE_DESCRIPTORS
70
-
71
- # The scopes needed to make gRPC calls to all of the methods defined in
72
- # this service.
73
- ALL_SCOPES = [
74
- "https://www.googleapis.com/auth/cloud-platform",
75
- "https://www.googleapis.com/auth/monitoring",
76
- "https://www.googleapis.com/auth/monitoring.read",
77
- "https://www.googleapis.com/auth/monitoring.write"
78
- ].freeze
79
-
80
-
81
- PROJECT_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
82
- "projects/{project}"
83
- )
84
-
85
- private_constant :PROJECT_PATH_TEMPLATE
86
-
87
- SERVICE_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
88
- "projects/{project}/services/{service}"
89
- )
90
-
91
- private_constant :SERVICE_PATH_TEMPLATE
92
-
93
- SERVICE_LEVEL_OBJECTIVE_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
94
- "projects/{project}/services/{service}/serviceLevelObjectives/{service_level_objective}"
95
- )
96
-
97
- private_constant :SERVICE_LEVEL_OBJECTIVE_PATH_TEMPLATE
98
-
99
- # Returns a fully-qualified project resource name string.
100
- # @param project [String]
101
- # @return [String]
102
- def self.project_path project
103
- PROJECT_PATH_TEMPLATE.render(
104
- :"project" => project
105
- )
106
- end
107
-
108
- # Returns a fully-qualified service resource name string.
109
- # @param project [String]
110
- # @param service [String]
111
- # @return [String]
112
- def self.service_path project, service
113
- SERVICE_PATH_TEMPLATE.render(
114
- :"project" => project,
115
- :"service" => service
116
- )
117
- end
118
-
119
- # Returns a fully-qualified service_level_objective resource name string.
120
- # @param project [String]
121
- # @param service [String]
122
- # @param service_level_objective [String]
123
- # @return [String]
124
- def self.service_level_objective_path project, service, service_level_objective
125
- SERVICE_LEVEL_OBJECTIVE_PATH_TEMPLATE.render(
126
- :"project" => project,
127
- :"service" => service,
128
- :"service_level_objective" => service_level_objective
129
- )
130
- end
131
-
132
- # @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
133
- # Provides the means for authenticating requests made by the client. This parameter can
134
- # be many types.
135
- # A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
136
- # authenticating requests made by this client.
137
- # A `String` will be treated as the path to the keyfile to be used for the construction of
138
- # credentials for this client.
139
- # A `Hash` will be treated as the contents of a keyfile to be used for the construction of
140
- # credentials for this client.
141
- # A `GRPC::Core::Channel` will be used to make calls through.
142
- # A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
143
- # should already be composed with a `GRPC::Core::CallCredentials` object.
144
- # A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
145
- # metadata for requests, generally, to give OAuth credentials.
146
- # @param scopes [Array<String>]
147
- # The OAuth scopes for this service. This parameter is ignored if
148
- # an updater_proc is supplied.
149
- # @param client_config [Hash]
150
- # A Hash for call options for each method. See
151
- # Google::Gax#construct_settings for the structure of
152
- # this data. Falls back to the default config if not specified
153
- # or the specified config is missing data points.
154
- # @param timeout [Numeric]
155
- # The default timeout, in seconds, for calls made through this client.
156
- # @param metadata [Hash]
157
- # Default metadata to be sent with each request. This can be overridden on a per call basis.
158
- # @param service_address [String]
159
- # Override for the service hostname, or `nil` to leave as the default.
160
- # @param service_port [Integer]
161
- # Override for the service port, or `nil` to leave as the default.
162
- # @param exception_transformer [Proc]
163
- # An optional proc that intercepts any exceptions raised during an API call to inject
164
- # custom error handling.
165
- def initialize \
166
- credentials: nil,
167
- scopes: ALL_SCOPES,
168
- client_config: {},
169
- timeout: DEFAULT_TIMEOUT,
170
- metadata: nil,
171
- service_address: nil,
172
- service_port: nil,
173
- exception_transformer: nil,
174
- lib_name: nil,
175
- lib_version: ""
176
- # These require statements are intentionally placed here to initialize
177
- # the gRPC module only when it's required.
178
- # See https://github.com/googleapis/toolkit/issues/446
179
- require "google/gax/grpc"
180
- require "google/monitoring/v3/service_service_services_pb"
181
-
182
- credentials ||= Google::Cloud::Monitoring::V3::Credentials.default
183
-
184
- if credentials.is_a?(String) || credentials.is_a?(Hash)
185
- updater_proc = Google::Cloud::Monitoring::V3::Credentials.new(credentials).updater_proc
186
- end
187
- if credentials.is_a?(GRPC::Core::Channel)
188
- channel = credentials
189
- end
190
- if credentials.is_a?(GRPC::Core::ChannelCredentials)
191
- chan_creds = credentials
192
- end
193
- if credentials.is_a?(Proc)
194
- updater_proc = credentials
195
- end
196
- if credentials.is_a?(Google::Auth::Credentials)
197
- updater_proc = credentials.updater_proc
198
- end
199
-
200
- package_version = Google::Cloud::Monitoring::VERSION
201
-
202
- google_api_client = "gl-ruby/#{RUBY_VERSION}"
203
- google_api_client << " #{lib_name}/#{lib_version}" if lib_name
204
- google_api_client << " gapic/#{package_version} gax/#{Google::Gax::VERSION}"
205
- google_api_client << " grpc/#{GRPC::VERSION}"
206
- google_api_client.freeze
207
-
208
- headers = { :"x-goog-api-client" => google_api_client }
209
- if credentials.respond_to?(:quota_project_id) && credentials.quota_project_id
210
- headers[:"x-goog-user-project"] = credentials.quota_project_id
211
- end
212
- headers.merge!(metadata) unless metadata.nil?
213
- client_config_file = Pathname.new(__dir__).join(
214
- "service_monitoring_service_client_config.json"
215
- )
216
- defaults = client_config_file.open do |f|
217
- Google::Gax.construct_settings(
218
- "google.monitoring.v3.ServiceMonitoringService",
219
- JSON.parse(f.read),
220
- client_config,
221
- Google::Gax::Grpc::STATUS_CODE_NAMES,
222
- timeout,
223
- page_descriptors: PAGE_DESCRIPTORS,
224
- errors: Google::Gax::Grpc::API_ERRORS,
225
- metadata: headers
226
- )
227
- end
228
-
229
- # Allow overriding the service path/port in subclasses.
230
- service_path = service_address || self.class::SERVICE_ADDRESS
231
- port = service_port || self.class::DEFAULT_SERVICE_PORT
232
- interceptors = self.class::GRPC_INTERCEPTORS
233
- @service_monitoring_service_stub = Google::Gax::Grpc.create_stub(
234
- service_path,
235
- port,
236
- chan_creds: chan_creds,
237
- channel: channel,
238
- updater_proc: updater_proc,
239
- scopes: scopes,
240
- interceptors: interceptors,
241
- &Google::Monitoring::V3::ServiceMonitoringService::Stub.method(:new)
242
- )
243
-
244
- @create_service = Google::Gax.create_api_call(
245
- @service_monitoring_service_stub.method(:create_service),
246
- defaults["create_service"],
247
- exception_transformer: exception_transformer,
248
- params_extractor: proc do |request|
249
- {'parent' => request.parent}
250
- end
251
- )
252
- @get_service = Google::Gax.create_api_call(
253
- @service_monitoring_service_stub.method(:get_service),
254
- defaults["get_service"],
255
- exception_transformer: exception_transformer,
256
- params_extractor: proc do |request|
257
- {'name' => request.name}
258
- end
259
- )
260
- @list_services = Google::Gax.create_api_call(
261
- @service_monitoring_service_stub.method(:list_services),
262
- defaults["list_services"],
263
- exception_transformer: exception_transformer,
264
- params_extractor: proc do |request|
265
- {'parent' => request.parent}
266
- end
267
- )
268
- @update_service = Google::Gax.create_api_call(
269
- @service_monitoring_service_stub.method(:update_service),
270
- defaults["update_service"],
271
- exception_transformer: exception_transformer,
272
- params_extractor: proc do |request|
273
- {'service.name' => request.service.name}
274
- end
275
- )
276
- @delete_service = Google::Gax.create_api_call(
277
- @service_monitoring_service_stub.method(:delete_service),
278
- defaults["delete_service"],
279
- exception_transformer: exception_transformer,
280
- params_extractor: proc do |request|
281
- {'name' => request.name}
282
- end
283
- )
284
- @create_service_level_objective = Google::Gax.create_api_call(
285
- @service_monitoring_service_stub.method(:create_service_level_objective),
286
- defaults["create_service_level_objective"],
287
- exception_transformer: exception_transformer,
288
- params_extractor: proc do |request|
289
- {'parent' => request.parent}
290
- end
291
- )
292
- @get_service_level_objective = Google::Gax.create_api_call(
293
- @service_monitoring_service_stub.method(:get_service_level_objective),
294
- defaults["get_service_level_objective"],
295
- exception_transformer: exception_transformer,
296
- params_extractor: proc do |request|
297
- {'name' => request.name}
298
- end
299
- )
300
- @list_service_level_objectives = Google::Gax.create_api_call(
301
- @service_monitoring_service_stub.method(:list_service_level_objectives),
302
- defaults["list_service_level_objectives"],
303
- exception_transformer: exception_transformer,
304
- params_extractor: proc do |request|
305
- {'parent' => request.parent}
306
- end
307
- )
308
- @update_service_level_objective = Google::Gax.create_api_call(
309
- @service_monitoring_service_stub.method(:update_service_level_objective),
310
- defaults["update_service_level_objective"],
311
- exception_transformer: exception_transformer,
312
- params_extractor: proc do |request|
313
- {'service_level_objective.name' => request.service_level_objective.name}
314
- end
315
- )
316
- @delete_service_level_objective = Google::Gax.create_api_call(
317
- @service_monitoring_service_stub.method(:delete_service_level_objective),
318
- defaults["delete_service_level_objective"],
319
- exception_transformer: exception_transformer,
320
- params_extractor: proc do |request|
321
- {'name' => request.name}
322
- end
323
- )
324
- end
325
-
326
- # Service calls
327
-
328
- # Create a `Service`.
329
- #
330
- # @param parent [String]
331
- # Required. Resource name of the parent workspace. The format is:
332
- #
333
- # projects/[PROJECT_ID_OR_NUMBER]
334
- # @param service [Google::Monitoring::V3::Service | Hash]
335
- # Required. The `Service` to create.
336
- # A hash of the same form as `Google::Monitoring::V3::Service`
337
- # can also be provided.
338
- # @param service_id [String]
339
- # Optional. The Service id to use for this Service. If omitted, an id will be
340
- # generated instead. Must match the pattern `[a-z0-9\-]+`
341
- # @param options [Google::Gax::CallOptions]
342
- # Overrides the default settings for this call, e.g, timeout,
343
- # retries, etc.
344
- # @yield [result, operation] Access the result along with the RPC operation
345
- # @yieldparam result [Google::Monitoring::V3::Service]
346
- # @yieldparam operation [GRPC::ActiveCall::Operation]
347
- # @return [Google::Monitoring::V3::Service]
348
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
349
- # @example
350
- # require "google/cloud/monitoring"
351
- #
352
- # service_monitoring_client = Google::Cloud::Monitoring::ServiceMonitoring.new(version: :v3)
353
- # formatted_parent = Google::Cloud::Monitoring::V3::ServiceMonitoringServiceClient.project_path("[PROJECT]")
354
- #
355
- # # TODO: Initialize `service`:
356
- # service = {}
357
- # response = service_monitoring_client.create_service(formatted_parent, service)
358
-
359
- def create_service \
360
- parent,
361
- service,
362
- service_id: nil,
363
- options: nil,
364
- &block
365
- req = {
366
- parent: parent,
367
- service: service,
368
- service_id: service_id
369
- }.delete_if { |_, v| v.nil? }
370
- req = Google::Gax::to_proto(req, Google::Monitoring::V3::CreateServiceRequest)
371
- @create_service.call(req, options, &block)
372
- end
373
-
374
- # Get the named `Service`.
375
- #
376
- # @param name [String]
377
- # Required. Resource name of the `Service`. The format is:
378
- #
379
- # projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID]
380
- # @param options [Google::Gax::CallOptions]
381
- # Overrides the default settings for this call, e.g, timeout,
382
- # retries, etc.
383
- # @yield [result, operation] Access the result along with the RPC operation
384
- # @yieldparam result [Google::Monitoring::V3::Service]
385
- # @yieldparam operation [GRPC::ActiveCall::Operation]
386
- # @return [Google::Monitoring::V3::Service]
387
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
388
- # @example
389
- # require "google/cloud/monitoring"
390
- #
391
- # service_monitoring_client = Google::Cloud::Monitoring::ServiceMonitoring.new(version: :v3)
392
- # formatted_name = Google::Cloud::Monitoring::V3::ServiceMonitoringServiceClient.service_path("[PROJECT]", "[SERVICE]")
393
- # response = service_monitoring_client.get_service(formatted_name)
394
-
395
- def get_service \
396
- name,
397
- options: nil,
398
- &block
399
- req = {
400
- name: name
401
- }.delete_if { |_, v| v.nil? }
402
- req = Google::Gax::to_proto(req, Google::Monitoring::V3::GetServiceRequest)
403
- @get_service.call(req, options, &block)
404
- end
405
-
406
- # List `Service`s for this workspace.
407
- #
408
- # @param parent [String]
409
- # Required. Resource name of the parent containing the listed services, either a
410
- # project or a Monitoring Workspace. The formats are:
411
- #
412
- # projects/[PROJECT_ID_OR_NUMBER]
413
- # workspaces/[HOST_PROJECT_ID_OR_NUMBER]
414
- # @param filter [String]
415
- # A filter specifying what `Service`s to return. The filter currently
416
- # supports the following fields:
417
- #
418
- # * `identifier_case`
419
- # * `app_engine.module_id`
420
- # * `cloud_endpoints.service`
421
- # * `cluster_istio.location`
422
- # * `cluster_istio.cluster_name`
423
- # * `cluster_istio.service_namespace`
424
- # * `cluster_istio.service_name`
425
- #
426
- # `identifier_case` refers to which option in the identifier oneof is
427
- # populated. For example, the filter `identifier_case = "CUSTOM"` would match
428
- # all services with a value for the `custom` field. Valid options are
429
- # "CUSTOM", "APP_ENGINE", "CLOUD_ENDPOINTS", and "CLUSTER_ISTIO".
430
- # @param page_size [Integer]
431
- # The maximum number of resources contained in the underlying API
432
- # response. If page streaming is performed per-resource, this
433
- # parameter does not affect the return value. If page streaming is
434
- # performed per-page, this determines the maximum number of
435
- # resources in a page.
436
- # @param options [Google::Gax::CallOptions]
437
- # Overrides the default settings for this call, e.g, timeout,
438
- # retries, etc.
439
- # @yield [result, operation] Access the result along with the RPC operation
440
- # @yieldparam result [Google::Gax::PagedEnumerable<Google::Monitoring::V3::Service>]
441
- # @yieldparam operation [GRPC::ActiveCall::Operation]
442
- # @return [Google::Gax::PagedEnumerable<Google::Monitoring::V3::Service>]
443
- # An enumerable of Google::Monitoring::V3::Service instances.
444
- # See Google::Gax::PagedEnumerable documentation for other
445
- # operations such as per-page iteration or access to the response
446
- # object.
447
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
448
- # @example
449
- # require "google/cloud/monitoring"
450
- #
451
- # service_monitoring_client = Google::Cloud::Monitoring::ServiceMonitoring.new(version: :v3)
452
- # formatted_parent = Google::Cloud::Monitoring::V3::ServiceMonitoringServiceClient.project_path("[PROJECT]")
453
- #
454
- # # Iterate over all results.
455
- # service_monitoring_client.list_services(formatted_parent).each do |element|
456
- # # Process element.
457
- # end
458
- #
459
- # # Or iterate over results one page at a time.
460
- # service_monitoring_client.list_services(formatted_parent).each_page do |page|
461
- # # Process each page at a time.
462
- # page.each do |element|
463
- # # Process element.
464
- # end
465
- # end
466
-
467
- def list_services \
468
- parent,
469
- filter: nil,
470
- page_size: nil,
471
- options: nil,
472
- &block
473
- req = {
474
- parent: parent,
475
- filter: filter,
476
- page_size: page_size
477
- }.delete_if { |_, v| v.nil? }
478
- req = Google::Gax::to_proto(req, Google::Monitoring::V3::ListServicesRequest)
479
- @list_services.call(req, options, &block)
480
- end
481
-
482
- # Update this `Service`.
483
- #
484
- # @param service [Google::Monitoring::V3::Service | Hash]
485
- # Required. The `Service` to draw updates from.
486
- # The given `name` specifies the resource to update.
487
- # A hash of the same form as `Google::Monitoring::V3::Service`
488
- # can also be provided.
489
- # @param update_mask [Google::Protobuf::FieldMask | Hash]
490
- # A set of field paths defining which fields to use for the update.
491
- # A hash of the same form as `Google::Protobuf::FieldMask`
492
- # can also be provided.
493
- # @param options [Google::Gax::CallOptions]
494
- # Overrides the default settings for this call, e.g, timeout,
495
- # retries, etc.
496
- # @yield [result, operation] Access the result along with the RPC operation
497
- # @yieldparam result [Google::Monitoring::V3::Service]
498
- # @yieldparam operation [GRPC::ActiveCall::Operation]
499
- # @return [Google::Monitoring::V3::Service]
500
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
501
- # @example
502
- # require "google/cloud/monitoring"
503
- #
504
- # service_monitoring_client = Google::Cloud::Monitoring::ServiceMonitoring.new(version: :v3)
505
- #
506
- # # TODO: Initialize `service`:
507
- # service = {}
508
- # response = service_monitoring_client.update_service(service)
509
-
510
- def update_service \
511
- service,
512
- update_mask: nil,
513
- options: nil,
514
- &block
515
- req = {
516
- service: service,
517
- update_mask: update_mask
518
- }.delete_if { |_, v| v.nil? }
519
- req = Google::Gax::to_proto(req, Google::Monitoring::V3::UpdateServiceRequest)
520
- @update_service.call(req, options, &block)
521
- end
522
-
523
- # Soft delete this `Service`.
524
- #
525
- # @param name [String]
526
- # Required. Resource name of the `Service` to delete. The format is:
527
- #
528
- # projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID]
529
- # @param options [Google::Gax::CallOptions]
530
- # Overrides the default settings for this call, e.g, timeout,
531
- # retries, etc.
532
- # @yield [result, operation] Access the result along with the RPC operation
533
- # @yieldparam result []
534
- # @yieldparam operation [GRPC::ActiveCall::Operation]
535
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
536
- # @example
537
- # require "google/cloud/monitoring"
538
- #
539
- # service_monitoring_client = Google::Cloud::Monitoring::ServiceMonitoring.new(version: :v3)
540
- # formatted_name = Google::Cloud::Monitoring::V3::ServiceMonitoringServiceClient.service_path("[PROJECT]", "[SERVICE]")
541
- # service_monitoring_client.delete_service(formatted_name)
542
-
543
- def delete_service \
544
- name,
545
- options: nil,
546
- &block
547
- req = {
548
- name: name
549
- }.delete_if { |_, v| v.nil? }
550
- req = Google::Gax::to_proto(req, Google::Monitoring::V3::DeleteServiceRequest)
551
- @delete_service.call(req, options, &block)
552
- nil
553
- end
554
-
555
- # Create a `ServiceLevelObjective` for the given `Service`.
556
- #
557
- # @param parent [String]
558
- # Required. Resource name of the parent `Service`. The format is:
559
- #
560
- # projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID]
561
- # @param service_level_objective [Google::Monitoring::V3::ServiceLevelObjective | Hash]
562
- # Required. The `ServiceLevelObjective` to create.
563
- # The provided `name` will be respected if no `ServiceLevelObjective` exists
564
- # with this name.
565
- # A hash of the same form as `Google::Monitoring::V3::ServiceLevelObjective`
566
- # can also be provided.
567
- # @param service_level_objective_id [String]
568
- # Optional. The ServiceLevelObjective id to use for this
569
- # ServiceLevelObjective. If omitted, an id will be generated instead. Must
570
- # match the pattern `[a-z0-9\-]+`
571
- # @param options [Google::Gax::CallOptions]
572
- # Overrides the default settings for this call, e.g, timeout,
573
- # retries, etc.
574
- # @yield [result, operation] Access the result along with the RPC operation
575
- # @yieldparam result [Google::Monitoring::V3::ServiceLevelObjective]
576
- # @yieldparam operation [GRPC::ActiveCall::Operation]
577
- # @return [Google::Monitoring::V3::ServiceLevelObjective]
578
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
579
- # @example
580
- # require "google/cloud/monitoring"
581
- #
582
- # service_monitoring_client = Google::Cloud::Monitoring::ServiceMonitoring.new(version: :v3)
583
- # formatted_parent = Google::Cloud::Monitoring::V3::ServiceMonitoringServiceClient.service_path("[PROJECT]", "[SERVICE]")
584
- #
585
- # # TODO: Initialize `service_level_objective`:
586
- # service_level_objective = {}
587
- # response = service_monitoring_client.create_service_level_objective(formatted_parent, service_level_objective)
588
-
589
- def create_service_level_objective \
590
- parent,
591
- service_level_objective,
592
- service_level_objective_id: nil,
593
- options: nil,
594
- &block
595
- req = {
596
- parent: parent,
597
- service_level_objective: service_level_objective,
598
- service_level_objective_id: service_level_objective_id
599
- }.delete_if { |_, v| v.nil? }
600
- req = Google::Gax::to_proto(req, Google::Monitoring::V3::CreateServiceLevelObjectiveRequest)
601
- @create_service_level_objective.call(req, options, &block)
602
- end
603
-
604
- # Get a `ServiceLevelObjective` by name.
605
- #
606
- # @param name [String]
607
- # Required. Resource name of the `ServiceLevelObjective` to get. The format is:
608
- #
609
- # projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID]/serviceLevelObjectives/[SLO_NAME]
610
- # @param view [Google::Monitoring::V3::ServiceLevelObjective::View]
611
- # View of the `ServiceLevelObjective` to return. If `DEFAULT`, return the
612
- # `ServiceLevelObjective` as originally defined. If `EXPLICIT` and the
613
- # `ServiceLevelObjective` is defined in terms of a `BasicSli`, replace the
614
- # `BasicSli` with a `RequestBasedSli` spelling out how the SLI is computed.
615
- # @param options [Google::Gax::CallOptions]
616
- # Overrides the default settings for this call, e.g, timeout,
617
- # retries, etc.
618
- # @yield [result, operation] Access the result along with the RPC operation
619
- # @yieldparam result [Google::Monitoring::V3::ServiceLevelObjective]
620
- # @yieldparam operation [GRPC::ActiveCall::Operation]
621
- # @return [Google::Monitoring::V3::ServiceLevelObjective]
622
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
623
- # @example
624
- # require "google/cloud/monitoring"
625
- #
626
- # service_monitoring_client = Google::Cloud::Monitoring::ServiceMonitoring.new(version: :v3)
627
- # formatted_name = Google::Cloud::Monitoring::V3::ServiceMonitoringServiceClient.service_level_objective_path("[PROJECT]", "[SERVICE]", "[SERVICE_LEVEL_OBJECTIVE]")
628
- # response = service_monitoring_client.get_service_level_objective(formatted_name)
629
-
630
- def get_service_level_objective \
631
- name,
632
- view: nil,
633
- options: nil,
634
- &block
635
- req = {
636
- name: name,
637
- view: view
638
- }.delete_if { |_, v| v.nil? }
639
- req = Google::Gax::to_proto(req, Google::Monitoring::V3::GetServiceLevelObjectiveRequest)
640
- @get_service_level_objective.call(req, options, &block)
641
- end
642
-
643
- # List the `ServiceLevelObjective`s for the given `Service`.
644
- #
645
- # @param parent [String]
646
- # Required. Resource name of the parent containing the listed SLOs, either a
647
- # project or a Monitoring Workspace. The formats are:
648
- #
649
- # projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID]
650
- # workspaces/[HOST_PROJECT_ID_OR_NUMBER]/services/-
651
- # @param filter [String]
652
- # A filter specifying what `ServiceLevelObjective`s to return.
653
- # @param page_size [Integer]
654
- # The maximum number of resources contained in the underlying API
655
- # response. If page streaming is performed per-resource, this
656
- # parameter does not affect the return value. If page streaming is
657
- # performed per-page, this determines the maximum number of
658
- # resources in a page.
659
- # @param view [Google::Monitoring::V3::ServiceLevelObjective::View]
660
- # View of the `ServiceLevelObjective`s to return. If `DEFAULT`, return each
661
- # `ServiceLevelObjective` as originally defined. If `EXPLICIT` and the
662
- # `ServiceLevelObjective` is defined in terms of a `BasicSli`, replace the
663
- # `BasicSli` with a `RequestBasedSli` spelling out how the SLI is computed.
664
- # @param options [Google::Gax::CallOptions]
665
- # Overrides the default settings for this call, e.g, timeout,
666
- # retries, etc.
667
- # @yield [result, operation] Access the result along with the RPC operation
668
- # @yieldparam result [Google::Gax::PagedEnumerable<Google::Monitoring::V3::ServiceLevelObjective>]
669
- # @yieldparam operation [GRPC::ActiveCall::Operation]
670
- # @return [Google::Gax::PagedEnumerable<Google::Monitoring::V3::ServiceLevelObjective>]
671
- # An enumerable of Google::Monitoring::V3::ServiceLevelObjective instances.
672
- # See Google::Gax::PagedEnumerable documentation for other
673
- # operations such as per-page iteration or access to the response
674
- # object.
675
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
676
- # @example
677
- # require "google/cloud/monitoring"
678
- #
679
- # service_monitoring_client = Google::Cloud::Monitoring::ServiceMonitoring.new(version: :v3)
680
- # formatted_parent = Google::Cloud::Monitoring::V3::ServiceMonitoringServiceClient.service_path("[PROJECT]", "[SERVICE]")
681
- #
682
- # # Iterate over all results.
683
- # service_monitoring_client.list_service_level_objectives(formatted_parent).each do |element|
684
- # # Process element.
685
- # end
686
- #
687
- # # Or iterate over results one page at a time.
688
- # service_monitoring_client.list_service_level_objectives(formatted_parent).each_page do |page|
689
- # # Process each page at a time.
690
- # page.each do |element|
691
- # # Process element.
692
- # end
693
- # end
694
-
695
- def list_service_level_objectives \
696
- parent,
697
- filter: nil,
698
- page_size: nil,
699
- view: nil,
700
- options: nil,
701
- &block
702
- req = {
703
- parent: parent,
704
- filter: filter,
705
- page_size: page_size,
706
- view: view
707
- }.delete_if { |_, v| v.nil? }
708
- req = Google::Gax::to_proto(req, Google::Monitoring::V3::ListServiceLevelObjectivesRequest)
709
- @list_service_level_objectives.call(req, options, &block)
710
- end
711
-
712
- # Update the given `ServiceLevelObjective`.
713
- #
714
- # @param service_level_objective [Google::Monitoring::V3::ServiceLevelObjective | Hash]
715
- # Required. The `ServiceLevelObjective` to draw updates from.
716
- # The given `name` specifies the resource to update.
717
- # A hash of the same form as `Google::Monitoring::V3::ServiceLevelObjective`
718
- # can also be provided.
719
- # @param update_mask [Google::Protobuf::FieldMask | Hash]
720
- # A set of field paths defining which fields to use for the update.
721
- # A hash of the same form as `Google::Protobuf::FieldMask`
722
- # can also be provided.
723
- # @param options [Google::Gax::CallOptions]
724
- # Overrides the default settings for this call, e.g, timeout,
725
- # retries, etc.
726
- # @yield [result, operation] Access the result along with the RPC operation
727
- # @yieldparam result [Google::Monitoring::V3::ServiceLevelObjective]
728
- # @yieldparam operation [GRPC::ActiveCall::Operation]
729
- # @return [Google::Monitoring::V3::ServiceLevelObjective]
730
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
731
- # @example
732
- # require "google/cloud/monitoring"
733
- #
734
- # service_monitoring_client = Google::Cloud::Monitoring::ServiceMonitoring.new(version: :v3)
735
- #
736
- # # TODO: Initialize `service_level_objective`:
737
- # service_level_objective = {}
738
- # response = service_monitoring_client.update_service_level_objective(service_level_objective)
739
-
740
- def update_service_level_objective \
741
- service_level_objective,
742
- update_mask: nil,
743
- options: nil,
744
- &block
745
- req = {
746
- service_level_objective: service_level_objective,
747
- update_mask: update_mask
748
- }.delete_if { |_, v| v.nil? }
749
- req = Google::Gax::to_proto(req, Google::Monitoring::V3::UpdateServiceLevelObjectiveRequest)
750
- @update_service_level_objective.call(req, options, &block)
751
- end
752
-
753
- # Delete the given `ServiceLevelObjective`.
754
- #
755
- # @param name [String]
756
- # Required. Resource name of the `ServiceLevelObjective` to delete. The format is:
757
- #
758
- # projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID]/serviceLevelObjectives/[SLO_NAME]
759
- # @param options [Google::Gax::CallOptions]
760
- # Overrides the default settings for this call, e.g, timeout,
761
- # retries, etc.
762
- # @yield [result, operation] Access the result along with the RPC operation
763
- # @yieldparam result []
764
- # @yieldparam operation [GRPC::ActiveCall::Operation]
765
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
766
- # @example
767
- # require "google/cloud/monitoring"
768
- #
769
- # service_monitoring_client = Google::Cloud::Monitoring::ServiceMonitoring.new(version: :v3)
770
- # formatted_name = Google::Cloud::Monitoring::V3::ServiceMonitoringServiceClient.service_level_objective_path("[PROJECT]", "[SERVICE]", "[SERVICE_LEVEL_OBJECTIVE]")
771
- # service_monitoring_client.delete_service_level_objective(formatted_name)
772
-
773
- def delete_service_level_objective \
774
- name,
775
- options: nil,
776
- &block
777
- req = {
778
- name: name
779
- }.delete_if { |_, v| v.nil? }
780
- req = Google::Gax::to_proto(req, Google::Monitoring::V3::DeleteServiceLevelObjectiveRequest)
781
- @delete_service_level_objective.call(req, options, &block)
782
- nil
783
- end
784
- end
785
- end
786
- end
787
- end
788
- end