google-cloud-monitoring-v3 0.4.2 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/lib/google/cloud/monitoring/v3/alert_policy_service/client.rb +157 -61
  3. data/lib/google/cloud/monitoring/v3/group_service/client.rb +189 -68
  4. data/lib/google/cloud/monitoring/v3/metric_service/client.rb +360 -80
  5. data/lib/google/cloud/monitoring/v3/notification_channel_service/client.rb +286 -87
  6. data/lib/google/cloud/monitoring/v3/query_service/client.rb +60 -41
  7. data/lib/google/cloud/monitoring/v3/service_monitoring_service/client.rb +281 -84
  8. data/lib/google/cloud/monitoring/v3/uptime_check_service/client.rb +182 -63
  9. data/lib/google/cloud/monitoring/v3/version.rb +1 -1
  10. data/lib/google/monitoring/v3/alert_pb.rb +17 -2
  11. data/lib/google/monitoring/v3/alert_service_pb.rb +2 -2
  12. data/lib/google/monitoring/v3/alert_service_services_pb.rb +1 -1
  13. data/lib/google/monitoring/v3/common_pb.rb +2 -2
  14. data/lib/google/monitoring/v3/group_pb.rb +1 -1
  15. data/lib/google/monitoring/v3/group_service_pb.rb +2 -2
  16. data/lib/google/monitoring/v3/group_service_services_pb.rb +1 -1
  17. data/lib/google/monitoring/v3/metric_pb.rb +2 -2
  18. data/lib/google/monitoring/v3/metric_service_pb.rb +2 -2
  19. data/lib/google/monitoring/v3/metric_service_services_pb.rb +13 -1
  20. data/lib/google/monitoring/v3/mutation_record_pb.rb +1 -1
  21. data/lib/google/monitoring/v3/notification_pb.rb +2 -2
  22. data/lib/google/monitoring/v3/notification_service_pb.rb +2 -2
  23. data/lib/google/monitoring/v3/notification_service_services_pb.rb +1 -1
  24. data/lib/google/monitoring/v3/query_service_pb.rb +2 -2
  25. data/lib/google/monitoring/v3/query_service_services_pb.rb +1 -1
  26. data/lib/google/monitoring/v3/service_pb.rb +5 -2
  27. data/lib/google/monitoring/v3/service_service_pb.rb +2 -2
  28. data/lib/google/monitoring/v3/service_service_services_pb.rb +1 -1
  29. data/lib/google/monitoring/v3/uptime_pb.rb +2 -2
  30. data/lib/google/monitoring/v3/uptime_service_pb.rb +3 -2
  31. data/lib/google/monitoring/v3/uptime_service_services_pb.rb +1 -1
  32. data/proto_docs/google/longrunning/operations.rb +164 -0
  33. data/proto_docs/google/monitoring/v3/alert.rb +68 -3
  34. data/proto_docs/google/monitoring/v3/alert_service.rb +4 -2
  35. data/proto_docs/google/monitoring/v3/common.rb +17 -5
  36. data/proto_docs/google/monitoring/v3/group_service.rb +4 -2
  37. data/proto_docs/google/monitoring/v3/metric.rb +3 -1
  38. data/proto_docs/google/monitoring/v3/metric_service.rb +13 -8
  39. data/proto_docs/google/monitoring/v3/notification_service.rb +8 -4
  40. data/proto_docs/google/monitoring/v3/service.rb +38 -6
  41. data/proto_docs/google/monitoring/v3/service_service.rb +4 -2
  42. data/proto_docs/google/monitoring/v3/span_context.rb +2 -2
  43. data/proto_docs/google/monitoring/v3/uptime.rb +5 -2
  44. data/proto_docs/google/monitoring/v3/uptime_service.rb +4 -2
  45. metadata +5 -4
@@ -41,13 +41,12 @@ module Google
41
41
  # See {::Google::Cloud::Monitoring::V3::QueryService::Client::Configuration}
42
42
  # for a description of the configuration fields.
43
43
  #
44
- # ## Example
44
+ # @example
45
45
  #
46
- # To modify the configuration for all QueryService clients:
47
- #
48
- # ::Google::Cloud::Monitoring::V3::QueryService::Client.configure do |config|
49
- # config.timeout = 10.0
50
- # end
46
+ # # Modify the configuration for all QueryService clients
47
+ # ::Google::Cloud::Monitoring::V3::QueryService::Client.configure do |config|
48
+ # config.timeout = 10.0
49
+ # end
51
50
  #
52
51
  # @yield [config] Configure the Client client.
53
52
  # @yieldparam config [Client::Configuration]
@@ -94,19 +93,15 @@ module Google
94
93
  ##
95
94
  # Create a new QueryService client object.
96
95
  #
97
- # ## Examples
98
- #
99
- # To create a new QueryService client with the default
100
- # configuration:
96
+ # @example
101
97
  #
102
- # client = ::Google::Cloud::Monitoring::V3::QueryService::Client.new
98
+ # # Create a client using the default configuration
99
+ # client = ::Google::Cloud::Monitoring::V3::QueryService::Client.new
103
100
  #
104
- # To create a new QueryService client with a custom
105
- # configuration:
106
- #
107
- # client = ::Google::Cloud::Monitoring::V3::QueryService::Client.new do |config|
108
- # config.timeout = 10.0
109
- # end
101
+ # # Create a client using a custom configuration
102
+ # client = ::Google::Cloud::Monitoring::V3::QueryService::Client.new do |config|
103
+ # config.timeout = 10.0
104
+ # end
110
105
  #
