google-cloud-monitoring 0.27.0 → 0.28.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +17 -5
- data/lib/google/cloud/monitoring.rb +164 -6
- data/lib/google/cloud/monitoring/credentials.rb +1 -1
- data/lib/google/cloud/monitoring/v3.rb +167 -26
- data/lib/google/cloud/monitoring/v3/alert_policy_service_client.rb +486 -0
- data/lib/google/cloud/monitoring/v3/alert_policy_service_client_config.json +51 -0
- data/lib/google/cloud/monitoring/v3/doc/google/api/distribution.rb +1 -1
- data/lib/google/cloud/monitoring/v3/doc/google/api/label.rb +1 -1
- data/lib/google/cloud/monitoring/v3/doc/google/api/metric.rb +1 -1
- data/lib/google/cloud/monitoring/v3/doc/google/api/monitored_resource.rb +1 -1
- data/lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/alert.rb +326 -0
- data/lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/common.rb +91 -3
- data/lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/group.rb +1 -1
- data/lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/metric.rb +1 -1
- data/lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/mutation_record.rb +28 -0
- data/lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/notification.rb +152 -0
- data/lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/uptime.rb +223 -0
- data/lib/google/cloud/monitoring/v3/doc/google/protobuf/duration.rb +1 -1
- data/lib/google/cloud/monitoring/v3/doc/google/protobuf/field_mask.rb +223 -0
- data/lib/google/cloud/monitoring/v3/doc/google/protobuf/timestamp.rb +1 -1
- data/lib/google/cloud/monitoring/v3/doc/google/protobuf/wrappers.rb +89 -0
- data/lib/google/cloud/monitoring/v3/doc/overview.rb +8 -7
- data/lib/google/cloud/monitoring/v3/group_service_client.rb +13 -21
- data/lib/google/cloud/monitoring/v3/metric_service_client.rb +19 -21
- data/lib/google/cloud/monitoring/v3/notification_channel_service_client.rb +557 -0
- data/lib/google/cloud/monitoring/v3/notification_channel_service_client_config.json +61 -0
- data/lib/google/cloud/monitoring/v3/uptime_check_service_client.rb +476 -0
- data/lib/google/cloud/monitoring/v3/uptime_check_service_client_config.json +56 -0
- data/lib/google/monitoring/v3/alert_pb.rb +78 -0
- data/lib/google/monitoring/v3/alert_service_pb.rb +49 -0
- data/lib/google/monitoring/v3/alert_service_services_pb.rb +62 -0
- data/lib/google/monitoring/v3/common_pb.rb +20 -0
- data/lib/google/monitoring/v3/group_service_services_pb.rb +1 -1
- data/lib/google/monitoring/v3/metric_service_services_pb.rb +1 -1
- data/lib/google/monitoring/v3/mutation_record_pb.rb +20 -0
- data/lib/google/monitoring/v3/notification_pb.rb +44 -0
- data/lib/google/monitoring/v3/notification_service_pb.rb +85 -0
- data/lib/google/monitoring/v3/notification_service_services_pb.rb +93 -0
- data/lib/google/monitoring/v3/uptime_pb.rb +89 -0
- data/lib/google/monitoring/v3/uptime_service_pb.rb +57 -0
- data/lib/google/monitoring/v3/uptime_service_services_pb.rb +66 -0
- metadata +31 -9
@@ -0,0 +1,61 @@
|
|
1
|
+
{
|
2
|
+
"interfaces": {
|
3
|
+
"google.monitoring.v3.NotificationChannelService": {
|
4
|
+
"retry_codes": {
|
5
|
+
"idempotent": [
|
6
|
+
"DEADLINE_EXCEEDED",
|
7
|
+
"UNAVAILABLE"
|
8
|
+
],
|
9
|
+
"non_idempotent": []
|
10
|
+
},
|
11
|
+
"retry_params": {
|
12
|
+
"default": {
|
13
|
+
"initial_retry_delay_millis": 100,
|
14
|
+
"retry_delay_multiplier": 1.3,
|
15
|
+
"max_retry_delay_millis": 60000,
|
16
|
+
"initial_rpc_timeout_millis": 20000,
|
17
|
+
"rpc_timeout_multiplier": 1.0,
|
18
|
+
"max_rpc_timeout_millis": 20000,
|
19
|
+
"total_timeout_millis": 600000
|
20
|
+
}
|
21
|
+
},
|
22
|
+
"methods": {
|
23
|
+
"ListNotificationChannelDescriptors": {
|
24
|
+
"timeout_millis": 60000,
|
25
|
+
"retry_codes_name": "idempotent",
|
26
|
+
"retry_params_name": "default"
|
27
|
+
},
|
28
|
+
"GetNotificationChannelDescriptor": {
|
29
|
+
"timeout_millis": 60000,
|
30
|
+
"retry_codes_name": "idempotent",
|
31
|
+
"retry_params_name": "default"
|
32
|
+
},
|
33
|
+
"ListNotificationChannels": {
|
34
|
+
"timeout_millis": 60000,
|
35
|
+
"retry_codes_name": "idempotent",
|
36
|
+
"retry_params_name": "default"
|
37
|
+
},
|
38
|
+
"GetNotificationChannel": {
|
39
|
+
"timeout_millis": 60000,
|
40
|
+
"retry_codes_name": "idempotent",
|
41
|
+
"retry_params_name": "default"
|
42
|
+
},
|
43
|
+
"CreateNotificationChannel": {
|
44
|
+
"timeout_millis": 60000,
|
45
|
+
"retry_codes_name": "non_idempotent",
|
46
|
+
"retry_params_name": "default"
|
47
|
+
},
|
48
|
+
"UpdateNotificationChannel": {
|
49
|
+
"timeout_millis": 60000,
|
50
|
+
"retry_codes_name": "non_idempotent",
|
51
|
+
"retry_params_name": "default"
|
52
|
+
},
|
53
|
+
"DeleteNotificationChannel": {
|
54
|
+
"timeout_millis": 60000,
|
55
|
+
"retry_codes_name": "idempotent",
|
56
|
+
"retry_params_name": "default"
|
57
|
+
}
|
58
|
+
}
|
59
|
+
}
|
60
|
+
}
|
61
|
+
}
|
@@ -0,0 +1,476 @@
|
|
1
|
+
# Copyright 2018 Google LLC
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
#
|
15
|
+
# EDITING INSTRUCTIONS
|
16
|
+
# This file was generated from the file
|
17
|
+
# https://github.com/googleapis/googleapis/blob/master/google/monitoring/v3/uptime_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
|
+
require "json"
|
23
|
+
require "pathname"
|
24
|
+
|
25
|
+
require "google/gax"
|
26
|
+
|
27
|
+
require "google/monitoring/v3/uptime_service_pb"
|
28
|
+
require "google/cloud/monitoring/credentials"
|
29
|
+
|
30
|
+
module Google
|
31
|
+
module Cloud
|
32
|
+
module Monitoring
|
33
|
+
module V3
|
34
|
+
# The UptimeCheckService API is used to manage (list, create, delete, edit)
|
35
|
+
# uptime check configurations in the Stackdriver Monitoring product. An uptime
|
36
|
+
# check is a piece of configuration that determines which resources and
|
37
|
+
# services to monitor for availability. These configurations can also be
|
38
|
+
# configured interactively by navigating to the [Cloud Console]
|
39
|
+
# (http://console.cloud.google.com), selecting the appropriate project,
|
40
|
+
# clicking on "Monitoring" on the left-hand side to navigate to Stackdriver,
|
41
|
+
# and then clicking on "Uptime".
|
42
|
+
#
|
43
|
+
# @!attribute [r] uptime_check_service_stub
|
44
|
+
# @return [Google::Monitoring::V3::UptimeCheckService::Stub]
|
45
|
+
class UptimeCheckServiceClient
|
46
|
+
attr_reader :uptime_check_service_stub
|
47
|
+
|
48
|
+
# The default address of the service.
|
49
|
+
SERVICE_ADDRESS = "monitoring.googleapis.com".freeze
|
50
|
+
|
51
|
+
# The default port of the service.
|
52
|
+
DEFAULT_SERVICE_PORT = 443
|
53
|
+
|
54
|
+
DEFAULT_TIMEOUT = 30
|
55
|
+
|
56
|
+
PAGE_DESCRIPTORS = {
|
57
|
+
"list_uptime_check_configs" => Google::Gax::PageDescriptor.new(
|
58
|
+
"page_token",
|
59
|
+
"next_page_token",
|
60
|
+
"uptime_check_configs"),
|
61
|
+
"list_uptime_check_ips" => Google::Gax::PageDescriptor.new(
|
62
|
+
"page_token",
|
63
|
+
"next_page_token",
|
64
|
+
"uptime_check_ips")
|
65
|
+
}.freeze
|
66
|
+
|
67
|
+
private_constant :PAGE_DESCRIPTORS
|
68
|
+
|
69
|
+
# The scopes needed to make gRPC calls to all of the methods defined in
|
70
|
+
# this service.
|
71
|
+
ALL_SCOPES = [
|
72
|
+
"https://www.googleapis.com/auth/cloud-platform",
|
73
|
+
"https://www.googleapis.com/auth/monitoring",
|
74
|
+
"https://www.googleapis.com/auth/monitoring.read",
|
75
|
+
"https://www.googleapis.com/auth/monitoring.write"
|
76
|
+
].freeze
|
77
|
+
|
78
|
+
|
79
|
+
PROJECT_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
|
80
|
+
"projects/{project}"
|
81
|
+
)
|
82
|
+
|
83
|
+
private_constant :PROJECT_PATH_TEMPLATE
|
84
|
+
|
85
|
+
UPTIME_CHECK_CONFIG_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
|
86
|
+
"projects/{project}/uptimeCheckConfigs/{uptime_check_config}"
|
87
|
+
)
|
88
|
+
|
89
|
+
private_constant :UPTIME_CHECK_CONFIG_PATH_TEMPLATE
|
90
|
+
|
91
|
+
# Returns a fully-qualified project resource name string.
|
92
|
+
# @param project [String]
|
93
|
+
# @return [String]
|
94
|
+
def self.project_path project
|
95
|
+
PROJECT_PATH_TEMPLATE.render(
|
96
|
+
:"project" => project
|
97
|
+
)
|
98
|
+
end
|
99
|
+
|
100
|
+
# Returns a fully-qualified uptime_check_config resource name string.
|
101
|
+
# @param project [String]
|
102
|
+
# @param uptime_check_config [String]
|
103
|
+
# @return [String]
|
104
|
+
def self.uptime_check_config_path project, uptime_check_config
|
105
|
+
UPTIME_CHECK_CONFIG_PATH_TEMPLATE.render(
|
106
|
+
:"project" => project,
|
107
|
+
:"uptime_check_config" => uptime_check_config
|
108
|
+
)
|
109
|
+
end
|
110
|
+
|
111
|
+
# @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
|
112
|
+
# Provides the means for authenticating requests made by the client. This parameter can
|
113
|
+
# be many types.
|
114
|
+
# A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
|
115
|
+
# authenticating requests made by this client.
|
116
|
+
# A `String` will be treated as the path to the keyfile to be used for the construction of
|
117
|
+
# credentials for this client.
|
118
|
+
# A `Hash` will be treated as the contents of a keyfile to be used for the construction of
|
119
|
+
# credentials for this client.
|
120
|
+
# A `GRPC::Core::Channel` will be used to make calls through.
|
121
|
+
# A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
|
122
|
+
# should already be composed with a `GRPC::Core::CallCredentials` object.
|
123
|
+
# A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
|
124
|
+
# metadata for requests, generally, to give OAuth credentials.
|
125
|
+
# @param scopes [Array<String>]
|
126
|
+
# The OAuth scopes for this service. This parameter is ignored if
|
127
|
+
# an updater_proc is supplied.
|
128
|
+
# @param client_config [Hash]
|
129
|
+
# A Hash for call options for each method. See
|
130
|
+
# Google::Gax#construct_settings for the structure of
|
131
|
+
# this data. Falls back to the default config if not specified
|
132
|
+
# or the specified config is missing data points.
|
133
|
+
# @param timeout [Numeric]
|
134
|
+
# The default timeout, in seconds, for calls made through this client.
|
135
|
+
def initialize \
|
136
|
+
credentials: nil,
|
137
|
+
scopes: ALL_SCOPES,
|
138
|
+
client_config: {},
|
139
|
+
timeout: DEFAULT_TIMEOUT,
|
140
|
+
lib_name: nil,
|
141
|
+
lib_version: ""
|
142
|
+
# These require statements are intentionally placed here to initialize
|
143
|
+
# the gRPC module only when it's required.
|
144
|
+
# See https://github.com/googleapis/toolkit/issues/446
|
145
|
+
require "google/gax/grpc"
|
146
|
+
require "google/monitoring/v3/uptime_service_services_pb"
|
147
|
+
|
148
|
+
credentials ||= Google::Cloud::Monitoring::Credentials.default
|
149
|
+
|
150
|
+
if credentials.is_a?(String) || credentials.is_a?(Hash)
|
151
|
+
updater_proc = Google::Cloud::Monitoring::Credentials.new(credentials).updater_proc
|
152
|
+
end
|
153
|
+
if credentials.is_a?(GRPC::Core::Channel)
|
154
|
+
channel = credentials
|
155
|
+
end
|
156
|
+
if credentials.is_a?(GRPC::Core::ChannelCredentials)
|
157
|
+
chan_creds = credentials
|
158
|
+
end
|
159
|
+
if credentials.is_a?(Proc)
|
160
|
+
updater_proc = credentials
|
161
|
+
end
|
162
|
+
if credentials.is_a?(Google::Auth::Credentials)
|
163
|
+
updater_proc = credentials.updater_proc
|
164
|
+
end
|
165
|
+
|
166
|
+
package_version = Gem.loaded_specs['google-cloud-monitoring'].version.version
|
167
|
+
|
168
|
+
google_api_client = "gl-ruby/#{RUBY_VERSION}"
|
169
|
+
google_api_client << " #{lib_name}/#{lib_version}" if lib_name
|
170
|
+
google_api_client << " gapic/#{package_version} gax/#{Google::Gax::VERSION}"
|
171
|
+
google_api_client << " grpc/#{GRPC::VERSION}"
|
172
|
+
google_api_client.freeze
|
173
|
+
|
174
|
+
headers = { :"x-goog-api-client" => google_api_client }
|
175
|
+
client_config_file = Pathname.new(__dir__).join(
|
176
|
+
"uptime_check_service_client_config.json"
|
177
|
+
)
|
178
|
+
defaults = client_config_file.open do |f|
|
179
|
+
Google::Gax.construct_settings(
|
180
|
+
"google.monitoring.v3.UptimeCheckService",
|
181
|
+
JSON.parse(f.read),
|
182
|
+
client_config,
|
183
|
+
Google::Gax::Grpc::STATUS_CODE_NAMES,
|
184
|
+
timeout,
|
185
|
+
page_descriptors: PAGE_DESCRIPTORS,
|
186
|
+
errors: Google::Gax::Grpc::API_ERRORS,
|
187
|
+
kwargs: headers
|
188
|
+
)
|
189
|
+
end
|
190
|
+
|
191
|
+
# Allow overriding the service path/port in subclasses.
|
192
|
+
service_path = self.class::SERVICE_ADDRESS
|
193
|
+
port = self.class::DEFAULT_SERVICE_PORT
|
194
|
+
@uptime_check_service_stub = Google::Gax::Grpc.create_stub(
|
195
|
+
service_path,
|
196
|
+
port,
|
197
|
+
chan_creds: chan_creds,
|
198
|
+
channel: channel,
|
199
|
+
updater_proc: updater_proc,
|
200
|
+
scopes: scopes,
|
201
|
+
&Google::Monitoring::V3::UptimeCheckService::Stub.method(:new)
|
202
|
+
)
|
203
|
+
|
204
|
+
@list_uptime_check_configs = Google::Gax.create_api_call(
|
205
|
+
@uptime_check_service_stub.method(:list_uptime_check_configs),
|
206
|
+
defaults["list_uptime_check_configs"]
|
207
|
+
)
|
208
|
+
@get_uptime_check_config = Google::Gax.create_api_call(
|
209
|
+
@uptime_check_service_stub.method(:get_uptime_check_config),
|
210
|
+
defaults["get_uptime_check_config"]
|
211
|
+
)
|
212
|
+
@create_uptime_check_config = Google::Gax.create_api_call(
|
213
|
+
@uptime_check_service_stub.method(:create_uptime_check_config),
|
214
|
+
defaults["create_uptime_check_config"]
|
215
|
+
)
|
216
|
+
@update_uptime_check_config = Google::Gax.create_api_call(
|
217
|
+
@uptime_check_service_stub.method(:update_uptime_check_config),
|
218
|
+
defaults["update_uptime_check_config"]
|
219
|
+
)
|
220
|
+
@delete_uptime_check_config = Google::Gax.create_api_call(
|
221
|
+
@uptime_check_service_stub.method(:delete_uptime_check_config),
|
222
|
+
defaults["delete_uptime_check_config"]
|
223
|
+
)
|
224
|
+
@list_uptime_check_ips = Google::Gax.create_api_call(
|
225
|
+
@uptime_check_service_stub.method(:list_uptime_check_ips),
|
226
|
+
defaults["list_uptime_check_ips"]
|
227
|
+
)
|
228
|
+
end
|
229
|
+
|
230
|
+
# Service calls
|
231
|
+
|
232
|
+
# Lists the existing valid uptime check configurations for the project,
|
233
|
+
# leaving out any invalid configurations.
|
234
|
+
#
|
235
|
+
# @param parent [String]
|
236
|
+
# The project whose uptime check configurations are listed. The format is
|
237
|
+
#
|
238
|
+
# +projects/[PROJECT_ID]+.
|
239
|
+
# @param page_size [Integer]
|
240
|
+
# The maximum number of resources contained in the underlying API
|
241
|
+
# response. If page streaming is performed per-resource, this
|
242
|
+
# parameter does not affect the return value. If page streaming is
|
243
|
+
# performed per-page, this determines the maximum number of
|
244
|
+
# resources in a page.
|
245
|
+
# @param options [Google::Gax::CallOptions]
|
246
|
+
# Overrides the default settings for this call, e.g, timeout,
|
247
|
+
# retries, etc.
|
248
|
+
# @return [Google::Gax::PagedEnumerable<Google::Monitoring::V3::UptimeCheckConfig>]
|
249
|
+
# An enumerable of Google::Monitoring::V3::UptimeCheckConfig instances.
|
250
|
+
# See Google::Gax::PagedEnumerable documentation for other
|
251
|
+
# operations such as per-page iteration or access to the response
|
252
|
+
# object.
|
253
|
+
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
254
|
+
# @example
|
255
|
+
# require "google/cloud/monitoring/v3"
|
256
|
+
#
|
257
|
+
# uptime_check_service_client = Google::Cloud::Monitoring::V3::UptimeCheck.new
|
258
|
+
# formatted_parent = Google::Cloud::Monitoring::V3::UptimeCheckServiceClient.project_path("[PROJECT]")
|
259
|
+
#
|
260
|
+
# # Iterate over all results.
|
261
|
+
# uptime_check_service_client.list_uptime_check_configs(formatted_parent).each do |element|
|
262
|
+
# # Process element.
|
263
|
+
# end
|
264
|
+
#
|
265
|
+
# # Or iterate over results one page at a time.
|
266
|
+
# uptime_check_service_client.list_uptime_check_configs(formatted_parent).each_page do |page|
|
267
|
+
# # Process each page at a time.
|
268
|
+
# page.each do |element|
|
269
|
+
# # Process element.
|
270
|
+
# end
|
271
|
+
# end
|
272
|
+
|
273
|
+
def list_uptime_check_configs \
|
274
|
+
parent,
|
275
|
+
page_size: nil,
|
276
|
+
options: nil
|
277
|
+
req = {
|
278
|
+
parent: parent,
|
279
|
+
page_size: page_size
|
280
|
+
}.delete_if { |_, v| v.nil? }
|
281
|
+
req = Google::Gax::to_proto(req, Google::Monitoring::V3::ListUptimeCheckConfigsRequest)
|
282
|
+
@list_uptime_check_configs.call(req, options)
|
283
|
+
end
|
284
|
+
|
285
|
+
# Gets a single uptime check configuration.
|
286
|
+
#
|
287
|
+
# @param name [String]
|
288
|
+
# The uptime check configuration to retrieve. The format is
|
289
|
+
#
|
290
|
+
# +projects/[PROJECT_ID]/uptimeCheckConfigs/[UPTIME_CHECK_ID]+.
|
291
|
+
# @param options [Google::Gax::CallOptions]
|
292
|
+
# Overrides the default settings for this call, e.g, timeout,
|
293
|
+
# retries, etc.
|
294
|
+
# @return [Google::Monitoring::V3::UptimeCheckConfig]
|
295
|
+
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
296
|
+
# @example
|
297
|
+
# require "google/cloud/monitoring/v3"
|
298
|
+
#
|
299
|
+
# uptime_check_service_client = Google::Cloud::Monitoring::V3::UptimeCheck.new
|
300
|
+
# formatted_name = Google::Cloud::Monitoring::V3::UptimeCheckServiceClient.uptime_check_config_path("[PROJECT]", "[UPTIME_CHECK_CONFIG]")
|
301
|
+
# response = uptime_check_service_client.get_uptime_check_config(formatted_name)
|
302
|
+
|
303
|
+
def get_uptime_check_config \
|
304
|
+
name,
|
305
|
+
options: nil
|
306
|
+
req = {
|
307
|
+
name: name
|
308
|
+
}.delete_if { |_, v| v.nil? }
|
309
|
+
req = Google::Gax::to_proto(req, Google::Monitoring::V3::GetUptimeCheckConfigRequest)
|
310
|
+
@get_uptime_check_config.call(req, options)
|
311
|
+
end
|
312
|
+
|
313
|
+
# Creates a new uptime check configuration.
|
314
|
+
#
|
315
|
+
# @param parent [String]
|
316
|
+
# The project in which to create the uptime check. The format is:
|
317
|
+
#
|
318
|
+
# +projects/[PROJECT_ID]+.
|
319
|
+
# @param uptime_check_config [Google::Monitoring::V3::UptimeCheckConfig | Hash]
|
320
|
+
# The new uptime check configuration.
|
321
|
+
# A hash of the same form as `Google::Monitoring::V3::UptimeCheckConfig`
|
322
|
+
# can also be provided.
|
323
|
+
# @param options [Google::Gax::CallOptions]
|
324
|
+
# Overrides the default settings for this call, e.g, timeout,
|
325
|
+
# retries, etc.
|
326
|
+
# @return [Google::Monitoring::V3::UptimeCheckConfig]
|
327
|
+
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
328
|
+
# @example
|
329
|
+
# require "google/cloud/monitoring/v3"
|
330
|
+
#
|
331
|
+
# uptime_check_service_client = Google::Cloud::Monitoring::V3::UptimeCheck.new
|
332
|
+
# formatted_parent = Google::Cloud::Monitoring::V3::UptimeCheckServiceClient.project_path("[PROJECT]")
|
333
|
+
#
|
334
|
+
# # TODO: Initialize +uptime_check_config+:
|
335
|
+
# uptime_check_config = {}
|
336
|
+
# response = uptime_check_service_client.create_uptime_check_config(formatted_parent, uptime_check_config)
|
337
|
+
|
338
|
+
def create_uptime_check_config \
|
339
|
+
parent,
|
340
|
+
uptime_check_config,
|
341
|
+
options: nil
|
342
|
+
req = {
|
343
|
+
parent: parent,
|
344
|
+
uptime_check_config: uptime_check_config
|
345
|
+
}.delete_if { |_, v| v.nil? }
|
346
|
+
req = Google::Gax::to_proto(req, Google::Monitoring::V3::CreateUptimeCheckConfigRequest)
|
347
|
+
@create_uptime_check_config.call(req, options)
|
348
|
+
end
|
349
|
+
|
350
|
+
# Updates an uptime check configuration. You can either replace the entire
|
351
|
+
# configuration with a new one or replace only certain fields in the current
|
352
|
+
# configuration by specifying the fields to be updated via +"updateMask"+.
|
353
|
+
# Returns the updated configuration.
|
354
|
+
#
|
355
|
+
# @param uptime_check_config [Google::Monitoring::V3::UptimeCheckConfig | Hash]
|
356
|
+
# Required. If an +"updateMask"+ has been specified, this field gives
|
357
|
+
# the values for the set of fields mentioned in the +"updateMask"+. If an
|
358
|
+
# +"updateMask"+ has not been given, this uptime check configuration replaces
|
359
|
+
# the current configuration. If a field is mentioned in +"updateMask+" but
|
360
|
+
# the corresonding field is omitted in this partial uptime check
|
361
|
+
# configuration, it has the effect of deleting/clearing the field from the
|
362
|
+
# configuration on the server.
|
363
|
+
# A hash of the same form as `Google::Monitoring::V3::UptimeCheckConfig`
|
364
|
+
# can also be provided.
|
365
|
+
# @param update_mask [Google::Protobuf::FieldMask | Hash]
|
366
|
+
# Optional. If present, only the listed fields in the current uptime check
|
367
|
+
# configuration are updated with values from the new configuration. If this
|
368
|
+
# field is empty, then the current configuration is completely replaced with
|
369
|
+
# the new configuration.
|
370
|
+
# A hash of the same form as `Google::Protobuf::FieldMask`
|
371
|
+
# can also be provided.
|
372
|
+
# @param options [Google::Gax::CallOptions]
|
373
|
+
# Overrides the default settings for this call, e.g, timeout,
|
374
|
+
# retries, etc.
|
375
|
+
# @return [Google::Monitoring::V3::UptimeCheckConfig]
|
376
|
+
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
377
|
+
# @example
|
378
|
+
# require "google/cloud/monitoring/v3"
|
379
|
+
#
|
380
|
+
# uptime_check_service_client = Google::Cloud::Monitoring::V3::UptimeCheck.new
|
381
|
+
#
|
382
|
+
# # TODO: Initialize +uptime_check_config+:
|
383
|
+
# uptime_check_config = {}
|
384
|
+
# response = uptime_check_service_client.update_uptime_check_config(uptime_check_config)
|
385
|
+
|
386
|
+
def update_uptime_check_config \
|
387
|
+
uptime_check_config,
|
388
|
+
update_mask: nil,
|
389
|
+
options: nil
|
390
|
+
req = {
|
391
|
+
uptime_check_config: uptime_check_config,
|
392
|
+
update_mask: update_mask
|
393
|
+
}.delete_if { |_, v| v.nil? }
|
394
|
+
req = Google::Gax::to_proto(req, Google::Monitoring::V3::UpdateUptimeCheckConfigRequest)
|
395
|
+
@update_uptime_check_config.call(req, options)
|
396
|
+
end
|
397
|
+
|
398
|
+
# Deletes an uptime check configuration. Note that this method will fail
|
399
|
+
# if the uptime check configuration is referenced by an alert policy or
|
400
|
+
# other dependent configs that would be rendered invalid by the deletion.
|
401
|
+
#
|
402
|
+
# @param name [String]
|
403
|
+
# The uptime check configuration to delete. The format is
|
404
|
+
#
|
405
|
+
# +projects/[PROJECT_ID]/uptimeCheckConfigs/[UPTIME_CHECK_ID]+.
|
406
|
+
# @param options [Google::Gax::CallOptions]
|
407
|
+
# Overrides the default settings for this call, e.g, timeout,
|
408
|
+
# retries, etc.
|
409
|
+
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
410
|
+
# @example
|
411
|
+
# require "google/cloud/monitoring/v3"
|
412
|
+
#
|
413
|
+
# uptime_check_service_client = Google::Cloud::Monitoring::V3::UptimeCheck.new
|
414
|
+
# formatted_name = Google::Cloud::Monitoring::V3::UptimeCheckServiceClient.uptime_check_config_path("[PROJECT]", "[UPTIME_CHECK_CONFIG]")
|
415
|
+
# uptime_check_service_client.delete_uptime_check_config(formatted_name)
|
416
|
+
|
417
|
+
def delete_uptime_check_config \
|
418
|
+
name,
|
419
|
+
options: nil
|
420
|
+
req = {
|
421
|
+
name: name
|
422
|
+
}.delete_if { |_, v| v.nil? }
|
423
|
+
req = Google::Gax::to_proto(req, Google::Monitoring::V3::DeleteUptimeCheckConfigRequest)
|
424
|
+
@delete_uptime_check_config.call(req, options)
|
425
|
+
nil
|
426
|
+
end
|
427
|
+
|
428
|
+
# Returns the list of IPs that checkers run from
|
429
|
+
#
|
430
|
+
# @param page_size [Integer]
|
431
|
+
# The maximum number of resources contained in the underlying API
|
432
|
+
# response. If page streaming is performed per-resource, this
|
433
|
+
# parameter does not affect the return value. If page streaming is
|
434
|
+
# performed per-page, this determines the maximum number of
|
435
|
+
# resources in a page.
|
436
|
+
# @param options [Google::Gax::CallOptions]
|
437
|
+
# Overrides the default settings for this call, e.g, timeout,
|
438
|
+
# retries, etc.
|
439
|
+
# @return [Google::Gax::PagedEnumerable<Google::Monitoring::V3::UptimeCheckIp>]
|
440
|
+
# An enumerable of Google::Monitoring::V3::UptimeCheckIp instances.
|
441
|
+
# See Google::Gax::PagedEnumerable documentation for other
|
442
|
+
# operations such as per-page iteration or access to the response
|
443
|
+
# object.
|
444
|
+
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
445
|
+
# @example
|
446
|
+
# require "google/cloud/monitoring/v3"
|
447
|
+
#
|
448
|
+
# uptime_check_service_client = Google::Cloud::Monitoring::V3::UptimeCheck.new
|
449
|
+
#
|
450
|
+
# # Iterate over all results.
|
451
|
+
# uptime_check_service_client.list_uptime_check_ips.each do |element|
|
452
|
+
# # Process element.
|
453
|
+
# end
|
454
|
+
#
|
455
|
+
# # Or iterate over results one page at a time.
|
456
|
+
# uptime_check_service_client.list_uptime_check_ips.each_page do |page|
|
457
|
+
# # Process each page at a time.
|
458
|
+
# page.each do |element|
|
459
|
+
# # Process element.
|
460
|
+
# end
|
461
|
+
# end
|
462
|
+
|
463
|
+
def list_uptime_check_ips \
|
464
|
+
page_size: nil,
|
465
|
+
options: nil
|
466
|
+
req = {
|
467
|
+
page_size: page_size
|
468
|
+
}.delete_if { |_, v| v.nil? }
|
469
|
+
req = Google::Gax::to_proto(req, Google::Monitoring::V3::ListUptimeCheckIpsRequest)
|
470
|
+
@list_uptime_check_ips.call(req, options)
|
471
|
+
end
|
472
|
+
end
|
473
|
+
end
|
474
|
+
end
|
475
|
+
end
|
476
|
+
end
|