google-cloud-monitoring 0.33.1 → 0.34.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +4 -1
- data/lib/google/cloud/monitoring.rb +63 -1
- data/lib/google/cloud/monitoring/dashboard.rb +147 -0
- data/lib/google/cloud/monitoring/dashboard/v1.rb +148 -0
- data/lib/google/cloud/monitoring/dashboard/v1/credentials.rb +46 -0
- data/lib/google/cloud/monitoring/dashboard/v1/dashboards_service_client.rb +454 -0
- data/lib/google/cloud/monitoring/dashboard/v1/dashboards_service_client_config.json +51 -0
- data/lib/google/cloud/monitoring/dashboard/v1/doc/google/monitoring/dashboard/v1/common.rb +394 -0
- data/lib/google/cloud/monitoring/dashboard/v1/doc/google/monitoring/dashboard/v1/dashboard.rb +53 -0
- data/lib/google/cloud/monitoring/dashboard/v1/doc/google/monitoring/dashboard/v1/dashboards_service.rb +82 -0
- data/lib/google/cloud/monitoring/dashboard/v1/doc/google/monitoring/dashboard/v1/layouts.rb +71 -0
- data/lib/google/cloud/monitoring/dashboard/v1/doc/google/monitoring/dashboard/v1/metrics.rb +151 -0
- data/lib/google/cloud/monitoring/dashboard/v1/doc/google/monitoring/dashboard/v1/scorecard.rb +102 -0
- data/lib/google/cloud/monitoring/dashboard/v1/doc/google/monitoring/dashboard/v1/text.rb +43 -0
- data/lib/google/cloud/monitoring/dashboard/v1/doc/google/monitoring/dashboard/v1/widget.rb +41 -0
- data/lib/google/cloud/monitoring/dashboard/v1/doc/google/monitoring/dashboard/v1/xychart.rb +141 -0
- data/lib/google/cloud/monitoring/dashboard/v1/doc/google/protobuf/duration.rb +91 -0
- data/lib/google/cloud/monitoring/dashboard/v1/doc/google/protobuf/empty.rb +29 -0
- data/lib/google/cloud/monitoring/v3.rb +72 -1
- data/lib/google/cloud/monitoring/v3/alert_policy_service_client_config.json +5 -5
- data/lib/google/cloud/monitoring/v3/doc/google/api/metric.rb +29 -45
- data/lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/alert.rb +6 -8
- data/lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/metric.rb +8 -8
- data/lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/metric_service.rb +6 -4
- data/lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/service.rb +341 -0
- data/lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/service_service.rb +187 -0
- data/lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/uptime.rb +16 -12
- data/lib/google/cloud/monitoring/v3/group_service_client_config.json +6 -6
- data/lib/google/cloud/monitoring/v3/metric_service_client.rb +6 -4
- data/lib/google/cloud/monitoring/v3/metric_service_client_config.json +7 -7
- data/lib/google/cloud/monitoring/v3/notification_channel_service_client_config.json +10 -10
- data/lib/google/cloud/monitoring/v3/service_monitoring_service_client.rb +775 -0
- data/lib/google/cloud/monitoring/v3/service_monitoring_service_client_config.json +76 -0
- data/lib/google/cloud/monitoring/version.rb +1 -1
- data/lib/google/monitoring/dashboard/v1/common_pb.rb +95 -0
- data/lib/google/monitoring/dashboard/v1/dashboard_pb.rb +29 -0
- data/lib/google/monitoring/dashboard/v1/dashboards_service_pb.rb +51 -0
- data/lib/google/monitoring/dashboard/v1/dashboards_service_services_pb.rb +76 -0
- data/lib/google/monitoring/dashboard/v1/drilldowns_pb.rb +17 -0
- data/lib/google/monitoring/dashboard/v1/layouts_pb.rb +41 -0
- data/lib/google/monitoring/dashboard/v1/metrics_pb.rb +76 -0
- data/lib/google/monitoring/dashboard/v1/scorecard_pb.rb +38 -0
- data/lib/google/monitoring/dashboard/v1/service_pb.rb +17 -0
- data/lib/google/monitoring/dashboard/v1/text_pb.rb +28 -0
- data/lib/google/monitoring/dashboard/v1/widget_pb.rb +32 -0
- data/lib/google/monitoring/dashboard/v1/xychart_pb.rb +66 -0
- data/lib/google/monitoring/v3/metric_service_pb.rb +11 -0
- data/lib/google/monitoring/v3/notification_pb.rb +1 -0
- data/lib/google/monitoring/v3/service_pb.rb +141 -0
- data/lib/google/monitoring/v3/service_service_pb.rb +85 -0
- data/lib/google/monitoring/v3/service_service_services_pb.rb +66 -0
- metadata +37 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8c4a61a7222b33f425fced6fb64aa3f22192f41ad280ab01f5b3b04fb07e452b
|
4
|
+
data.tar.gz: 01433a95d0f7343e0aed2de08f8babefc3a048300a1cd9a1d75696ba96839b1b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bcb8f24fc48c007d9af0f9ce395ce4b9f1379de30ce92eccbefed4dc81cbad2c1dca6aee2789123f47b8027b9730e6ab8220b708877a01cfc09657d5f592d531
|
7
|
+
data.tar.gz: 3e0728a632ae23a57b7f16fbf91537541a0de9fb542f8ab2b9c5c7a630ca17776038d221581f487a30e0bd43019dcc70cff1d5be55ba237639baa331bf8c204f
|
data/README.md
CHANGED
@@ -3,7 +3,10 @@
|
|
3
3
|
[Stackdriver Monitoring API][Product Documentation]:
|
4
4
|
Manages your Stackdriver Monitoring data and configurations. Most projects
|
5
5
|
must be associated with a Stackdriver account, with a few exceptions as
|
6
|
-
noted on the individual method pages.
|
6
|
+
noted on the individual method pages. The table entries below are
|
7
|
+
presented in alphabetical order, not in order of common use. For
|
8
|
+
explanations of the concepts found in the table entries, read the
|
9
|
+
[Stackdriver Monitoring documentation](/monitoring/docs).
|
7
10
|
- [Client Library Documentation][]
|
8
11
|
- [Product Documentation][]
|
9
12
|
|
@@ -26,7 +26,10 @@ module Google
|
|
26
26
|
# [Stackdriver Monitoring API][Product Documentation]:
|
27
27
|
# Manages your Stackdriver Monitoring data and configurations. Most projects
|
28
28
|
# must be associated with a Stackdriver account, with a few exceptions as
|
29
|
-
# noted on the individual method pages.
|
29
|
+
# noted on the individual method pages. The table entries below are
|
30
|
+
# presented in alphabetical order, not in order of common use. For
|
31
|
+
# explanations of the concepts found in the table entries, read the
|
32
|
+
# [Stackdriver Monitoring documentation](/monitoring/docs).
|
30
33
|
# - [Product Documentation][]
|
31
34
|
#
|
32
35
|
# ## Quick Start
|
@@ -355,6 +358,65 @@ module Google
|
|
355
358
|
end
|
356
359
|
end
|
357
360
|
|
361
|
+
module ServiceMonitoring
|
362
|
+
##
|
363
|
+
# The Stackdriver Monitoring Service-Oriented Monitoring API has endpoints for
|
364
|
+
# managing and querying aspects of a workspace's services. These include the
|
365
|
+
# `Service`'s monitored resources, its Service-Level Objectives, and a taxonomy
|
366
|
+
# of categorized Health Metrics.
|
367
|
+
#
|
368
|
+
# @param version [Symbol, String]
|
369
|
+
# The major version of the service to be used. By default :v3
|
370
|
+
# is used.
|
371
|
+
# @overload new(version:, credentials:, scopes:, client_config:, timeout:)
|
372
|
+
# @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
|
373
|
+
# Provides the means for authenticating requests made by the client. This parameter can
|
374
|
+
# be many types.
|
375
|
+
# A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
|
376
|
+
# authenticating requests made by this client.
|
377
|
+
# A `String` will be treated as the path to the keyfile to be used for the construction of
|
378
|
+
# credentials for this client.
|
379
|
+
# A `Hash` will be treated as the contents of a keyfile to be used for the construction of
|
380
|
+
# credentials for this client.
|
381
|
+
# A `GRPC::Core::Channel` will be used to make calls through.
|
382
|
+
# A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
|
383
|
+
# should already be composed with a `GRPC::Core::CallCredentials` object.
|
384
|
+
# A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
|
385
|
+
# metadata for requests, generally, to give OAuth credentials.
|
386
|
+
# @param scopes [Array<String>]
|
387
|
+
# The OAuth scopes for this service. This parameter is ignored if
|
388
|
+
# an updater_proc is supplied.
|
389
|
+
# @param client_config [Hash]
|
390
|
+
# A Hash for call options for each method. See
|
391
|
+
# Google::Gax#construct_settings for the structure of
|
392
|
+
# this data. Falls back to the default config if not specified
|
393
|
+
# or the specified config is missing data points.
|
394
|
+
# @param timeout [Numeric]
|
395
|
+
# The default timeout, in seconds, for calls made through this client.
|
396
|
+
# @param metadata [Hash]
|
397
|
+
# Default metadata to be sent with each request. This can be overridden on a per call basis.
|
398
|
+
# @param service_address [String]
|
399
|
+
# Override for the service hostname, or `nil` to leave as the default.
|
400
|
+
# @param service_port [Integer]
|
401
|
+
# Override for the service port, or `nil` to leave as the default.
|
402
|
+
# @param exception_transformer [Proc]
|
403
|
+
# An optional proc that intercepts any exceptions raised during an API call to inject
|
404
|
+
# custom error handling.
|
405
|
+
def self.new(*args, version: :v3, **kwargs)
|
406
|
+
unless AVAILABLE_VERSIONS.include?(version.to_s.downcase)
|
407
|
+
raise "The version: #{version} is not available. The available versions " \
|
408
|
+
"are: [#{AVAILABLE_VERSIONS.join(", ")}]"
|
409
|
+
end
|
410
|
+
|
411
|
+
require "#{FILE_DIR}/#{version.to_s.downcase}"
|
412
|
+
version_module = Google::Cloud::Monitoring
|
413
|
+
.constants
|
414
|
+
.select {|sym| sym.to_s.downcase == version.to_s.downcase}
|
415
|
+
.first
|
416
|
+
Google::Cloud::Monitoring.const_get(version_module)::ServiceMonitoring.new(*args, **kwargs)
|
417
|
+
end
|
418
|
+
end
|
419
|
+
|
358
420
|
module UptimeCheck
|
359
421
|
##
|
360
422
|
# The UptimeCheckService API is used to manage (list, create, delete, edit)
|
@@ -0,0 +1,147 @@
|
|
1
|
+
# Copyright 2019 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
|
+
|
16
|
+
require "google/gax"
|
17
|
+
require "pathname"
|
18
|
+
|
19
|
+
module Google
|
20
|
+
module Cloud
|
21
|
+
module Monitoring
|
22
|
+
# rubocop:disable LineLength
|
23
|
+
|
24
|
+
##
|
25
|
+
# # Ruby Client for Stackdriver Monitoring Dashboards API ([Alpha](https://github.com/googleapis/google-cloud-ruby#versioning))
|
26
|
+
#
|
27
|
+
# [Stackdriver Monitoring Dashboards API][Product Documentation]:
|
28
|
+
# Manages dashboard configurations used in the Stackdriver UI.
|
29
|
+
# - [Product Documentation][]
|
30
|
+
#
|
31
|
+
# ## Quick Start
|
32
|
+
# In order to use this library, you first need to go through the following
|
33
|
+
# steps:
|
34
|
+
#
|
35
|
+
# 1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project)
|
36
|
+
# 2. [Enable billing for your project.](https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project)
|
37
|
+
# 3. [Enable the Stackdriver Monitoring Dashboards API.](https://console.cloud.google.com/apis/library/monitoring.googleapis.com)
|
38
|
+
# 4. [Setup Authentication.](https://googleapis.dev/ruby/google-cloud-monitoring/latest/file.AUTHENTICATION.html)
|
39
|
+
#
|
40
|
+
# ### Installation
|
41
|
+
# ```
|
42
|
+
# $ gem install google-cloud-monitoring-dashboard
|
43
|
+
# ```
|
44
|
+
#
|
45
|
+
# ### Next Steps
|
46
|
+
# - Read the [Stackdriver Monitoring Dashboards API Product documentation][Product Documentation]
|
47
|
+
# to learn more about the product and see How-to Guides.
|
48
|
+
# - View this [repository's main README](https://github.com/googleapis/google-cloud-ruby/blob/master/README.md)
|
49
|
+
# to see the full list of Cloud APIs that we cover.
|
50
|
+
#
|
51
|
+
# [Product Documentation]: https://cloud.google.com/monitoring
|
52
|
+
#
|
53
|
+
# ## Enabling Logging
|
54
|
+
#
|
55
|
+
# To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
|
56
|
+
# The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/stdlib-2.5.0/libdoc/logger/rdoc/Logger.html) as shown below,
|
57
|
+
# or a [`Google::Cloud::Logging::Logger`](https://googleapis.dev/ruby/google-cloud-logging/latest)
|
58
|
+
# that will write logs to [Stackdriver Logging](https://cloud.google.com/logging/). See [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb)
|
59
|
+
# and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
|
60
|
+
#
|
61
|
+
# Configuring a Ruby stdlib logger:
|
62
|
+
#
|
63
|
+
# ```ruby
|
64
|
+
# require "logger"
|
65
|
+
#
|
66
|
+
# module MyLogger
|
67
|
+
# LOGGER = Logger.new $stderr, level: Logger::WARN
|
68
|
+
# def logger
|
69
|
+
# LOGGER
|
70
|
+
# end
|
71
|
+
# end
|
72
|
+
#
|
73
|
+
# # Define a gRPC module-level logger method before grpc/logconfig.rb loads.
|
74
|
+
# module GRPC
|
75
|
+
# extend MyLogger
|
76
|
+
# end
|
77
|
+
# ```
|
78
|
+
#
|
79
|
+
module Dashboard
|
80
|
+
# rubocop:enable LineLength
|
81
|
+
|
82
|
+
FILE_DIR = File.realdirpath(Pathname.new(__FILE__).join("..").join("dashboard"))
|
83
|
+
|
84
|
+
AVAILABLE_VERSIONS = Dir["#{FILE_DIR}/*"]
|
85
|
+
.select { |file| File.directory?(file) }
|
86
|
+
.select { |dir| Google::Gax::VERSION_MATCHER.match(File.basename(dir)) }
|
87
|
+
.select { |dir| File.exist?(dir + ".rb") }
|
88
|
+
.map { |dir| File.basename(dir) }
|
89
|
+
|
90
|
+
##
|
91
|
+
# Manages Stackdriver dashboards. A dashboard is an arrangement of data display
|
92
|
+
# widgets in a specific layout.
|
93
|
+
#
|
94
|
+
# @param version [Symbol, String]
|
95
|
+
# The major version of the service to be used. By default :v1
|
96
|
+
# is used.
|
97
|
+
# @overload new(version:, credentials:, scopes:, client_config:, timeout:)
|
98
|
+
# @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
|
99
|
+
# Provides the means for authenticating requests made by the client. This parameter can
|
100
|
+
# be many types.
|
101
|
+
# A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
|
102
|
+
# authenticating requests made by this client.
|
103
|
+
# A `String` will be treated as the path to the keyfile to be used for the construction of
|
104
|
+
# credentials for this client.
|
105
|
+
# A `Hash` will be treated as the contents of a keyfile to be used for the construction of
|
106
|
+
# credentials for this client.
|
107
|
+
# A `GRPC::Core::Channel` will be used to make calls through.
|
108
|
+
# A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
|
109
|
+
# should already be composed with a `GRPC::Core::CallCredentials` object.
|
110
|
+
# A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
|
111
|
+
# metadata for requests, generally, to give OAuth credentials.
|
112
|
+
# @param scopes [Array<String>]
|
113
|
+
# The OAuth scopes for this service. This parameter is ignored if
|
114
|
+
# an updater_proc is supplied.
|
115
|
+
# @param client_config [Hash]
|
116
|
+
# A Hash for call options for each method. See
|
117
|
+
# Google::Gax#construct_settings for the structure of
|
118
|
+
# this data. Falls back to the default config if not specified
|
119
|
+
# or the specified config is missing data points.
|
120
|
+
# @param timeout [Numeric]
|
121
|
+
# The default timeout, in seconds, for calls made through this client.
|
122
|
+
# @param metadata [Hash]
|
123
|
+
# Default metadata to be sent with each request. This can be overridden on a per call basis.
|
124
|
+
# @param service_address [String]
|
125
|
+
# Override for the service hostname, or `nil` to leave as the default.
|
126
|
+
# @param service_port [Integer]
|
127
|
+
# Override for the service port, or `nil` to leave as the default.
|
128
|
+
# @param exception_transformer [Proc]
|
129
|
+
# An optional proc that intercepts any exceptions raised during an API call to inject
|
130
|
+
# custom error handling.
|
131
|
+
def self.new(*args, version: :v1, **kwargs)
|
132
|
+
unless AVAILABLE_VERSIONS.include?(version.to_s.downcase)
|
133
|
+
raise "The version: #{version} is not available. The available versions " \
|
134
|
+
"are: [#{AVAILABLE_VERSIONS.join(", ")}]"
|
135
|
+
end
|
136
|
+
|
137
|
+
require "#{FILE_DIR}/#{version.to_s.downcase}"
|
138
|
+
version_module = Google::Cloud::Monitoring::Dashboard
|
139
|
+
.constants
|
140
|
+
.select {|sym| sym.to_s.downcase == version.to_s.downcase}
|
141
|
+
.first
|
142
|
+
Google::Cloud::Monitoring::Dashboard.const_get(version_module).new(*args, **kwargs)
|
143
|
+
end
|
144
|
+
end
|
145
|
+
end
|
146
|
+
end
|
147
|
+
end
|
@@ -0,0 +1,148 @@
|
|
1
|
+
# Copyright 2019 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
|
+
|
16
|
+
require "google/cloud/monitoring/dashboard/v1/dashboards_service_client"
|
17
|
+
|
18
|
+
module Google
|
19
|
+
module Cloud
|
20
|
+
module Monitoring
|
21
|
+
module Dashboard
|
22
|
+
# rubocop:disable LineLength
|
23
|
+
|
24
|
+
##
|
25
|
+
# # Ruby Client for Stackdriver Monitoring Dashboards API ([Alpha](https://github.com/googleapis/google-cloud-ruby#versioning))
|
26
|
+
#
|
27
|
+
# [Stackdriver Monitoring Dashboards API][Product Documentation]:
|
28
|
+
# Manages dashboard configurations used in the Stackdriver UI.
|
29
|
+
# - [Product Documentation][]
|
30
|
+
#
|
31
|
+
# ## Quick Start
|
32
|
+
# In order to use this library, you first need to go through the following
|
33
|
+
# steps:
|
34
|
+
#
|
35
|
+
# 1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project)
|
36
|
+
# 2. [Enable billing for your project.](https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project)
|
37
|
+
# 3. [Enable the Stackdriver Monitoring Dashboards API.](https://console.cloud.google.com/apis/library/monitoring.googleapis.com)
|
38
|
+
# 4. [Setup Authentication.](https://googleapis.dev/ruby/google-cloud-monitoring/latest/file.AUTHENTICATION.html)
|
39
|
+
#
|
40
|
+
# ### Installation
|
41
|
+
# ```
|
42
|
+
# $ gem install google-cloud-monitoring-dashboard
|
43
|
+
# ```
|
44
|
+
#
|
45
|
+
# ### Next Steps
|
46
|
+
# - Read the [Stackdriver Monitoring Dashboards API Product documentation][Product Documentation]
|
47
|
+
# to learn more about the product and see How-to Guides.
|
48
|
+
# - View this [repository's main README](https://github.com/googleapis/google-cloud-ruby/blob/master/README.md)
|
49
|
+
# to see the full list of Cloud APIs that we cover.
|
50
|
+
#
|
51
|
+
# [Product Documentation]: https://cloud.google.com/monitoring
|
52
|
+
#
|
53
|
+
# ## Enabling Logging
|
54
|
+
#
|
55
|
+
# To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
|
56
|
+
# The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/stdlib-2.5.0/libdoc/logger/rdoc/Logger.html) as shown below,
|
57
|
+
# or a [`Google::Cloud::Logging::Logger`](https://googleapis.dev/ruby/google-cloud-logging/latest)
|
58
|
+
# that will write logs to [Stackdriver Logging](https://cloud.google.com/logging/). See [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb)
|
59
|
+
# and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
|
60
|
+
#
|
61
|
+
# Configuring a Ruby stdlib logger:
|
62
|
+
#
|
63
|
+
# ```ruby
|
64
|
+
# require "logger"
|
65
|
+
#
|
66
|
+
# module MyLogger
|
67
|
+
# LOGGER = Logger.new $stderr, level: Logger::WARN
|
68
|
+
# def logger
|
69
|
+
# LOGGER
|
70
|
+
# end
|
71
|
+
# end
|
72
|
+
#
|
73
|
+
# # Define a gRPC module-level logger method before grpc/logconfig.rb loads.
|
74
|
+
# module GRPC
|
75
|
+
# extend MyLogger
|
76
|
+
# end
|
77
|
+
# ```
|
78
|
+
#
|
79
|
+
module V1
|
80
|
+
# rubocop:enable LineLength
|
81
|
+
|
82
|
+
##
|
83
|
+
# Manages Stackdriver dashboards. A dashboard is an arrangement of data display
|
84
|
+
# widgets in a specific layout.
|
85
|
+
#
|
86
|
+
# @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
|
87
|
+
# Provides the means for authenticating requests made by the client. This parameter can
|
88
|
+
# be many types.
|
89
|
+
# A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
|
90
|
+
# authenticating requests made by this client.
|
91
|
+
# A `String` will be treated as the path to the keyfile to be used for the construction of
|
92
|
+
# credentials for this client.
|
93
|
+
# A `Hash` will be treated as the contents of a keyfile to be used for the construction of
|
94
|
+
# credentials for this client.
|
95
|
+
# A `GRPC::Core::Channel` will be used to make calls through.
|
96
|
+
# A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
|
97
|
+
# should already be composed with a `GRPC::Core::CallCredentials` object.
|
98
|
+
# A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
|
99
|
+
# metadata for requests, generally, to give OAuth credentials.
|
100
|
+
# @param scopes [Array<String>]
|
101
|
+
# The OAuth scopes for this service. This parameter is ignored if
|
102
|
+
# an updater_proc is supplied.
|
103
|
+
# @param client_config [Hash]
|
104
|
+
# A Hash for call options for each method. See
|
105
|
+
# Google::Gax#construct_settings for the structure of
|
106
|
+
# this data. Falls back to the default config if not specified
|
107
|
+
# or the specified config is missing data points.
|
108
|
+
# @param timeout [Numeric]
|
109
|
+
# The default timeout, in seconds, for calls made through this client.
|
110
|
+
# @param metadata [Hash]
|
111
|
+
# Default metadata to be sent with each request. This can be overridden on a per call basis.
|
112
|
+
# @param service_address [String]
|
113
|
+
# Override for the service hostname, or `nil` to leave as the default.
|
114
|
+
# @param service_port [Integer]
|
115
|
+
# Override for the service port, or `nil` to leave as the default.
|
116
|
+
# @param exception_transformer [Proc]
|
117
|
+
# An optional proc that intercepts any exceptions raised during an API call to inject
|
118
|
+
# custom error handling.
|
119
|
+
def self.new \
|
120
|
+
credentials: nil,
|
121
|
+
scopes: nil,
|
122
|
+
client_config: nil,
|
123
|
+
timeout: nil,
|
124
|
+
metadata: nil,
|
125
|
+
service_address: nil,
|
126
|
+
service_port: nil,
|
127
|
+
exception_transformer: nil,
|
128
|
+
lib_name: nil,
|
129
|
+
lib_version: nil
|
130
|
+
kwargs = {
|
131
|
+
credentials: credentials,
|
132
|
+
scopes: scopes,
|
133
|
+
client_config: client_config,
|
134
|
+
timeout: timeout,
|
135
|
+
metadata: metadata,
|
136
|
+
exception_transformer: exception_transformer,
|
137
|
+
lib_name: lib_name,
|
138
|
+
service_address: service_address,
|
139
|
+
service_port: service_port,
|
140
|
+
lib_version: lib_version
|
141
|
+
}.select { |_, v| v != nil }
|
142
|
+
Google::Cloud::Monitoring::Dashboard::V1::DashboardsServiceClient.new(**kwargs)
|
143
|
+
end
|
144
|
+
end
|
145
|
+
end
|
146
|
+
end
|
147
|
+
end
|
148
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# Copyright 2019 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
|
+
|
16
|
+
require "googleauth"
|
17
|
+
|
18
|
+
module Google
|
19
|
+
module Cloud
|
20
|
+
module Monitoring
|
21
|
+
module Dashboard
|
22
|
+
module V1
|
23
|
+
class Credentials < Google::Auth::Credentials
|
24
|
+
SCOPE = [
|
25
|
+
"https://www.googleapis.com/auth/cloud-platform",
|
26
|
+
"https://www.googleapis.com/auth/monitoring",
|
27
|
+
"https://www.googleapis.com/auth/monitoring.read",
|
28
|
+
"https://www.googleapis.com/auth/monitoring.write"
|
29
|
+
].freeze
|
30
|
+
PATH_ENV_VARS = %w(MONITORING_CREDENTIALS
|
31
|
+
MONITORING_KEYFILE
|
32
|
+
GOOGLE_CLOUD_CREDENTIALS
|
33
|
+
GOOGLE_CLOUD_KEYFILE
|
34
|
+
GCLOUD_KEYFILE)
|
35
|
+
JSON_ENV_VARS = %w(MONITORING_CREDENTIALS_JSON
|
36
|
+
MONITORING_KEYFILE_JSON
|
37
|
+
GOOGLE_CLOUD_CREDENTIALS_JSON
|
38
|
+
GOOGLE_CLOUD_KEYFILE_JSON
|
39
|
+
GCLOUD_KEYFILE_JSON)
|
40
|
+
DEFAULT_PATHS = ["~/.config/gcloud/application_default_credentials.json"]
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,454 @@
|
|
1
|
+
# Copyright 2019 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/dashboard/v1/dashboards_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/dashboard/v1/dashboards_service_pb"
|
29
|
+
require "google/cloud/monitoring/dashboard/v1/credentials"
|
30
|
+
require "google/cloud/monitoring/version"
|
31
|
+
|
32
|
+
module Google
|
33
|
+
module Cloud
|
34
|
+
module Monitoring
|
35
|
+
module Dashboard
|
36
|
+
module V1
|
37
|
+
# Manages Stackdriver dashboards. A dashboard is an arrangement of data display
|
38
|
+
# widgets in a specific layout.
|
39
|
+
#
|
40
|
+
# @!attribute [r] dashboards_service_stub
|
41
|
+
# @return [Google::Monitoring::Dashboard::V1::DashboardsService::Stub]
|
42
|
+
class DashboardsServiceClient
|
43
|
+
attr_reader :dashboards_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_dashboards" => Google::Gax::PageDescriptor.new(
|
58
|
+
"page_token",
|
59
|
+
"next_page_token",
|
60
|
+
"dashboards")
|
61
|
+
}.freeze
|
62
|
+
|
63
|
+
private_constant :PAGE_DESCRIPTORS
|
64
|
+
|
65
|
+
# The scopes needed to make gRPC calls to all of the methods defined in
|
66
|
+
# this service.
|
67
|
+
ALL_SCOPES = [
|
68
|
+
"https://www.googleapis.com/auth/cloud-platform",
|
69
|
+
"https://www.googleapis.com/auth/monitoring",
|
70
|
+
"https://www.googleapis.com/auth/monitoring.read",
|
71
|
+
"https://www.googleapis.com/auth/monitoring.write"
|
72
|
+
].freeze
|
73
|
+
|
74
|
+
|
75
|
+
# @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
|
76
|
+
# Provides the means for authenticating requests made by the client. This parameter can
|
77
|
+
# be many types.
|
78
|
+
# A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
|
79
|
+
# authenticating requests made by this client.
|
80
|
+
# A `String` will be treated as the path to the keyfile to be used for the construction of
|
81
|
+
# credentials for this client.
|
82
|
+
# A `Hash` will be treated as the contents of a keyfile to be used for the construction of
|
83
|
+
# credentials for this client.
|
84
|
+
# A `GRPC::Core::Channel` will be used to make calls through.
|
85
|
+
# A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
|
86
|
+
# should already be composed with a `GRPC::Core::CallCredentials` object.
|
87
|
+
# A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
|
88
|
+
# metadata for requests, generally, to give OAuth credentials.
|
89
|
+
# @param scopes [Array<String>]
|
90
|
+
# The OAuth scopes for this service. This parameter is ignored if
|
91
|
+
# an updater_proc is supplied.
|
92
|
+
# @param client_config [Hash]
|
93
|
+
# A Hash for call options for each method. See
|
94
|
+
# Google::Gax#construct_settings for the structure of
|
95
|
+
# this data. Falls back to the default config if not specified
|
96
|
+
# or the specified config is missing data points.
|
97
|
+
# @param timeout [Numeric]
|
98
|
+
# The default timeout, in seconds, for calls made through this client.
|
99
|
+
# @param metadata [Hash]
|
100
|
+
# Default metadata to be sent with each request. This can be overridden on a per call basis.
|
101
|
+
# @param service_address [String]
|
102
|
+
# Override for the service hostname, or `nil` to leave as the default.
|
103
|
+
# @param service_port [Integer]
|
104
|
+
# Override for the service port, or `nil` to leave as the default.
|
105
|
+
# @param exception_transformer [Proc]
|
106
|
+
# An optional proc that intercepts any exceptions raised during an API call to inject
|
107
|
+
# custom error handling.
|
108
|
+
def initialize \
|
109
|
+
credentials: nil,
|
110
|
+
scopes: ALL_SCOPES,
|
111
|
+
client_config: {},
|
112
|
+
timeout: DEFAULT_TIMEOUT,
|
113
|
+
metadata: nil,
|
114
|
+
service_address: nil,
|
115
|
+
service_port: nil,
|
116
|
+
exception_transformer: nil,
|
117
|
+
lib_name: nil,
|
118
|
+
lib_version: ""
|
119
|
+
# These require statements are intentionally placed here to initialize
|
120
|
+
# the gRPC module only when it's required.
|
121
|
+
# See https://github.com/googleapis/toolkit/issues/446
|
122
|
+
require "google/gax/grpc"
|
123
|
+
require "google/monitoring/dashboard/v1/dashboards_service_services_pb"
|
124
|
+
|
125
|
+
credentials ||= Google::Cloud::Monitoring::Dashboard::V1::Credentials.default
|
126
|
+
|
127
|
+
if credentials.is_a?(String) || credentials.is_a?(Hash)
|
128
|
+
updater_proc = Google::Cloud::Monitoring::Dashboard::V1::Credentials.new(credentials).updater_proc
|
129
|
+
end
|
130
|
+
if credentials.is_a?(GRPC::Core::Channel)
|
131
|
+
channel = credentials
|
132
|
+
end
|
133
|
+
if credentials.is_a?(GRPC::Core::ChannelCredentials)
|
134
|
+
chan_creds = credentials
|
135
|
+
end
|
136
|
+
if credentials.is_a?(Proc)
|
137
|
+
updater_proc = credentials
|
138
|
+
end
|
139
|
+
if credentials.is_a?(Google::Auth::Credentials)
|
140
|
+
updater_proc = credentials.updater_proc
|
141
|
+
end
|
142
|
+
|
143
|
+
package_version = Google::Cloud::Monitoring::VERSION
|
144
|
+
|
145
|
+
google_api_client = "gl-ruby/#{RUBY_VERSION}"
|
146
|
+
google_api_client << " #{lib_name}/#{lib_version}" if lib_name
|
147
|
+
google_api_client << " gapic/#{package_version} gax/#{Google::Gax::VERSION}"
|
148
|
+
google_api_client << " grpc/#{GRPC::VERSION}"
|
149
|
+
google_api_client.freeze
|
150
|
+
|
151
|
+
headers = { :"x-goog-api-client" => google_api_client }
|
152
|
+
headers.merge!(metadata) unless metadata.nil?
|
153
|
+
client_config_file = Pathname.new(__dir__).join(
|
154
|
+
"dashboards_service_client_config.json"
|
155
|
+
)
|
156
|
+
defaults = client_config_file.open do |f|
|
157
|
+
Google::Gax.construct_settings(
|
158
|
+
"google.monitoring.dashboard.v1.DashboardsService",
|
159
|
+
JSON.parse(f.read),
|
160
|
+
client_config,
|
161
|
+
Google::Gax::Grpc::STATUS_CODE_NAMES,
|
162
|
+
timeout,
|
163
|
+
page_descriptors: PAGE_DESCRIPTORS,
|
164
|
+
errors: Google::Gax::Grpc::API_ERRORS,
|
165
|
+
metadata: headers
|
166
|
+
)
|
167
|
+
end
|
168
|
+
|
169
|
+
# Allow overriding the service path/port in subclasses.
|
170
|
+
service_path = service_address || self.class::SERVICE_ADDRESS
|
171
|
+
port = service_port || self.class::DEFAULT_SERVICE_PORT
|
172
|
+
interceptors = self.class::GRPC_INTERCEPTORS
|
173
|
+
@dashboards_service_stub = Google::Gax::Grpc.create_stub(
|
174
|
+
service_path,
|
175
|
+
port,
|
176
|
+
chan_creds: chan_creds,
|
177
|
+
channel: channel,
|
178
|
+
updater_proc: updater_proc,
|
179
|
+
scopes: scopes,
|
180
|
+
interceptors: interceptors,
|
181
|
+
&Google::Monitoring::Dashboard::V1::DashboardsService::Stub.method(:new)
|
182
|
+
)
|
183
|
+
|
184
|
+
@create_dashboard = Google::Gax.create_api_call(
|
185
|
+
@dashboards_service_stub.method(:create_dashboard),
|
186
|
+
defaults["create_dashboard"],
|
187
|
+
exception_transformer: exception_transformer,
|
188
|
+
params_extractor: proc do |request|
|
189
|
+
{'parent' => request.parent}
|
190
|
+
end
|
191
|
+
)
|
192
|
+
@list_dashboards = Google::Gax.create_api_call(
|
193
|
+
@dashboards_service_stub.method(:list_dashboards),
|
194
|
+
defaults["list_dashboards"],
|
195
|
+
exception_transformer: exception_transformer,
|
196
|
+
params_extractor: proc do |request|
|
197
|
+
{'parent' => request.parent}
|
198
|
+
end
|
199
|
+
)
|
200
|
+
@get_dashboard = Google::Gax.create_api_call(
|
201
|
+
@dashboards_service_stub.method(:get_dashboard),
|
202
|
+
defaults["get_dashboard"],
|
203
|
+
exception_transformer: exception_transformer,
|
204
|
+
params_extractor: proc do |request|
|
205
|
+
{'name' => request.name}
|
206
|
+
end
|
207
|
+
)
|
208
|
+
@delete_dashboard = Google::Gax.create_api_call(
|
209
|
+
@dashboards_service_stub.method(:delete_dashboard),
|
210
|
+
defaults["delete_dashboard"],
|
211
|
+
exception_transformer: exception_transformer,
|
212
|
+
params_extractor: proc do |request|
|
213
|
+
{'name' => request.name}
|
214
|
+
end
|
215
|
+
)
|
216
|
+
@update_dashboard = Google::Gax.create_api_call(
|
217
|
+
@dashboards_service_stub.method(:update_dashboard),
|
218
|
+
defaults["update_dashboard"],
|
219
|
+
exception_transformer: exception_transformer,
|
220
|
+
params_extractor: proc do |request|
|
221
|
+
{'dashboard.name' => request.dashboard.name}
|
222
|
+
end
|
223
|
+
)
|
224
|
+
end
|
225
|
+
|
226
|
+
# Service calls
|
227
|
+
|
228
|
+
# Creates a new custom dashboard.
|
229
|
+
#
|
230
|
+
# This method requires the `monitoring.dashboards.create` permission
|
231
|
+
# on the specified project. For more information, see
|
232
|
+
# [Google Cloud IAM](https://cloud.google.com/iam).
|
233
|
+
#
|
234
|
+
# @param parent [String]
|
235
|
+
# Required. The project on which to execute the request. The format is
|
236
|
+
# `"projects/{project_id_or_number}"`. The \\{project_id_or_number} must match
|
237
|
+
# the dashboard resource name.
|
238
|
+
# @param dashboard [Google::Monitoring::Dashboard::V1::Dashboard | Hash]
|
239
|
+
# Required. The initial dashboard specification.
|
240
|
+
# A hash of the same form as `Google::Monitoring::Dashboard::V1::Dashboard`
|
241
|
+
# can also be provided.
|
242
|
+
# @param options [Google::Gax::CallOptions]
|
243
|
+
# Overrides the default settings for this call, e.g, timeout,
|
244
|
+
# retries, etc.
|
245
|
+
# @yield [result, operation] Access the result along with the RPC operation
|
246
|
+
# @yieldparam result [Google::Monitoring::Dashboard::V1::Dashboard]
|
247
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
248
|
+
# @return [Google::Monitoring::Dashboard::V1::Dashboard]
|
249
|
+
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
250
|
+
# @example
|
251
|
+
# require "google/cloud/monitoring/dashboard"
|
252
|
+
#
|
253
|
+
# dashboards_client = Google::Cloud::Monitoring::Dashboard.new(version: :v1)
|
254
|
+
#
|
255
|
+
# # TODO: Initialize `parent`:
|
256
|
+
# parent = ''
|
257
|
+
#
|
258
|
+
# # TODO: Initialize `dashboard`:
|
259
|
+
# dashboard = {}
|
260
|
+
# response = dashboards_client.create_dashboard(parent, dashboard)
|
261
|
+
|
262
|
+
def create_dashboard \
|
263
|
+
parent,
|
264
|
+
dashboard,
|
265
|
+
options: nil,
|
266
|
+
&block
|
267
|
+
req = {
|
268
|
+
parent: parent,
|
269
|
+
dashboard: dashboard
|
270
|
+
}.delete_if { |_, v| v.nil? }
|
271
|
+
req = Google::Gax::to_proto(req, Google::Monitoring::Dashboard::V1::CreateDashboardRequest)
|
272
|
+
@create_dashboard.call(req, options, &block)
|
273
|
+
end
|
274
|
+
|
275
|
+
# Lists the existing dashboards.
|
276
|
+
#
|
277
|
+
# This method requires the `monitoring.dashboards.list` permission
|
278
|
+
# on the specified project. For more information, see
|
279
|
+
# [Google Cloud IAM](https://cloud.google.com/iam).
|
280
|
+
#
|
281
|
+
# @param parent [String]
|
282
|
+
# Required. The scope of the dashboards to list. A project scope must be
|
283
|
+
# specified in the form of `"projects/{project_id_or_number}"`.
|
284
|
+
# @param page_size [Integer]
|
285
|
+
# The maximum number of resources contained in the underlying API
|
286
|
+
# response. If page streaming is performed per-resource, this
|
287
|
+
# parameter does not affect the return value. If page streaming is
|
288
|
+
# performed per-page, this determines the maximum number of
|
289
|
+
# resources in a page.
|
290
|
+
# @param options [Google::Gax::CallOptions]
|
291
|
+
# Overrides the default settings for this call, e.g, timeout,
|
292
|
+
# retries, etc.
|
293
|
+
# @yield [result, operation] Access the result along with the RPC operation
|
294
|
+
# @yieldparam result [Google::Gax::PagedEnumerable<Google::Monitoring::Dashboard::V1::Dashboard>]
|
295
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
296
|
+
# @return [Google::Gax::PagedEnumerable<Google::Monitoring::Dashboard::V1::Dashboard>]
|
297
|
+
# An enumerable of Google::Monitoring::Dashboard::V1::Dashboard instances.
|
298
|
+
# See Google::Gax::PagedEnumerable documentation for other
|
299
|
+
# operations such as per-page iteration or access to the response
|
300
|
+
# object.
|
301
|
+
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
302
|
+
# @example
|
303
|
+
# require "google/cloud/monitoring/dashboard"
|
304
|
+
#
|
305
|
+
# dashboards_client = Google::Cloud::Monitoring::Dashboard.new(version: :v1)
|
306
|
+
#
|
307
|
+
# # TODO: Initialize `parent`:
|
308
|
+
# parent = ''
|
309
|
+
#
|
310
|
+
# # Iterate over all results.
|
311
|
+
# dashboards_client.list_dashboards(parent).each do |element|
|
312
|
+
# # Process element.
|
313
|
+
# end
|
314
|
+
#
|
315
|
+
# # Or iterate over results one page at a time.
|
316
|
+
# dashboards_client.list_dashboards(parent).each_page do |page|
|
317
|
+
# # Process each page at a time.
|
318
|
+
# page.each do |element|
|
319
|
+
# # Process element.
|
320
|
+
# end
|
321
|
+
# end
|
322
|
+
|
323
|
+
def list_dashboards \
|
324
|
+
parent,
|
325
|
+
page_size: nil,
|
326
|
+
options: nil,
|
327
|
+
&block
|
328
|
+
req = {
|
329
|
+
parent: parent,
|
330
|
+
page_size: page_size
|
331
|
+
}.delete_if { |_, v| v.nil? }
|
332
|
+
req = Google::Gax::to_proto(req, Google::Monitoring::Dashboard::V1::ListDashboardsRequest)
|
333
|
+
@list_dashboards.call(req, options, &block)
|
334
|
+
end
|
335
|
+
|
336
|
+
# Fetches a specific dashboard.
|
337
|
+
#
|
338
|
+
# This method requires the `monitoring.dashboards.get` permission
|
339
|
+
# on the specified dashboard. For more information, see
|
340
|
+
# [Google Cloud IAM](https://cloud.google.com/iam).
|
341
|
+
#
|
342
|
+
# @param name [String]
|
343
|
+
# Required. The resource name of the Dashboard. The format is one of
|
344
|
+
# `"dashboards/{dashboard_id}"` (for system dashboards) or
|
345
|
+
# `"projects/{project_id_or_number}/dashboards/{dashboard_id}"`
|
346
|
+
# (for custom dashboards).
|
347
|
+
# @param options [Google::Gax::CallOptions]
|
348
|
+
# Overrides the default settings for this call, e.g, timeout,
|
349
|
+
# retries, etc.
|
350
|
+
# @yield [result, operation] Access the result along with the RPC operation
|
351
|
+
# @yieldparam result [Google::Monitoring::Dashboard::V1::Dashboard]
|
352
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
353
|
+
# @return [Google::Monitoring::Dashboard::V1::Dashboard]
|
354
|
+
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
355
|
+
# @example
|
356
|
+
# require "google/cloud/monitoring/dashboard"
|
357
|
+
#
|
358
|
+
# dashboards_client = Google::Cloud::Monitoring::Dashboard.new(version: :v1)
|
359
|
+
#
|
360
|
+
# # TODO: Initialize `name`:
|
361
|
+
# name = ''
|
362
|
+
# response = dashboards_client.get_dashboard(name)
|
363
|
+
|
364
|
+
def get_dashboard \
|
365
|
+
name,
|
366
|
+
options: nil,
|
367
|
+
&block
|
368
|
+
req = {
|
369
|
+
name: name
|
370
|
+
}.delete_if { |_, v| v.nil? }
|
371
|
+
req = Google::Gax::to_proto(req, Google::Monitoring::Dashboard::V1::GetDashboardRequest)
|
372
|
+
@get_dashboard.call(req, options, &block)
|
373
|
+
end
|
374
|
+
|
375
|
+
# Deletes an existing custom dashboard.
|
376
|
+
#
|
377
|
+
# This method requires the `monitoring.dashboards.delete` permission
|
378
|
+
# on the specified dashboard. For more information, see
|
379
|
+
# [Google Cloud IAM](https://cloud.google.com/iam).
|
380
|
+
#
|
381
|
+
# @param name [String]
|
382
|
+
# Required. The resource name of the Dashboard. The format is
|
383
|
+
# `"projects/{project_id_or_number}/dashboards/{dashboard_id}"`.
|
384
|
+
# @param options [Google::Gax::CallOptions]
|
385
|
+
# Overrides the default settings for this call, e.g, timeout,
|
386
|
+
# retries, etc.
|
387
|
+
# @yield [result, operation] Access the result along with the RPC operation
|
388
|
+
# @yieldparam result []
|
389
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
390
|
+
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
391
|
+
# @example
|
392
|
+
# require "google/cloud/monitoring/dashboard"
|
393
|
+
#
|
394
|
+
# dashboards_client = Google::Cloud::Monitoring::Dashboard.new(version: :v1)
|
395
|
+
#
|
396
|
+
# # TODO: Initialize `name`:
|
397
|
+
# name = ''
|
398
|
+
# dashboards_client.delete_dashboard(name)
|
399
|
+
|
400
|
+
def delete_dashboard \
|
401
|
+
name,
|
402
|
+
options: nil,
|
403
|
+
&block
|
404
|
+
req = {
|
405
|
+
name: name
|
406
|
+
}.delete_if { |_, v| v.nil? }
|
407
|
+
req = Google::Gax::to_proto(req, Google::Monitoring::Dashboard::V1::DeleteDashboardRequest)
|
408
|
+
@delete_dashboard.call(req, options, &block)
|
409
|
+
nil
|
410
|
+
end
|
411
|
+
|
412
|
+
# Replaces an existing custom dashboard with a new definition.
|
413
|
+
#
|
414
|
+
# This method requires the `monitoring.dashboards.update` permission
|
415
|
+
# on the specified dashboard. For more information, see
|
416
|
+
# [Google Cloud IAM](https://cloud.google.com/iam).
|
417
|
+
#
|
418
|
+
# @param dashboard [Google::Monitoring::Dashboard::V1::Dashboard | Hash]
|
419
|
+
# Required. The dashboard that will replace the existing dashboard.
|
420
|
+
# A hash of the same form as `Google::Monitoring::Dashboard::V1::Dashboard`
|
421
|
+
# can also be provided.
|
422
|
+
# @param options [Google::Gax::CallOptions]
|
423
|
+
# Overrides the default settings for this call, e.g, timeout,
|
424
|
+
# retries, etc.
|
425
|
+
# @yield [result, operation] Access the result along with the RPC operation
|
426
|
+
# @yieldparam result [Google::Monitoring::Dashboard::V1::Dashboard]
|
427
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
428
|
+
# @return [Google::Monitoring::Dashboard::V1::Dashboard]
|
429
|
+
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
430
|
+
# @example
|
431
|
+
# require "google/cloud/monitoring/dashboard"
|
432
|
+
#
|
433
|
+
# dashboards_client = Google::Cloud::Monitoring::Dashboard.new(version: :v1)
|
434
|
+
#
|
435
|
+
# # TODO: Initialize `dashboard`:
|
436
|
+
# dashboard = {}
|
437
|
+
# response = dashboards_client.update_dashboard(dashboard)
|
438
|
+
|
439
|
+
def update_dashboard \
|
440
|
+
dashboard,
|
441
|
+
options: nil,
|
442
|
+
&block
|
443
|
+
req = {
|
444
|
+
dashboard: dashboard
|
445
|
+
}.delete_if { |_, v| v.nil? }
|
446
|
+
req = Google::Gax::to_proto(req, Google::Monitoring::Dashboard::V1::UpdateDashboardRequest)
|
447
|
+
@update_dashboard.call(req, options, &block)
|
448
|
+
end
|
449
|
+
end
|
450
|
+
end
|
451
|
+
end
|
452
|
+
end
|
453
|
+
end
|
454
|
+
end
|