google-cloud-monitoring-dashboard-v1 0.10.0 → 0.12.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (29) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -2
  3. data/lib/google/cloud/monitoring/dashboard/v1/dashboards_service/client.rb +6 -8
  4. data/lib/google/cloud/monitoring/dashboard/v1/dashboards_service/rest/client.rb +683 -0
  5. data/lib/google/cloud/monitoring/dashboard/v1/dashboards_service/rest/service_stub.rb +347 -0
  6. data/lib/google/cloud/monitoring/dashboard/v1/dashboards_service/rest.rb +55 -0
  7. data/lib/google/cloud/monitoring/dashboard/v1/dashboards_service.rb +6 -0
  8. data/lib/google/cloud/monitoring/dashboard/v1/rest.rb +39 -0
  9. data/lib/google/cloud/monitoring/dashboard/v1/version.rb +1 -1
  10. data/lib/google/cloud/monitoring/dashboard/v1.rb +5 -0
  11. data/lib/google/monitoring/dashboard/v1/alertchart_pb.rb +24 -4
  12. data/lib/google/monitoring/dashboard/v1/collapsible_group_pb.rb +24 -4
  13. data/lib/google/monitoring/dashboard/v1/common_pb.rb +25 -70
  14. data/lib/google/monitoring/dashboard/v1/dashboard_filter_pb.rb +24 -17
  15. data/lib/google/monitoring/dashboard/v1/dashboard_pb.rb +26 -14
  16. data/lib/google/monitoring/dashboard/v1/dashboards_service_pb.rb +25 -25
  17. data/lib/google/monitoring/dashboard/v1/drilldowns_pb.rb +25 -2
  18. data/lib/google/monitoring/dashboard/v1/layouts_pb.rb +25 -30
  19. data/lib/google/monitoring/dashboard/v1/logs_panel_pb.rb +24 -5
  20. data/lib/google/monitoring/dashboard/v1/metrics_pb.rb +25 -59
  21. data/lib/google/monitoring/dashboard/v1/scorecard_pb.rb +26 -17
  22. data/lib/google/monitoring/dashboard/v1/service_pb.rb +25 -2
  23. data/lib/google/monitoring/dashboard/v1/table_display_options_pb.rb +24 -4
  24. data/lib/google/monitoring/dashboard/v1/table_pb.rb +27 -21
  25. data/lib/google/monitoring/dashboard/v1/text_pb.rb +24 -10
  26. data/lib/google/monitoring/dashboard/v1/widget_pb.rb +32 -14
  27. data/lib/google/monitoring/dashboard/v1/xychart_pb.rb +26 -47
  28. data/proto_docs/google/api/client.rb +67 -4
  29. metadata +11 -7