111
106
  # @yield [config] Configure the QueryService client.
112
107
  # @yieldparam config [Client::Configuration]
@@ -126,10 +121,9 @@ module Google
126
121
 
127
122
  # Create credentials
128
123
  credentials = @config.credentials
129
- # Use self-signed JWT if the scope and endpoint are unchanged from default,
124
+ # Use self-signed JWT if the endpoint is unchanged from default,
130
125
  # but only if the default endpoint does not have a region prefix.
131
- enable_self_signed_jwt = @config.scope == Client.configure.scope &&
132
- @config.endpoint == Client.configure.endpoint &&
126
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
133
127
  !@config.endpoint.split(".").first.include?("-")
134
128
  credentials ||= Credentials.default scope: @config.scope,
135
129
  enable_self_signed_jwt: enable_self_signed_jwt
@@ -169,7 +163,8 @@ module Google
169
163
  # the default parameter values, pass an empty Hash as a request object (see above).
170
164
  #
171
165
  # @param name [::String]
172
- # Required. The project on which to execute the request. The format is:
166
+ # Required. The [project](https://cloud.google.com/monitoring/api/v3#project_name) on
167
+ # which to execute the request. The format is:
173
168
  #
174
169
  # projects/[PROJECT_ID_OR_NUMBER]
175
170
  # @param query [::String]
@@ -191,6 +186,27 @@ module Google
191
186
  #
192
187
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
193
188
  #
189
+ # @example Basic example
190
+ # require "google/cloud/monitoring/v3"
191
+ #
192
+ # # Create a client object. The client can be reused for multiple calls.
193
+ # client = Google::Cloud::Monitoring::V3::QueryService::Client.new
194
+ #
195
+ # # Create a request. To set request fields, pass in keyword arguments.
196
+ # request = Google::Cloud::Monitoring::V3::QueryTimeSeriesRequest.new
197
+ #
198
+ # # Call the query_time_series method.
199
+ # result = client.query_time_series request
200
+ #
201
+ # # The returned object is of type Gapic::PagedEnumerable. You can
202
+ # # iterate over all elements by calling #each, and the enumerable
203
+ # # will lazily make API calls to fetch subsequent pages. Other
204
+ # # methods are also available for managing paging directly.
205
+ # result.each do |response|
206
+ # # Each element is of type ::Google::Cloud::Monitoring::V3::TimeSeriesData.
207
+ # p response
208
+ # end
209
+ #
194
210
  def query_time_series request, options = nil
195
211
  raise ::ArgumentError, "request must be provided" if request.nil?
196
212
 
@@ -208,16 +224,20 @@ module Google
208
224
  gapic_version: ::Google::Cloud::Monitoring::V3::VERSION
209
225
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
210
226
 
211
- header_params = {
212
- "name" => request.name
213
- }
227
+ header_params = {}
228
+ if request.name
229
+ header_params["name"] = request.name
230
+ end
231
+
214
232
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
215
233
  metadata[:"x-goog-request-params"] ||= request_params_header
216
234
 
217
235
  options.apply_defaults timeout: @config.rpcs.query_time_series.timeout,
218
236
  metadata: metadata,
219
237
  retry_policy: @config.rpcs.query_time_series.retry_policy
220
- options.apply_defaults metadata: @config.metadata,
238
+
239
+ options.apply_defaults timeout: @config.timeout,
240
+ metadata: @config.metadata,
221
241
  retry_policy: @config.retry_policy
222
242
 
223
243
  @query_service_stub.call_rpc :query_time_series, request, options: options do |response, operation|
@@ -242,22 +262,21 @@ module Google
242
262
  # Configuration can be applied globally to all clients, or to a single client
243
263
  # on construction.
244
264
  #
245
- # # Examples
246
- #
247
- # To modify the global config, setting the timeout for query_time_series
248
- # to 20 seconds, and all remaining timeouts to 10 seconds:
249
- #
250
- # ::Google::Cloud::Monitoring::V3::QueryService::Client.configure do |config|
251
- # config.timeout = 10.0
252
- # config.rpcs.query_time_series.timeout = 20.0
253
- # end
254
- #
255
- # To apply the above configuration only to a new client:
256
- #
257
- # client = ::Google::Cloud::Monitoring::V3::QueryService::Client.new do |config|
258
- # config.timeout = 10.0
259
- # config.rpcs.query_time_series.timeout = 20.0
260
- # end
265
+ # @example
266
+ #
267
+ # # Modify the global config, setting the timeout for
268
+ # # query_time_series to 20 seconds,
269
+ # # and all remaining timeouts to 10 seconds.
270
+ # ::Google::Cloud::Monitoring::V3::QueryService::Client.configure do |config|
271
+ # config.timeout = 10.0
272
+ # config.rpcs.query_time_series.timeout = 20.0
273
+ # end
274
+ #
275
+ # # Apply the above configuration only to a new client.
276
+ # client = ::Google::Cloud::Monitoring::V3::QueryService::Client.new do |config|
277
+ # config.timeout = 10.0
278
+ # config.rpcs.query_time_series.timeout = 20.0
279
+ # end
261
280
  #
262
281
  # @!attribute [rw] endpoint
263
282
  # The hostname or hostname:port of the service endpoint.