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,56 +0,0 @@
1
- {
2
- "interfaces": {
3
- "google.monitoring.v3.GroupService": {
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
- "ListGroups": {
24
- "timeout_millis": 60000,
25
- "retry_codes_name": "idempotent",
26
- "retry_params_name": "default"
27
- },
28
- "GetGroup": {
29
- "timeout_millis": 60000,
30
- "retry_codes_name": "idempotent",
31
- "retry_params_name": "default"
32
- },
33
- "CreateGroup": {
34
- "timeout_millis": 60000,
35
- "retry_codes_name": "non_idempotent",
36
- "retry_params_name": "default"
37
- },
38
- "UpdateGroup": {
39
- "timeout_millis": 60000,
40
- "retry_codes_name": "idempotent",
41
- "retry_params_name": "default"
42
- },
43
- "DeleteGroup": {
44
- "timeout_millis": 60000,
45
- "retry_codes_name": "idempotent",
46
- "retry_params_name": "default"
47
- },
48
- "ListGroupMembers": {
49
- "timeout_millis": 60000,
50
- "retry_codes_name": "idempotent",
51
- "retry_params_name": "default"
52
- }
53
- }
54
- }
55
- }
56
- }
@@ -1,750 +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/metric_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/metric_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
- # Manages metric descriptors, monitored resource descriptors, and
37
- # time series data.
38
- #
39
- # @!attribute [r] metric_service_stub
40
- # @return [Google::Monitoring::V3::MetricService::Stub]
41
- class MetricServiceClient
42
- # @private
43
- attr_reader :metric_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_monitored_resource_descriptors" => Google::Gax::PageDescriptor.new(
58
- "page_token",
59
- "next_page_token",
60
- "resource_descriptors"),
61
- "list_metric_descriptors" => Google::Gax::PageDescriptor.new(
62
- "page_token",
63
- "next_page_token",
64
- "metric_descriptors"),
65
- "list_time_series" => Google::Gax::PageDescriptor.new(
66
- "page_token",
67
- "next_page_token",
68
- "time_series")
69
- }.freeze
70
-
71
- private_constant :PAGE_DESCRIPTORS
72
-
73
- # The scopes needed to make gRPC calls to all of the methods defined in
74
- # this service.
75
- ALL_SCOPES = [
76
- "https://www.googleapis.com/auth/cloud-platform",
77
- "https://www.googleapis.com/auth/monitoring",
78
- "https://www.googleapis.com/auth/monitoring.read",
79
- "https://www.googleapis.com/auth/monitoring.write"
80
- ].freeze
81
-
82
-
83
- METRIC_DESCRIPTOR_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
84
- "projects/{project}/metricDescriptors/{metric_descriptor=**}"
85
- )
86
-
87
- private_constant :METRIC_DESCRIPTOR_PATH_TEMPLATE
88
-
89
- MONITORED_RESOURCE_DESCRIPTOR_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
90
- "projects/{project}/monitoredResourceDescriptors/{monitored_resource_descriptor}"
91
- )
92
-
93
- private_constant :MONITORED_RESOURCE_DESCRIPTOR_PATH_TEMPLATE
94
-
95
- PROJECT_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
96
- "projects/{project}"
97
- )
98
-
99
- private_constant :PROJECT_PATH_TEMPLATE
100
-
101
- # Returns a fully-qualified metric_descriptor resource name string.
102
- # @param project [String]
103
- # @param metric_descriptor [String]
104
- # @return [String]
105
- def self.metric_descriptor_path project, metric_descriptor
106
- METRIC_DESCRIPTOR_PATH_TEMPLATE.render(
107
- :"project" => project,
108
- :"metric_descriptor" => metric_descriptor
109
- )
110
- end
111
-
112
- # Returns a fully-qualified monitored_resource_descriptor resource name string.
113
- # @param project [String]
114
- # @param monitored_resource_descriptor [String]
115
- # @return [String]
116
- def self.monitored_resource_descriptor_path project, monitored_resource_descriptor
117
- MONITORED_RESOURCE_DESCRIPTOR_PATH_TEMPLATE.render(
118
- :"project" => project,
119
- :"monitored_resource_descriptor" => monitored_resource_descriptor
120
- )
121
- end
122
-
123
- # Returns a fully-qualified project resource name string.
124
- # @param project [String]
125
- # @return [String]
126
- def self.project_path project
127
- PROJECT_PATH_TEMPLATE.render(
128
- :"project" => project
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/metric_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
- "metric_service_client_config.json"
215
- )
216
- defaults = client_config_file.open do |f|
217
- Google::Gax.construct_settings(
218
- "google.monitoring.v3.MetricService",
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
- @metric_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::MetricService::Stub.method(:new)
242
- )
243
-
244
- @list_monitored_resource_descriptors = Google::Gax.create_api_call(
245
- @metric_service_stub.method(:list_monitored_resource_descriptors),
246
- defaults["list_monitored_resource_descriptors"],
247
- exception_transformer: exception_transformer,
248
- params_extractor: proc do |request|
249
- {'name' => request.name}
250
- end
251
- )
252
- @get_monitored_resource_descriptor = Google::Gax.create_api_call(
253
- @metric_service_stub.method(:get_monitored_resource_descriptor),
254
- defaults["get_monitored_resource_descriptor"],
255
- exception_transformer: exception_transformer,
256
- params_extractor: proc do |request|
257
- {'name' => request.name}
258
- end
259
- )
260
- @list_metric_descriptors = Google::Gax.create_api_call(
261
- @metric_service_stub.method(:list_metric_descriptors),
262
- defaults["list_metric_descriptors"],
263
- exception_transformer: exception_transformer,
264
- params_extractor: proc do |request|
265
- {'name' => request.name}
266
- end
267
- )
268
- @get_metric_descriptor = Google::Gax.create_api_call(
269
- @metric_service_stub.method(:get_metric_descriptor),
270
- defaults["get_metric_descriptor"],
271
- exception_transformer: exception_transformer,
272
- params_extractor: proc do |request|
273
- {'name' => request.name}
274
- end
275
- )
276
- @create_metric_descriptor = Google::Gax.create_api_call(
277
- @metric_service_stub.method(:create_metric_descriptor),
278
- defaults["create_metric_descriptor"],
279
- exception_transformer: exception_transformer,
280
- params_extractor: proc do |request|
281
- {'name' => request.name}
282
- end
283
- )
284
- @delete_metric_descriptor = Google::Gax.create_api_call(
285
- @metric_service_stub.method(:delete_metric_descriptor),
286
- defaults["delete_metric_descriptor"],
287
- exception_transformer: exception_transformer,
288
- params_extractor: proc do |request|
289
- {'name' => request.name}
290
- end
291
- )
292
- @list_time_series = Google::Gax.create_api_call(
293
- @metric_service_stub.method(:list_time_series),
294
- defaults["list_time_series"],
295
- exception_transformer: exception_transformer,
296
- params_extractor: proc do |request|
297
- {'name' => request.name}
298
- end
299
- )
300
- @create_time_series = Google::Gax.create_api_call(
301
- @metric_service_stub.method(:create_time_series),
302
- defaults["create_time_series"],
303
- exception_transformer: exception_transformer,
304
- params_extractor: proc do |request|
305
- {'name' => request.name}
306
- end
307
- )
308
- end
309
-
310
- # Service calls
311
-
312
- # Lists monitored resource descriptors that match a filter. This method does not require a Workspace.
313
- #
314
- # @param name [String]
315
- # Required. The project on which to execute the request. The format is:
316
- #
317
- # projects/[PROJECT_ID_OR_NUMBER]
318
- # @param filter [String]
319
- # An optional [filter](https://cloud.google.com/monitoring/api/v3/filters)
320
- # describing the descriptors to be returned. The filter can reference the
321
- # descriptor's type and labels. For example, the following filter returns
322
- # only Google Compute Engine descriptors that have an `id` label:
323
- #
324
- # resource.type = starts_with("gce_") AND resource.label:id
325
- # @param page_size [Integer]
326
- # The maximum number of resources contained in the underlying API
327
- # response. If page streaming is performed per-resource, this
328
- # parameter does not affect the return value. If page streaming is
329
- # performed per-page, this determines the maximum number of
330
- # resources in a page.
331
- # @param options [Google::Gax::CallOptions]
332
- # Overrides the default settings for this call, e.g, timeout,
333
- # retries, etc.
334
- # @yield [result, operation] Access the result along with the RPC operation
335
- # @yieldparam result [Google::Gax::PagedEnumerable<Google::Api::MonitoredResourceDescriptor>]
336
- # @yieldparam operation [GRPC::ActiveCall::Operation]
337
- # @return [Google::Gax::PagedEnumerable<Google::Api::MonitoredResourceDescriptor>]
338
- # An enumerable of Google::Api::MonitoredResourceDescriptor instances.
339
- # See Google::Gax::PagedEnumerable documentation for other
340
- # operations such as per-page iteration or access to the response
341
- # object.
342
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
343
- # @example
344
- # require "google/cloud/monitoring"
345
- #
346
- # metric_client = Google::Cloud::Monitoring::Metric.new(version: :v3)
347
- # formatted_name = Google::Cloud::Monitoring::V3::MetricServiceClient.project_path("[PROJECT]")
348
- #
349
- # # Iterate over all results.
350
- # metric_client.list_monitored_resource_descriptors(formatted_name).each do |element|
351
- # # Process element.
352
- # end
353
- #
354
- # # Or iterate over results one page at a time.
355
- # metric_client.list_monitored_resource_descriptors(formatted_name).each_page do |page|
356
- # # Process each page at a time.
357
- # page.each do |element|
358
- # # Process element.
359
- # end
360
- # end
361
-
362
- def list_monitored_resource_descriptors \
363
- name,
364
- filter: nil,
365
- page_size: nil,
366
- options: nil,
367
- &block
368
- req = {
369
- name: name,
370
- filter: filter,
371
- page_size: page_size
372
- }.delete_if { |_, v| v.nil? }
373
- req = Google::Gax::to_proto(req, Google::Monitoring::V3::ListMonitoredResourceDescriptorsRequest)
374
- @list_monitored_resource_descriptors.call(req, options, &block)
375
- end
376
-
377
- # Gets a single monitored resource descriptor. This method does not require a Workspace.
378
- #
379
- # @param name [String]
380
- # Required. The monitored resource descriptor to get. The format is:
381
- #
382
- # projects/[PROJECT_ID_OR_NUMBER]/monitoredResourceDescriptors/[RESOURCE_TYPE]
383
- #
384
- # The `[RESOURCE_TYPE]` is a predefined type, such as
385
- # `cloudsql_database`.
386
- # @param options [Google::Gax::CallOptions]
387
- # Overrides the default settings for this call, e.g, timeout,
388
- # retries, etc.
389
- # @yield [result, operation] Access the result along with the RPC operation
390
- # @yieldparam result [Google::Api::MonitoredResourceDescriptor]
391
- # @yieldparam operation [GRPC::ActiveCall::Operation]
392
- # @return [Google::Api::MonitoredResourceDescriptor]
393
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
394
- # @example
395
- # require "google/cloud/monitoring"
396
- #
397
- # metric_client = Google::Cloud::Monitoring::Metric.new(version: :v3)
398
- # formatted_name = Google::Cloud::Monitoring::V3::MetricServiceClient.monitored_resource_descriptor_path("[PROJECT]", "[MONITORED_RESOURCE_DESCRIPTOR]")
399
- # response = metric_client.get_monitored_resource_descriptor(formatted_name)
400
-
401
- def get_monitored_resource_descriptor \
402
- name,
403
- options: nil,
404
- &block
405
- req = {
406
- name: name
407
- }.delete_if { |_, v| v.nil? }
408
- req = Google::Gax::to_proto(req, Google::Monitoring::V3::GetMonitoredResourceDescriptorRequest)
409
- @get_monitored_resource_descriptor.call(req, options, &block)
410
- end
411
-
412
- # Lists metric descriptors that match a filter. This method does not require a Workspace.
413
- #
414
- # @param name [String]
415
- # Required. The project on which to execute the request. The format is:
416
- #
417
- # projects/[PROJECT_ID_OR_NUMBER]
418
- # @param filter [String]
419
- # If this field is empty, all custom and
420
- # system-defined metric descriptors are returned.
421
- # Otherwise, the [filter](https://cloud.google.com/monitoring/api/v3/filters)
422
- # specifies which metric descriptors are to be
423
- # returned. For example, the following filter matches all
424
- # [custom metrics](https://cloud.google.com/monitoring/custom-metrics):
425
- #
426
- # metric.type = starts_with("custom.googleapis.com/")
427
- # @param page_size [Integer]
428
- # The maximum number of resources contained in the underlying API
429
- # response. If page streaming is performed per-resource, this
430
- # parameter does not affect the return value. If page streaming is
431
- # performed per-page, this determines the maximum number of
432
- # resources in a page.
433
- # @param options [Google::Gax::CallOptions]
434
- # Overrides the default settings for this call, e.g, timeout,
435
- # retries, etc.
436
- # @yield [result, operation] Access the result along with the RPC operation
437
- # @yieldparam result [Google::Gax::PagedEnumerable<Google::Api::MetricDescriptor>]
438
- # @yieldparam operation [GRPC::ActiveCall::Operation]
439
- # @return [Google::Gax::PagedEnumerable<Google::Api::MetricDescriptor>]
440
- # An enumerable of Google::Api::MetricDescriptor instances.
441
- # See Google::Gax::PagedEnumerable documentation for other
442
- # operations such as per-page iteration or access to the response
443
- # object.
444
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
445
- # @example
446
- # require "google/cloud/monitoring"
447
- #
448
- # metric_client = Google::Cloud::Monitoring::Metric.new(version: :v3)
449
- # formatted_name = Google::Cloud::Monitoring::V3::MetricServiceClient.project_path("[PROJECT]")
450
- #
451
- # # Iterate over all results.
452
- # metric_client.list_metric_descriptors(formatted_name).each do |element|
453
- # # Process element.
454
- # end
455
- #
456
- # # Or iterate over results one page at a time.
457
- # metric_client.list_metric_descriptors(formatted_name).each_page do |page|
458
- # # Process each page at a time.
459
- # page.each do |element|
460
- # # Process element.
461
- # end
462
- # end
463
-
464
- def list_metric_descriptors \
465
- name,
466
- filter: nil,
467
- page_size: nil,
468
- options: nil,
469
- &block
470
- req = {
471
- name: name,
472
- filter: filter,
473
- page_size: page_size
474
- }.delete_if { |_, v| v.nil? }
475
- req = Google::Gax::to_proto(req, Google::Monitoring::V3::ListMetricDescriptorsRequest)
476
- @list_metric_descriptors.call(req, options, &block)
477
- end
478
-
479
- # Gets a single metric descriptor. This method does not require a Workspace.
480
- #
481
- # @param name [String]
482
- # Required. The metric descriptor on which to execute the request. The format is:
483
- #
484
- # projects/[PROJECT_ID_OR_NUMBER]/metricDescriptors/[METRIC_ID]
485
- #
486
- # An example value of `[METRIC_ID]` is
487
- # `"compute.googleapis.com/instance/disk/read_bytes_count"`.
488
- # @param options [Google::Gax::CallOptions]
489
- # Overrides the default settings for this call, e.g, timeout,
490
- # retries, etc.
491
- # @yield [result, operation] Access the result along with the RPC operation
492
- # @yieldparam result [Google::Api::MetricDescriptor]
493
- # @yieldparam operation [GRPC::ActiveCall::Operation]
494
- # @return [Google::Api::MetricDescriptor]
495
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
496
- # @example
497
- # require "google/cloud/monitoring"
498
- #
499
- # metric_client = Google::Cloud::Monitoring::Metric.new(version: :v3)
500
- # formatted_name = Google::Cloud::Monitoring::V3::MetricServiceClient.metric_descriptor_path("[PROJECT]", "[METRIC_DESCRIPTOR]")
501
- # response = metric_client.get_metric_descriptor(formatted_name)
502
-
503
- def get_metric_descriptor \
504
- name,
505
- options: nil,
506
- &block
507
- req = {
508
- name: name
509
- }.delete_if { |_, v| v.nil? }
510
- req = Google::Gax::to_proto(req, Google::Monitoring::V3::GetMetricDescriptorRequest)
511
- @get_metric_descriptor.call(req, options, &block)
512
- end
513
-
514
- # Creates a new metric descriptor.
515
- # User-created metric descriptors define
516
- # [custom metrics](https://cloud.google.com/monitoring/custom-metrics).
517
- #
518
- # @param name [String]
519
- # Required. The project on which to execute the request. The format is:
520
- #
521
- # projects/[PROJECT_ID_OR_NUMBER]
522
- # @param metric_descriptor [Google::Api::MetricDescriptor | Hash]
523
- # Required. The new [custom metric](https://cloud.google.com/monitoring/custom-metrics)
524
- # descriptor.
525
- # A hash of the same form as `Google::Api::MetricDescriptor`
526
- # can also be provided.
527
- # @param options [Google::Gax::CallOptions]
528
- # Overrides the default settings for this call, e.g, timeout,
529
- # retries, etc.
530
- # @yield [result, operation] Access the result along with the RPC operation
531
- # @yieldparam result [Google::Api::MetricDescriptor]
532
- # @yieldparam operation [GRPC::ActiveCall::Operation]
533
- # @return [Google::Api::MetricDescriptor]
534
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
535
- # @example
536
- # require "google/cloud/monitoring"
537
- #
538
- # metric_client = Google::Cloud::Monitoring::Metric.new(version: :v3)
539
- # formatted_name = Google::Cloud::Monitoring::V3::MetricServiceClient.project_path("[PROJECT]")
540
- #
541
- # # TODO: Initialize `metric_descriptor`:
542
- # metric_descriptor = {}
543
- # response = metric_client.create_metric_descriptor(formatted_name, metric_descriptor)
544
-
545
- def create_metric_descriptor \
546
- name,
547
- metric_descriptor,
548
- options: nil,
549
- &block
550
- req = {
551
- name: name,
552
- metric_descriptor: metric_descriptor
553
- }.delete_if { |_, v| v.nil? }
554
- req = Google::Gax::to_proto(req, Google::Monitoring::V3::CreateMetricDescriptorRequest)
555
- @create_metric_descriptor.call(req, options, &block)
556
- end
557
-
558
- # Deletes a metric descriptor. Only user-created
559
- # [custom metrics](https://cloud.google.com/monitoring/custom-metrics) can be
560
- # deleted.
561
- #
562
- # @param name [String]
563
- # Required. The metric descriptor on which to execute the request. The format is:
564
- #
565
- # projects/[PROJECT_ID_OR_NUMBER]/metricDescriptors/[METRIC_ID]
566
- #
567
- # An example of `[METRIC_ID]` is:
568
- # `"custom.googleapis.com/my_test_metric"`.
569
- # @param options [Google::Gax::CallOptions]
570
- # Overrides the default settings for this call, e.g, timeout,
571
- # retries, etc.
572
- # @yield [result, operation] Access the result along with the RPC operation
573
- # @yieldparam result []
574
- # @yieldparam operation [GRPC::ActiveCall::Operation]
575
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
576
- # @example
577
- # require "google/cloud/monitoring"
578
- #
579
- # metric_client = Google::Cloud::Monitoring::Metric.new(version: :v3)
580
- # formatted_name = Google::Cloud::Monitoring::V3::MetricServiceClient.metric_descriptor_path("[PROJECT]", "[METRIC_DESCRIPTOR]")
581
- # metric_client.delete_metric_descriptor(formatted_name)
582
-
583
- def delete_metric_descriptor \
584
- name,
585
- options: nil,
586
- &block
587
- req = {
588
- name: name
589
- }.delete_if { |_, v| v.nil? }
590
- req = Google::Gax::to_proto(req, Google::Monitoring::V3::DeleteMetricDescriptorRequest)
591
- @delete_metric_descriptor.call(req, options, &block)
592
- nil
593
- end
594
-
595
- # Lists time series that match a filter. This method does not require a Workspace.
596
- #
597
- # @param name [String]
598
- # Required. The project on which to execute the request. The format is:
599
- #
600
- # projects/[PROJECT_ID_OR_NUMBER]
601
- # @param filter [String]
602
- # Required. A [monitoring filter](https://cloud.google.com/monitoring/api/v3/filters)
603
- # that specifies which time series should be returned. The filter must
604
- # specify a single metric type, and can additionally specify metric labels
605
- # and other information. For example:
606
- #
607
- # metric.type = "compute.googleapis.com/instance/cpu/usage_time" AND
608
- # metric.labels.instance_name = "my-instance-name"
609
- # @param interval [Google::Monitoring::V3::TimeInterval | Hash]
610
- # Required. The time interval for which results should be returned. Only time series
611
- # that contain data points in the specified interval are included
612
- # in the response.
613
- # A hash of the same form as `Google::Monitoring::V3::TimeInterval`
614
- # can also be provided.
615
- # @param view [Google::Monitoring::V3::ListTimeSeriesRequest::TimeSeriesView]
616
- # Required. Specifies which information is returned about the time series.
617
- # @param aggregation [Google::Monitoring::V3::Aggregation | Hash]
618
- # Specifies the alignment of data points in individual time series as
619
- # well as how to combine the retrieved time series across specified labels.
620
- #
621
- # By default (if no `aggregation` is explicitly specified), the raw time
622
- # series data is returned.
623
- # A hash of the same form as `Google::Monitoring::V3::Aggregation`
624
- # can also be provided.
625
- # @param order_by [String]
626
- # Unsupported: must be left blank. The points in each time series are
627
- # currently returned in reverse time order (most recent to oldest).
628
- # @param page_size [Integer]
629
- # The maximum number of resources contained in the underlying API
630
- # response. If page streaming is performed per-resource, this
631
- # parameter does not affect the return value. If page streaming is
632
- # performed per-page, this determines the maximum number of
633
- # resources in a page.
634
- # @param options [Google::Gax::CallOptions]
635
- # Overrides the default settings for this call, e.g, timeout,
636
- # retries, etc.
637
- # @yield [result, operation] Access the result along with the RPC operation
638
- # @yieldparam result [Google::Gax::PagedEnumerable<Google::Monitoring::V3::TimeSeries>]
639
- # @yieldparam operation [GRPC::ActiveCall::Operation]
640
- # @return [Google::Gax::PagedEnumerable<Google::Monitoring::V3::TimeSeries>]
641
- # An enumerable of Google::Monitoring::V3::TimeSeries instances.
642
- # See Google::Gax::PagedEnumerable documentation for other
643
- # operations such as per-page iteration or access to the response
644
- # object.
645
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
646
- # @example
647
- # require "google/cloud/monitoring"
648
- #
649
- # metric_client = Google::Cloud::Monitoring::Metric.new(version: :v3)
650
- # formatted_name = Google::Cloud::Monitoring::V3::MetricServiceClient.project_path("[PROJECT]")
651
- #
652
- # # TODO: Initialize `filter`:
653
- # filter = ''
654
- #
655
- # # TODO: Initialize `interval`:
656
- # interval = {}
657
- #
658
- # # TODO: Initialize `view`:
659
- # view = :FULL
660
- #
661
- # # Iterate over all results.
662
- # metric_client.list_time_series(formatted_name, filter, interval, view).each do |element|
663
- # # Process element.
664
- # end
665
- #
666
- # # Or iterate over results one page at a time.
667
- # metric_client.list_time_series(formatted_name, filter, interval, view).each_page do |page|
668
- # # Process each page at a time.
669
- # page.each do |element|
670
- # # Process element.
671
- # end
672
- # end
673
-
674
- def list_time_series \
675
- name,
676
- filter,
677
- interval,
678
- view,
679
- aggregation: nil,
680
- order_by: nil,
681
- page_size: nil,
682
- options: nil,
683
- &block
684
- req = {
685
- name: name,
686
- filter: filter,
687
- interval: interval,
688
- view: view,
689
- aggregation: aggregation,
690
- order_by: order_by,
691
- page_size: page_size
692
- }.delete_if { |_, v| v.nil? }
693
- req = Google::Gax::to_proto(req, Google::Monitoring::V3::ListTimeSeriesRequest)
694
- @list_time_series.call(req, options, &block)
695
- end
696
-
697
- # Creates or adds data to one or more time series.
698
- # The response is empty if all time series in the request were written.
699
- # If any time series could not be written, a corresponding failure message is
700
- # included in the error response.
701
- #
702
- # @param name [String]
703
- # Required. The project on which to execute the request. The format is:
704
- #
705
- # projects/[PROJECT_ID_OR_NUMBER]
706
- # @param time_series [Array<Google::Monitoring::V3::TimeSeries | Hash>]
707
- # Required. The new data to be added to a list of time series.
708
- # Adds at most one data point to each of several time series. The new data
709
- # point must be more recent than any other point in its time series. Each
710
- # `TimeSeries` value must fully specify a unique time series by supplying
711
- # all label values for the metric and the monitored resource.
712
- #
713
- # The maximum number of `TimeSeries` objects per `Create` request is 200.
714
- # A hash of the same form as `Google::Monitoring::V3::TimeSeries`
715
- # can also be provided.
716
- # @param options [Google::Gax::CallOptions]
717
- # Overrides the default settings for this call, e.g, timeout,
718
- # retries, etc.
719
- # @yield [result, operation] Access the result along with the RPC operation
720
- # @yieldparam result []
721
- # @yieldparam operation [GRPC::ActiveCall::Operation]
722
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
723
- # @example
724
- # require "google/cloud/monitoring"
725
- #
726
- # metric_client = Google::Cloud::Monitoring::Metric.new(version: :v3)
727
- # formatted_name = Google::Cloud::Monitoring::V3::MetricServiceClient.project_path("[PROJECT]")
728
- #
729
- # # TODO: Initialize `time_series`:
730
- # time_series = []
731
- # metric_client.create_time_series(formatted_name, time_series)
732
-
733
- def create_time_series \
734
- name,
735
- time_series,
736
- options: nil,
737
- &block
738
- req = {
739
- name: name,
740
- time_series: time_series
741
- }.delete_if { |_, v| v.nil? }
742
- req = Google::Gax::to_proto(req, Google::Monitoring::V3::CreateTimeSeriesRequest)
743
- @create_time_series.call(req, options, &block)
744
- nil
745
- end
746
- end
747
- end
748
- end
749
- end
750
- end