@@ -0,0 +1,683 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2023 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ require "google/cloud/errors"
20
+ require "google/monitoring/dashboard/v1/dashboards_service_pb"
21
+ require "google/cloud/monitoring/dashboard/v1/dashboards_service/rest/service_stub"
22
+
23
+ module Google
24
+ module Cloud
25
+ module Monitoring
26
+ module Dashboard
27
+ module V1
28
+ module DashboardsService
29
+ module Rest
30
+ ##
31
+ # REST client for the DashboardsService service.
32
+ #
33
+ # Manages Stackdriver dashboards. A dashboard is an arrangement of data display
34
+ # widgets in a specific layout.
35
+ #
36
+ class Client
37
+ include Paths
38
+
39
+ # @private
40
+ attr_reader :dashboards_service_stub
41
+
42
+ ##
43
+ # Configure the DashboardsService Client class.
44
+ #
45
+ # See {::Google::Cloud::Monitoring::Dashboard::V1::DashboardsService::Rest::Client::Configuration}
46
+ # for a description of the configuration fields.
47
+ #
48
+ # @example
49
+ #
50
+ # # Modify the configuration for all DashboardsService clients
51
+ # ::Google::Cloud::Monitoring::Dashboard::V1::DashboardsService::Rest::Client.configure do |config|
52
+ # config.timeout = 10.0
53
+ # end
54
+ #
55
+ # @yield [config] Configure the Client client.
56
+ # @yieldparam config [Client::Configuration]
57
+ #
58
+ # @return [Client::Configuration]
59
+ #
60
+ def self.configure
61
+ @configure ||= begin
62
+ namespace = ["Google", "Cloud", "Monitoring", "Dashboard", "V1"]
63
+ parent_config = while namespace.any?
64
+ parent_name = namespace.join "::"
65
+ parent_const = const_get parent_name
66
+ break parent_const.configure if parent_const.respond_to? :configure
67
+ namespace.pop
68
+ end
69
+ default_config = Client::Configuration.new parent_config
70
+
71
+ default_config.timeout = 30.0
72
+ default_config.retry_policy = {
73
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14, 2]
74
+ }
75
+
76
+ default_config.rpcs.create_dashboard.timeout = 30.0
77
+
78
+ default_config.rpcs.delete_dashboard.timeout = 30.0
79
+
80
+ default_config.rpcs.update_dashboard.timeout = 30.0
81
+
82
+ default_config
83
+ end
84
+ yield @configure if block_given?
85
+ @configure
86
+ end
87
+
88
+ ##
89
+ # Configure the DashboardsService Client instance.
90
+ #
91
+ # The configuration is set to the derived mode, meaning that values can be changed,
92
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
93
+ # should be made on {Client.configure}.
94
+ #
95
+ # See {::Google::Cloud::Monitoring::Dashboard::V1::DashboardsService::Rest::Client::Configuration}
96
+ # for a description of the configuration fields.
97
+ #
98
+ # @yield [config] Configure the Client client.
99
+ # @yieldparam config [Client::Configuration]
100
+ #
101
+ # @return [Client::Configuration]
102
+ #
103
+ def configure
104
+ yield @config if block_given?
105
+ @config
106
+ end
107
+
108
+ ##
109
+ # Create a new DashboardsService REST client object.
110
+ #
111
+ # @example
112
+ #
113
+ # # Create a client using the default configuration
114
+ # client = ::Google::Cloud::Monitoring::Dashboard::V1::DashboardsService::Rest::Client.new
115
+ #
116
+ # # Create a client using a custom configuration
117
+ # client = ::Google::Cloud::Monitoring::Dashboard::V1::DashboardsService::Rest::Client.new do |config|
118
+ # config.timeout = 10.0
119
+ # end
120
+ #
121
+ # @yield [config] Configure the DashboardsService client.
122
+ # @yieldparam config [Client::Configuration]
123
+ #
124
+ def initialize
125
+ # Create the configuration object
126
+ @config = Configuration.new Client.configure
127
+
128
+ # Yield the configuration if needed
129
+ yield @config if block_given?
130
+
131
+ # Create credentials
132
+ credentials = @config.credentials
133
+ # Use self-signed JWT if the endpoint is unchanged from default,
134
+ # but only if the default endpoint does not have a region prefix.
135
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
136
+ !@config.endpoint.split(".").first.include?("-")
137
+ credentials ||= Credentials.default scope: @config.scope,
138
+ enable_self_signed_jwt: enable_self_signed_jwt
139
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
140
+ credentials = Credentials.new credentials, scope: @config.scope
141
+ end
142
+
143
+ @quota_project_id = @config.quota_project
144
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
145
+
146
+ @dashboards_service_stub = ::Google::Cloud::Monitoring::Dashboard::V1::DashboardsService::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
147
+ end
148
+
149
+ # Service calls
150
+
151
+ ##
152
+ # Creates a new custom dashboard. For examples on how you can use this API to
153
+ # create dashboards, see [Managing dashboards by
154
+ # API](https://cloud.google.com/monitoring/dashboards/api-dashboard). This
155
+ # method requires the `monitoring.dashboards.create` permission on the
156
+ # specified project. For more information about permissions, see [Cloud
157
+ # Identity and Access Management](https://cloud.google.com/iam).
158
+ #
159
+ # @overload create_dashboard(request, options = nil)
160
+ # Pass arguments to `create_dashboard` via a request object, either of type
161
+ # {::Google::Cloud::Monitoring::Dashboard::V1::CreateDashboardRequest} or an equivalent Hash.
162
+ #
163
+ # @param request [::Google::Cloud::Monitoring::Dashboard::V1::CreateDashboardRequest, ::Hash]
164
+ # A request object representing the call parameters. Required. To specify no
165
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
166
+ # @param options [::Gapic::CallOptions, ::Hash]
167
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
168
+ #
169
+ # @overload create_dashboard(parent: nil, dashboard: nil, validate_only: nil)
170
+ # Pass arguments to `create_dashboard` via keyword arguments. Note that at
171
+ # least one keyword argument is required. To specify no parameters, or to keep all
172
+ # the default parameter values, pass an empty Hash as a request object (see above).
173
+ #
174
+ # @param parent [::String]
175
+ # Required. The project on which to execute the request. The format is:
176
+ #
177
+ # projects/[PROJECT_ID_OR_NUMBER]
178
+ #
179
+ # The `[PROJECT_ID_OR_NUMBER]` must match the dashboard resource name.
180
+ # @param dashboard [::Google::Cloud::Monitoring::Dashboard::V1::Dashboard, ::Hash]
181
+ # Required. The initial dashboard specification.
182
+ # @param validate_only [::Boolean]
183
+ # If set, validate the request and preview the review, but do not actually
184
+ # save it.
185
+ # @yield [result, operation] Access the result along with the TransportOperation object
186
+ # @yieldparam result [::Google::Cloud::Monitoring::Dashboard::V1::Dashboard]
187
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
188
+ #
189
+ # @return [::Google::Cloud::Monitoring::Dashboard::V1::Dashboard]
190
+ #
191
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
192
+ def create_dashboard request, options = nil
193
+ raise ::ArgumentError, "request must be provided" if request.nil?
194
+
195
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Monitoring::Dashboard::V1::CreateDashboardRequest
196
+
197
+ # Converts hash and nil to an options object
198
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
199
+
200
+ # Customize the options with defaults
201
+ call_metadata = @config.rpcs.create_dashboard.metadata.to_h
202
+
203
+ # Set x-goog-api-client and x-goog-user-project headers
204
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
205
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
206
+ gapic_version: ::Google::Cloud::Monitoring::Dashboard::V1::VERSION,
207
+ transports_version_send: [:rest]
208
+
209
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
210
+
211
+ options.apply_defaults timeout: @config.rpcs.create_dashboard.timeout,
212
+ metadata: call_metadata,
213
+ retry_policy: @config.rpcs.create_dashboard.retry_policy
214
+
215
+ options.apply_defaults timeout: @config.timeout,
216
+ metadata: @config.metadata,
217
+ retry_policy: @config.retry_policy
218
+
219
+ @dashboards_service_stub.create_dashboard request, options do |result, operation|
220
+ yield result, operation if block_given?
221
+ return result
222
+ end
223
+ rescue ::Gapic::Rest::Error => e
224
+ raise ::Google::Cloud::Error.from_error(e)
225
+ end
226
+
227
+ ##
228
+ # Lists the existing dashboards.
229
+ #
230
+ # This method requires the `monitoring.dashboards.list` permission
231
+ # on the specified project. For more information, see
232
+ # [Cloud Identity and Access Management](https://cloud.google.com/iam).
233
+ #
234
+ # @overload list_dashboards(request, options = nil)
235
+ # Pass arguments to `list_dashboards` via a request object, either of type
236
+ # {::Google::Cloud::Monitoring::Dashboard::V1::ListDashboardsRequest} or an equivalent Hash.
237
+ #
238
+ # @param request [::Google::Cloud::Monitoring::Dashboard::V1::ListDashboardsRequest, ::Hash]
239
+ # A request object representing the call parameters. Required. To specify no
240
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
241
+ # @param options [::Gapic::CallOptions, ::Hash]
242
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
243
+ #
244
+ # @overload list_dashboards(parent: nil, page_size: nil, page_token: nil)
245
+ # Pass arguments to `list_dashboards` via keyword arguments. Note that at
246
+ # least one keyword argument is required. To specify no parameters, or to keep all
247
+ # the default parameter values, pass an empty Hash as a request object (see above).
248
+ #
249
+ # @param parent [::String]
250
+ # Required. The scope of the dashboards to list. The format is:
251
+ #
252
+ # projects/[PROJECT_ID_OR_NUMBER]
253
+ # @param page_size [::Integer]
254
+ # A positive number that is the maximum number of results to return.
255
+ # If unspecified, a default of 1000 is used.
256
+ # @param page_token [::String]
257
+ # If this field is not empty then it must contain the `nextPageToken` value
258
+ # returned by a previous call to this method. Using this field causes the
259
+ # method to return additional results from the previous method call.
260
+ # @yield [result, operation] Access the result along with the TransportOperation object
261
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Monitoring::Dashboard::V1::Dashboard>]
262
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
263
+ #
264
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Monitoring::Dashboard::V1::Dashboard>]
265
+ #
266
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
267
+ def list_dashboards request, options = nil
268
+ raise ::ArgumentError, "request must be provided" if request.nil?
269
+
270
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Monitoring::Dashboard::V1::ListDashboardsRequest
271
+
272
+ # Converts hash and nil to an options object
273
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
274
+
275
+ # Customize the options with defaults
276
+ call_metadata = @config.rpcs.list_dashboards.metadata.to_h
277
+
278
+ # Set x-goog-api-client and x-goog-user-project headers
279
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
280
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
281
+ gapic_version: ::Google::Cloud::Monitoring::Dashboard::V1::VERSION,
282
+ transports_version_send: [:rest]
283
+
284
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
285
+
286
+ options.apply_defaults timeout: @config.rpcs.list_dashboards.timeout,
287
+ metadata: call_metadata,
288
+ retry_policy: @config.rpcs.list_dashboards.retry_policy
289
+
290
+ options.apply_defaults timeout: @config.timeout,
291
+ metadata: @config.metadata,
292
+ retry_policy: @config.retry_policy
293
+
294
+ @dashboards_service_stub.list_dashboards request, options do |result, operation|
295
+ result = ::Gapic::Rest::PagedEnumerable.new @dashboards_service_stub, :list_dashboards, "dashboards", request, result, options
296
+ yield result, operation if block_given?
297
+ return result
298
+ end
299
+ rescue ::Gapic::Rest::Error => e
300
+ raise ::Google::Cloud::Error.from_error(e)
301
+ end
302
+
303
+ ##
304
+ # Fetches a specific dashboard.
305
+ #
306
+ # This method requires the `monitoring.dashboards.get` permission
307
+ # on the specified dashboard. For more information, see
308
+ # [Cloud Identity and Access Management](https://cloud.google.com/iam).
309
+ #
310
+ # @overload get_dashboard(request, options = nil)
311
+ # Pass arguments to `get_dashboard` via a request object, either of type
312
+ # {::Google::Cloud::Monitoring::Dashboard::V1::GetDashboardRequest} or an equivalent Hash.
313
+ #
314
+ # @param request [::Google::Cloud::Monitoring::Dashboard::V1::GetDashboardRequest, ::Hash]
315
+ # A request object representing the call parameters. Required. To specify no
316
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
317
+ # @param options [::Gapic::CallOptions, ::Hash]
318
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
319
+ #
320
+ # @overload get_dashboard(name: nil)
321
+ # Pass arguments to `get_dashboard` via keyword arguments. Note that at
322
+ # least one keyword argument is required. To specify no parameters, or to keep all
323
+ # the default parameter values, pass an empty Hash as a request object (see above).
324
+ #
325
+ # @param name [::String]
326
+ # Required. The resource name of the Dashboard. The format is one of:
327
+ #
328
+ # - `dashboards/[DASHBOARD_ID]` (for system dashboards)
329
+ # - `projects/[PROJECT_ID_OR_NUMBER]/dashboards/[DASHBOARD_ID]`
330
+ # (for custom dashboards).
331
+ # @yield [result, operation] Access the result along with the TransportOperation object
332
+ # @yieldparam result [::Google::Cloud::Monitoring::Dashboard::V1::Dashboard]
333
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
334
+ #
335
+ # @return [::Google::Cloud::Monitoring::Dashboard::V1::Dashboard]
336
+ #
337
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
338
+ def get_dashboard request, options = nil
339
+ raise ::ArgumentError, "request must be provided" if request.nil?
340
+
341
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Monitoring::Dashboard::V1::GetDashboardRequest
342
+
343
+ # Converts hash and nil to an options object
344
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
345
+
346
+ # Customize the options with defaults
347
+ call_metadata = @config.rpcs.get_dashboard.metadata.to_h
348
+
349
+ # Set x-goog-api-client and x-goog-user-project headers
350
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
351
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
352
+ gapic_version: ::Google::Cloud::Monitoring::Dashboard::V1::VERSION,
353
+ transports_version_send: [:rest]
354
+
355
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
356
+
357
+ options.apply_defaults timeout: @config.rpcs.get_dashboard.timeout,
358
+ metadata: call_metadata,
359
+ retry_policy: @config.rpcs.get_dashboard.retry_policy
360
+
361
+ options.apply_defaults timeout: @config.timeout,
362
+ metadata: @config.metadata,
363
+ retry_policy: @config.retry_policy
364
+
365
+ @dashboards_service_stub.get_dashboard request, options do |result, operation|
366
+ yield result, operation if block_given?
367
+ return result
368
+ end
369
+ rescue ::Gapic::Rest::Error => e
370
+ raise ::Google::Cloud::Error.from_error(e)
371
+ end
372
+
373
+ ##
374
+ # Deletes an existing custom dashboard.
375
+ #
376
+ # This method requires the `monitoring.dashboards.delete` permission
377
+ # on the specified dashboard. For more information, see
378
+ # [Cloud Identity and Access Management](https://cloud.google.com/iam).
379
+ #
380
+ # @overload delete_dashboard(request, options = nil)
381
+ # Pass arguments to `delete_dashboard` via a request object, either of type
382
+ # {::Google::Cloud::Monitoring::Dashboard::V1::DeleteDashboardRequest} or an equivalent Hash.
383
+ #
384
+ # @param request [::Google::Cloud::Monitoring::Dashboard::V1::DeleteDashboardRequest, ::Hash]
385
+ # A request object representing the call parameters. Required. To specify no
386
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
387
+ # @param options [::Gapic::CallOptions, ::Hash]
388
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
389
+ #
390
+ # @overload delete_dashboard(name: nil)
391
+ # Pass arguments to `delete_dashboard` via keyword arguments. Note that at
392
+ # least one keyword argument is required. To specify no parameters, or to keep all
393
+ # the default parameter values, pass an empty Hash as a request object (see above).
394
+ #
395
+ # @param name [::String]
396
+ # Required. The resource name of the Dashboard. The format is:
397
+ #
398
+ # projects/[PROJECT_ID_OR_NUMBER]/dashboards/[DASHBOARD_ID]
399
+ # @yield [result, operation] Access the result along with the TransportOperation object
400
+ # @yieldparam result [::Google::Protobuf::Empty]
401
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
402
+ #
403
+ # @return [::Google::Protobuf::Empty]
404
+ #
405
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
406
+ def delete_dashboard request, options = nil
407
+ raise ::ArgumentError, "request must be provided" if request.nil?
408
+
409
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Monitoring::Dashboard::V1::DeleteDashboardRequest
410
+
411
+ # Converts hash and nil to an options object
412
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
413
+
414
+ # Customize the options with defaults
415
+ call_metadata = @config.rpcs.delete_dashboard.metadata.to_h
416
+
417
+ # Set x-goog-api-client and x-goog-user-project headers
418
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
419
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
420
+ gapic_version: ::Google::Cloud::Monitoring::Dashboard::V1::VERSION,
421
+ transports_version_send: [:rest]
422
+
423
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
424
+
425
+ options.apply_defaults timeout: @config.rpcs.delete_dashboard.timeout,
426
+ metadata: call_metadata,
427
+ retry_policy: @config.rpcs.delete_dashboard.retry_policy
428
+
429
+ options.apply_defaults timeout: @config.timeout,
430
+ metadata: @config.metadata,
431
+ retry_policy: @config.retry_policy
432
+
433
+ @dashboards_service_stub.delete_dashboard request, options do |result, operation|
434
+ yield result, operation if block_given?
435
+ return result
436
+ end
437
+ rescue ::Gapic::Rest::Error => e
438
+ raise ::Google::Cloud::Error.from_error(e)
439
+ end
440
+
441
+ ##
442
+ # Replaces an existing custom dashboard with a new definition.
443
+ #
444
+ # This method requires the `monitoring.dashboards.update` permission
445
+ # on the specified dashboard. For more information, see
446
+ # [Cloud Identity and Access Management](https://cloud.google.com/iam).
447
+ #
448
+ # @overload update_dashboard(request, options = nil)
449
+ # Pass arguments to `update_dashboard` via a request object, either of type
450
+ # {::Google::Cloud::Monitoring::Dashboard::V1::UpdateDashboardRequest} or an equivalent Hash.
451
+ #
452
+ # @param request [::Google::Cloud::Monitoring::Dashboard::V1::UpdateDashboardRequest, ::Hash]
453
+ # A request object representing the call parameters. Required. To specify no
454
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
455
+ # @param options [::Gapic::CallOptions, ::Hash]
456
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
457
+ #
458
+ # @overload update_dashboard(dashboard: nil, validate_only: nil)
459
+ # Pass arguments to `update_dashboard` via keyword arguments. Note that at
460
+ # least one keyword argument is required. To specify no parameters, or to keep all
461
+ # the default parameter values, pass an empty Hash as a request object (see above).
462
+ #
463
+ # @param dashboard [::Google::Cloud::Monitoring::Dashboard::V1::Dashboard, ::Hash]
464
+ # Required. The dashboard that will replace the existing dashboard.
465
+ # @param validate_only [::Boolean]
466
+ # If set, validate the request and preview the review, but do not actually
467
+ # save it.
468
+ # @yield [result, operation] Access the result along with the TransportOperation object
469
+ # @yieldparam result [::Google::Cloud::Monitoring::Dashboard::V1::Dashboard]
470
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
471
+ #
472
+ # @return [::Google::Cloud::Monitoring::Dashboard::V1::Dashboard]
473
+ #
474
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
475
+ def update_dashboard request, options = nil
476
+ raise ::ArgumentError, "request must be provided" if request.nil?
477
+
478
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Monitoring::Dashboard::V1::UpdateDashboardRequest
479
+
480
+ # Converts hash and nil to an options object
481
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
482
+
483
+ # Customize the options with defaults
484
+ call_metadata = @config.rpcs.update_dashboard.metadata.to_h
485
+
486
+ # Set x-goog-api-client and x-goog-user-project headers
487
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
488
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
489
+ gapic_version: ::Google::Cloud::Monitoring::Dashboard::V1::VERSION,
490
+ transports_version_send: [:rest]
491
+
492
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
493
+
494
+ options.apply_defaults timeout: @config.rpcs.update_dashboard.timeout,
495
+ metadata: call_metadata,
496
+ retry_policy: @config.rpcs.update_dashboard.retry_policy
497
+
498
+ options.apply_defaults timeout: @config.timeout,
499
+ metadata: @config.metadata,
500
+ retry_policy: @config.retry_policy
501
+
502
+ @dashboards_service_stub.update_dashboard request, options do |result, operation|
503
+ yield result, operation if block_given?
504
+ return result
505
+ end
506
+ rescue ::Gapic::Rest::Error => e
507
+ raise ::Google::Cloud::Error.from_error(e)
508
+ end
509
+
510
+ ##
511
+ # Configuration class for the DashboardsService REST API.
512
+ #
513
+ # This class represents the configuration for DashboardsService REST,
514
+ # providing control over timeouts, retry behavior, logging, transport
515
+ # parameters, and other low-level controls. Certain parameters can also be
516
+ # applied individually to specific RPCs. See
517
+ # {::Google::Cloud::Monitoring::Dashboard::V1::DashboardsService::Rest::Client::Configuration::Rpcs}
518
+ # for a list of RPCs that can be configured independently.
519
+ #
520
+ # Configuration can be applied globally to all clients, or to a single client
521
+ # on construction.
522
+ #
523
+ # @example
524
+ #
525
+ # # Modify the global config, setting the timeout for
526
+ # # create_dashboard to 20 seconds,
527
+ # # and all remaining timeouts to 10 seconds.
528
+ # ::Google::Cloud::Monitoring::Dashboard::V1::DashboardsService::Rest::Client.configure do |config|
529
+ # config.timeout = 10.0
530
+ # config.rpcs.create_dashboard.timeout = 20.0
531
+ # end
532
+ #
533
+ # # Apply the above configuration only to a new client.
534
+ # client = ::Google::Cloud::Monitoring::Dashboard::V1::DashboardsService::Rest::Client.new do |config|
535
+ # config.timeout = 10.0
536
+ # config.rpcs.create_dashboard.timeout = 20.0
537
+ # end
538
+ #
539
+ # @!attribute [rw] endpoint
540
+ # The hostname or hostname:port of the service endpoint.
541
+ # Defaults to `"monitoring.googleapis.com"`.
542
+ # @return [::String]
543
+ # @!attribute [rw] credentials
544
+ # Credentials to send with calls. You may provide any of the following types:
545
+ # * (`String`) The path to a service account key file in JSON format
546
+ # * (`Hash`) A service account key as a Hash
547
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
548
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
549
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
550
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
551
+ # * (`nil`) indicating no credentials
552
+ # @return [::Object]
553
+ # @!attribute [rw] scope
554
+ # The OAuth scopes
555
+ # @return [::Array<::String>]
556
+ # @!attribute [rw] lib_name
557
+ # The library name as recorded in instrumentation and logging
558
+ # @return [::String]
559
+ # @!attribute [rw] lib_version
560
+ # The library version as recorded in instrumentation and logging
561
+ # @return [::String]
562
+ # @!attribute [rw] timeout
563
+ # The call timeout in seconds.
564
+ # @return [::Numeric]
565
+ # @!attribute [rw] metadata
566
+ # Additional headers to be sent with the call.
567
+ # @return [::Hash{::Symbol=>::String}]
568
+ # @!attribute [rw] retry_policy
569
+ # The retry policy. The value is a hash with the following keys:
570
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
571
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
572
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
573
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
574
+ # trigger a retry.
575
+ # @return [::Hash]
576
+ # @!attribute [rw] quota_project
577
+ # A separate project against which to charge quota.
578
+ # @return [::String]
579
+ #
580
+ class Configuration
581
+ extend ::Gapic::Config
582
+
583
+ config_attr :endpoint, "monitoring.googleapis.com", ::String
584
+ config_attr :credentials, nil do |value|
585
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
586
+ allowed.any? { |klass| klass === value }
587
+ end
588
+ config_attr :scope, nil, ::String, ::Array, nil
589
+ config_attr :lib_name, nil, ::String, nil
590
+ config_attr :lib_version, nil, ::String, nil
591
+ config_attr :timeout, nil, ::Numeric, nil
592
+ config_attr :metadata, nil, ::Hash, nil
593
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
594
+ config_attr :quota_project, nil, ::String, nil
595
+
596
+ # @private
597
+ def initialize parent_config = nil
598
+ @parent_config = parent_config unless parent_config.nil?
599
+
600
+ yield self if block_given?
601
+ end
602
+
603
+ ##
604
+ # Configurations for individual RPCs
605
+ # @return [Rpcs]
606
+ #
607
+ def rpcs
608
+ @rpcs ||= begin
609
+ parent_rpcs = nil
610
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
611
+ Rpcs.new parent_rpcs
612
+ end
613
+ end
614
+
615
+ ##
616
+ # Configuration RPC class for the DashboardsService API.
617
+ #
618
+ # Includes fields providing the configuration for each RPC in this service.
619
+ # Each configuration object is of type `Gapic::Config::Method` and includes
620
+ # the following configuration fields:
621
+ #
622
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
623
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
624
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
625
+ # include the following keys:
626
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
627
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
628
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
629
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
630
+ # trigger a retry.
631
+ #
632
+ class Rpcs
633
+ ##
634
+ # RPC-specific configuration for `create_dashboard`
635
+ # @return [::Gapic::Config::Method]
636
+ #
637
+ attr_reader :create_dashboard
638
+ ##
639
+ # RPC-specific configuration for `list_dashboards`
640
+ # @return [::Gapic::Config::Method]
641
+ #
642
+ attr_reader :list_dashboards
643
+ ##
644
+ # RPC-specific configuration for `get_dashboard`
645
+ # @return [::Gapic::Config::Method]
646
+ #
647
+ attr_reader :get_dashboard
648
+ ##
649
+ # RPC-specific configuration for `delete_dashboard`
650
+ # @return [::Gapic::Config::Method]
651
+ #
652
+ attr_reader :delete_dashboard
653
+ ##
654
+ # RPC-specific configuration for `update_dashboard`
655
+ # @return [::Gapic::Config::Method]
656
+ #
657
+ attr_reader :update_dashboard
658
+
659
+ # @private
660
+ def initialize parent_rpcs = nil
661
+ create_dashboard_config = parent_rpcs.create_dashboard if parent_rpcs.respond_to? :create_dashboard
662
+ @create_dashboard = ::Gapic::Config::Method.new create_dashboard_config
663
+ list_dashboards_config = parent_rpcs.list_dashboards if parent_rpcs.respond_to? :list_dashboards
664
+ @list_dashboards = ::Gapic::Config::Method.new list_dashboards_config
665
+ get_dashboard_config = parent_rpcs.get_dashboard if parent_rpcs.respond_to? :get_dashboard
666
+ @get_dashboard = ::Gapic::Config::Method.new get_dashboard_config
667
+ delete_dashboard_config = parent_rpcs.delete_dashboard if parent_rpcs.respond_to? :delete_dashboard
668
+ @delete_dashboard = ::Gapic::Config::Method.new delete_dashboard_config
669
+ update_dashboard_config = parent_rpcs.update_dashboard if parent_rpcs.respond_to? :update_dashboard
670
+ @update_dashboard = ::Gapic::Config::Method.new update_dashboard_config
671
+
672
+ yield self if block_given?
673
+ end
674
+ end
675
+ end
676
+ end
677
+ end
678
+ end
679
+ end
680
+ end
681
+ end
682
+ end
683
+ end