google-cloud-monitoring 0.21.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 +7 -0
- data/README.md +45 -0
- data/Rakefile +70 -0
- data/lib/google/cloud/monitoring/v3.rb +18 -0
- data/lib/google/cloud/monitoring/v3/group_service_api.rb +498 -0
- data/lib/google/cloud/monitoring/v3/group_service_client_config.json +58 -0
- data/lib/google/cloud/monitoring/v3/metric_service_api.rb +641 -0
- data/lib/google/cloud/monitoring/v3/metric_service_client_config.json +68 -0
- data/lib/google/monitoring/v3/common_pb.rb +75 -0
- data/lib/google/monitoring/v3/group_pb.rb +22 -0
- data/lib/google/monitoring/v3/group_service_pb.rb +68 -0
- data/lib/google/monitoring/v3/group_service_services_pb.rb +65 -0
- data/lib/google/monitoring/v3/metric_pb.rb +30 -0
- data/lib/google/monitoring/v3/metric_service_pb.rb +93 -0
- data/lib/google/monitoring/v3/metric_service_services_pb.rb +64 -0
- metadata +141 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 8adaf73e554892b212cd2e0479d37ceabd745d81
|
4
|
+
data.tar.gz: 187c5f778a7f754d43eb78f1fe33e4b4347c157c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: b37697ee21a77c9ad6a288951ac11f1cdb8c56d8206201df668bec89f8cec15596c5b4fa179215fe471ba87d10aeb1b207836ebbf7329a72b939c4918ca2075c
|
7
|
+
data.tar.gz: 058f3a40c0cab2d052635aa5548c0b036feeb6d3212f5be4e5fc79fc4b6f6c3dbe3ff472e6206dcf6d009967f3e69aed486fb221b7e3b54bd424c822a5efa5ee
|
data/README.md
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
Stackdriver Monitoring API for Ruby
|
2
|
+
=================================================
|
3
|
+
|
4
|
+
google-cloud-monitoring uses [Google API extensions][google-gax] to provide an
|
5
|
+
easy-to-use client library for the [Stackdriver Monitoring API][] (v3) defined in the [googleapis][] git repository
|
6
|
+
|
7
|
+
|
8
|
+
[googleapis]: https://github.com/googleapis/googleapis/tree/master/google/google/monitoring/v3
|
9
|
+
[google-gax]: https://github.com/googleapis/gax-ruby
|
10
|
+
[Stackdriver Monitoring API]: https://developers.google.com/apis-explorer/#p/monitoring/v3/
|
11
|
+
|
12
|
+
Getting started
|
13
|
+
---------------
|
14
|
+
|
15
|
+
google-cloud-monitoring will allow you to connect to the [Stackdriver Monitoring API][] and access all its methods.
|
16
|
+
|
17
|
+
In order to achieve so you need to set up authentication as well as install the library locally.
|
18
|
+
|
19
|
+
|
20
|
+
Setup Authentication
|
21
|
+
--------------------
|
22
|
+
|
23
|
+
To authenticate all your API calls, first install and setup the [Google Cloud SDK][].
|
24
|
+
Once done, you can then run the following command in your terminal:
|
25
|
+
|
26
|
+
$ gcloud beta auth application-default login
|
27
|
+
|
28
|
+
or
|
29
|
+
|
30
|
+
$ gcloud auth login
|
31
|
+
|
32
|
+
Please see [[gcloud beta auth application-default login][] document for the difference between these commands.
|
33
|
+
|
34
|
+
[Google Cloud SDK]: https://cloud.google.com/sdk/
|
35
|
+
[gcloud beta auth application-default login]: https://cloud.google.com/sdk/gcloud/reference/beta/auth/application-default/login
|
36
|
+
|
37
|
+
|
38
|
+
Installation
|
39
|
+
-------------------
|
40
|
+
|
41
|
+
Install this library using gem:
|
42
|
+
|
43
|
+
$ [sudo] gem install google-cloud-monitoring
|
44
|
+
|
45
|
+
At this point you are all set to continue.
|
data/Rakefile
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
# Copyright 2016 Google Inc. All rights reserved.
|
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
|
+
# http://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 "bundler/setup"
|
17
|
+
require "bundler/gem_tasks"
|
18
|
+
|
19
|
+
task :test do
|
20
|
+
end
|
21
|
+
|
22
|
+
task :rubocop do
|
23
|
+
end
|
24
|
+
|
25
|
+
namespace :test do
|
26
|
+
desc "Runs tests with coverage."
|
27
|
+
task :coverage do
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
# Acceptance tests
|
32
|
+
desc "Runs the monitoring acceptance tests."
|
33
|
+
task :acceptance, :project, :keyfile do |_, args|
|
34
|
+
end
|
35
|
+
|
36
|
+
namespace :acceptance do
|
37
|
+
desc "Runs acceptance tests with coverage."
|
38
|
+
task :coverage, :project, :keyfile do |t, args|
|
39
|
+
end
|
40
|
+
|
41
|
+
|
42
|
+
desc "Runs acceptance cleanup."
|
43
|
+
task :cleanup do
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
desc "Runs yard-doctest example tests."
|
48
|
+
task :doctest do
|
49
|
+
end
|
50
|
+
|
51
|
+
desc "Start an interactive shell."
|
52
|
+
task :console do
|
53
|
+
end
|
54
|
+
|
55
|
+
require "yard"
|
56
|
+
require "yard/rake/yardoc_task"
|
57
|
+
YARD::Rake::YardocTask.new
|
58
|
+
|
59
|
+
desc "Generates JSON output from google-cloud-monitoring .yardoc"
|
60
|
+
task :jsondoc => :yard do
|
61
|
+
require "rubygems"
|
62
|
+
require "gcloud/jsondoc"
|
63
|
+
|
64
|
+
registry = YARD::Registry.load! ".yardoc"
|
65
|
+
generator = Gcloud::Jsondoc::Generator.new registry, "google-cloud-monitoring"
|
66
|
+
generator.write_to "jsondoc"
|
67
|
+
cp ["docs/toc.json"], "jsondoc", verbose: true
|
68
|
+
end
|
69
|
+
|
70
|
+
task :default => :test
|
@@ -0,0 +1,18 @@
|
|
1
|
+
|
2
|
+
# Copyright 2016 Google Inc. All rights reserved.
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
|
16
|
+
|
17
|
+
require "google/cloud/monitoring/v3/group_service_api"
|
18
|
+
require "google/cloud/monitoring/v3/metric_service_api"
|
@@ -0,0 +1,498 @@
|
|
1
|
+
# Copyright 2016 Google Inc. All rights reserved.
|
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
|
+
# http://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/v3/group_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
|
+
# The only allowed edits are to method and file documentation. A 3-way
|
23
|
+
# merge preserves those additions if the generated source changes.
|
24
|
+
|
25
|
+
require "json"
|
26
|
+
require "pathname"
|
27
|
+
|
28
|
+
require "google/gax"
|
29
|
+
require "google/monitoring/v3/group_service_pb"
|
30
|
+
|
31
|
+
module Google
|
32
|
+
module Cloud
|
33
|
+
module Monitoring
|
34
|
+
module V3
|
35
|
+
# The Group API lets you inspect and manage your
|
36
|
+
# {groups}[https://cloud.google.comgoogle.monitoring.v3.Group].
|
37
|
+
#
|
38
|
+
# A group is a named filter that is used to identify
|
39
|
+
# a collection of monitored resources. Groups are typically used to
|
40
|
+
# mirror the physical and/or logical topology of the environment.
|
41
|
+
# Because group membership is computed dynamically, monitored
|
42
|
+
# resources that are started in the future are automatically placed
|
43
|
+
# in matching groups. By using a group to name monitored resources in,
|
44
|
+
# for example, an alert policy, the target of that alert policy is
|
45
|
+
# updated automatically as monitored resources are added and removed
|
46
|
+
# from the infrastructure.
|
47
|
+
#
|
48
|
+
# @!attribute [r] group_service_stub
|
49
|
+
# @return [Google::Monitoring::V3::GroupService::Stub]
|
50
|
+
class GroupServiceApi
|
51
|
+
attr_reader :group_service_stub
|
52
|
+
|
53
|
+
# The default address of the service.
|
54
|
+
SERVICE_ADDRESS = "monitoring.googleapis.com".freeze
|
55
|
+
|
56
|
+
# The default port of the service.
|
57
|
+
DEFAULT_SERVICE_PORT = 443
|
58
|
+
|
59
|
+
CODE_GEN_NAME_VERSION = "gapic/0.1.0".freeze
|
60
|
+
|
61
|
+
DEFAULT_TIMEOUT = 30
|
62
|
+
|
63
|
+
PAGE_DESCRIPTORS = {
|
64
|
+
"list_groups" => Google::Gax::PageDescriptor.new(
|
65
|
+
"page_token",
|
66
|
+
"next_page_token",
|
67
|
+
"group"),
|
68
|
+
"list_group_members" => Google::Gax::PageDescriptor.new(
|
69
|
+
"page_token",
|
70
|
+
"next_page_token",
|
71
|
+
"members")
|
72
|
+
}.freeze
|
73
|
+
|
74
|
+
private_constant :PAGE_DESCRIPTORS
|
75
|
+
|
76
|
+
# The scopes needed to make gRPC calls to all of the methods defined in
|
77
|
+
# this service.
|
78
|
+
ALL_SCOPES = [
|
79
|
+
].freeze
|
80
|
+
|
81
|
+
PROJECT_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
|
82
|
+
"projects/{project}"
|
83
|
+
)
|
84
|
+
|
85
|
+
private_constant :PROJECT_PATH_TEMPLATE
|
86
|
+
|
87
|
+
GROUP_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
|
88
|
+
"projects/{project}/groups/{group}"
|
89
|
+
)
|
90
|
+
|
91
|
+
private_constant :GROUP_PATH_TEMPLATE
|
92
|
+
|
93
|
+
# Returns a fully-qualified project resource name string.
|
94
|
+
# @param project [String]
|
95
|
+
# @return [String]
|
96
|
+
def self.project_path project
|
97
|
+
PROJECT_PATH_TEMPLATE.render(
|
98
|
+
:"project" => project
|
99
|
+
)
|
100
|
+
end
|
101
|
+
|
102
|
+
# Returns a fully-qualified group resource name string.
|
103
|
+
# @param project [String]
|
104
|
+
# @param group [String]
|
105
|
+
# @return [String]
|
106
|
+
def self.group_path project, group
|
107
|
+
GROUP_PATH_TEMPLATE.render(
|
108
|
+
:"project" => project,
|
109
|
+
:"group" => group
|
110
|
+
)
|
111
|
+
end
|
112
|
+
|
113
|
+
# Parses the project from a project resource.
|
114
|
+
# @param project_name [String]
|
115
|
+
# @return [String]
|
116
|
+
def self.match_project_from_project_name project_name
|
117
|
+
PROJECT_PATH_TEMPLATE.match(project_name)["project"]
|
118
|
+
end
|
119
|
+
|
120
|
+
# Parses the project from a group resource.
|
121
|
+
# @param group_name [String]
|
122
|
+
# @return [String]
|
123
|
+
def self.match_project_from_group_name group_name
|
124
|
+
GROUP_PATH_TEMPLATE.match(group_name)["project"]
|
125
|
+
end
|
126
|
+
|
127
|
+
# Parses the group from a group resource.
|
128
|
+
# @param group_name [String]
|
129
|
+
# @return [String]
|
130
|
+
def self.match_group_from_group_name group_name
|
131
|
+
GROUP_PATH_TEMPLATE.match(group_name)["group"]
|
132
|
+
end
|
133
|
+
|
134
|
+
# @param service_path [String]
|
135
|
+
# The domain name of the API remote host.
|
136
|
+
# @param port [Integer]
|
137
|
+
# The port on which to connect to the remote host.
|
138
|
+
# @param channel [Channel]
|
139
|
+
# A Channel object through which to make calls.
|
140
|
+
# @param chan_creds [Grpc::ChannelCredentials]
|
141
|
+
# A ChannelCredentials for the setting up the RPC client.
|
142
|
+
# @param client_config[Hash]
|
143
|
+
# A Hash for call options for each method. See
|
144
|
+
# Google::Gax#construct_settings for the structure of
|
145
|
+
# this data. Falls back to the default config if not specified
|
146
|
+
# or the specified config is missing data points.
|
147
|
+
# @param timeout [Numeric]
|
148
|
+
# The default timeout, in seconds, for calls made through this client.
|
149
|
+
# @param app_name [String]
|
150
|
+
# The codename of the calling service.
|
151
|
+
# @param app_version [String]
|
152
|
+
# The version of the calling service.
|
153
|
+
def initialize \
|
154
|
+
service_path: SERVICE_ADDRESS,
|
155
|
+
port: DEFAULT_SERVICE_PORT,
|
156
|
+
channel: nil,
|
157
|
+
chan_creds: nil,
|
158
|
+
scopes: ALL_SCOPES,
|
159
|
+
client_config: {},
|
160
|
+
timeout: DEFAULT_TIMEOUT,
|
161
|
+
app_name: "gax",
|
162
|
+
app_version: Google::Gax::VERSION
|
163
|
+
# These require statements are intentionally placed here to initialize
|
164
|
+
# the gRPC module only when it's required.
|
165
|
+
# See https://github.com/googleapis/toolkit/issues/446
|
166
|
+
require "google/gax/grpc"
|
167
|
+
require "google/monitoring/v3/group_service_services_pb"
|
168
|
+
|
169
|
+
google_api_client = "#{app_name}/#{app_version} " \
|
170
|
+
"#{CODE_GEN_NAME_VERSION} gax/#{Google::Gax::VERSION} " \
|
171
|
+
"ruby/#{RUBY_VERSION}".freeze
|
172
|
+
headers = { :"x-goog-api-client" => google_api_client }
|
173
|
+
client_config_file = Pathname.new(__dir__).join(
|
174
|
+
"group_service_client_config.json"
|
175
|
+
)
|
176
|
+
defaults = client_config_file.open do |f|
|
177
|
+
Google::Gax.construct_settings(
|
178
|
+
"google.monitoring.v3.GroupService",
|
179
|
+
JSON.parse(f.read),
|
180
|
+
client_config,
|
181
|
+
Google::Gax::Grpc::STATUS_CODE_NAMES,
|
182
|
+
timeout,
|
183
|
+
page_descriptors: PAGE_DESCRIPTORS,
|
184
|
+
errors: Google::Gax::Grpc::API_ERRORS,
|
185
|
+
kwargs: headers
|
186
|
+
)
|
187
|
+
end
|
188
|
+
@group_service_stub = Google::Gax::Grpc.create_stub(
|
189
|
+
service_path,
|
190
|
+
port,
|
191
|
+
chan_creds: chan_creds,
|
192
|
+
channel: channel,
|
193
|
+
scopes: scopes,
|
194
|
+
&Google::Monitoring::V3::GroupService::Stub.method(:new)
|
195
|
+
)
|
196
|
+
|
197
|
+
@list_groups = Google::Gax.create_api_call(
|
198
|
+
@group_service_stub.method(:list_groups),
|
199
|
+
defaults["list_groups"]
|
200
|
+
)
|
201
|
+
@get_group = Google::Gax.create_api_call(
|
202
|
+
@group_service_stub.method(:get_group),
|
203
|
+
defaults["get_group"]
|
204
|
+
)
|
205
|
+
@create_group = Google::Gax.create_api_call(
|
206
|
+
@group_service_stub.method(:create_group),
|
207
|
+
defaults["create_group"]
|
208
|
+
)
|
209
|
+
@update_group = Google::Gax.create_api_call(
|
210
|
+
@group_service_stub.method(:update_group),
|
211
|
+
defaults["update_group"]
|
212
|
+
)
|
213
|
+
@delete_group = Google::Gax.create_api_call(
|
214
|
+
@group_service_stub.method(:delete_group),
|
215
|
+
defaults["delete_group"]
|
216
|
+
)
|
217
|
+
@list_group_members = Google::Gax.create_api_call(
|
218
|
+
@group_service_stub.method(:list_group_members),
|
219
|
+
defaults["list_group_members"]
|
220
|
+
)
|
221
|
+
end
|
222
|
+
|
223
|
+
# Service calls
|
224
|
+
|
225
|
+
# Lists the existing groups.
|
226
|
+
#
|
227
|
+
# @param name [String]
|
228
|
+
# The project whose groups are to be listed. The format is
|
229
|
+
# +"projects/{project_id_or_number}"+.
|
230
|
+
# @param children_of_group [String]
|
231
|
+
# A group name: +"projects/{project_id_or_number}/groups/{group_id}"+.
|
232
|
+
# Returns groups whose +parentName+ field contains the group
|
233
|
+
# name. If no groups have this parent, the results are empty.
|
234
|
+
# @param ancestors_of_group [String]
|
235
|
+
# A group name: +"projects/{project_id_or_number}/groups/{group_id}"+.
|
236
|
+
# Returns groups that are ancestors of the specified group.
|
237
|
+
# The groups are returned in order, starting with the immediate parent and
|
238
|
+
# ending with the most distant ancestor. If the specified group has no
|
239
|
+
# immediate parent, the results are empty.
|
240
|
+
# @param descendants_of_group [String]
|
241
|
+
# A group name: +"projects/{project_id_or_number}/groups/{group_id}"+.
|
242
|
+
# Returns the descendants of the specified group. This is a superset of
|
243
|
+
# the results returned by the +childrenOfGroup+ filter, and includes
|
244
|
+
# children-of-children, and so forth.
|
245
|
+
# @param page_size [Integer]
|
246
|
+
# The maximum number of resources contained in the underlying API
|
247
|
+
# response. If page streaming is performed per-resource, this
|
248
|
+
# parameter does not affect the return value. If page streaming is
|
249
|
+
# performed per-page, this determines the maximum number of
|
250
|
+
# resources in a page.
|
251
|
+
# @param options [Google::Gax::CallOptions]
|
252
|
+
# Overrides the default settings for this call, e.g, timeout,
|
253
|
+
# retries, etc.
|
254
|
+
# @return [Google::Gax::PagedEnumerable<Google::Monitoring::V3::Group>]
|
255
|
+
# An enumerable of Google::Monitoring::V3::Group instances.
|
256
|
+
# See Google::Gax::PagedEnumerable documentation for other
|
257
|
+
# operations such as per-page iteration or access to the response
|
258
|
+
# object.
|
259
|
+
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
260
|
+
# @example
|
261
|
+
# require "google/cloud/monitoring/v3/group_service_api"
|
262
|
+
#
|
263
|
+
# GroupServiceApi = Google::Cloud::Monitoring::V3::GroupServiceApi
|
264
|
+
#
|
265
|
+
# group_service_api = GroupServiceApi.new
|
266
|
+
# formatted_name = GroupServiceApi.project_path("[PROJECT]")
|
267
|
+
#
|
268
|
+
# # Iterate over all results.
|
269
|
+
# group_service_api.list_groups(formatted_name).each do |element|
|
270
|
+
# # Process element.
|
271
|
+
# end
|
272
|
+
#
|
273
|
+
# # Or iterate over results one page at a time.
|
274
|
+
# group_service_api.list_groups(formatted_name).each_page do |page|
|
275
|
+
# # Process each page at a time.
|
276
|
+
# page.each do |element|
|
277
|
+
# # Process element.
|
278
|
+
# end
|
279
|
+
# end
|
280
|
+
|
281
|
+
def list_groups \
|
282
|
+
name,
|
283
|
+
children_of_group: nil,
|
284
|
+
ancestors_of_group: nil,
|
285
|
+
descendants_of_group: nil,
|
286
|
+
page_size: nil,
|
287
|
+
options: nil
|
288
|
+
req = Google::Monitoring::V3::ListGroupsRequest.new(
|
289
|
+
name: name
|
290
|
+
)
|
291
|
+
req.children_of_group = children_of_group unless children_of_group.nil?
|
292
|
+
req.ancestors_of_group = ancestors_of_group unless ancestors_of_group.nil?
|
293
|
+
req.descendants_of_group = descendants_of_group unless descendants_of_group.nil?
|
294
|
+
req.page_size = page_size unless page_size.nil?
|
295
|
+
@list_groups.call(req, options)
|
296
|
+
end
|
297
|
+
|
298
|
+
# Gets a single group.
|
299
|
+
#
|
300
|
+
# @param name [String]
|
301
|
+
# The group to retrieve. The format is
|
302
|
+
# +"projects/{project_id_or_number}/groups/{group_id}"+.
|
303
|
+
# @param options [Google::Gax::CallOptions]
|
304
|
+
# Overrides the default settings for this call, e.g, timeout,
|
305
|
+
# retries, etc.
|
306
|
+
# @return [Google::Monitoring::V3::Group]
|
307
|
+
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
308
|
+
# @example
|
309
|
+
# require "google/cloud/monitoring/v3/group_service_api"
|
310
|
+
#
|
311
|
+
# GroupServiceApi = Google::Cloud::Monitoring::V3::GroupServiceApi
|
312
|
+
#
|
313
|
+
# group_service_api = GroupServiceApi.new
|
314
|
+
# formatted_name = GroupServiceApi.group_path("[PROJECT]", "[GROUP]")
|
315
|
+
# response = group_service_api.get_group(formatted_name)
|
316
|
+
|
317
|
+
def get_group \
|
318
|
+
name,
|
319
|
+
options: nil
|
320
|
+
req = Google::Monitoring::V3::GetGroupRequest.new(
|
321
|
+
name: name
|
322
|
+
)
|
323
|
+
@get_group.call(req, options)
|
324
|
+
end
|
325
|
+
|
326
|
+
# Creates a new group.
|
327
|
+
#
|
328
|
+
# @param name [String]
|
329
|
+
# The project in which to create the group. The format is
|
330
|
+
# +"projects/{project_id_or_number}"+.
|
331
|
+
# @param group [Google::Monitoring::V3::Group]
|
332
|
+
# A group definition. It is an error to define the +name+ field because
|
333
|
+
# the system assigns the name.
|
334
|
+
# @param validate_only [true, false]
|
335
|
+
# If true, validate this request but do not create the group.
|
336
|
+
# @param options [Google::Gax::CallOptions]
|
337
|
+
# Overrides the default settings for this call, e.g, timeout,
|
338
|
+
# retries, etc.
|
339
|
+
# @return [Google::Monitoring::V3::Group]
|
340
|
+
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
341
|
+
# @example
|
342
|
+
# require "google/cloud/monitoring/v3/group_service_api"
|
343
|
+
#
|
344
|
+
# Group = Google::Monitoring::V3::Group
|
345
|
+
# GroupServiceApi = Google::Cloud::Monitoring::V3::GroupServiceApi
|
346
|
+
#
|
347
|
+
# group_service_api = GroupServiceApi.new
|
348
|
+
# formatted_name = GroupServiceApi.project_path("[PROJECT]")
|
349
|
+
# group = Group.new
|
350
|
+
# response = group_service_api.create_group(formatted_name, group)
|
351
|
+
|
352
|
+
def create_group \
|
353
|
+
name,
|
354
|
+
group,
|
355
|
+
validate_only: nil,
|
356
|
+
options: nil
|
357
|
+
req = Google::Monitoring::V3::CreateGroupRequest.new(
|
358
|
+
name: name,
|
359
|
+
group: group
|
360
|
+
)
|
361
|
+
req.validate_only = validate_only unless validate_only.nil?
|
362
|
+
@create_group.call(req, options)
|
363
|
+
end
|
364
|
+
|
365
|
+
# Updates an existing group.
|
366
|
+
# You can change any group attributes except +name+.
|
367
|
+
#
|
368
|
+
# @param group [Google::Monitoring::V3::Group]
|
369
|
+
# The new definition of the group. All fields of the existing group,
|
370
|
+
# excepting +name+, are replaced with the corresponding fields of this group.
|
371
|
+
# @param validate_only [true, false]
|
372
|
+
# If true, validate this request but do not update the existing group.
|
373
|
+
# @param options [Google::Gax::CallOptions]
|
374
|
+
# Overrides the default settings for this call, e.g, timeout,
|
375
|
+
# retries, etc.
|
376
|
+
# @return [Google::Monitoring::V3::Group]
|
377
|
+
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
378
|
+
# @example
|
379
|
+
# require "google/cloud/monitoring/v3/group_service_api"
|
380
|
+
#
|
381
|
+
# Group = Google::Monitoring::V3::Group
|
382
|
+
# GroupServiceApi = Google::Cloud::Monitoring::V3::GroupServiceApi
|
383
|
+
#
|
384
|
+
# group_service_api = GroupServiceApi.new
|
385
|
+
# group = Group.new
|
386
|
+
# response = group_service_api.update_group(group)
|
387
|
+
|
388
|
+
def update_group \
|
389
|
+
group,
|
390
|
+
validate_only: nil,
|
391
|
+
options: nil
|
392
|
+
req = Google::Monitoring::V3::UpdateGroupRequest.new(
|
393
|
+
group: group
|
394
|
+
)
|
395
|
+
req.validate_only = validate_only unless validate_only.nil?
|
396
|
+
@update_group.call(req, options)
|
397
|
+
end
|
398
|
+
|
399
|
+
# Deletes an existing group.
|
400
|
+
#
|
401
|
+
# @param name [String]
|
402
|
+
# The group to delete. The format is
|
403
|
+
# +"projects/{project_id_or_number}/groups/{group_id}"+.
|
404
|
+
# @param options [Google::Gax::CallOptions]
|
405
|
+
# Overrides the default settings for this call, e.g, timeout,
|
406
|
+
# retries, etc.
|
407
|
+
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
408
|
+
# @example
|
409
|
+
# require "google/cloud/monitoring/v3/group_service_api"
|
410
|
+
#
|
411
|
+
# GroupServiceApi = Google::Cloud::Monitoring::V3::GroupServiceApi
|
412
|
+
#
|
413
|
+
# group_service_api = GroupServiceApi.new
|
414
|
+
# formatted_name = GroupServiceApi.group_path("[PROJECT]", "[GROUP]")
|
415
|
+
# group_service_api.delete_group(formatted_name)
|
416
|
+
|
417
|
+
def delete_group \
|
418
|
+
name,
|
419
|
+
options: nil
|
420
|
+
req = Google::Monitoring::V3::DeleteGroupRequest.new(
|
421
|
+
name: name
|
422
|
+
)
|
423
|
+
@delete_group.call(req, options)
|
424
|
+
end
|
425
|
+
|
426
|
+
# Lists the monitored resources that are members of a group.
|
427
|
+
#
|
428
|
+
# @param name [String]
|
429
|
+
# The group whose members are listed. The format is
|
430
|
+
# +"projects/{project_id_or_number}/groups/{group_id}"+.
|
431
|
+
# @param page_size [Integer]
|
432
|
+
# The maximum number of resources contained in the underlying API
|
433
|
+
# response. If page streaming is performed per-resource, this
|
434
|
+
# parameter does not affect the return value. If page streaming is
|
435
|
+
# performed per-page, this determines the maximum number of
|
436
|
+
# resources in a page.
|
437
|
+
# @param filter [String]
|
438
|
+
# An optional {list filter}[https://cloud.google.com/monitoring/api/learn_more#filtering] describing
|
439
|
+
# the members to be returned. The filter may reference the type, labels, and
|
440
|
+
# metadata of monitored resources that comprise the group.
|
441
|
+
# For example, to return only resources representing Compute Engine VM
|
442
|
+
# instances, use this filter:
|
443
|
+
#
|
444
|
+
# resource.type = "gce_instance"
|
445
|
+
# @param interval [Google::Monitoring::V3::TimeInterval]
|
446
|
+
# An optional time interval for which results should be returned. Only
|
447
|
+
# members that were part of the group during the specified interval are
|
448
|
+
# included in the response. If no interval is provided then the group
|
449
|
+
# membership over the last minute is returned.
|
450
|
+
# @param options [Google::Gax::CallOptions]
|
451
|
+
# Overrides the default settings for this call, e.g, timeout,
|
452
|
+
# retries, etc.
|
453
|
+
# @return [Google::Gax::PagedEnumerable<Google::Api::MonitoredResource>]
|
454
|
+
# An enumerable of Google::Api::MonitoredResource instances.
|
455
|
+
# See Google::Gax::PagedEnumerable documentation for other
|
456
|
+
# operations such as per-page iteration or access to the response
|
457
|
+
# object.
|
458
|
+
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
459
|
+
# @example
|
460
|
+
# require "google/cloud/monitoring/v3/group_service_api"
|
461
|
+
#
|
462
|
+
# GroupServiceApi = Google::Cloud::Monitoring::V3::GroupServiceApi
|
463
|
+
#
|
464
|
+
# group_service_api = GroupServiceApi.new
|
465
|
+
# formatted_name = GroupServiceApi.group_path("[PROJECT]", "[GROUP]")
|
466
|
+
#
|
467
|
+
# # Iterate over all results.
|
468
|
+
# group_service_api.list_group_members(formatted_name).each do |element|
|
469
|
+
# # Process element.
|
470
|
+
# end
|
471
|
+
#
|
472
|
+
# # Or iterate over results one page at a time.
|
473
|
+
# group_service_api.list_group_members(formatted_name).each_page do |page|
|
474
|
+
# # Process each page at a time.
|
475
|
+
# page.each do |element|
|
476
|
+
# # Process element.
|
477
|
+
# end
|
478
|
+
# end
|
479
|
+
|
480
|
+
def list_group_members \
|
481
|
+
name,
|
482
|
+
page_size: nil,
|
483
|
+
filter: nil,
|
484
|
+
interval: nil,
|
485
|
+
options: nil
|
486
|
+
req = Google::Monitoring::V3::ListGroupMembersRequest.new(
|
487
|
+
name: name
|
488
|
+
)
|
489
|
+
req.page_size = page_size unless page_size.nil?
|
490
|
+
req.filter = filter unless filter.nil?
|
491
|
+
req.interval = interval unless interval.nil?
|
492
|
+
@list_group_members.call(req, options)
|
493
|
+
end
|
494
|
+
end
|
495
|
+
end
|
496
|
+
end
|
497
|
+
end
|
498
|
+
end
|