google-cloud-monitoring 0.38.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (101) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +2 -1
  3. data/AUTHENTICATION.md +51 -54
  4. data/LICENSE.md +201 -0
  5. data/MIGRATING.md +361 -0
  6. data/README.md +95 -52
  7. data/lib/google-cloud-monitoring.rb +6 -5
  8. data/lib/google/cloud/monitoring.rb +286 -442
  9. data/lib/google/cloud/monitoring/dashboard.rb +88 -117
  10. data/lib/google/cloud/monitoring/{v3/doc/google/protobuf/wrappers.rb → dashboard/version.rb} +12 -9
  11. data/lib/google/cloud/monitoring/version.rb +6 -2
  12. metadata +73 -130
  13. data/LICENSE +0 -201
  14. data/lib/google/cloud/monitoring/dashboard/v1.rb +0 -148
  15. data/lib/google/cloud/monitoring/dashboard/v1/credentials.rb +0 -46
  16. data/lib/google/cloud/monitoring/dashboard/v1/dashboards_service_client.rb +0 -457
  17. data/lib/google/cloud/monitoring/dashboard/v1/dashboards_service_client_config.json +0 -51
  18. data/lib/google/cloud/monitoring/dashboard/v1/doc/google/monitoring/dashboard/v1/common.rb +0 -394
  19. data/lib/google/cloud/monitoring/dashboard/v1/doc/google/monitoring/dashboard/v1/dashboard.rb +0 -53
  20. data/lib/google/cloud/monitoring/dashboard/v1/doc/google/monitoring/dashboard/v1/dashboards_service.rb +0 -82
  21. data/lib/google/cloud/monitoring/dashboard/v1/doc/google/monitoring/dashboard/v1/layouts.rb +0 -71
  22. data/lib/google/cloud/monitoring/dashboard/v1/doc/google/monitoring/dashboard/v1/metrics.rb +0 -151
  23. data/lib/google/cloud/monitoring/dashboard/v1/doc/google/monitoring/dashboard/v1/scorecard.rb +0 -102
  24. data/lib/google/cloud/monitoring/dashboard/v1/doc/google/monitoring/dashboard/v1/text.rb +0 -43
  25. data/lib/google/cloud/monitoring/dashboard/v1/doc/google/monitoring/dashboard/v1/widget.rb +0 -41
  26. data/lib/google/cloud/monitoring/dashboard/v1/doc/google/monitoring/dashboard/v1/xychart.rb +0 -141
  27. data/lib/google/cloud/monitoring/dashboard/v1/doc/google/protobuf/duration.rb +0 -91
  28. data/lib/google/cloud/monitoring/dashboard/v1/doc/google/protobuf/empty.rb +0 -29
  29. data/lib/google/cloud/monitoring/v3.rb +0 -532
  30. data/lib/google/cloud/monitoring/v3/alert_policy_service_client.rb +0 -553
  31. data/lib/google/cloud/monitoring/v3/alert_policy_service_client_config.json +0 -51
  32. data/lib/google/cloud/monitoring/v3/credentials.rb +0 -44
  33. data/lib/google/cloud/monitoring/v3/doc/google/api/distribution.rb +0 -200
  34. data/lib/google/cloud/monitoring/v3/doc/google/api/label.rb +0 -42
  35. data/lib/google/cloud/monitoring/v3/doc/google/api/metric.rb +0 -245
  36. data/lib/google/cloud/monitoring/v3/doc/google/api/monitored_resource.rb +0 -108
  37. data/lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/alert.rb +0 -344
  38. data/lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/alert_service.rb +0 -138
  39. data/lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/common.rb +0 -449
  40. data/lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/group.rb +0 -75
  41. data/lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/group_service.rb +0 -167
  42. data/lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/metric.rb +0 -85
  43. data/lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/metric_service.rb +0 -230
  44. data/lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/mutation_record.rb +0 -29
  45. data/lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/notification.rb +0 -156
  46. data/lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/notification_service.rb +0 -221
  47. data/lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/service.rb +0 -361
  48. data/lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/service_service.rb +0 -197
  49. data/lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/uptime.rb +0 -364
  50. data/lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/uptime_service.rb +0 -136
  51. data/lib/google/cloud/monitoring/v3/doc/google/protobuf/any.rb +0 -131
  52. data/lib/google/cloud/monitoring/v3/doc/google/protobuf/duration.rb +0 -91
  53. data/lib/google/cloud/monitoring/v3/doc/google/protobuf/empty.rb +0 -29
  54. data/lib/google/cloud/monitoring/v3/doc/google/protobuf/field_mask.rb +0 -222
  55. data/lib/google/cloud/monitoring/v3/doc/google/protobuf/struct.rb +0 -74
  56. data/lib/google/cloud/monitoring/v3/doc/google/protobuf/timestamp.rb +0 -113
  57. data/lib/google/cloud/monitoring/v3/doc/google/rpc/status.rb +0 -39
  58. data/lib/google/cloud/monitoring/v3/group_service_client.rb +0 -606
  59. data/lib/google/cloud/monitoring/v3/group_service_client_config.json +0 -56
  60. data/lib/google/cloud/monitoring/v3/metric_service_client.rb +0 -750
  61. data/lib/google/cloud/monitoring/v3/metric_service_client_config.json +0 -66
  62. data/lib/google/cloud/monitoring/v3/notification_channel_service_client.rb +0 -811
  63. data/lib/google/cloud/monitoring/v3/notification_channel_service_client_config.json +0 -76
  64. data/lib/google/cloud/monitoring/v3/service_monitoring_service_client.rb +0 -788
  65. data/lib/google/cloud/monitoring/v3/service_monitoring_service_client_config.json +0 -76
  66. data/lib/google/cloud/monitoring/v3/uptime_check_service_client.rb +0 -550
  67. data/lib/google/cloud/monitoring/v3/uptime_check_service_client_config.json +0 -56
  68. data/lib/google/monitoring/dashboard/v1/common_pb.rb +0 -95
  69. data/lib/google/monitoring/dashboard/v1/dashboard_pb.rb +0 -29
  70. data/lib/google/monitoring/dashboard/v1/dashboards_service_pb.rb +0 -51
  71. data/lib/google/monitoring/dashboard/v1/dashboards_service_services_pb.rb +0 -76
  72. data/lib/google/monitoring/dashboard/v1/drilldowns_pb.rb +0 -17
  73. data/lib/google/monitoring/dashboard/v1/layouts_pb.rb +0 -41
  74. data/lib/google/monitoring/dashboard/v1/metrics_pb.rb +0 -76
  75. data/lib/google/monitoring/dashboard/v1/scorecard_pb.rb +0 -38
  76. data/lib/google/monitoring/dashboard/v1/service_pb.rb +0 -17
  77. data/lib/google/monitoring/dashboard/v1/text_pb.rb +0 -28
  78. data/lib/google/monitoring/dashboard/v1/widget_pb.rb +0 -32
  79. data/lib/google/monitoring/dashboard/v1/xychart_pb.rb +0 -66
  80. data/lib/google/monitoring/v3/alert_pb.rb +0 -87
  81. data/lib/google/monitoring/v3/alert_service_pb.rb +0 -53
  82. data/lib/google/monitoring/v3/alert_service_services_pb.rb +0 -63
  83. data/lib/google/monitoring/v3/common_pb.rb +0 -95
  84. data/lib/google/monitoring/v3/dropped_labels_pb.rb +0 -19
  85. data/lib/google/monitoring/v3/group_pb.rb +0 -24
  86. data/lib/google/monitoring/v3/group_service_pb.rb +0 -73
  87. data/lib/google/monitoring/v3/group_service_services_pb.rb +0 -66
  88. data/lib/google/monitoring/v3/metric_pb.rb +0 -82
  89. data/lib/google/monitoring/v3/metric_service_pb.rb +0 -130
  90. data/lib/google/monitoring/v3/metric_service_services_pb.rb +0 -66
  91. data/lib/google/monitoring/v3/mutation_record_pb.rb +0 -21
  92. data/lib/google/monitoring/v3/notification_pb.rb +0 -47
  93. data/lib/google/monitoring/v3/notification_service_pb.rb +0 -90
  94. data/lib/google/monitoring/v3/notification_service_services_pb.rb +0 -94
  95. data/lib/google/monitoring/v3/service_pb.rb +0 -149
  96. data/lib/google/monitoring/v3/service_service_pb.rb +0 -86
  97. data/lib/google/monitoring/v3/service_service_services_pb.rb +0 -65
  98. data/lib/google/monitoring/v3/span_context_pb.rb +0 -19
  99. data/lib/google/monitoring/v3/uptime_pb.rb +0 -123
  100. data/lib/google/monitoring/v3/uptime_service_pb.rb +0 -63
  101. data/lib/google/monitoring/v3/uptime_service_services_pb.rb +0 -67
