google-cloud-monitoring 0.21.0 → 0.22.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardopts +8 -0
- data/LICENSE +201 -0
- data/README.md +2 -2
- data/lib/google-cloud-monitoring.rb +24 -0
- data/lib/google/cloud/monitoring/v3.rb +2 -2
- data/lib/google/cloud/monitoring/v3/doc/google/api/distribution.rb +172 -0
- data/lib/google/cloud/monitoring/v3/doc/google/api/label.rb +41 -0
- data/lib/google/cloud/monitoring/v3/doc/google/api/metric.rb +187 -0
- data/lib/google/cloud/monitoring/v3/doc/google/api/monitored_resource.rb +81 -0
- data/lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/common.rb +322 -0
- data/lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/group.rb +69 -0
- data/lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/metric.rb +78 -0
- data/lib/google/cloud/monitoring/v3/doc/google/protobuf/duration.rb +71 -0
- data/lib/google/cloud/monitoring/v3/doc/google/protobuf/timestamp.rb +83 -0
- data/lib/google/cloud/monitoring/v3/{group_service_api.rb → group_service_client.rb} +63 -57
- data/lib/google/cloud/monitoring/v3/{metric_service_api.rb → metric_service_client.rb} +77 -70
- metadata +37 -39
- data/Rakefile +0 -70
@@ -0,0 +1,69 @@
|
|
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
|
+
module Google
|
16
|
+
module Monitoring
|
17
|
+
module V3
|
18
|
+
# The description of a dynamic collection of monitored resources. Each group
|
19
|
+
# has a filter that is matched against monitored resources and their associated
|
20
|
+
# metadata. If a group's filter matches an available monitored resource, then
|
21
|
+
# that resource is a member of that group. Groups can contain any number of
|
22
|
+
# monitored resources, and each monitored resource can be a member of any
|
23
|
+
# number of groups.
|
24
|
+
#
|
25
|
+
# Groups can be nested in parent-child hierarchies. The +parentName+ field
|
26
|
+
# identifies an optional parent for each group. If a group has a parent, then
|
27
|
+
# the only monitored resources available to be matched by the group's filter
|
28
|
+
# are the resources contained in the parent group. In other words, a group
|
29
|
+
# contains the monitored resources that match its filter and the filters of all
|
30
|
+
# the group's ancestors. A group without a parent can contain any monitored
|
31
|
+
# resource.
|
32
|
+
#
|
33
|
+
# For example, consider an infrastructure running a set of instances with two
|
34
|
+
# user-defined tags: +"environment"+ and +"role"+. A parent group has a filter,
|
35
|
+
# +environment="production"+. A child of that parent group has a filter,
|
36
|
+
# +role="transcoder"+. The parent group contains all instances in the
|
37
|
+
# production environment, regardless of their roles. The child group contains
|
38
|
+
# instances that have the transcoder role *and* are in the production
|
39
|
+
# environment.
|
40
|
+
#
|
41
|
+
# The monitored resources contained in a group can change at any moment,
|
42
|
+
# depending on what resources exist and what filters are associated with the
|
43
|
+
# group and its ancestors.
|
44
|
+
# @!attribute [rw] name
|
45
|
+
# @return [String]
|
46
|
+
# Output only. The name of this group. The format is
|
47
|
+
# +"projects/{project_id_or_number}/groups/{group_id}"+.
|
48
|
+
# When creating a group, this field is ignored and a new name is created
|
49
|
+
# consisting of the project specified in the call to +CreateGroup+
|
50
|
+
# and a unique +{group_id}+ that is generated automatically.
|
51
|
+
# @!attribute [rw] display_name
|
52
|
+
# @return [String]
|
53
|
+
# A user-assigned name for this group, used only for display purposes.
|
54
|
+
# @!attribute [rw] parent_name
|
55
|
+
# @return [String]
|
56
|
+
# The name of the group's parent, if it has one.
|
57
|
+
# The format is +"projects/{project_id_or_number}/groups/{group_id}"+.
|
58
|
+
# For groups with no parent, +parentName+ is the empty string, +""+.
|
59
|
+
# @!attribute [rw] filter
|
60
|
+
# @return [String]
|
61
|
+
# The filter used to determine which monitored resources belong to this group.
|
62
|
+
# @!attribute [rw] is_cluster
|
63
|
+
# @return [true, false]
|
64
|
+
# If true, the members of this group are considered to be a cluster.
|
65
|
+
# The system can perform additional analysis on groups that are clusters.
|
66
|
+
class Group; end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
@@ -0,0 +1,78 @@
|
|
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
|
+
module Google
|
16
|
+
module Monitoring
|
17
|
+
module V3
|
18
|
+
# A single data point in a time series.
|
19
|
+
# @!attribute [rw] interval
|
20
|
+
# @return [Google::Monitoring::V3::TimeInterval]
|
21
|
+
# The time interval to which the data point applies. For GAUGE metrics, only
|
22
|
+
# the end time of the interval is used. For DELTA metrics, the start and end
|
23
|
+
# time should specify a non-zero interval, with subsequent points specifying
|
24
|
+
# contiguous and non-overlapping intervals. For CUMULATIVE metrics, the
|
25
|
+
# start and end time should specify a non-zero interval, with subsequent
|
26
|
+
# points specifying the same start time and increasing end times, until an
|
27
|
+
# event resets the cumulative value to zero and sets a new start time for the
|
28
|
+
# following points.
|
29
|
+
# @!attribute [rw] value
|
30
|
+
# @return [Google::Monitoring::V3::TypedValue]
|
31
|
+
# The value of the data point.
|
32
|
+
class Point; end
|
33
|
+
|
34
|
+
# A collection of data points that describes the time-varying values
|
35
|
+
# of a metric. A time series is identified by a combination of a
|
36
|
+
# fully-specified monitored resource and a fully-specified metric.
|
37
|
+
# This type is used for both listing and creating time series.
|
38
|
+
# @!attribute [rw] metric
|
39
|
+
# @return [Google::Api::Metric]
|
40
|
+
# The associated metric. A fully-specified metric used to identify the time
|
41
|
+
# series.
|
42
|
+
# @!attribute [rw] resource
|
43
|
+
# @return [Google::Api::MonitoredResource]
|
44
|
+
# The associated resource. A fully-specified monitored resource used to
|
45
|
+
# identify the time series.
|
46
|
+
# @!attribute [rw] metric_kind
|
47
|
+
# @return [Google::Api::MetricDescriptor::MetricKind]
|
48
|
+
# The metric kind of the time series. When listing time series, this metric
|
49
|
+
# kind might be different from the metric kind of the associated metric if
|
50
|
+
# this time series is an alignment or reduction of other time series.
|
51
|
+
#
|
52
|
+
# When creating a time series, this field is optional. If present, it must be
|
53
|
+
# the same as the metric kind of the associated metric. If the associated
|
54
|
+
# metric's descriptor must be auto-created, then this field specifies the
|
55
|
+
# metric kind of the new descriptor and must be either +GAUGE+ (the default)
|
56
|
+
# or +CUMULATIVE+.
|
57
|
+
# @!attribute [rw] value_type
|
58
|
+
# @return [Google::Api::MetricDescriptor::ValueType]
|
59
|
+
# The value type of the time series. When listing time series, this value
|
60
|
+
# type might be different from the value type of the associated metric if
|
61
|
+
# this time series is an alignment or reduction of other time series.
|
62
|
+
#
|
63
|
+
# When creating a time series, this field is optional. If present, it must be
|
64
|
+
# the same as the type of the data in the +points+ field.
|
65
|
+
# @!attribute [rw] points
|
66
|
+
# @return [Array<Google::Monitoring::V3::Point>]
|
67
|
+
# The data points of this time series. When listing time series, the order of
|
68
|
+
# the points is specified by the list method.
|
69
|
+
#
|
70
|
+
# When creating a time series, this field must contain exactly one point and
|
71
|
+
# the point's type must be the same as the value type of the associated
|
72
|
+
# metric. If the associated metric's descriptor must be auto-created, then
|
73
|
+
# the value type of the descriptor is determined by the point's type, which
|
74
|
+
# must be +BOOL+, +INT64+, +DOUBLE+, or +DISTRIBUTION+.
|
75
|
+
class TimeSeries; end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
@@ -0,0 +1,71 @@
|
|
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
|
+
module Google
|
16
|
+
module Protobuf
|
17
|
+
# A Duration represents a signed, fixed-length span of time represented
|
18
|
+
# as a count of seconds and fractions of seconds at nanosecond
|
19
|
+
# resolution. It is independent of any calendar and concepts like "day"
|
20
|
+
# or "month". It is related to Timestamp in that the difference between
|
21
|
+
# two Timestamp values is a Duration and it can be added or subtracted
|
22
|
+
# from a Timestamp. Range is approximately +-10,000 years.
|
23
|
+
#
|
24
|
+
# Example 1: Compute Duration from two Timestamps in pseudo code.
|
25
|
+
#
|
26
|
+
# Timestamp start = ...;
|
27
|
+
# Timestamp end = ...;
|
28
|
+
# Duration duration = ...;
|
29
|
+
#
|
30
|
+
# duration.seconds = end.seconds - start.seconds;
|
31
|
+
# duration.nanos = end.nanos - start.nanos;
|
32
|
+
#
|
33
|
+
# if (duration.seconds < 0 && duration.nanos > 0) {
|
34
|
+
# duration.seconds += 1;
|
35
|
+
# duration.nanos -= 1000000000;
|
36
|
+
# } else if (durations.seconds > 0 && duration.nanos < 0) {
|
37
|
+
# duration.seconds -= 1;
|
38
|
+
# duration.nanos += 1000000000;
|
39
|
+
# }
|
40
|
+
#
|
41
|
+
# Example 2: Compute Timestamp from Timestamp + Duration in pseudo code.
|
42
|
+
#
|
43
|
+
# Timestamp start = ...;
|
44
|
+
# Duration duration = ...;
|
45
|
+
# Timestamp end = ...;
|
46
|
+
#
|
47
|
+
# end.seconds = start.seconds + duration.seconds;
|
48
|
+
# end.nanos = start.nanos + duration.nanos;
|
49
|
+
#
|
50
|
+
# if (end.nanos < 0) {
|
51
|
+
# end.seconds -= 1;
|
52
|
+
# end.nanos += 1000000000;
|
53
|
+
# } else if (end.nanos >= 1000000000) {
|
54
|
+
# end.seconds += 1;
|
55
|
+
# end.nanos -= 1000000000;
|
56
|
+
# }
|
57
|
+
# @!attribute [rw] seconds
|
58
|
+
# @return [Integer]
|
59
|
+
# Signed seconds of the span of time. Must be from -315,576,000,000
|
60
|
+
# to +315,576,000,000 inclusive.
|
61
|
+
# @!attribute [rw] nanos
|
62
|
+
# @return [Integer]
|
63
|
+
# Signed fractions of a second at nanosecond resolution of the span
|
64
|
+
# of time. Durations less than one second are represented with a 0
|
65
|
+
# +seconds+ field and a positive or negative +nanos+ field. For durations
|
66
|
+
# of one second or more, a non-zero value for the +nanos+ field must be
|
67
|
+
# of the same sign as the +seconds+ field. Must be from -999,999,999
|
68
|
+
# to +999,999,999 inclusive.
|
69
|
+
class Duration; end
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,83 @@
|
|
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
|
+
module Google
|
16
|
+
module Protobuf
|
17
|
+
# A Timestamp represents a point in time independent of any time zone
|
18
|
+
# or calendar, represented as seconds and fractions of seconds at
|
19
|
+
# nanosecond resolution in UTC Epoch time. It is encoded using the
|
20
|
+
# Proleptic Gregorian Calendar which extends the Gregorian calendar
|
21
|
+
# backwards to year one. It is encoded assuming all minutes are 60
|
22
|
+
# seconds long, i.e. leap seconds are "smeared" so that no leap second
|
23
|
+
# table is needed for interpretation. Range is from
|
24
|
+
# 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z.
|
25
|
+
# By restricting to that range, we ensure that we can convert to
|
26
|
+
# and from RFC 3339 date strings.
|
27
|
+
# See {https://www.ietf.org/rfc/rfc3339.txt}[https://www.ietf.org/rfc/rfc3339.txt].
|
28
|
+
#
|
29
|
+
# Example 1: Compute Timestamp from POSIX +time()+.
|
30
|
+
#
|
31
|
+
# Timestamp timestamp;
|
32
|
+
# timestamp.set_seconds(time(NULL));
|
33
|
+
# timestamp.set_nanos(0);
|
34
|
+
#
|
35
|
+
# Example 2: Compute Timestamp from POSIX +gettimeofday()+.
|
36
|
+
#
|
37
|
+
# struct timeval tv;
|
38
|
+
# gettimeofday(&tv, NULL);
|
39
|
+
#
|
40
|
+
# Timestamp timestamp;
|
41
|
+
# timestamp.set_seconds(tv.tv_sec);
|
42
|
+
# timestamp.set_nanos(tv.tv_usec * 1000);
|
43
|
+
#
|
44
|
+
# Example 3: Compute Timestamp from Win32 +GetSystemTimeAsFileTime()+.
|
45
|
+
#
|
46
|
+
# FILETIME ft;
|
47
|
+
# GetSystemTimeAsFileTime(&ft);
|
48
|
+
# UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
|
49
|
+
#
|
50
|
+
# // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z
|
51
|
+
# // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.
|
52
|
+
# Timestamp timestamp;
|
53
|
+
# timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
|
54
|
+
# timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));
|
55
|
+
#
|
56
|
+
# Example 4: Compute Timestamp from Java +System.currentTimeMillis()+.
|
57
|
+
#
|
58
|
+
# long millis = System.currentTimeMillis();
|
59
|
+
#
|
60
|
+
# Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
|
61
|
+
# .setNanos((int) ((millis % 1000) * 1000000)).build();
|
62
|
+
#
|
63
|
+
#
|
64
|
+
# Example 5: Compute Timestamp from current time in Python.
|
65
|
+
#
|
66
|
+
# now = time.time()
|
67
|
+
# seconds = int(now)
|
68
|
+
# nanos = int((now - seconds) * 10**9)
|
69
|
+
# timestamp = Timestamp(seconds=seconds, nanos=nanos)
|
70
|
+
# @!attribute [rw] seconds
|
71
|
+
# @return [Integer]
|
72
|
+
# Represents seconds of UTC time since Unix epoch
|
73
|
+
# 1970-01-01T00:00:00Z. Must be from from 0001-01-01T00:00:00Z to
|
74
|
+
# 9999-12-31T23:59:59Z inclusive.
|
75
|
+
# @!attribute [rw] nanos
|
76
|
+
# @return [Integer]
|
77
|
+
# Non-negative fractions of a second at nanosecond resolution. Negative
|
78
|
+
# second values with fractions must still have non-negative nanos values
|
79
|
+
# that count forward in time. Must be from 0 to 999,999,999
|
80
|
+
# inclusive.
|
81
|
+
class Timestamp; end
|
82
|
+
end
|
83
|
+
end
|
@@ -47,7 +47,7 @@ module Google
|
|
47
47
|
#
|
48
48
|
# @!attribute [r] group_service_stub
|
49
49
|
# @return [Google::Monitoring::V3::GroupService::Stub]
|
50
|
-
class
|
50
|
+
class GroupServiceClient
|
51
51
|
attr_reader :group_service_stub
|
52
52
|
|
53
53
|
# The default address of the service.
|
@@ -76,6 +76,10 @@ module Google
|
|
76
76
|
# The scopes needed to make gRPC calls to all of the methods defined in
|
77
77
|
# this service.
|
78
78
|
ALL_SCOPES = [
|
79
|
+
"https://www.googleapis.com/auth/cloud-platform",
|
80
|
+
"https://www.googleapis.com/auth/monitoring",
|
81
|
+
"https://www.googleapis.com/auth/monitoring.read",
|
82
|
+
"https://www.googleapis.com/auth/monitoring.write"
|
79
83
|
].freeze
|
80
84
|
|
81
85
|
PROJECT_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
|
@@ -166,6 +170,7 @@ module Google
|
|
166
170
|
require "google/gax/grpc"
|
167
171
|
require "google/monitoring/v3/group_service_services_pb"
|
168
172
|
|
173
|
+
|
169
174
|
google_api_client = "#{app_name}/#{app_version} " \
|
170
175
|
"#{CODE_GEN_NAME_VERSION} gax/#{Google::Gax::VERSION} " \
|
171
176
|
"ruby/#{RUBY_VERSION}".freeze
|
@@ -258,20 +263,20 @@ module Google
|
|
258
263
|
# object.
|
259
264
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
260
265
|
# @example
|
261
|
-
# require "google/cloud/monitoring/v3/
|
266
|
+
# require "google/cloud/monitoring/v3/group_service_client"
|
262
267
|
#
|
263
|
-
#
|
268
|
+
# GroupServiceClient = Google::Cloud::Monitoring::V3::GroupServiceClient
|
264
269
|
#
|
265
|
-
#
|
266
|
-
# formatted_name =
|
270
|
+
# group_service_client = GroupServiceClient.new
|
271
|
+
# formatted_name = GroupServiceClient.project_path("[PROJECT]")
|
267
272
|
#
|
268
273
|
# # Iterate over all results.
|
269
|
-
#
|
274
|
+
# group_service_client.list_groups(formatted_name).each do |element|
|
270
275
|
# # Process element.
|
271
276
|
# end
|
272
277
|
#
|
273
278
|
# # Or iterate over results one page at a time.
|
274
|
-
#
|
279
|
+
# group_service_client.list_groups(formatted_name).each_page do |page|
|
275
280
|
# # Process each page at a time.
|
276
281
|
# page.each do |element|
|
277
282
|
# # Process element.
|
@@ -285,13 +290,13 @@ module Google
|
|
285
290
|
descendants_of_group: nil,
|
286
291
|
page_size: nil,
|
287
292
|
options: nil
|
288
|
-
req = Google::Monitoring::V3::ListGroupsRequest.new(
|
289
|
-
name: name
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
293
|
+
req = Google::Monitoring::V3::ListGroupsRequest.new({
|
294
|
+
name: name,
|
295
|
+
children_of_group: children_of_group,
|
296
|
+
ancestors_of_group: ancestors_of_group,
|
297
|
+
descendants_of_group: descendants_of_group,
|
298
|
+
page_size: page_size
|
299
|
+
}.delete_if { |_, v| v.nil? })
|
295
300
|
@list_groups.call(req, options)
|
296
301
|
end
|
297
302
|
|
@@ -306,20 +311,20 @@ module Google
|
|
306
311
|
# @return [Google::Monitoring::V3::Group]
|
307
312
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
308
313
|
# @example
|
309
|
-
# require "google/cloud/monitoring/v3/
|
314
|
+
# require "google/cloud/monitoring/v3/group_service_client"
|
310
315
|
#
|
311
|
-
#
|
316
|
+
# GroupServiceClient = Google::Cloud::Monitoring::V3::GroupServiceClient
|
312
317
|
#
|
313
|
-
#
|
314
|
-
# formatted_name =
|
315
|
-
# response =
|
318
|
+
# group_service_client = GroupServiceClient.new
|
319
|
+
# formatted_name = GroupServiceClient.group_path("[PROJECT]", "[GROUP]")
|
320
|
+
# response = group_service_client.get_group(formatted_name)
|
316
321
|
|
317
322
|
def get_group \
|
318
323
|
name,
|
319
324
|
options: nil
|
320
|
-
req = Google::Monitoring::V3::GetGroupRequest.new(
|
325
|
+
req = Google::Monitoring::V3::GetGroupRequest.new({
|
321
326
|
name: name
|
322
|
-
)
|
327
|
+
}.delete_if { |_, v| v.nil? })
|
323
328
|
@get_group.call(req, options)
|
324
329
|
end
|
325
330
|
|
@@ -339,26 +344,26 @@ module Google
|
|
339
344
|
# @return [Google::Monitoring::V3::Group]
|
340
345
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
341
346
|
# @example
|
342
|
-
# require "google/cloud/monitoring/v3/
|
347
|
+
# require "google/cloud/monitoring/v3/group_service_client"
|
343
348
|
#
|
344
349
|
# Group = Google::Monitoring::V3::Group
|
345
|
-
#
|
350
|
+
# GroupServiceClient = Google::Cloud::Monitoring::V3::GroupServiceClient
|
346
351
|
#
|
347
|
-
#
|
348
|
-
# formatted_name =
|
352
|
+
# group_service_client = GroupServiceClient.new
|
353
|
+
# formatted_name = GroupServiceClient.project_path("[PROJECT]")
|
349
354
|
# group = Group.new
|
350
|
-
# response =
|
355
|
+
# response = group_service_client.create_group(formatted_name, group)
|
351
356
|
|
352
357
|
def create_group \
|
353
358
|
name,
|
354
359
|
group,
|
355
360
|
validate_only: nil,
|
356
361
|
options: nil
|
357
|
-
req = Google::Monitoring::V3::CreateGroupRequest.new(
|
362
|
+
req = Google::Monitoring::V3::CreateGroupRequest.new({
|
358
363
|
name: name,
|
359
|
-
group: group
|
360
|
-
|
361
|
-
|
364
|
+
group: group,
|
365
|
+
validate_only: validate_only
|
366
|
+
}.delete_if { |_, v| v.nil? })
|
362
367
|
@create_group.call(req, options)
|
363
368
|
end
|
364
369
|
|
@@ -376,23 +381,23 @@ module Google
|
|
376
381
|
# @return [Google::Monitoring::V3::Group]
|
377
382
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
378
383
|
# @example
|
379
|
-
# require "google/cloud/monitoring/v3/
|
384
|
+
# require "google/cloud/monitoring/v3/group_service_client"
|
380
385
|
#
|
381
386
|
# Group = Google::Monitoring::V3::Group
|
382
|
-
#
|
387
|
+
# GroupServiceClient = Google::Cloud::Monitoring::V3::GroupServiceClient
|
383
388
|
#
|
384
|
-
#
|
389
|
+
# group_service_client = GroupServiceClient.new
|
385
390
|
# group = Group.new
|
386
|
-
# response =
|
391
|
+
# response = group_service_client.update_group(group)
|
387
392
|
|
388
393
|
def update_group \
|
389
394
|
group,
|
390
395
|
validate_only: nil,
|
391
396
|
options: nil
|
392
|
-
req = Google::Monitoring::V3::UpdateGroupRequest.new(
|
393
|
-
group: group
|
394
|
-
|
395
|
-
|
397
|
+
req = Google::Monitoring::V3::UpdateGroupRequest.new({
|
398
|
+
group: group,
|
399
|
+
validate_only: validate_only
|
400
|
+
}.delete_if { |_, v| v.nil? })
|
396
401
|
@update_group.call(req, options)
|
397
402
|
end
|
398
403
|
|
@@ -406,21 +411,22 @@ module Google
|
|
406
411
|
# retries, etc.
|
407
412
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
408
413
|
# @example
|
409
|
-
# require "google/cloud/monitoring/v3/
|
414
|
+
# require "google/cloud/monitoring/v3/group_service_client"
|
410
415
|
#
|
411
|
-
#
|
416
|
+
# GroupServiceClient = Google::Cloud::Monitoring::V3::GroupServiceClient
|
412
417
|
#
|
413
|
-
#
|
414
|
-
# formatted_name =
|
415
|
-
#
|
418
|
+
# group_service_client = GroupServiceClient.new
|
419
|
+
# formatted_name = GroupServiceClient.group_path("[PROJECT]", "[GROUP]")
|
420
|
+
# group_service_client.delete_group(formatted_name)
|
416
421
|
|
417
422
|
def delete_group \
|
418
423
|
name,
|
419
424
|
options: nil
|
420
|
-
req = Google::Monitoring::V3::DeleteGroupRequest.new(
|
425
|
+
req = Google::Monitoring::V3::DeleteGroupRequest.new({
|
421
426
|
name: name
|
422
|
-
)
|
427
|
+
}.delete_if { |_, v| v.nil? })
|
423
428
|
@delete_group.call(req, options)
|
429
|
+
nil
|
424
430
|
end
|
425
431
|
|
426
432
|
# Lists the monitored resources that are members of a group.
|
@@ -457,20 +463,20 @@ module Google
|
|
457
463
|
# object.
|
458
464
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
459
465
|
# @example
|
460
|
-
# require "google/cloud/monitoring/v3/
|
466
|
+
# require "google/cloud/monitoring/v3/group_service_client"
|
461
467
|
#
|
462
|
-
#
|
468
|
+
# GroupServiceClient = Google::Cloud::Monitoring::V3::GroupServiceClient
|
463
469
|
#
|
464
|
-
#
|
465
|
-
# formatted_name =
|
470
|
+
# group_service_client = GroupServiceClient.new
|
471
|
+
# formatted_name = GroupServiceClient.group_path("[PROJECT]", "[GROUP]")
|
466
472
|
#
|
467
473
|
# # Iterate over all results.
|
468
|
-
#
|
474
|
+
# group_service_client.list_group_members(formatted_name).each do |element|
|
469
475
|
# # Process element.
|
470
476
|
# end
|
471
477
|
#
|
472
478
|
# # Or iterate over results one page at a time.
|
473
|
-
#
|
479
|
+
# group_service_client.list_group_members(formatted_name).each_page do |page|
|
474
480
|
# # Process each page at a time.
|
475
481
|
# page.each do |element|
|
476
482
|
# # Process element.
|
@@ -483,12 +489,12 @@ module Google
|
|
483
489
|
filter: nil,
|
484
490
|
interval: nil,
|
485
491
|
options: nil
|
486
|
-
req = Google::Monitoring::V3::ListGroupMembersRequest.new(
|
487
|
-
name: name
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
+
req = Google::Monitoring::V3::ListGroupMembersRequest.new({
|
493
|
+
name: name,
|
494
|
+
page_size: page_size,
|
495
|
+
filter: filter,
|
496
|
+
interval: interval
|
497
|
+
}.delete_if { |_, v| v.nil? })
|
492
498
|
@list_group_members.call(req, options)
|
493
499
|
end
|
494
500
|
end
|