google-cloud-monitoring-v3 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.yardopts +12 -0
- data/AUTHENTICATION.md +169 -0
- data/LICENSE.md +203 -0
- data/README.md +71 -0
- data/lib/google-cloud-monitoring-v3.rb +21 -0
- data/lib/google/cloud/monitoring/v3.rb +40 -0
- data/lib/google/cloud/monitoring/v3/alert_policy_service.rb +57 -0
- data/lib/google/cloud/monitoring/v3/alert_policy_service/client.rb +772 -0
- data/lib/google/cloud/monitoring/v3/alert_policy_service/credentials.rb +53 -0
- data/lib/google/cloud/monitoring/v3/alert_policy_service/paths.rb +185 -0
- data/lib/google/cloud/monitoring/v3/group_service.rb +60 -0
- data/lib/google/cloud/monitoring/v3/group_service/client.rb +862 -0
- data/lib/google/cloud/monitoring/v3/group_service/credentials.rb +53 -0
- data/lib/google/cloud/monitoring/v3/group_service/paths.rb +127 -0
- data/lib/google/cloud/monitoring/v3/metric_service.rb +50 -0
- data/lib/google/cloud/monitoring/v3/metric_service/client.rb +1040 -0
- data/lib/google/cloud/monitoring/v3/metric_service/credentials.rb +54 -0
- data/lib/google/cloud/monitoring/v3/metric_service/paths.rb +179 -0
- data/lib/google/cloud/monitoring/v3/notification_channel_service.rb +50 -0
- data/lib/google/cloud/monitoring/v3/notification_channel_service/client.rb +1213 -0
- data/lib/google/cloud/monitoring/v3/notification_channel_service/credentials.rb +53 -0
- data/lib/google/cloud/monitoring/v3/notification_channel_service/paths.rb +179 -0
- data/lib/google/cloud/monitoring/v3/service_monitoring_service.rb +52 -0
- data/lib/google/cloud/monitoring/v3/service_monitoring_service/client.rb +1168 -0
- data/lib/google/cloud/monitoring/v3/service_monitoring_service/credentials.rb +53 -0
- data/lib/google/cloud/monitoring/v3/service_monitoring_service/paths.rb +185 -0
- data/lib/google/cloud/monitoring/v3/uptime_check_service.rb +56 -0
- data/lib/google/cloud/monitoring/v3/uptime_check_service/client.rb +822 -0
- data/lib/google/cloud/monitoring/v3/uptime_check_service/credentials.rb +53 -0
- data/lib/google/cloud/monitoring/v3/uptime_check_service/paths.rb +127 -0
- data/lib/google/cloud/monitoring/v3/version.rb +28 -0
- data/lib/google/monitoring/v3/alert_pb.rb +84 -0
- data/lib/google/monitoring/v3/alert_service_pb.rb +56 -0
- data/lib/google/monitoring/v3/alert_service_services_pb.rb +64 -0
- data/lib/google/monitoring/v3/common_pb.rb +98 -0
- data/lib/google/monitoring/v3/dropped_labels_pb.rb +22 -0
- data/lib/google/monitoring/v3/group_pb.rb +27 -0
- data/lib/google/monitoring/v3/group_service_pb.rb +76 -0
- data/lib/google/monitoring/v3/group_service_services_pb.rb +67 -0
- data/lib/google/monitoring/v3/metric_pb.rb +85 -0
- data/lib/google/monitoring/v3/metric_service_pb.rb +133 -0
- data/lib/google/monitoring/v3/metric_service_services_pb.rb +67 -0
- data/lib/google/monitoring/v3/mutation_record_pb.rb +24 -0
- data/lib/google/monitoring/v3/notification_pb.rb +50 -0
- data/lib/google/monitoring/v3/notification_service_pb.rb +93 -0
- data/lib/google/monitoring/v3/notification_service_services_pb.rb +95 -0
- data/lib/google/monitoring/v3/service_pb.rb +152 -0
- data/lib/google/monitoring/v3/service_service_pb.rb +89 -0
- data/lib/google/monitoring/v3/service_service_services_pb.rb +66 -0
- data/lib/google/monitoring/v3/span_context_pb.rb +22 -0
- data/lib/google/monitoring/v3/uptime_pb.rb +126 -0
- data/lib/google/monitoring/v3/uptime_service_pb.rb +66 -0
- data/lib/google/monitoring/v3/uptime_service_services_pb.rb +68 -0
- data/proto_docs/README.md +4 -0
- data/proto_docs/google/api/distribution.rb +225 -0
- data/proto_docs/google/api/field_behavior.rb +59 -0
- data/proto_docs/google/api/label.rb +49 -0
- data/proto_docs/google/api/launch_stage.rb +65 -0
- data/proto_docs/google/api/metric.rb +203 -0
- data/proto_docs/google/api/monitored_resource.rb +137 -0
- data/proto_docs/google/api/resource.rb +247 -0
- data/proto_docs/google/monitoring/v3/alert.rb +359 -0
- data/proto_docs/google/monitoring/v3/alert_service.rb +162 -0
- data/proto_docs/google/monitoring/v3/common.rb +464 -0
- data/proto_docs/google/monitoring/v3/dropped_labels.rb +58 -0
- data/proto_docs/google/monitoring/v3/group.rb +84 -0
- data/proto_docs/google/monitoring/v3/group_service.rb +197 -0
- data/proto_docs/google/monitoring/v3/metric.rb +249 -0
- data/proto_docs/google/monitoring/v3/metric_service.rb +366 -0
- data/proto_docs/google/monitoring/v3/mutation_record.rb +38 -0
- data/proto_docs/google/monitoring/v3/notification.rb +186 -0
- data/proto_docs/google/monitoring/v3/notification_service.rb +266 -0
- data/proto_docs/google/monitoring/v3/service.rb +424 -0
- data/proto_docs/google/monitoring/v3/service_service.rb +239 -0
- data/proto_docs/google/monitoring/v3/span_context.rb +49 -0
- data/proto_docs/google/monitoring/v3/uptime.rb +403 -0
- data/proto_docs/google/monitoring/v3/uptime_service.rb +166 -0
- data/proto_docs/google/protobuf/any.rb +138 -0
- data/proto_docs/google/protobuf/duration.rb +98 -0
- data/proto_docs/google/protobuf/empty.rb +36 -0
- data/proto_docs/google/protobuf/field_mask.rb +229 -0
- data/proto_docs/google/protobuf/struct.rb +96 -0
- data/proto_docs/google/protobuf/timestamp.rb +120 -0
- data/proto_docs/google/protobuf/wrappers.rb +121 -0
- data/proto_docs/google/rpc/status.rb +46 -0
- data/proto_docs/google/type/calendar_period.rb +55 -0
- metadata +269 -0
@@ -0,0 +1,53 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2020 Google LLC
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
|
+
|
19
|
+
require "googleauth"
|
20
|
+
|
21
|
+
module Google
|
22
|
+
module Cloud
|
23
|
+
module Monitoring
|
24
|
+
module V3
|
25
|
+
module AlertPolicyService
|
26
|
+
# Credentials for the AlertPolicyService API.
|
27
|
+
class Credentials < ::Google::Auth::Credentials
|
28
|
+
self.scope = [
|
29
|
+
"https://www.googleapis.com/auth/cloud-platform",
|
30
|
+
"https://www.googleapis.com/auth/monitoring",
|
31
|
+
"https://www.googleapis.com/auth/monitoring.read"
|
32
|
+
]
|
33
|
+
self.env_vars = [
|
34
|
+
"MONITORING_CREDENTIALS",
|
35
|
+
"MONITORING_KEYFILE",
|
36
|
+
"GOOGLE_CLOUD_CREDENTIALS",
|
37
|
+
"GOOGLE_CLOUD_KEYFILE",
|
38
|
+
"GCLOUD_KEYFILE",
|
39
|
+
"MONITORING_CREDENTIALS_JSON",
|
40
|
+
"MONITORING_KEYFILE_JSON",
|
41
|
+
"GOOGLE_CLOUD_CREDENTIALS_JSON",
|
42
|
+
"GOOGLE_CLOUD_KEYFILE_JSON",
|
43
|
+
"GCLOUD_KEYFILE_JSON"
|
44
|
+
]
|
45
|
+
self.paths = [
|
46
|
+
"~/.config/google_cloud/application_default_credentials.json"
|
47
|
+
]
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,185 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2020 Google LLC
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
|
+
|
19
|
+
|
20
|
+
module Google
|
21
|
+
module Cloud
|
22
|
+
module Monitoring
|
23
|
+
module V3
|
24
|
+
module AlertPolicyService
|
25
|
+
# Path helper methods for the AlertPolicyService API.
|
26
|
+
module Paths
|
27
|
+
##
|
28
|
+
# Create a fully-qualified AlertPolicy resource string.
|
29
|
+
#
|
30
|
+
# @overload alert_policy_path(project:, alert_policy:)
|
31
|
+
# The resource will be in the following format:
|
32
|
+
#
|
33
|
+
# `projects/{project}/alertPolicies/{alert_policy}`
|
34
|
+
#
|
35
|
+
# @param project [String]
|
36
|
+
# @param alert_policy [String]
|
37
|
+
#
|
38
|
+
# @overload alert_policy_path(organization:, alert_policy:)
|
39
|
+
# The resource will be in the following format:
|
40
|
+
#
|
41
|
+
# `organizations/{organization}/alertPolicies/{alert_policy}`
|
42
|
+
#
|
43
|
+
# @param organization [String]
|
44
|
+
# @param alert_policy [String]
|
45
|
+
#
|
46
|
+
# @overload alert_policy_path(folder:, alert_policy:)
|
47
|
+
# The resource will be in the following format:
|
48
|
+
#
|
49
|
+
# `folders/{folder}/alertPolicies/{alert_policy}`
|
50
|
+
#
|
51
|
+
# @param folder [String]
|
52
|
+
# @param alert_policy [String]
|
53
|
+
#
|
54
|
+
# @return [::String]
|
55
|
+
def alert_policy_path **args
|
56
|
+
resources = {
|
57
|
+
"alert_policy:project" => (proc do |project:, alert_policy:|
|
58
|
+
raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
|
59
|
+
|
60
|
+
"projects/#{project}/alertPolicies/#{alert_policy}"
|
61
|
+
end),
|
62
|
+
"alert_policy:organization" => (proc do |organization:, alert_policy:|
|
63
|
+
raise ::ArgumentError, "organization cannot contain /" if organization.to_s.include? "/"
|
64
|
+
|
65
|
+
"organizations/#{organization}/alertPolicies/#{alert_policy}"
|
66
|
+
end),
|
67
|
+
"alert_policy:folder" => (proc do |folder:, alert_policy:|
|
68
|
+
raise ::ArgumentError, "folder cannot contain /" if folder.to_s.include? "/"
|
69
|
+
|
70
|
+
"folders/#{folder}/alertPolicies/#{alert_policy}"
|
71
|
+
end)
|
72
|
+
}
|
73
|
+
|
74
|
+
resource = resources[args.keys.sort.join(":")]
|
75
|
+
raise ::ArgumentError, "no resource found for values #{args.keys}" if resource.nil?
|
76
|
+
resource.call(**args)
|
77
|
+
end
|
78
|
+
|
79
|
+
##
|
80
|
+
# Create a fully-qualified AlertPolicyCondition resource string.
|
81
|
+
#
|
82
|
+
# @overload alert_policy_condition_path(project:, alert_policy:, condition:)
|
83
|
+
# The resource will be in the following format:
|
84
|
+
#
|
85
|
+
# `projects/{project}/alertPolicies/{alert_policy}/conditions/{condition}`
|
86
|
+
#
|
87
|
+
# @param project [String]
|
88
|
+
# @param alert_policy [String]
|
89
|
+
# @param condition [String]
|
90
|
+
#
|
91
|
+
# @overload alert_policy_condition_path(organization:, alert_policy:, condition:)
|
92
|
+
# The resource will be in the following format:
|
93
|
+
#
|
94
|
+
# `organizations/{organization}/alertPolicies/{alert_policy}/conditions/{condition}`
|
95
|
+
#
|
96
|
+
# @param organization [String]
|
97
|
+
# @param alert_policy [String]
|
98
|
+
# @param condition [String]
|
99
|
+
#
|
100
|
+
# @overload alert_policy_condition_path(folder:, alert_policy:, condition:)
|
101
|
+
# The resource will be in the following format:
|
102
|
+
#
|
103
|
+
# `folders/{folder}/alertPolicies/{alert_policy}/conditions/{condition}`
|
104
|
+
#
|
105
|
+
# @param folder [String]
|
106
|
+
# @param alert_policy [String]
|
107
|
+
# @param condition [String]
|
108
|
+
#
|
109
|
+
# @return [::String]
|
110
|
+
def alert_policy_condition_path **args
|
111
|
+
resources = {
|
112
|
+
"alert_policy:condition:project" => (proc do |project:, alert_policy:, condition:|
|
113
|
+
raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
|
114
|
+
raise ::ArgumentError, "alert_policy cannot contain /" if alert_policy.to_s.include? "/"
|
115
|
+
|
116
|
+
"projects/#{project}/alertPolicies/#{alert_policy}/conditions/#{condition}"
|
117
|
+
end),
|
118
|
+
"alert_policy:condition:organization" => (proc do |organization:, alert_policy:, condition:|
|
119
|
+
raise ::ArgumentError, "organization cannot contain /" if organization.to_s.include? "/"
|
120
|
+
raise ::ArgumentError, "alert_policy cannot contain /" if alert_policy.to_s.include? "/"
|
121
|
+
|
122
|
+
"organizations/#{organization}/alertPolicies/#{alert_policy}/conditions/#{condition}"
|
123
|
+
end),
|
124
|
+
"alert_policy:condition:folder" => (proc do |folder:, alert_policy:, condition:|
|
125
|
+
raise ::ArgumentError, "folder cannot contain /" if folder.to_s.include? "/"
|
126
|
+
raise ::ArgumentError, "alert_policy cannot contain /" if alert_policy.to_s.include? "/"
|
127
|
+
|
128
|
+
"folders/#{folder}/alertPolicies/#{alert_policy}/conditions/#{condition}"
|
129
|
+
end)
|
130
|
+
}
|
131
|
+
|
132
|
+
resource = resources[args.keys.sort.join(":")]
|
133
|
+
raise ::ArgumentError, "no resource found for values #{args.keys}" if resource.nil?
|
134
|
+
resource.call(**args)
|
135
|
+
end
|
136
|
+
|
137
|
+
##
|
138
|
+
# Create a fully-qualified Folder resource string.
|
139
|
+
#
|
140
|
+
# The resource will be in the following format:
|
141
|
+
#
|
142
|
+
# `folders/{folder}`
|
143
|
+
#
|
144
|
+
# @param folder [String]
|
145
|
+
#
|
146
|
+
# @return [::String]
|
147
|
+
def folder_path folder:
|
148
|
+
"folders/#{folder}"
|
149
|
+
end
|
150
|
+
|
151
|
+
##
|
152
|
+
# Create a fully-qualified Organization resource string.
|
153
|
+
#
|
154
|
+
# The resource will be in the following format:
|
155
|
+
#
|
156
|
+
# `organizations/{organization}`
|
157
|
+
#
|
158
|
+
# @param organization [String]
|
159
|
+
#
|
160
|
+
# @return [::String]
|
161
|
+
def organization_path organization:
|
162
|
+
"organizations/#{organization}"
|
163
|
+
end
|
164
|
+
|
165
|
+
##
|
166
|
+
# Create a fully-qualified Project resource string.
|
167
|
+
#
|
168
|
+
# The resource will be in the following format:
|
169
|
+
#
|
170
|
+
# `projects/{project}`
|
171
|
+
#
|
172
|
+
# @param project [String]
|
173
|
+
#
|
174
|
+
# @return [::String]
|
175
|
+
def project_path project:
|
176
|
+
"projects/#{project}"
|
177
|
+
end
|
178
|
+
|
179
|
+
extend self
|
180
|
+
end
|
181
|
+
end
|
182
|
+
end
|
183
|
+
end
|
184
|
+
end
|
185
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2020 Google LLC
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
|
+
|
19
|
+
require "gapic/common"
|
20
|
+
require "gapic/config"
|
21
|
+
require "gapic/config/method"
|
22
|
+
|
23
|
+
require "google/cloud/monitoring/v3/version"
|
24
|
+
|
25
|
+
require "google/cloud/monitoring/v3/group_service/credentials"
|
26
|
+
require "google/cloud/monitoring/v3/group_service/paths"
|
27
|
+
require "google/cloud/monitoring/v3/group_service/client"
|
28
|
+
|
29
|
+
module Google
|
30
|
+
module Cloud
|
31
|
+
module Monitoring
|
32
|
+
module V3
|
33
|
+
##
|
34
|
+
# The Group API lets you inspect and manage your
|
35
|
+
# [groups](#google.monitoring.v3.Group).
|
36
|
+
#
|
37
|
+
# A group is a named filter that is used to identify
|
38
|
+
# a collection of monitored resources. Groups are typically used to
|
39
|
+
# mirror the physical and/or logical topology of the environment.
|
40
|
+
# Because group membership is computed dynamically, monitored
|
41
|
+
# resources that are started in the future are automatically placed
|
42
|
+
# in matching groups. By using a group to name monitored resources in,
|
43
|
+
# for example, an alert policy, the target of that alert policy is
|
44
|
+
# updated automatically as monitored resources are added and removed
|
45
|
+
# from the infrastructure.
|
46
|
+
#
|
47
|
+
# To load this service and instantiate a client:
|
48
|
+
#
|
49
|
+
# require "google/cloud/monitoring/v3/group_service"
|
50
|
+
# client = ::Google::Cloud::Monitoring::V3::GroupService::Client.new
|
51
|
+
#
|
52
|
+
module GroupService
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
helper_path = ::File.join __dir__, "group_service", "helpers.rb"
|
60
|
+
require "google/cloud/monitoring/v3/group_service/helpers" if ::File.file? helper_path
|
@@ -0,0 +1,862 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2020 Google LLC
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
|
+
|
19
|
+
require "google/cloud/errors"
|
20
|
+
require "google/monitoring/v3/group_service_pb"
|
21
|
+
|
22
|
+
module Google
|
23
|
+
module Cloud
|
24
|
+
module Monitoring
|
25
|
+
module V3
|
26
|
+
module GroupService
|
27
|
+
##
|
28
|
+
# Client for the GroupService service.
|
29
|
+
#
|
30
|
+
# The Group API lets you inspect and manage your
|
31
|
+
# [groups](#google.monitoring.v3.Group).
|
32
|
+
#
|
33
|
+
# A group is a named filter that is used to identify
|
34
|
+
# a collection of monitored resources. Groups are typically used to
|
35
|
+
# mirror the physical and/or logical topology of the environment.
|
36
|
+
# Because group membership is computed dynamically, monitored
|
37
|
+
# resources that are started in the future are automatically placed
|
38
|
+
# in matching groups. By using a group to name monitored resources in,
|
39
|
+
# for example, an alert policy, the target of that alert policy is
|
40
|
+
# updated automatically as monitored resources are added and removed
|
41
|
+
# from the infrastructure.
|
42
|
+
#
|
43
|
+
class Client
|
44
|
+
include Paths
|
45
|
+
|
46
|
+
# @private
|
47
|
+
attr_reader :group_service_stub
|
48
|
+
|
49
|
+
##
|
50
|
+
# Configure the GroupService Client class.
|
51
|
+
#
|
52
|
+
# See {::Google::Cloud::Monitoring::V3::GroupService::Client::Configuration}
|
53
|
+
# for a description of the configuration fields.
|
54
|
+
#
|
55
|
+
# ## Example
|
56
|
+
#
|
57
|
+
# To modify the configuration for all GroupService clients:
|
58
|
+
#
|
59
|
+
# ::Google::Cloud::Monitoring::V3::GroupService::Client.configure do |config|
|
60
|
+
# config.timeout = 10.0
|
61
|
+
# end
|
62
|
+
#
|
63
|
+
# @yield [config] Configure the Client client.
|
64
|
+
# @yieldparam config [Client::Configuration]
|
65
|
+
#
|
66
|
+
# @return [Client::Configuration]
|
67
|
+
#
|
68
|
+
def self.configure
|
69
|
+
@configure ||= begin
|
70
|
+
namespace = ["Google", "Cloud", "Monitoring", "V3"]
|
71
|
+
parent_config = while namespace.any?
|
72
|
+
parent_name = namespace.join "::"
|
73
|
+
parent_const = const_get parent_name
|
74
|
+
break parent_const.configure if parent_const&.respond_to? :configure
|
75
|
+
namespace.pop
|
76
|
+
end
|
77
|
+
default_config = Client::Configuration.new parent_config
|
78
|
+
|
79
|
+
default_config.rpcs.list_groups.timeout = 30.0
|
80
|
+
default_config.rpcs.list_groups.retry_policy = {
|
81
|
+
initial_delay: 0.1,
|
82
|
+
max_delay: 30.0,
|
83
|
+
multiplier: 1.3,
|
84
|
+
retry_codes: ["DEADLINE_EXCEEDED", "UNAVAILABLE"]
|
85
|
+
}
|
86
|
+
|
87
|
+
default_config.rpcs.get_group.timeout = 30.0
|
88
|
+
default_config.rpcs.get_group.retry_policy = {
|
89
|
+
initial_delay: 0.1,
|
90
|
+
max_delay: 30.0,
|
91
|
+
multiplier: 1.3,
|
92
|
+
retry_codes: ["DEADLINE_EXCEEDED", "UNAVAILABLE"]
|
93
|
+
}
|
94
|
+
|
95
|
+
default_config.rpcs.create_group.timeout = 30.0
|
96
|
+
|
97
|
+
default_config.rpcs.update_group.timeout = 30.0
|
98
|
+
default_config.rpcs.update_group.retry_policy = {
|
99
|
+
initial_delay: 0.1,
|
100
|
+
max_delay: 30.0,
|
101
|
+
multiplier: 1.3,
|
102
|
+
retry_codes: ["DEADLINE_EXCEEDED", "UNAVAILABLE"]
|
103
|
+
}
|
104
|
+
|
105
|
+
default_config.rpcs.delete_group.timeout = 30.0
|
106
|
+
default_config.rpcs.delete_group.retry_policy = {
|
107
|
+
initial_delay: 0.1,
|
108
|
+
max_delay: 30.0,
|
109
|
+
multiplier: 1.3,
|
110
|
+
retry_codes: ["DEADLINE_EXCEEDED", "UNAVAILABLE"]
|
111
|
+
}
|
112
|
+
|
113
|
+
default_config.rpcs.list_group_members.timeout = 30.0
|
114
|
+
default_config.rpcs.list_group_members.retry_policy = {
|
115
|
+
initial_delay: 0.1,
|
116
|
+
max_delay: 30.0,
|
117
|
+
multiplier: 1.3,
|
118
|
+
retry_codes: ["DEADLINE_EXCEEDED", "UNAVAILABLE"]
|
119
|
+
}
|
120
|
+
|
121
|
+
default_config
|
122
|
+
end
|
123
|
+
yield @configure if block_given?
|
124
|
+
@configure
|
125
|
+
end
|
126
|
+
|
127
|
+
##
|
128
|
+
# Configure the GroupService Client instance.
|
129
|
+
#
|
130
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
131
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
132
|
+
# should be made on {Client.configure}.
|
133
|
+
#
|
134
|
+
# See {::Google::Cloud::Monitoring::V3::GroupService::Client::Configuration}
|
135
|
+
# for a description of the configuration fields.
|
136
|
+
#
|
137
|
+
# @yield [config] Configure the Client client.
|
138
|
+
# @yieldparam config [Client::Configuration]
|
139
|
+
#
|
140
|
+
# @return [Client::Configuration]
|
141
|
+
#
|
142
|
+
def configure
|
143
|
+
yield @config if block_given?
|
144
|
+
@config
|
145
|
+
end
|
146
|
+
|
147
|
+
##
|
148
|
+
# Create a new GroupService client object.
|
149
|
+
#
|
150
|
+
# ## Examples
|
151
|
+
#
|
152
|
+
# To create a new GroupService client with the default
|
153
|
+
# configuration:
|
154
|
+
#
|
155
|
+
# client = ::Google::Cloud::Monitoring::V3::GroupService::Client.new
|
156
|
+
#
|
157
|
+
# To create a new GroupService client with a custom
|
158
|
+
# configuration:
|
159
|
+
#
|
160
|
+
# client = ::Google::Cloud::Monitoring::V3::GroupService::Client.new do |config|
|
161
|
+
# config.timeout = 10.0
|
162
|
+
# end
|
163
|
+
#
|
164
|
+
# @yield [config] Configure the GroupService client.
|
165
|
+
# @yieldparam config [Client::Configuration]
|
166
|
+
#
|
167
|
+
def initialize
|
168
|
+
# These require statements are intentionally placed here to initialize
|
169
|
+
# the gRPC module only when it's required.
|
170
|
+
# See https://github.com/googleapis/toolkit/issues/446
|
171
|
+
require "gapic/grpc"
|
172
|
+
require "google/monitoring/v3/group_service_services_pb"
|
173
|
+
|
174
|
+
# Create the configuration object
|
175
|
+
@config = Configuration.new Client.configure
|
176
|
+
|
177
|
+
# Yield the configuration if needed
|
178
|
+
yield @config if block_given?
|
179
|
+
|
180
|
+
# Create credentials
|
181
|
+
credentials = @config.credentials
|
182
|
+
credentials ||= Credentials.default scope: @config.scope
|
183
|
+
if credentials.is_a?(String) || credentials.is_a?(Hash)
|
184
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
185
|
+
end
|
186
|
+
@quota_project_id = @config.quota_project
|
187
|
+
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
188
|
+
|
189
|
+
@group_service_stub = ::Gapic::ServiceStub.new(
|
190
|
+
::Google::Cloud::Monitoring::V3::GroupService::Stub,
|
191
|
+
credentials: credentials,
|
192
|
+
endpoint: @config.endpoint,
|
193
|
+
channel_args: @config.channel_args,
|
194
|
+
interceptors: @config.interceptors
|
195
|
+
)
|
196
|
+
end
|
197
|
+
|
198
|
+
# Service calls
|
199
|
+
|
200
|
+
##
|
201
|
+
# Lists the existing groups.
|
202
|
+
#
|
203
|
+
# @overload list_groups(request, options = nil)
|
204
|
+
# Pass arguments to `list_groups` via a request object, either of type
|
205
|
+
# {::Google::Cloud::Monitoring::V3::ListGroupsRequest} or an equivalent Hash.
|
206
|
+
#
|
207
|
+
# @param request [::Google::Cloud::Monitoring::V3::ListGroupsRequest, ::Hash]
|
208
|
+
# A request object representing the call parameters. Required. To specify no
|
209
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
210
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
211
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
212
|
+
#
|
213
|
+
# @overload list_groups(name: nil, children_of_group: nil, ancestors_of_group: nil, descendants_of_group: nil, page_size: nil, page_token: nil)
|
214
|
+
# Pass arguments to `list_groups` via keyword arguments. Note that at
|
215
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
216
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
217
|
+
#
|
218
|
+
# @param name [::String]
|
219
|
+
# Required. The project whose groups are to be listed. The format is:
|
220
|
+
#
|
221
|
+
# projects/[PROJECT_ID_OR_NUMBER]
|
222
|
+
# @param children_of_group [::String]
|
223
|
+
# A group name. The format is:
|
224
|
+
#
|
225
|
+
# projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID]
|
226
|
+
#
|
227
|
+
# Returns groups whose `parent_name` field contains the group
|
228
|
+
# name. If no groups have this parent, the results are empty.
|
229
|
+
# @param ancestors_of_group [::String]
|
230
|
+
# A group name. The format is:
|
231
|
+
#
|
232
|
+
# projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID]
|
233
|
+
#
|
234
|
+
# Returns groups that are ancestors of the specified group.
|
235
|
+
# The groups are returned in order, starting with the immediate parent and
|
236
|
+
# ending with the most distant ancestor. If the specified group has no
|
237
|
+
# immediate parent, the results are empty.
|
238
|
+
# @param descendants_of_group [::String]
|
239
|
+
# A group name. The format is:
|
240
|
+
#
|
241
|
+
# projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID]
|
242
|
+
#
|
243
|
+
# Returns the descendants of the specified group. This is a superset of
|
244
|
+
# the results returned by the `children_of_group` filter, and includes
|
245
|
+
# children-of-children, and so forth.
|
246
|
+
# @param page_size [::Integer]
|
247
|
+
# A positive number that is the maximum number of results to return.
|
248
|
+
# @param page_token [::String]
|
249
|
+
# If this field is not empty then it must contain the `next_page_token` value
|
250
|
+
# returned by a previous call to this method. Using this field causes the
|
251
|
+
# method to return additional results from the previous method call.
|
252
|
+
#
|
253
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
254
|
+
# @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Monitoring::V3::Group>]
|
255
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
256
|
+
#
|
257
|
+
# @return [::Gapic::PagedEnumerable<::Google::Cloud::Monitoring::V3::Group>]
|
258
|
+
#
|
259
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
260
|
+
#
|
261
|
+
def list_groups request, options = nil
|
262
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
263
|
+
|
264
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Monitoring::V3::ListGroupsRequest
|
265
|
+
|
266
|
+
# Converts hash and nil to an options object
|
267
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
268
|
+
|
269
|
+
# Customize the options with defaults
|
270
|
+
metadata = @config.rpcs.list_groups.metadata.to_h
|
271
|
+
|
272
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
273
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
274
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
275
|
+
gapic_version: ::Google::Cloud::Monitoring::V3::VERSION
|
276
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
277
|
+
|
278
|
+
header_params = {
|
279
|
+
"name" => request.name
|
280
|
+
}
|
281
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
282
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
283
|
+
|
284
|
+
options.apply_defaults timeout: @config.rpcs.list_groups.timeout,
|
285
|
+
metadata: metadata,
|
286
|
+
retry_policy: @config.rpcs.list_groups.retry_policy
|
287
|
+
options.apply_defaults metadata: @config.metadata,
|
288
|
+
retry_policy: @config.retry_policy
|
289
|
+
|
290
|
+
@group_service_stub.call_rpc :list_groups, request, options: options do |response, operation|
|
291
|
+
response = ::Gapic::PagedEnumerable.new @group_service_stub, :list_groups, request, response, operation, options
|
292
|
+
yield response, operation if block_given?
|
293
|
+
return response
|
294
|
+
end
|
295
|
+
rescue ::GRPC::BadStatus => e
|
296
|
+
raise ::Google::Cloud::Error.from_error(e)
|
297
|
+
end
|
298
|
+
|
299
|
+
##
|
300
|
+
# Gets a single group.
|
301
|
+
#
|
302
|
+
# @overload get_group(request, options = nil)
|
303
|
+
# Pass arguments to `get_group` via a request object, either of type
|
304
|
+
# {::Google::Cloud::Monitoring::V3::GetGroupRequest} or an equivalent Hash.
|
305
|
+
#
|
306
|
+
# @param request [::Google::Cloud::Monitoring::V3::GetGroupRequest, ::Hash]
|
307
|
+
# A request object representing the call parameters. Required. To specify no
|
308
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
309
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
310
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
311
|
+
#
|
312
|
+
# @overload get_group(name: nil)
|
313
|
+
# Pass arguments to `get_group` via keyword arguments. Note that at
|
314
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
315
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
316
|
+
#
|
317
|
+
# @param name [::String]
|
318
|
+
# Required. The group to retrieve. The format is:
|
319
|
+
#
|
320
|
+
# projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID]
|
321
|
+
#
|
322
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
323
|
+
# @yieldparam response [::Google::Cloud::Monitoring::V3::Group]
|
324
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
325
|
+
#
|
326
|
+
# @return [::Google::Cloud::Monitoring::V3::Group]
|
327
|
+
#
|
328
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
329
|
+
#
|
330
|
+
def get_group request, options = nil
|
331
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
332
|
+
|
333
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Monitoring::V3::GetGroupRequest
|
334
|
+
|
335
|
+
# Converts hash and nil to an options object
|
336
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
337
|
+
|
338
|
+
# Customize the options with defaults
|
339
|
+
metadata = @config.rpcs.get_group.metadata.to_h
|
340
|
+
|
341
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
342
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
343
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
344
|
+
gapic_version: ::Google::Cloud::Monitoring::V3::VERSION
|
345
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
346
|
+
|
347
|
+
header_params = {
|
348
|
+
"name" => request.name
|
349
|
+
}
|
350
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
351
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
352
|
+
|
353
|
+
options.apply_defaults timeout: @config.rpcs.get_group.timeout,
|
354
|
+
metadata: metadata,
|
355
|
+
retry_policy: @config.rpcs.get_group.retry_policy
|
356
|
+
options.apply_defaults metadata: @config.metadata,
|
357
|
+
retry_policy: @config.retry_policy
|
358
|
+
|
359
|
+
@group_service_stub.call_rpc :get_group, request, options: options do |response, operation|
|
360
|
+
yield response, operation if block_given?
|
361
|
+
return response
|
362
|
+
end
|
363
|
+
rescue ::GRPC::BadStatus => e
|
364
|
+
raise ::Google::Cloud::Error.from_error(e)
|
365
|
+
end
|
366
|
+
|
367
|
+
##
|
368
|
+
# Creates a new group.
|
369
|
+
#
|
370
|
+
# @overload create_group(request, options = nil)
|
371
|
+
# Pass arguments to `create_group` via a request object, either of type
|
372
|
+
# {::Google::Cloud::Monitoring::V3::CreateGroupRequest} or an equivalent Hash.
|
373
|
+
#
|
374
|
+
# @param request [::Google::Cloud::Monitoring::V3::CreateGroupRequest, ::Hash]
|
375
|
+
# A request object representing the call parameters. Required. To specify no
|
376
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
377
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
378
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
379
|
+
#
|
380
|
+
# @overload create_group(name: nil, group: nil, validate_only: nil)
|
381
|
+
# Pass arguments to `create_group` via keyword arguments. Note that at
|
382
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
383
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
384
|
+
#
|
385
|
+
# @param name [::String]
|
386
|
+
# Required. The project in which to create the group. The format is:
|
387
|
+
#
|
388
|
+
# projects/[PROJECT_ID_OR_NUMBER]
|
389
|
+
# @param group [::Google::Cloud::Monitoring::V3::Group, ::Hash]
|
390
|
+
# Required. A group definition. It is an error to define the `name` field because
|
391
|
+
# the system assigns the name.
|
392
|
+
# @param validate_only [::Boolean]
|
393
|
+
# If true, validate this request but do not create the group.
|
394
|
+
#
|
395
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
396
|
+
# @yieldparam response [::Google::Cloud::Monitoring::V3::Group]
|
397
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
398
|
+
#
|
399
|
+
# @return [::Google::Cloud::Monitoring::V3::Group]
|
400
|
+
#
|
401
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
402
|
+
#
|
403
|
+
def create_group request, options = nil
|
404
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
405
|
+
|
406
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Monitoring::V3::CreateGroupRequest
|
407
|
+
|
408
|
+
# Converts hash and nil to an options object
|
409
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
410
|
+
|
411
|
+
# Customize the options with defaults
|
412
|
+
metadata = @config.rpcs.create_group.metadata.to_h
|
413
|
+
|
414
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
415
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
416
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
417
|
+
gapic_version: ::Google::Cloud::Monitoring::V3::VERSION
|
418
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
419
|
+
|
420
|
+
header_params = {
|
421
|
+
"name" => request.name
|
422
|
+
}
|
423
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
424
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
425
|
+
|
426
|
+
options.apply_defaults timeout: @config.rpcs.create_group.timeout,
|
427
|
+
metadata: metadata,
|
428
|
+
retry_policy: @config.rpcs.create_group.retry_policy
|
429
|
+
options.apply_defaults metadata: @config.metadata,
|
430
|
+
retry_policy: @config.retry_policy
|
431
|
+
|
432
|
+
@group_service_stub.call_rpc :create_group, request, options: options do |response, operation|
|
433
|
+
yield response, operation if block_given?
|
434
|
+
return response
|
435
|
+
end
|
436
|
+
rescue ::GRPC::BadStatus => e
|
437
|
+
raise ::Google::Cloud::Error.from_error(e)
|
438
|
+
end
|
439
|
+
|
440
|
+
##
|
441
|
+
# Updates an existing group.
|
442
|
+
# You can change any group attributes except `name`.
|
443
|
+
#
|
444
|
+
# @overload update_group(request, options = nil)
|
445
|
+
# Pass arguments to `update_group` via a request object, either of type
|
446
|
+
# {::Google::Cloud::Monitoring::V3::UpdateGroupRequest} or an equivalent Hash.
|
447
|
+
#
|
448
|
+
# @param request [::Google::Cloud::Monitoring::V3::UpdateGroupRequest, ::Hash]
|
449
|
+
# A request object representing the call parameters. Required. To specify no
|
450
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
451
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
452
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
453
|
+
#
|
454
|
+
# @overload update_group(group: nil, validate_only: nil)
|
455
|
+
# Pass arguments to `update_group` via keyword arguments. Note that at
|
456
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
457
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
458
|
+
#
|
459
|
+
# @param group [::Google::Cloud::Monitoring::V3::Group, ::Hash]
|
460
|
+
# Required. The new definition of the group. All fields of the existing group,
|
461
|
+
# excepting `name`, are replaced with the corresponding fields of this group.
|
462
|
+
# @param validate_only [::Boolean]
|
463
|
+
# If true, validate this request but do not update the existing group.
|
464
|
+
#
|
465
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
466
|
+
# @yieldparam response [::Google::Cloud::Monitoring::V3::Group]
|
467
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
468
|
+
#
|
469
|
+
# @return [::Google::Cloud::Monitoring::V3::Group]
|
470
|
+
#
|
471
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
472
|
+
#
|
473
|
+
def update_group request, options = nil
|
474
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
475
|
+
|
476
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Monitoring::V3::UpdateGroupRequest
|
477
|
+
|
478
|
+
# Converts hash and nil to an options object
|
479
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
480
|
+
|
481
|
+
# Customize the options with defaults
|
482
|
+
metadata = @config.rpcs.update_group.metadata.to_h
|
483
|
+
|
484
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
485
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
486
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
487
|
+
gapic_version: ::Google::Cloud::Monitoring::V3::VERSION
|
488
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
489
|
+
|
490
|
+
header_params = {
|
491
|
+
"group.name" => request.group.name
|
492
|
+
}
|
493
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
494
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
495
|
+
|
496
|
+
options.apply_defaults timeout: @config.rpcs.update_group.timeout,
|
497
|
+
metadata: metadata,
|
498
|
+
retry_policy: @config.rpcs.update_group.retry_policy
|
499
|
+
options.apply_defaults metadata: @config.metadata,
|
500
|
+
retry_policy: @config.retry_policy
|
501
|
+
|
502
|
+
@group_service_stub.call_rpc :update_group, request, options: options do |response, operation|
|
503
|
+
yield response, operation if block_given?
|
504
|
+
return response
|
505
|
+
end
|
506
|
+
rescue ::GRPC::BadStatus => e
|
507
|
+
raise ::Google::Cloud::Error.from_error(e)
|
508
|
+
end
|
509
|
+
|
510
|
+
##
|
511
|
+
# Deletes an existing group.
|
512
|
+
#
|
513
|
+
# @overload delete_group(request, options = nil)
|
514
|
+
# Pass arguments to `delete_group` via a request object, either of type
|
515
|
+
# {::Google::Cloud::Monitoring::V3::DeleteGroupRequest} or an equivalent Hash.
|
516
|
+
#
|
517
|
+
# @param request [::Google::Cloud::Monitoring::V3::DeleteGroupRequest, ::Hash]
|
518
|
+
# A request object representing the call parameters. Required. To specify no
|
519
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
520
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
521
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
522
|
+
#
|
523
|
+
# @overload delete_group(name: nil, recursive: nil)
|
524
|
+
# Pass arguments to `delete_group` via keyword arguments. Note that at
|
525
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
526
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
527
|
+
#
|
528
|
+
# @param name [::String]
|
529
|
+
# Required. The group to delete. The format is:
|
530
|
+
#
|
531
|
+
# projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID]
|
532
|
+
# @param recursive [::Boolean]
|
533
|
+
# If this field is true, then the request means to delete a group with all
|
534
|
+
# its descendants. Otherwise, the request means to delete a group only when
|
535
|
+
# it has no descendants. The default value is false.
|
536
|
+
#
|
537
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
538
|
+
# @yieldparam response [::Google::Protobuf::Empty]
|
539
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
540
|
+
#
|
541
|
+
# @return [::Google::Protobuf::Empty]
|
542
|
+
#
|
543
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
544
|
+
#
|
545
|
+
def delete_group request, options = nil
|
546
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
547
|
+
|
548
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Monitoring::V3::DeleteGroupRequest
|
549
|
+
|
550
|
+
# Converts hash and nil to an options object
|
551
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
552
|
+
|
553
|
+
# Customize the options with defaults
|
554
|
+
metadata = @config.rpcs.delete_group.metadata.to_h
|
555
|
+
|
556
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
557
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
558
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
559
|
+
gapic_version: ::Google::Cloud::Monitoring::V3::VERSION
|
560
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
561
|
+
|
562
|
+
header_params = {
|
563
|
+
"name" => request.name
|
564
|
+
}
|
565
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
566
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
567
|
+
|
568
|
+
options.apply_defaults timeout: @config.rpcs.delete_group.timeout,
|
569
|
+
metadata: metadata,
|
570
|
+
retry_policy: @config.rpcs.delete_group.retry_policy
|
571
|
+
options.apply_defaults metadata: @config.metadata,
|
572
|
+
retry_policy: @config.retry_policy
|
573
|
+
|
574
|
+
@group_service_stub.call_rpc :delete_group, request, options: options do |response, operation|
|
575
|
+
yield response, operation if block_given?
|
576
|
+
return response
|
577
|
+
end
|
578
|
+
rescue ::GRPC::BadStatus => e
|
579
|
+
raise ::Google::Cloud::Error.from_error(e)
|
580
|
+
end
|
581
|
+
|
582
|
+
##
|
583
|
+
# Lists the monitored resources that are members of a group.
|
584
|
+
#
|
585
|
+
# @overload list_group_members(request, options = nil)
|
586
|
+
# Pass arguments to `list_group_members` via a request object, either of type
|
587
|
+
# {::Google::Cloud::Monitoring::V3::ListGroupMembersRequest} or an equivalent Hash.
|
588
|
+
#
|
589
|
+
# @param request [::Google::Cloud::Monitoring::V3::ListGroupMembersRequest, ::Hash]
|
590
|
+
# A request object representing the call parameters. Required. To specify no
|
591
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
592
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
593
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
594
|
+
#
|
595
|
+
# @overload list_group_members(name: nil, page_size: nil, page_token: nil, filter: nil, interval: nil)
|
596
|
+
# Pass arguments to `list_group_members` via keyword arguments. Note that at
|
597
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
598
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
599
|
+
#
|
600
|
+
# @param name [::String]
|
601
|
+
# Required. The group whose members are listed. The format is:
|
602
|
+
#
|
603
|
+
# projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID]
|
604
|
+
# @param page_size [::Integer]
|
605
|
+
# A positive number that is the maximum number of results to return.
|
606
|
+
# @param page_token [::String]
|
607
|
+
# If this field is not empty then it must contain the `next_page_token` value
|
608
|
+
# returned by a previous call to this method. Using this field causes the
|
609
|
+
# method to return additional results from the previous method call.
|
610
|
+
# @param filter [::String]
|
611
|
+
# An optional [list
|
612
|
+
# filter](https://cloud.google.com/monitoring/api/learn_more#filtering)
|
613
|
+
# describing the members to be returned. The filter may reference the type,
|
614
|
+
# labels, and metadata of monitored resources that comprise the group. For
|
615
|
+
# example, to return only resources representing Compute Engine VM instances,
|
616
|
+
# use this filter:
|
617
|
+
#
|
618
|
+
# `resource.type = "gce_instance"`
|
619
|
+
# @param interval [::Google::Cloud::Monitoring::V3::TimeInterval, ::Hash]
|
620
|
+
# An optional time interval for which results should be returned. Only
|
621
|
+
# members that were part of the group during the specified interval are
|
622
|
+
# included in the response. If no interval is provided then the group
|
623
|
+
# membership over the last minute is returned.
|
624
|
+
#
|
625
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
626
|
+
# @yieldparam response [::Gapic::PagedEnumerable<::Google::Api::MonitoredResource>]
|
627
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
628
|
+
#
|
629
|
+
# @return [::Gapic::PagedEnumerable<::Google::Api::MonitoredResource>]
|
630
|
+
#
|
631
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
632
|
+
#
|
633
|
+
def list_group_members request, options = nil
|
634
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
635
|
+
|
636
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Monitoring::V3::ListGroupMembersRequest
|
637
|
+
|
638
|
+
# Converts hash and nil to an options object
|
639
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
640
|
+
|
641
|
+
# Customize the options with defaults
|
642
|
+
metadata = @config.rpcs.list_group_members.metadata.to_h
|
643
|
+
|
644
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
645
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
646
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
647
|
+
gapic_version: ::Google::Cloud::Monitoring::V3::VERSION
|
648
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
649
|
+
|
650
|
+
header_params = {
|
651
|
+
"name" => request.name
|
652
|
+
}
|
653
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
654
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
655
|
+
|
656
|
+
options.apply_defaults timeout: @config.rpcs.list_group_members.timeout,
|
657
|
+
metadata: metadata,
|
658
|
+
retry_policy: @config.rpcs.list_group_members.retry_policy
|
659
|
+
options.apply_defaults metadata: @config.metadata,
|
660
|
+
retry_policy: @config.retry_policy
|
661
|
+
|
662
|
+
@group_service_stub.call_rpc :list_group_members, request, options: options do |response, operation|
|
663
|
+
response = ::Gapic::PagedEnumerable.new @group_service_stub, :list_group_members, request, response, operation, options
|
664
|
+
yield response, operation if block_given?
|
665
|
+
return response
|
666
|
+
end
|
667
|
+
rescue ::GRPC::BadStatus => e
|
668
|
+
raise ::Google::Cloud::Error.from_error(e)
|
669
|
+
end
|
670
|
+
|
671
|
+
##
|
672
|
+
# Configuration class for the GroupService API.
|
673
|
+
#
|
674
|
+
# This class represents the configuration for GroupService,
|
675
|
+
# providing control over timeouts, retry behavior, logging, transport
|
676
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
677
|
+
# applied individually to specific RPCs. See
|
678
|
+
# {::Google::Cloud::Monitoring::V3::GroupService::Client::Configuration::Rpcs}
|
679
|
+
# for a list of RPCs that can be configured independently.
|
680
|
+
#
|
681
|
+
# Configuration can be applied globally to all clients, or to a single client
|
682
|
+
# on construction.
|
683
|
+
#
|
684
|
+
# # Examples
|
685
|
+
#
|
686
|
+
# To modify the global config, setting the timeout for list_groups
|
687
|
+
# to 20 seconds, and all remaining timeouts to 10 seconds:
|
688
|
+
#
|
689
|
+
# ::Google::Cloud::Monitoring::V3::GroupService::Client.configure do |config|
|
690
|
+
# config.timeout = 10.0
|
691
|
+
# config.rpcs.list_groups.timeout = 20.0
|
692
|
+
# end
|
693
|
+
#
|
694
|
+
# To apply the above configuration only to a new client:
|
695
|
+
#
|
696
|
+
# client = ::Google::Cloud::Monitoring::V3::GroupService::Client.new do |config|
|
697
|
+
# config.timeout = 10.0
|
698
|
+
# config.rpcs.list_groups.timeout = 20.0
|
699
|
+
# end
|
700
|
+
#
|
701
|
+
# @!attribute [rw] endpoint
|
702
|
+
# The hostname or hostname:port of the service endpoint.
|
703
|
+
# Defaults to `"monitoring.googleapis.com"`.
|
704
|
+
# @return [::String]
|
705
|
+
# @!attribute [rw] credentials
|
706
|
+
# Credentials to send with calls. You may provide any of the following types:
|
707
|
+
# * (`String`) The path to a service account key file in JSON format
|
708
|
+
# * (`Hash`) A service account key as a Hash
|
709
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
710
|
+
# (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
|
711
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
712
|
+
# (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
|
713
|
+
# * (`GRPC::Core::Channel`) a gRPC channel with included credentials
|
714
|
+
# * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
|
715
|
+
# * (`nil`) indicating no credentials
|
716
|
+
# @return [::Object]
|
717
|
+
# @!attribute [rw] scope
|
718
|
+
# The OAuth scopes
|
719
|
+
# @return [::Array<::String>]
|
720
|
+
# @!attribute [rw] lib_name
|
721
|
+
# The library name as recorded in instrumentation and logging
|
722
|
+
# @return [::String]
|
723
|
+
# @!attribute [rw] lib_version
|
724
|
+
# The library version as recorded in instrumentation and logging
|
725
|
+
# @return [::String]
|
726
|
+
# @!attribute [rw] channel_args
|
727
|
+
# Extra parameters passed to the gRPC channel. Note: this is ignored if a
|
728
|
+
# `GRPC::Core::Channel` object is provided as the credential.
|
729
|
+
# @return [::Hash]
|
730
|
+
# @!attribute [rw] interceptors
|
731
|
+
# An array of interceptors that are run before calls are executed.
|
732
|
+
# @return [::Array<::GRPC::ClientInterceptor>]
|
733
|
+
# @!attribute [rw] timeout
|
734
|
+
# The call timeout in seconds.
|
735
|
+
# @return [::Numeric]
|
736
|
+
# @!attribute [rw] metadata
|
737
|
+
# Additional gRPC headers to be sent with the call.
|
738
|
+
# @return [::Hash{::Symbol=>::String}]
|
739
|
+
# @!attribute [rw] retry_policy
|
740
|
+
# The retry policy. The value is a hash with the following keys:
|
741
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
742
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
743
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
744
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
745
|
+
# trigger a retry.
|
746
|
+
# @return [::Hash]
|
747
|
+
# @!attribute [rw] quota_project
|
748
|
+
# A separate project against which to charge quota.
|
749
|
+
# @return [::String]
|
750
|
+
#
|
751
|
+
class Configuration
|
752
|
+
extend ::Gapic::Config
|
753
|
+
|
754
|
+
config_attr :endpoint, "monitoring.googleapis.com", ::String
|
755
|
+
config_attr :credentials, nil do |value|
|
756
|
+
allowed = [::String, ::Hash, ::Proc, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
757
|
+
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
|
758
|
+
allowed.any? { |klass| klass === value }
|
759
|
+
end
|
760
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
761
|
+
config_attr :lib_name, nil, ::String, nil
|
762
|
+
config_attr :lib_version, nil, ::String, nil
|
763
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
|
764
|
+
config_attr :interceptors, nil, ::Array, nil
|
765
|
+
config_attr :timeout, nil, ::Numeric, nil
|
766
|
+
config_attr :metadata, nil, ::Hash, nil
|
767
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
768
|
+
config_attr :quota_project, nil, ::String, nil
|
769
|
+
|
770
|
+
# @private
|
771
|
+
def initialize parent_config = nil
|
772
|
+
@parent_config = parent_config unless parent_config.nil?
|
773
|
+
|
774
|
+
yield self if block_given?
|
775
|
+
end
|
776
|
+
|
777
|
+
##
|
778
|
+
# Configurations for individual RPCs
|
779
|
+
# @return [Rpcs]
|
780
|
+
#
|
781
|
+
def rpcs
|
782
|
+
@rpcs ||= begin
|
783
|
+
parent_rpcs = nil
|
784
|
+
parent_rpcs = @parent_config.rpcs if @parent_config&.respond_to? :rpcs
|
785
|
+
Rpcs.new parent_rpcs
|
786
|
+
end
|
787
|
+
end
|
788
|
+
|
789
|
+
##
|
790
|
+
# Configuration RPC class for the GroupService API.
|
791
|
+
#
|
792
|
+
# Includes fields providing the configuration for each RPC in this service.
|
793
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
794
|
+
# the following configuration fields:
|
795
|
+
#
|
796
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in milliseconds
|
797
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
798
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
799
|
+
# include the following keys:
|
800
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
801
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
802
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
803
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
804
|
+
# trigger a retry.
|
805
|
+
#
|
806
|
+
class Rpcs
|
807
|
+
##
|
808
|
+
# RPC-specific configuration for `list_groups`
|
809
|
+
# @return [::Gapic::Config::Method]
|
810
|
+
#
|
811
|
+
attr_reader :list_groups
|
812
|
+
##
|
813
|
+
# RPC-specific configuration for `get_group`
|
814
|
+
# @return [::Gapic::Config::Method]
|
815
|
+
#
|
816
|
+
attr_reader :get_group
|
817
|
+
##
|
818
|
+
# RPC-specific configuration for `create_group`
|
819
|
+
# @return [::Gapic::Config::Method]
|
820
|
+
#
|
821
|
+
attr_reader :create_group
|
822
|
+
##
|
823
|
+
# RPC-specific configuration for `update_group`
|
824
|
+
# @return [::Gapic::Config::Method]
|
825
|
+
#
|
826
|
+
attr_reader :update_group
|
827
|
+
##
|
828
|
+
# RPC-specific configuration for `delete_group`
|
829
|
+
# @return [::Gapic::Config::Method]
|
830
|
+
#
|
831
|
+
attr_reader :delete_group
|
832
|
+
##
|
833
|
+
# RPC-specific configuration for `list_group_members`
|
834
|
+
# @return [::Gapic::Config::Method]
|
835
|
+
#
|
836
|
+
attr_reader :list_group_members
|
837
|
+
|
838
|
+
# @private
|
839
|
+
def initialize parent_rpcs = nil
|
840
|
+
list_groups_config = parent_rpcs&.list_groups if parent_rpcs&.respond_to? :list_groups
|
841
|
+
@list_groups = ::Gapic::Config::Method.new list_groups_config
|
842
|
+
get_group_config = parent_rpcs&.get_group if parent_rpcs&.respond_to? :get_group
|
843
|
+
@get_group = ::Gapic::Config::Method.new get_group_config
|
844
|
+
create_group_config = parent_rpcs&.create_group if parent_rpcs&.respond_to? :create_group
|
845
|
+
@create_group = ::Gapic::Config::Method.new create_group_config
|
846
|
+
update_group_config = parent_rpcs&.update_group if parent_rpcs&.respond_to? :update_group
|
847
|
+
@update_group = ::Gapic::Config::Method.new update_group_config
|
848
|
+
delete_group_config = parent_rpcs&.delete_group if parent_rpcs&.respond_to? :delete_group
|
849
|
+
@delete_group = ::Gapic::Config::Method.new delete_group_config
|
850
|
+
list_group_members_config = parent_rpcs&.list_group_members if parent_rpcs&.respond_to? :list_group_members
|
851
|
+
@list_group_members = ::Gapic::Config::Method.new list_group_members_config
|
852
|
+
|
853
|
+
yield self if block_given?
|
854
|
+
end
|
855
|
+
end
|
856
|
+
end
|
857
|
+
end
|
858
|
+
end
|
859
|
+
end
|
860
|
+
end
|
861
|
+
end
|
862
|
+
end
|