google-cloud-monitoring-dashboard-v1 0.1.0

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