data/LICENSE DELETED
@@ -1,201 +0,0 @@
1
- Apache License
2
- Version 2.0, January 2004
3
- https://www.apache.org/licenses/
4
-
5
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
-
7
- 1. Definitions.
8
-
9
- "License" shall mean the terms and conditions for use, reproduction,
10
- and distribution as defined by Sections 1 through 9 of this document.
11
-
12
- "Licensor" shall mean the copyright owner or entity authorized by
13
- the copyright owner that is granting the License.
14
-
15
- "Legal Entity" shall mean the union of the acting entity and all
16
- other entities that control, are controlled by, or are under common
17
- control with that entity. For the purposes of this definition,
18
- "control" means (i) the power, direct or indirect, to cause the
19
- direction or management of such entity, whether by contract or
20
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
- outstanding shares, or (iii) beneficial ownership of such entity.
22
-
23
- "You" (or "Your") shall mean an individual or Legal Entity
24
- exercising permissions granted by this License.
25
-
26
- "Source" form shall mean the preferred form for making modifications,
27
- including but not limited to software source code, documentation
28
- source, and configuration files.
29
-
30
- "Object" form shall mean any form resulting from mechanical
31
- transformation or translation of a Source form, including but
32
- not limited to compiled object code, generated documentation,
33
- and conversions to other media types.
34
-
35
- "Work" shall mean the work of authorship, whether in Source or
36
- Object form, made available under the License, as indicated by a
37
- copyright notice that is included in or attached to the work
38
- (an example is provided in the Appendix below).
39
-
40
- "Derivative Works" shall mean any work, whether in Source or Object
41
- form, that is based on (or derived from) the Work and for which the
42
- editorial revisions, annotations, elaborations, or other modifications
43
- represent, as a whole, an original work of authorship. For the purposes
44
- of this License, Derivative Works shall not include works that remain
45
- separable from, or merely link (or bind by name) to the interfaces of,
46
- the Work and Derivative Works thereof.
47
-
48
- "Contribution" shall mean any work of authorship, including
49
- the original version of the Work and any modifications or additions
50
- to that Work or Derivative Works thereof, that is intentionally
51
- submitted to Licensor for inclusion in the Work by the copyright owner
52
- or by an individual or Legal Entity authorized to submit on behalf of
53
- the copyright owner. For the purposes of this definition, "submitted"
54
- means any form of electronic, verbal, or written communication sent
55
- to the Licensor or its representatives, including but not limited to
56
- communication on electronic mailing lists, source code control systems,
57
- and issue tracking systems that are managed by, or on behalf of, the
58
- Licensor for the purpose of discussing and improving the Work, but
59
- excluding communication that is conspicuously marked or otherwise
60
- designated in writing by the copyright owner as "Not a Contribution."
61
-
62
- "Contributor" shall mean Licensor and any individual or Legal Entity
63
- on behalf of whom a Contribution has been received by Licensor and
64
- subsequently incorporated within the Work.
65
-
66
- 2. Grant of Copyright License. Subject to the terms and conditions of
67
- this License, each Contributor hereby grants to You a perpetual,
68
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
- copyright license to reproduce, prepare Derivative Works of,
70
- publicly display, publicly perform, sublicense, and distribute the
71
- Work and such Derivative Works in Source or Object form.
72
-
73
- 3. Grant of Patent License. Subject to the terms and conditions of
74
- this License, each Contributor hereby grants to You a perpetual,
75
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
- (except as stated in this section) patent license to make, have made,
77
- use, offer to sell, sell, import, and otherwise transfer the Work,
78
- where such license applies only to those patent claims licensable
79
- by such Contributor that are necessarily infringed by their
80
- Contribution(s) alone or by combination of their Contribution(s)
81
- with the Work to which such Contribution(s) was submitted. If You
82
- institute patent litigation against any entity (including a
83
- cross-claim or counterclaim in a lawsuit) alleging that the Work
84
- or a Contribution incorporated within the Work constitutes direct
85
- or contributory patent infringement, then any patent licenses
86
- granted to You under this License for that Work shall terminate
87
- as of the date such litigation is filed.
88
-
89
- 4. Redistribution. You may reproduce and distribute copies of the
90
- Work or Derivative Works thereof in any medium, with or without
91
- modifications, and in Source or Object form, provided that You
92
- meet the following conditions:
93
-
94
- (a) You must give any other recipients of the Work or
95
- Derivative Works a copy of this License; and
96
-
97
- (b) You must cause any modified files to carry prominent notices
98
- stating that You changed the files; and
99
-
100
- (c) You must retain, in the Source form of any Derivative Works
101
- that You distribute, all copyright, patent, trademark, and
102
- attribution notices from the Source form of the Work,
103
- excluding those notices that do not pertain to any part of
104
- the Derivative Works; and
105
-
106
- (d) If the Work includes a "NOTICE" text file as part of its
107
- distribution, then any Derivative Works that You distribute must
108
- include a readable copy of the attribution notices contained
109
- within such NOTICE file, excluding those notices that do not
110
- pertain to any part of the Derivative Works, in at least one
111
- of the following places: within a NOTICE text file distributed
112
- as part of the Derivative Works; within the Source form or
113
- documentation, if provided along with the Derivative Works; or,
114
- within a display generated by the Derivative Works, if and
115
- wherever such third-party notices normally appear. The contents
116
- of the NOTICE file are for informational purposes only and
117
- do not modify the License. You may add Your own attribution
118
- notices within Derivative Works that You distribute, alongside
119
- or as an addendum to the NOTICE text from the Work, provided
120
- that such additional attribution notices cannot be construed
121
- as modifying the License.
122
-
123
- You may add Your own copyright statement to Your modifications and
124
- may provide additional or different license terms and conditions
125
- for use, reproduction, or distribution of Your modifications, or
126
- for any such Derivative Works as a whole, provided Your use,
127
- reproduction, and distribution of the Work otherwise complies with
128
- the conditions stated in this License.
129
-
130
- 5. Submission of Contributions. Unless You explicitly state otherwise,
131
- any Contribution intentionally submitted for inclusion in the Work
132
- by You to the Licensor shall be under the terms and conditions of
133
- this License, without any additional terms or conditions.
134
- Notwithstanding the above, nothing herein shall supersede or modify
135
- the terms of any separate license agreement you may have executed
136
- with Licensor regarding such Contributions.
137
-
138
- 6. Trademarks. This License does not grant permission to use the trade
139
- names, trademarks, service marks, or product names of the Licensor,
140
- except as required for reasonable and customary use in describing the
141
- origin of the Work and reproducing the content of the NOTICE file.
142
-
143
- 7. Disclaimer of Warranty. Unless required by applicable law or
144
- agreed to in writing, Licensor provides the Work (and each
145
- Contributor provides its Contributions) on an "AS IS" BASIS,
146
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
- implied, including, without limitation, any warranties or conditions
148
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
- PARTICULAR PURPOSE. You are solely responsible for determining the
150
- appropriateness of using or redistributing the Work and assume any
151
- risks associated with Your exercise of permissions under this License.
152
-
153
- 8. Limitation of Liability. In no event and under no legal theory,
154
- whether in tort (including negligence), contract, or otherwise,
155
- unless required by applicable law (such as deliberate and grossly
156
- negligent acts) or agreed to in writing, shall any Contributor be
157
- liable to You for damages, including any direct, indirect, special,
158
- incidental, or consequential damages of any character arising as a
159
- result of this License or out of the use or inability to use the
160
- Work (including but not limited to damages for loss of goodwill,
161
- work stoppage, computer failure or malfunction, or any and all
162
- other commercial damages or losses), even if such Contributor
163
- has been advised of the possibility of such damages.
164
-
165
- 9. Accepting Warranty or Additional Liability. While redistributing
166
- the Work or Derivative Works thereof, You may choose to offer,
167
- and charge a fee for, acceptance of support, warranty, indemnity,
168
- or other liability obligations and/or rights consistent with this
169
- License. However, in accepting such obligations, You may act only
170
- on Your own behalf and on Your sole responsibility, not on behalf
171
- of any other Contributor, and only if You agree to indemnify,
172
- defend, and hold each Contributor harmless for any liability
173
- incurred by, or claims asserted against, such Contributor by reason
174
- of your accepting any such warranty or additional liability.
175
-
176
- END OF TERMS AND CONDITIONS
177
-
178
- APPENDIX: How to apply the Apache License to your work.
179
-
180
- To apply the Apache License to your work, attach the following
181
- boilerplate notice, with the fields enclosed by brackets "[]"
182
- replaced with your own identifying information. (Don't include
183
- the brackets!) The text should be enclosed in the appropriate
184
- comment syntax for the file format. We also recommend that a
185
- file or class name and description of purpose be included on the
186
- same "printed page" as the copyright notice for easier
187
- identification within third-party archives.
188
-
189
- Copyright [yyyy] [name of copyright owner]
190
-
191
- Licensed under the Apache License, Version 2.0 (the "License");
192
- you may not use this file except in compliance with the License.
193
- You may obtain a copy of the License at
194
-
195
- https://www.apache.org/licenses/LICENSE-2.0
196
-
197
- Unless required by applicable law or agreed to in writing, software
198
- distributed under the License is distributed on an "AS IS" BASIS,
199
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
- See the License for the specific language governing permissions and
201
- limitations under the License.
@@ -1,148 +0,0 @@
1
- # Copyright 2020 Google LLC
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # https://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
-
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
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
@@ -1,46 +0,0 @@
1
- # Copyright 2020 Google LLC
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # https://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
-
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
@@ -1,457 +0,0 @@
1
- # Copyright 2020 Google LLC
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # https://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
- #
15
- # EDITING INSTRUCTIONS
16
- # This file was generated from the file
17
- # https://github.com/googleapis/googleapis/blob/master/google/monitoring/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
- if credentials.respond_to?(:quota_project_id) && credentials.quota_project_id
153
- headers[:"x-goog-user-project"] = credentials.quota_project_id
154
- end
155
- headers.merge!(metadata) unless metadata.nil?
156
- client_config_file = Pathname.new(__dir__).join(
157
- "dashboards_service_client_config.json"
158
- )
159
- defaults = client_config_file.open do |f|
160
- Google::Gax.construct_settings(
161
- "google.monitoring.dashboard.v1.DashboardsService",
162
- JSON.parse(f.read),
163
- client_config,
164
- Google::Gax::Grpc::STATUS_CODE_NAMES,
165
- timeout,
166
- page_descriptors: PAGE_DESCRIPTORS,
167
- errors: Google::Gax::Grpc::API_ERRORS,
168
- metadata: headers
169
- )
170
- end
171
-
172
- # Allow overriding the service path/port in subclasses.
173
- service_path = service_address || self.class::SERVICE_ADDRESS
174
- port = service_port || self.class::DEFAULT_SERVICE_PORT
175
- interceptors = self.class::GRPC_INTERCEPTORS
176
- @dashboards_service_stub = Google::Gax::Grpc.create_stub(
177
- service_path,
178
- port,
179
- chan_creds: chan_creds,
180
- channel: channel,
181
- updater_proc: updater_proc,
182
- scopes: scopes,
183
- interceptors: interceptors,
184
- &Google::Monitoring::Dashboard::V1::DashboardsService::Stub.method(:new)
185
- )
186
-
187
- @create_dashboard = Google::Gax.create_api_call(
188
- @dashboards_service_stub.method(:create_dashboard),
189
- defaults["create_dashboard"],
190
- exception_transformer: exception_transformer,
191
- params_extractor: proc do |request|
192
- {'parent' => request.parent}
193
- end
194
- )
195
- @list_dashboards = Google::Gax.create_api_call(
196
- @dashboards_service_stub.method(:list_dashboards),
197
- defaults["list_dashboards"],
198
- exception_transformer: exception_transformer,
199
- params_extractor: proc do |request|
200
- {'parent' => request.parent}
201
- end
202
- )
203
- @get_dashboard = Google::Gax.create_api_call(
204
- @dashboards_service_stub.method(:get_dashboard),
205
- defaults["get_dashboard"],
206
- exception_transformer: exception_transformer,
207
- params_extractor: proc do |request|
208
- {'name' => request.name}
209
- end
210
- )
211
- @delete_dashboard = Google::Gax.create_api_call(
212
- @dashboards_service_stub.method(:delete_dashboard),
213
- defaults["delete_dashboard"],
214
- exception_transformer: exception_transformer,
215
- params_extractor: proc do |request|
216
- {'name' => request.name}
217
- end
218
- )
219
- @update_dashboard = Google::Gax.create_api_call(
220
- @dashboards_service_stub.method(:update_dashboard),
221
- defaults["update_dashboard"],
222
- exception_transformer: exception_transformer,
223
- params_extractor: proc do |request|
224
- {'dashboard.name' => request.dashboard.name}
225
- end
226
- )
227
- end
228
-
229
- # Service calls
230
-
231
- # Creates a new custom dashboard.
232
- #
233
- # This method requires the `monitoring.dashboards.create` permission
234
- # on the specified project. For more information, see
235
- # [Google Cloud IAM](https://cloud.google.com/iam).
236
- #
237
- # @param parent [String]
238
- # Required. The project on which to execute the request. The format is
239
- # `"projects/{project_id_or_number}"`. The \\{project_id_or_number} must match
240
- # the dashboard resource name.
241
- # @param dashboard [Google::Monitoring::Dashboard::V1::Dashboard | Hash]
242
- # Required. The initial dashboard specification.
243
- # A hash of the same form as `Google::Monitoring::Dashboard::V1::Dashboard`
244
- # can also be provided.
245
- # @param options [Google::Gax::CallOptions]
246
- # Overrides the default settings for this call, e.g, timeout,
247
- # retries, etc.
248
- # @yield [result, operation] Access the result along with the RPC operation
249
- # @yieldparam result [Google::Monitoring::Dashboard::V1::Dashboard]
250
- # @yieldparam operation [GRPC::ActiveCall::Operation]
251
- # @return [Google::Monitoring::Dashboard::V1::Dashboard]
252
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
253
- # @example
254
- # require "google/cloud/monitoring/dashboard"
255
- #
256
- # dashboards_client = Google::Cloud::Monitoring::Dashboard.new(version: :v1)
257
- #
258
- # # TODO: Initialize `parent`:
259
- # parent = ''
260
- #
261
- # # TODO: Initialize `dashboard`:
262
- # dashboard = {}
263
- # response = dashboards_client.create_dashboard(parent, dashboard)
264
-
265
- def create_dashboard \
266
- parent,
267
- dashboard,
268
- options: nil,
269
- &block
270
- req = {
271
- parent: parent,
272
- dashboard: dashboard
273
- }.delete_if { |_, v| v.nil? }
274
- req = Google::Gax::to_proto(req, Google::Monitoring::Dashboard::V1::CreateDashboardRequest)
275
- @create_dashboard.call(req, options, &block)
276
- end
277
-
278
- # Lists the existing dashboards.
279
- #
280
- # This method requires the `monitoring.dashboards.list` permission
281
- # on the specified project. For more information, see
282
- # [Google Cloud IAM](https://cloud.google.com/iam).
283
- #
284
- # @param parent [String]
285
- # Required. The scope of the dashboards to list. A project scope must be
286
- # specified in the form of `"projects/{project_id_or_number}"`.
287
- # @param page_size [Integer]
288
- # The maximum number of resources contained in the underlying API
289
- # response. If page streaming is performed per-resource, this
290
- # parameter does not affect the return value. If page streaming is
291
- # performed per-page, this determines the maximum number of
292
- # resources in a page.
293
- # @param options [Google::Gax::CallOptions]
294
- # Overrides the default settings for this call, e.g, timeout,
295
- # retries, etc.
296
- # @yield [result, operation] Access the result along with the RPC operation
297
- # @yieldparam result [Google::Gax::PagedEnumerable<Google::Monitoring::Dashboard::V1::Dashboard>]
298
- # @yieldparam operation [GRPC::ActiveCall::Operation]
299
- # @return [Google::Gax::PagedEnumerable<Google::Monitoring::Dashboard::V1::Dashboard>]
300
- # An enumerable of Google::Monitoring::Dashboard::V1::Dashboard instances.
301
- # See Google::Gax::PagedEnumerable documentation for other
302
- # operations such as per-page iteration or access to the response
303
- # object.
304
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
305
- # @example
306
- # require "google/cloud/monitoring/dashboard"
307
- #
308
- # dashboards_client = Google::Cloud::Monitoring::Dashboard.new(version: :v1)
309
- #
310
- # # TODO: Initialize `parent`:
311
- # parent = ''
312
- #
313
- # # Iterate over all results.
314
- # dashboards_client.list_dashboards(parent).each do |element|
315
- # # Process element.
316
- # end
317
- #
318
- # # Or iterate over results one page at a time.
319
- # dashboards_client.list_dashboards(parent).each_page do |page|
320
- # # Process each page at a time.
321
- # page.each do |element|
322
- # # Process element.
323
- # end
324
- # end
325
-
326
- def list_dashboards \
327
- parent,
328
- page_size: nil,
329
- options: nil,
330
- &block
331
- req = {
332
- parent: parent,
333
- page_size: page_size
334
- }.delete_if { |_, v| v.nil? }
335
- req = Google::Gax::to_proto(req, Google::Monitoring::Dashboard::V1::ListDashboardsRequest)
336
- @list_dashboards.call(req, options, &block)
337
- end
338
-
339
- # Fetches a specific dashboard.
340
- #
341
- # This method requires the `monitoring.dashboards.get` permission
342
- # on the specified dashboard. For more information, see
343
- # [Google Cloud IAM](https://cloud.google.com/iam).
344
- #
345
- # @param name [String]
346
- # Required. The resource name of the Dashboard. The format is one of
347
- # `"dashboards/{dashboard_id}"` (for system dashboards) or
348
- # `"projects/{project_id_or_number}/dashboards/{dashboard_id}"`
349
- # (for custom dashboards).
350
- # @param options [Google::Gax::CallOptions]
351
- # Overrides the default settings for this call, e.g, timeout,
352
- # retries, etc.
353
- # @yield [result, operation] Access the result along with the RPC operation
354
- # @yieldparam result [Google::Monitoring::Dashboard::V1::Dashboard]
355
- # @yieldparam operation [GRPC::ActiveCall::Operation]
356
- # @return [Google::Monitoring::Dashboard::V1::Dashboard]
357
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
358
- # @example
359
- # require "google/cloud/monitoring/dashboard"
360
- #
361
- # dashboards_client = Google::Cloud::Monitoring::Dashboard.new(version: :v1)
362
- #
363
- # # TODO: Initialize `name`:
364
- # name = ''
365
- # response = dashboards_client.get_dashboard(name)
366
-
367
- def get_dashboard \
368
- name,
369
- options: nil,
370
- &block
371
- req = {
372
- name: name
373
- }.delete_if { |_, v| v.nil? }
374
- req = Google::Gax::to_proto(req, Google::Monitoring::Dashboard::V1::GetDashboardRequest)
375
- @get_dashboard.call(req, options, &block)
376
- end
377
-
378
- # Deletes an existing custom dashboard.
379
- #
380
- # This method requires the `monitoring.dashboards.delete` permission
381
- # on the specified dashboard. For more information, see
382
- # [Google Cloud IAM](https://cloud.google.com/iam).
383
- #
384
- # @param name [String]
385
- # Required. The resource name of the Dashboard. The format is
386
- # `"projects/{project_id_or_number}/dashboards/{dashboard_id}"`.
387
- # @param options [Google::Gax::CallOptions]
388
- # Overrides the default settings for this call, e.g, timeout,
389
- # retries, etc.
390
- # @yield [result, operation] Access the result along with the RPC operation
391
- # @yieldparam result []
392
- # @yieldparam operation [GRPC::ActiveCall::Operation]
393
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
394
- # @example
395
- # require "google/cloud/monitoring/dashboard"
396
- #
397
- # dashboards_client = Google::Cloud::Monitoring::Dashboard.new(version: :v1)
398
- #
399
- # # TODO: Initialize `name`:
400
- # name = ''
401
- # dashboards_client.delete_dashboard(name)
402
-
403
- def delete_dashboard \
404
- name,
405
- options: nil,
406
- &block
407
- req = {
408
- name: name
409
- }.delete_if { |_, v| v.nil? }
410
- req = Google::Gax::to_proto(req, Google::Monitoring::Dashboard::V1::DeleteDashboardRequest)
411
- @delete_dashboard.call(req, options, &block)
412
- nil
413
- end
414
-
415
- # Replaces an existing custom dashboard with a new definition.
416
- #
417
- # This method requires the `monitoring.dashboards.update` permission
418
- # on the specified dashboard. For more information, see
419
- # [Google Cloud IAM](https://cloud.google.com/iam).
420
- #
421
- # @param dashboard [Google::Monitoring::Dashboard::V1::Dashboard | Hash]
422
- # Required. The dashboard that will replace the existing dashboard.
423
- # A hash of the same form as `Google::Monitoring::Dashboard::V1::Dashboard`
424
- # can also be provided.
425
- # @param options [Google::Gax::CallOptions]
426
- # Overrides the default settings for this call, e.g, timeout,
427
- # retries, etc.
428
- # @yield [result, operation] Access the result along with the RPC operation
429
- # @yieldparam result [Google::Monitoring::Dashboard::V1::Dashboard]
430
- # @yieldparam operation [GRPC::ActiveCall::Operation]
431
- # @return [Google::Monitoring::Dashboard::V1::Dashboard]
432
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
433
- # @example
434
- # require "google/cloud/monitoring/dashboard"
435
- #
436
- # dashboards_client = Google::Cloud::Monitoring::Dashboard.new(version: :v1)
437
- #
438
- # # TODO: Initialize `dashboard`:
439
- # dashboard = {}
440
- # response = dashboards_client.update_dashboard(dashboard)
441
-
442
- def update_dashboard \
443
- dashboard,
444
- options: nil,
445
- &block
446
- req = {
447
- dashboard: dashboard
448
- }.delete_if { |_, v| v.nil? }
449
- req = Google::Gax::to_proto(req, Google::Monitoring::Dashboard::V1::UpdateDashboardRequest)
450
- @update_dashboard.call(req, options, &block)
451
- end
452
- end
453
- end
454
- end
455
- end
456
- end
457
- end