google-cloud-monitoring 0.33.1 → 0.34.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 +4 -1
- data/lib/google/cloud/monitoring.rb +63 -1
- data/lib/google/cloud/monitoring/dashboard.rb +147 -0
- data/lib/google/cloud/monitoring/dashboard/v1.rb +148 -0
- data/lib/google/cloud/monitoring/dashboard/v1/credentials.rb +46 -0
- data/lib/google/cloud/monitoring/dashboard/v1/dashboards_service_client.rb +454 -0
- data/lib/google/cloud/monitoring/dashboard/v1/dashboards_service_client_config.json +51 -0
- data/lib/google/cloud/monitoring/dashboard/v1/doc/google/monitoring/dashboard/v1/common.rb +394 -0
- data/lib/google/cloud/monitoring/dashboard/v1/doc/google/monitoring/dashboard/v1/dashboard.rb +53 -0
- data/lib/google/cloud/monitoring/dashboard/v1/doc/google/monitoring/dashboard/v1/dashboards_service.rb +82 -0
- data/lib/google/cloud/monitoring/dashboard/v1/doc/google/monitoring/dashboard/v1/layouts.rb +71 -0
- data/lib/google/cloud/monitoring/dashboard/v1/doc/google/monitoring/dashboard/v1/metrics.rb +151 -0
- data/lib/google/cloud/monitoring/dashboard/v1/doc/google/monitoring/dashboard/v1/scorecard.rb +102 -0
- data/lib/google/cloud/monitoring/dashboard/v1/doc/google/monitoring/dashboard/v1/text.rb +43 -0
- data/lib/google/cloud/monitoring/dashboard/v1/doc/google/monitoring/dashboard/v1/widget.rb +41 -0
- data/lib/google/cloud/monitoring/dashboard/v1/doc/google/monitoring/dashboard/v1/xychart.rb +141 -0
- data/lib/google/cloud/monitoring/dashboard/v1/doc/google/protobuf/duration.rb +91 -0
- data/lib/google/cloud/monitoring/dashboard/v1/doc/google/protobuf/empty.rb +29 -0
- data/lib/google/cloud/monitoring/v3.rb +72 -1
- data/lib/google/cloud/monitoring/v3/alert_policy_service_client_config.json +5 -5
- data/lib/google/cloud/monitoring/v3/doc/google/api/metric.rb +29 -45
- data/lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/alert.rb +6 -8
- data/lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/metric.rb +8 -8
- data/lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/metric_service.rb +6 -4
- data/lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/service.rb +341 -0
- data/lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/service_service.rb +187 -0
- data/lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/uptime.rb +16 -12
- data/lib/google/cloud/monitoring/v3/group_service_client_config.json +6 -6
- data/lib/google/cloud/monitoring/v3/metric_service_client.rb +6 -4
- data/lib/google/cloud/monitoring/v3/metric_service_client_config.json +7 -7
- data/lib/google/cloud/monitoring/v3/notification_channel_service_client_config.json +10 -10
- data/lib/google/cloud/monitoring/v3/service_monitoring_service_client.rb +775 -0
- data/lib/google/cloud/monitoring/v3/service_monitoring_service_client_config.json +76 -0
- data/lib/google/cloud/monitoring/version.rb +1 -1
- data/lib/google/monitoring/dashboard/v1/common_pb.rb +95 -0
- data/lib/google/monitoring/dashboard/v1/dashboard_pb.rb +29 -0
- data/lib/google/monitoring/dashboard/v1/dashboards_service_pb.rb +51 -0
- data/lib/google/monitoring/dashboard/v1/dashboards_service_services_pb.rb +76 -0
- data/lib/google/monitoring/dashboard/v1/drilldowns_pb.rb +17 -0
- data/lib/google/monitoring/dashboard/v1/layouts_pb.rb +41 -0
- data/lib/google/monitoring/dashboard/v1/metrics_pb.rb +76 -0
- data/lib/google/monitoring/dashboard/v1/scorecard_pb.rb +38 -0
- data/lib/google/monitoring/dashboard/v1/service_pb.rb +17 -0
- data/lib/google/monitoring/dashboard/v1/text_pb.rb +28 -0
- data/lib/google/monitoring/dashboard/v1/widget_pb.rb +32 -0
- data/lib/google/monitoring/dashboard/v1/xychart_pb.rb +66 -0
- data/lib/google/monitoring/v3/metric_service_pb.rb +11 -0
- data/lib/google/monitoring/v3/notification_pb.rb +1 -0
- data/lib/google/monitoring/v3/service_pb.rb +141 -0
- data/lib/google/monitoring/v3/service_service_pb.rb +85 -0
- data/lib/google/monitoring/v3/service_service_services_pb.rb +66 -0
- metadata +37 -2
@@ -221,11 +221,15 @@ module Google
|
|
221
221
|
# construct the full URL. Required.
|
222
222
|
class TcpCheck; end
|
223
223
|
|
224
|
-
# Used to perform
|
225
|
-
# expressions, together with their negations.
|
224
|
+
# Optional. Used to perform content matching. This allows matching based on
|
225
|
+
# substrings and regular expressions, together with their negations. Only the
|
226
|
+
# first 4 MB of an HTTP or HTTPS check's response (and the first
|
227
|
+
# 1 MB of a TCP check's response) are examined for purposes of content
|
228
|
+
# matching.
|
226
229
|
# @!attribute [rw] content
|
227
230
|
# @return [String]
|
228
|
-
# String or regex content to match
|
231
|
+
# String or regex content to match. Maximum 1024 bytes. An empty `content`
|
232
|
+
# string indicates no content matching is to be performed.
|
229
233
|
# @!attribute [rw] matcher
|
230
234
|
# @return [Google::Monitoring::V3::UptimeCheckConfig::ContentMatcher::ContentMatcherOption]
|
231
235
|
# The type of content matcher that will be applied to the server output,
|
@@ -238,23 +242,23 @@ module Google
|
|
238
242
|
# Treated as `CONTAINS_STRING`.
|
239
243
|
CONTENT_MATCHER_OPTION_UNSPECIFIED = 0
|
240
244
|
|
241
|
-
# Selects substring matching
|
242
|
-
# the `content` string
|
245
|
+
# Selects substring matching. The match succeeds if the output contains
|
246
|
+
# the `content` string. This is the default value for checks without
|
243
247
|
# a `matcher` option, or where the value of `matcher` is
|
244
248
|
# `CONTENT_MATCHER_OPTION_UNSPECIFIED`.
|
245
249
|
CONTAINS_STRING = 1
|
246
250
|
|
247
|
-
# Selects negation of substring matching
|
248
|
-
# does
|
251
|
+
# Selects negation of substring matching. The match succeeds if the
|
252
|
+
# output does _NOT_ contain the `content` string.
|
249
253
|
NOT_CONTAINS_STRING = 2
|
250
254
|
|
251
|
-
# Selects regular
|
252
|
-
# matches the regular expression specified in the `content` string
|
255
|
+
# Selects regular-expression matching. The match succeeds of the output
|
256
|
+
# matches the regular expression specified in the `content` string.
|
253
257
|
MATCHES_REGEX = 3
|
254
258
|
|
255
|
-
# Selects negation of regular
|
256
|
-
# the output does
|
257
|
-
# `content` string
|
259
|
+
# Selects negation of regular-expression matching. The match succeeds if
|
260
|
+
# the output does _NOT_ match the regular expression specified in the
|
261
|
+
# `content` string.
|
258
262
|
NOT_MATCHES_REGEX = 4
|
259
263
|
end
|
260
264
|
end
|
@@ -21,32 +21,32 @@
|
|
21
21
|
},
|
22
22
|
"methods": {
|
23
23
|
"ListGroups": {
|
24
|
-
"timeout_millis":
|
24
|
+
"timeout_millis": 60000,
|
25
25
|
"retry_codes_name": "idempotent",
|
26
26
|
"retry_params_name": "default"
|
27
27
|
},
|
28
28
|
"GetGroup": {
|
29
|
-
"timeout_millis":
|
29
|
+
"timeout_millis": 60000,
|
30
30
|
"retry_codes_name": "idempotent",
|
31
31
|
"retry_params_name": "default"
|
32
32
|
},
|
33
33
|
"CreateGroup": {
|
34
|
-
"timeout_millis":
|
34
|
+
"timeout_millis": 60000,
|
35
35
|
"retry_codes_name": "non_idempotent",
|
36
36
|
"retry_params_name": "default"
|
37
37
|
},
|
38
38
|
"UpdateGroup": {
|
39
|
-
"timeout_millis":
|
39
|
+
"timeout_millis": 60000,
|
40
40
|
"retry_codes_name": "idempotent",
|
41
41
|
"retry_params_name": "default"
|
42
42
|
},
|
43
43
|
"DeleteGroup": {
|
44
|
-
"timeout_millis":
|
44
|
+
"timeout_millis": 60000,
|
45
45
|
"retry_codes_name": "idempotent",
|
46
46
|
"retry_params_name": "default"
|
47
47
|
},
|
48
48
|
"ListGroupMembers": {
|
49
|
-
"timeout_millis":
|
49
|
+
"timeout_millis": 60000,
|
50
50
|
"retry_codes_name": "idempotent",
|
51
51
|
"retry_params_name": "default"
|
52
52
|
}
|
@@ -602,14 +602,16 @@ module Google
|
|
602
602
|
# @param view [Google::Monitoring::V3::ListTimeSeriesRequest::TimeSeriesView]
|
603
603
|
# Specifies which information is returned about the time series.
|
604
604
|
# @param aggregation [Google::Monitoring::V3::Aggregation | Hash]
|
605
|
-
#
|
606
|
-
#
|
607
|
-
#
|
605
|
+
# Specifies the alignment of data points in individual time series as
|
606
|
+
# well as how to combine the retrieved time series across specified labels.
|
607
|
+
#
|
608
|
+
# By default (if no `aggregation` is explicitly specified), the raw time
|
609
|
+
# series data is returned.
|
608
610
|
# A hash of the same form as `Google::Monitoring::V3::Aggregation`
|
609
611
|
# can also be provided.
|
610
612
|
# @param order_by [String]
|
611
613
|
# Unsupported: must be left blank. The points in each time series are
|
612
|
-
# returned in reverse time order.
|
614
|
+
# currently returned in reverse time order (most recent to oldest).
|
613
615
|
# @param page_size [Integer]
|
614
616
|
# The maximum number of resources contained in the underlying API
|
615
617
|
# response. If page streaming is performed per-resource, this
|
@@ -21,37 +21,37 @@
|
|
21
21
|
},
|
22
22
|
"methods": {
|
23
23
|
"ListMonitoredResourceDescriptors": {
|
24
|
-
"timeout_millis":
|
24
|
+
"timeout_millis": 60000,
|
25
25
|
"retry_codes_name": "idempotent",
|
26
26
|
"retry_params_name": "default"
|
27
27
|
},
|
28
28
|
"GetMonitoredResourceDescriptor": {
|
29
|
-
"timeout_millis":
|
29
|
+
"timeout_millis": 60000,
|
30
30
|
"retry_codes_name": "idempotent",
|
31
31
|
"retry_params_name": "default"
|
32
32
|
},
|
33
33
|
"ListMetricDescriptors": {
|
34
|
-
"timeout_millis":
|
34
|
+
"timeout_millis": 60000,
|
35
35
|
"retry_codes_name": "idempotent",
|
36
36
|
"retry_params_name": "default"
|
37
37
|
},
|
38
38
|
"GetMetricDescriptor": {
|
39
|
-
"timeout_millis":
|
39
|
+
"timeout_millis": 60000,
|
40
40
|
"retry_codes_name": "idempotent",
|
41
41
|
"retry_params_name": "default"
|
42
42
|
},
|
43
43
|
"CreateMetricDescriptor": {
|
44
|
-
"timeout_millis":
|
44
|
+
"timeout_millis": 60000,
|
45
45
|
"retry_codes_name": "non_idempotent",
|
46
46
|
"retry_params_name": "default"
|
47
47
|
},
|
48
48
|
"DeleteMetricDescriptor": {
|
49
|
-
"timeout_millis":
|
49
|
+
"timeout_millis": 60000,
|
50
50
|
"retry_codes_name": "idempotent",
|
51
51
|
"retry_params_name": "default"
|
52
52
|
},
|
53
53
|
"ListTimeSeries": {
|
54
|
-
"timeout_millis":
|
54
|
+
"timeout_millis": 60000,
|
55
55
|
"retry_codes_name": "idempotent",
|
56
56
|
"retry_params_name": "default"
|
57
57
|
},
|
@@ -21,52 +21,52 @@
|
|
21
21
|
},
|
22
22
|
"methods": {
|
23
23
|
"ListNotificationChannelDescriptors": {
|
24
|
-
"timeout_millis":
|
24
|
+
"timeout_millis": 60000,
|
25
25
|
"retry_codes_name": "idempotent",
|
26
26
|
"retry_params_name": "default"
|
27
27
|
},
|
28
28
|
"GetNotificationChannelDescriptor": {
|
29
|
-
"timeout_millis":
|
29
|
+
"timeout_millis": 60000,
|
30
30
|
"retry_codes_name": "idempotent",
|
31
31
|
"retry_params_name": "default"
|
32
32
|
},
|
33
33
|
"ListNotificationChannels": {
|
34
|
-
"timeout_millis":
|
34
|
+
"timeout_millis": 60000,
|
35
35
|
"retry_codes_name": "idempotent",
|
36
36
|
"retry_params_name": "default"
|
37
37
|
},
|
38
38
|
"GetNotificationChannel": {
|
39
|
-
"timeout_millis":
|
39
|
+
"timeout_millis": 60000,
|
40
40
|
"retry_codes_name": "idempotent",
|
41
41
|
"retry_params_name": "default"
|
42
42
|
},
|
43
43
|
"CreateNotificationChannel": {
|
44
|
-
"timeout_millis":
|
44
|
+
"timeout_millis": 60000,
|
45
45
|
"retry_codes_name": "non_idempotent",
|
46
46
|
"retry_params_name": "default"
|
47
47
|
},
|
48
48
|
"UpdateNotificationChannel": {
|
49
|
-
"timeout_millis":
|
49
|
+
"timeout_millis": 60000,
|
50
50
|
"retry_codes_name": "non_idempotent",
|
51
51
|
"retry_params_name": "default"
|
52
52
|
},
|
53
53
|
"DeleteNotificationChannel": {
|
54
|
-
"timeout_millis":
|
54
|
+
"timeout_millis": 60000,
|
55
55
|
"retry_codes_name": "idempotent",
|
56
56
|
"retry_params_name": "default"
|
57
57
|
},
|
58
58
|
"SendNotificationChannelVerificationCode": {
|
59
|
-
"timeout_millis":
|
59
|
+
"timeout_millis": 60000,
|
60
60
|
"retry_codes_name": "non_idempotent",
|
61
61
|
"retry_params_name": "default"
|
62
62
|
},
|
63
63
|
"GetNotificationChannelVerificationCode": {
|
64
|
-
"timeout_millis":
|
64
|
+
"timeout_millis": 60000,
|
65
65
|
"retry_codes_name": "idempotent",
|
66
66
|
"retry_params_name": "default"
|
67
67
|
},
|
68
68
|
"VerifyNotificationChannel": {
|
69
|
-
"timeout_millis":
|
69
|
+
"timeout_millis": 60000,
|
70
70
|
"retry_codes_name": "idempotent",
|
71
71
|
"retry_params_name": "default"
|
72
72
|
}
|
@@ -0,0 +1,775 @@
|
|
1
|
+
# Copyright 2019 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/service_service.proto,
|
18
|
+
# and updates to that file get reflected here through a refresh process.
|
19
|
+
# For the short term, the refresh process will only be runnable by Google
|
20
|
+
# engineers.
|
21
|
+
|
22
|
+
|
23
|
+
require "json"
|
24
|
+
require "pathname"
|
25
|
+
|
26
|
+
require "google/gax"
|
27
|
+
|
28
|
+
require "google/monitoring/v3/service_service_pb"
|
29
|
+
require "google/cloud/monitoring/v3/credentials"
|
30
|
+
require "google/cloud/monitoring/version"
|
31
|
+
|
32
|
+
module Google
|
33
|
+
module Cloud
|
34
|
+
module Monitoring
|
35
|
+
module V3
|
36
|
+
# The Stackdriver Monitoring Service-Oriented Monitoring API has endpoints for
|
37
|
+
# managing and querying aspects of a workspace's services. These include the
|
38
|
+
# `Service`'s monitored resources, its Service-Level Objectives, and a taxonomy
|
39
|
+
# of categorized Health Metrics.
|
40
|
+
#
|
41
|
+
# @!attribute [r] service_monitoring_service_stub
|
42
|
+
# @return [Google::Monitoring::V3::ServiceMonitoringService::Stub]
|
43
|
+
class ServiceMonitoringServiceClient
|
44
|
+
# @private
|
45
|
+
attr_reader :service_monitoring_service_stub
|
46
|
+
|
47
|
+
# The default address of the service.
|
48
|
+
SERVICE_ADDRESS = "monitoring.googleapis.com".freeze
|
49
|
+
|
50
|
+
# The default port of the service.
|
51
|
+
DEFAULT_SERVICE_PORT = 443
|
52
|
+
|
53
|
+
# The default set of gRPC interceptors.
|
54
|
+
GRPC_INTERCEPTORS = []
|
55
|
+
|
56
|
+
DEFAULT_TIMEOUT = 30
|
57
|
+
|
58
|
+
PAGE_DESCRIPTORS = {
|
59
|
+
"list_services" => Google::Gax::PageDescriptor.new(
|
60
|
+
"page_token",
|
61
|
+
"next_page_token",
|
62
|
+
"services"),
|
63
|
+
"list_service_level_objectives" => Google::Gax::PageDescriptor.new(
|
64
|
+
"page_token",
|
65
|
+
"next_page_token",
|
66
|
+
"service_level_objectives")
|
67
|
+
}.freeze
|
68
|
+
|
69
|
+
private_constant :PAGE_DESCRIPTORS
|
70
|
+
|
71
|
+
# The scopes needed to make gRPC calls to all of the methods defined in
|
72
|
+
# this service.
|
73
|
+
ALL_SCOPES = [
|
74
|
+
"https://www.googleapis.com/auth/cloud-platform",
|
75
|
+
"https://www.googleapis.com/auth/monitoring",
|
76
|
+
"https://www.googleapis.com/auth/monitoring.read",
|
77
|
+
"https://www.googleapis.com/auth/monitoring.write"
|
78
|
+
].freeze
|
79
|
+
|
80
|
+
|
81
|
+
PROJECT_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
|
82
|
+
"projects/{project}"
|
83
|
+
)
|
84
|
+
|
85
|
+
private_constant :PROJECT_PATH_TEMPLATE
|
86
|
+
|
87
|
+
SERVICE_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
|
88
|
+
"projects/{project}/services/{service}"
|
89
|
+
)
|
90
|
+
|
91
|
+
private_constant :SERVICE_PATH_TEMPLATE
|
92
|
+
|
93
|
+
SERVICE_LEVEL_OBJECTIVE_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
|
94
|
+
"projects/{project}/services/{service}/serviceLevelObjectives/{service_level_objective}"
|
95
|
+
)
|
96
|
+
|
97
|
+
private_constant :SERVICE_LEVEL_OBJECTIVE_PATH_TEMPLATE
|
98
|
+
|
99
|
+
# Returns a fully-qualified project resource name string.
|
100
|
+
# @param project [String]
|
101
|
+
# @return [String]
|
102
|
+
def self.project_path project
|
103
|
+
PROJECT_PATH_TEMPLATE.render(
|
104
|
+
:"project" => project
|
105
|
+
)
|
106
|
+
end
|
107
|
+
|
108
|
+
# Returns a fully-qualified service resource name string.
|
109
|
+
# @param project [String]
|
110
|
+
# @param service [String]
|
111
|
+
# @return [String]
|
112
|
+
def self.service_path project, service
|
113
|
+
SERVICE_PATH_TEMPLATE.render(
|
114
|
+
:"project" => project,
|
115
|
+
:"service" => service
|
116
|
+
)
|
117
|
+
end
|
118
|
+
|
119
|
+
# Returns a fully-qualified service_level_objective resource name string.
|
120
|
+
# @param project [String]
|
121
|
+
# @param service [String]
|
122
|
+
# @param service_level_objective [String]
|
123
|
+
# @return [String]
|
124
|
+
def self.service_level_objective_path project, service, service_level_objective
|
125
|
+
SERVICE_LEVEL_OBJECTIVE_PATH_TEMPLATE.render(
|
126
|
+
:"project" => project,
|
127
|
+
:"service" => service,
|
128
|
+
:"service_level_objective" => service_level_objective
|
129
|
+
)
|
130
|
+
end
|
131
|
+
|
132
|
+
# @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
|
133
|
+
# Provides the means for authenticating requests made by the client. This parameter can
|
134
|
+
# be many types.
|
135
|
+
# A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
|
136
|
+
# authenticating requests made by this client.
|
137
|
+
# A `String` will be treated as the path to the keyfile to be used for the construction of
|
138
|
+
# credentials for this client.
|
139
|
+
# A `Hash` will be treated as the contents of a keyfile to be used for the construction of
|
140
|
+
# credentials for this client.
|
141
|
+
# A `GRPC::Core::Channel` will be used to make calls through.
|
142
|
+
# A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
|
143
|
+
# should already be composed with a `GRPC::Core::CallCredentials` object.
|
144
|
+
# A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
|
145
|
+
# metadata for requests, generally, to give OAuth credentials.
|
146
|
+
# @param scopes [Array<String>]
|
147
|
+
# The OAuth scopes for this service. This parameter is ignored if
|
148
|
+
# an updater_proc is supplied.
|
149
|
+
# @param client_config [Hash]
|
150
|
+
# A Hash for call options for each method. See
|
151
|
+
# Google::Gax#construct_settings for the structure of
|
152
|
+
# this data. Falls back to the default config if not specified
|
153
|
+
# or the specified config is missing data points.
|
154
|
+
# @param timeout [Numeric]
|
155
|
+
# The default timeout, in seconds, for calls made through this client.
|
156
|
+
# @param metadata [Hash]
|
157
|
+
# Default metadata to be sent with each request. This can be overridden on a per call basis.
|
158
|
+
# @param service_address [String]
|
159
|
+
# Override for the service hostname, or `nil` to leave as the default.
|
160
|
+
# @param service_port [Integer]
|
161
|
+
# Override for the service port, or `nil` to leave as the default.
|
162
|
+
# @param exception_transformer [Proc]
|
163
|
+
# An optional proc that intercepts any exceptions raised during an API call to inject
|
164
|
+
# custom error handling.
|
165
|
+
def initialize \
|
166
|
+
credentials: nil,
|
167
|
+
scopes: ALL_SCOPES,
|
168
|
+
client_config: {},
|
169
|
+
timeout: DEFAULT_TIMEOUT,
|
170
|
+
metadata: nil,
|
171
|
+
service_address: nil,
|
172
|
+
service_port: nil,
|
173
|
+
exception_transformer: nil,
|
174
|
+
lib_name: nil,
|
175
|
+
lib_version: ""
|
176
|
+
# These require statements are intentionally placed here to initialize
|
177
|
+
# the gRPC module only when it's required.
|
178
|
+
# See https://github.com/googleapis/toolkit/issues/446
|
179
|
+
require "google/gax/grpc"
|
180
|
+
require "google/monitoring/v3/service_service_services_pb"
|
181
|
+
|
182
|
+
credentials ||= Google::Cloud::Monitoring::V3::Credentials.default
|
183
|
+
|
184
|
+
if credentials.is_a?(String) || credentials.is_a?(Hash)
|
185
|
+
updater_proc = Google::Cloud::Monitoring::V3::Credentials.new(credentials).updater_proc
|
186
|
+
end
|
187
|
+
if credentials.is_a?(GRPC::Core::Channel)
|
188
|
+
channel = credentials
|
189
|
+
end
|
190
|
+
if credentials.is_a?(GRPC::Core::ChannelCredentials)
|
191
|
+
chan_creds = credentials
|
192
|
+
end
|
193
|
+
if credentials.is_a?(Proc)
|
194
|
+
updater_proc = credentials
|
195
|
+
end
|
196
|
+
if credentials.is_a?(Google::Auth::Credentials)
|
197
|
+
updater_proc = credentials.updater_proc
|
198
|
+
end
|
199
|
+
|
200
|
+
package_version = Google::Cloud::Monitoring::VERSION
|
201
|
+
|
202
|
+
google_api_client = "gl-ruby/#{RUBY_VERSION}"
|
203
|
+
google_api_client << " #{lib_name}/#{lib_version}" if lib_name
|
204
|
+
google_api_client << " gapic/#{package_version} gax/#{Google::Gax::VERSION}"
|
205
|
+
google_api_client << " grpc/#{GRPC::VERSION}"
|
206
|
+
google_api_client.freeze
|
207
|
+
|
208
|
+
headers = { :"x-goog-api-client" => google_api_client }
|
209
|
+
headers.merge!(metadata) unless metadata.nil?
|
210
|
+
client_config_file = Pathname.new(__dir__).join(
|
211
|
+
"service_monitoring_service_client_config.json"
|
212
|
+
)
|
213
|
+
defaults = client_config_file.open do |f|
|
214
|
+
Google::Gax.construct_settings(
|
215
|
+
"google.monitoring.v3.ServiceMonitoringService",
|
216
|
+
JSON.parse(f.read),
|
217
|
+
client_config,
|
218
|
+
Google::Gax::Grpc::STATUS_CODE_NAMES,
|
219
|
+
timeout,
|
220
|
+
page_descriptors: PAGE_DESCRIPTORS,
|
221
|
+
errors: Google::Gax::Grpc::API_ERRORS,
|
222
|
+
metadata: headers
|
223
|
+
)
|
224
|
+
end
|
225
|
+
|
226
|
+
# Allow overriding the service path/port in subclasses.
|
227
|
+
service_path = service_address || self.class::SERVICE_ADDRESS
|
228
|
+
port = service_port || self.class::DEFAULT_SERVICE_PORT
|
229
|
+
interceptors = self.class::GRPC_INTERCEPTORS
|
230
|
+
@service_monitoring_service_stub = Google::Gax::Grpc.create_stub(
|
231
|
+
service_path,
|
232
|
+
port,
|
233
|
+
chan_creds: chan_creds,
|
234
|
+
channel: channel,
|
235
|
+
updater_proc: updater_proc,
|
236
|
+
scopes: scopes,
|
237
|
+
interceptors: interceptors,
|
238
|
+
&Google::Monitoring::V3::ServiceMonitoringService::Stub.method(:new)
|
239
|
+
)
|
240
|
+
|
241
|
+
@create_service = Google::Gax.create_api_call(
|
242
|
+
@service_monitoring_service_stub.method(:create_service),
|
243
|
+
defaults["create_service"],
|
244
|
+
exception_transformer: exception_transformer,
|
245
|
+
params_extractor: proc do |request|
|
246
|
+
{'parent' => request.parent}
|
247
|
+
end
|
248
|
+
)
|
249
|
+
@get_service = Google::Gax.create_api_call(
|
250
|
+
@service_monitoring_service_stub.method(:get_service),
|
251
|
+
defaults["get_service"],
|
252
|
+
exception_transformer: exception_transformer,
|
253
|
+
params_extractor: proc do |request|
|
254
|
+
{'name' => request.name}
|
255
|
+
end
|
256
|
+
)
|
257
|
+
@list_services = Google::Gax.create_api_call(
|
258
|
+
@service_monitoring_service_stub.method(:list_services),
|
259
|
+
defaults["list_services"],
|
260
|
+
exception_transformer: exception_transformer,
|
261
|
+
params_extractor: proc do |request|
|
262
|
+
{'parent' => request.parent}
|
263
|
+
end
|
264
|
+
)
|
265
|
+
@update_service = Google::Gax.create_api_call(
|
266
|
+
@service_monitoring_service_stub.method(:update_service),
|
267
|
+
defaults["update_service"],
|
268
|
+
exception_transformer: exception_transformer,
|
269
|
+
params_extractor: proc do |request|
|
270
|
+
{'service.name' => request.service.name}
|
271
|
+
end
|
272
|
+
)
|
273
|
+
@delete_service = Google::Gax.create_api_call(
|
274
|
+
@service_monitoring_service_stub.method(:delete_service),
|
275
|
+
defaults["delete_service"],
|
276
|
+
exception_transformer: exception_transformer,
|
277
|
+
params_extractor: proc do |request|
|
278
|
+
{'name' => request.name}
|
279
|
+
end
|
280
|
+
)
|
281
|
+
@create_service_level_objective = Google::Gax.create_api_call(
|
282
|
+
@service_monitoring_service_stub.method(:create_service_level_objective),
|
283
|
+
defaults["create_service_level_objective"],
|
284
|
+
exception_transformer: exception_transformer,
|
285
|
+
params_extractor: proc do |request|
|
286
|
+
{'parent' => request.parent}
|
287
|
+
end
|
288
|
+
)
|
289
|
+
@get_service_level_objective = Google::Gax.create_api_call(
|
290
|
+
@service_monitoring_service_stub.method(:get_service_level_objective),
|
291
|
+
defaults["get_service_level_objective"],
|
292
|
+
exception_transformer: exception_transformer,
|
293
|
+
params_extractor: proc do |request|
|
294
|
+
{'name' => request.name}
|
295
|
+
end
|
296
|
+
)
|
297
|
+
@list_service_level_objectives = Google::Gax.create_api_call(
|
298
|
+
@service_monitoring_service_stub.method(:list_service_level_objectives),
|
299
|
+
defaults["list_service_level_objectives"],
|
300
|
+
exception_transformer: exception_transformer,
|
301
|
+
params_extractor: proc do |request|
|
302
|
+
{'parent' => request.parent}
|
303
|
+
end
|
304
|
+
)
|
305
|
+
@update_service_level_objective = Google::Gax.create_api_call(
|
306
|
+
@service_monitoring_service_stub.method(:update_service_level_objective),
|
307
|
+
defaults["update_service_level_objective"],
|
308
|
+
exception_transformer: exception_transformer,
|
309
|
+
params_extractor: proc do |request|
|
310
|
+
{'service_level_objective.name' => request.service_level_objective.name}
|
311
|
+
end
|
312
|
+
)
|
313
|
+
@delete_service_level_objective = Google::Gax.create_api_call(
|
314
|
+
@service_monitoring_service_stub.method(:delete_service_level_objective),
|
315
|
+
defaults["delete_service_level_objective"],
|
316
|
+
exception_transformer: exception_transformer,
|
317
|
+
params_extractor: proc do |request|
|
318
|
+
{'name' => request.name}
|
319
|
+
end
|
320
|
+
)
|
321
|
+
end
|
322
|
+
|
323
|
+
# Service calls
|
324
|
+
|
325
|
+
# Create a `Service`.
|
326
|
+
#
|
327
|
+
# @param parent [String]
|
328
|
+
# Resource name of the parent workspace.
|
329
|
+
# Of the form `projects/{project_id}`.
|
330
|
+
# @param service [Google::Monitoring::V3::Service | Hash]
|
331
|
+
# The `Service` to create.
|
332
|
+
# A hash of the same form as `Google::Monitoring::V3::Service`
|
333
|
+
# can also be provided.
|
334
|
+
# @param service_id [String]
|
335
|
+
# Optional. The Service id to use for this Service. If omitted, an id will be
|
336
|
+
# generated instead. Must match the pattern [a-z0-9\-]+
|
337
|
+
# @param options [Google::Gax::CallOptions]
|
338
|
+
# Overrides the default settings for this call, e.g, timeout,
|
339
|
+
# retries, etc.
|
340
|
+
# @yield [result, operation] Access the result along with the RPC operation
|
341
|
+
# @yieldparam result [Google::Monitoring::V3::Service]
|
342
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
343
|
+
# @return [Google::Monitoring::V3::Service]
|
344
|
+
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
345
|
+
# @example
|
346
|
+
# require "google/cloud/monitoring"
|
347
|
+
#
|
348
|
+
# service_monitoring_client = Google::Cloud::Monitoring::ServiceMonitoring.new(version: :v3)
|
349
|
+
# formatted_parent = Google::Cloud::Monitoring::V3::ServiceMonitoringServiceClient.project_path("[PROJECT]")
|
350
|
+
#
|
351
|
+
# # TODO: Initialize `service`:
|
352
|
+
# service = {}
|
353
|
+
# response = service_monitoring_client.create_service(formatted_parent, service)
|
354
|
+
|
355
|
+
def create_service \
|
356
|
+
parent,
|
357
|
+
service,
|
358
|
+
service_id: nil,
|
359
|
+
options: nil,
|
360
|
+
&block
|
361
|
+
req = {
|
362
|
+
parent: parent,
|
363
|
+
service: service,
|
364
|
+
service_id: service_id
|
365
|
+
}.delete_if { |_, v| v.nil? }
|
366
|
+
req = Google::Gax::to_proto(req, Google::Monitoring::V3::CreateServiceRequest)
|
367
|
+
@create_service.call(req, options, &block)
|
368
|
+
end
|
369
|
+
|
370
|
+
# Get the named `Service`.
|
371
|
+
#
|
372
|
+
# @param name [String]
|
373
|
+
# Resource name of the `Service`.
|
374
|
+
# Of the form `projects/{project_id}/services/{service_id}`.
|
375
|
+
# @param options [Google::Gax::CallOptions]
|
376
|
+
# Overrides the default settings for this call, e.g, timeout,
|
377
|
+
# retries, etc.
|
378
|
+
# @yield [result, operation] Access the result along with the RPC operation
|
379
|
+
# @yieldparam result [Google::Monitoring::V3::Service]
|
380
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
381
|
+
# @return [Google::Monitoring::V3::Service]
|
382
|
+
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
383
|
+
# @example
|
384
|
+
# require "google/cloud/monitoring"
|
385
|
+
#
|
386
|
+
# service_monitoring_client = Google::Cloud::Monitoring::ServiceMonitoring.new(version: :v3)
|
387
|
+
# formatted_name = Google::Cloud::Monitoring::V3::ServiceMonitoringServiceClient.service_path("[PROJECT]", "[SERVICE]")
|
388
|
+
# response = service_monitoring_client.get_service(formatted_name)
|
389
|
+
|
390
|
+
def get_service \
|
391
|
+
name,
|
392
|
+
options: nil,
|
393
|
+
&block
|
394
|
+
req = {
|
395
|
+
name: name
|
396
|
+
}.delete_if { |_, v| v.nil? }
|
397
|
+
req = Google::Gax::to_proto(req, Google::Monitoring::V3::GetServiceRequest)
|
398
|
+
@get_service.call(req, options, &block)
|
399
|
+
end
|
400
|
+
|
401
|
+
# List `Service`s for this workspace.
|
402
|
+
#
|
403
|
+
# @param parent [String]
|
404
|
+
# Resource name of the parent `Workspace`.
|
405
|
+
# Of the form `projects/{project_id}`.
|
406
|
+
# @param filter [String]
|
407
|
+
# A filter specifying what `Service`s to return. The filter currently
|
408
|
+
# supports the following fields:
|
409
|
+
#
|
410
|
+
# * `identifier_case`
|
411
|
+
# * `app_engine.module_id`
|
412
|
+
# * `cloud_endpoints.service`
|
413
|
+
# * `cluster_istio.location`
|
414
|
+
# * `cluster_istio.cluster_name`
|
415
|
+
# * `cluster_istio.service_namespace`
|
416
|
+
# * `cluster_istio.service_name`
|
417
|
+
#
|
418
|
+
# `identifier_case` refers to which option in the identifier oneof is
|
419
|
+
# populated. For example, the filter `identifier_case = "CUSTOM"` would match
|
420
|
+
# all services with a value for the `custom` field. Valid options are
|
421
|
+
# "CUSTOM", "APP_ENGINE", "CLOUD_ENDPOINTS", and "CLUSTER_ISTIO".
|
422
|
+
# @param page_size [Integer]
|
423
|
+
# The maximum number of resources contained in the underlying API
|
424
|
+
# response. If page streaming is performed per-resource, this
|
425
|
+
# parameter does not affect the return value. If page streaming is
|
426
|
+
# performed per-page, this determines the maximum number of
|
427
|
+
# resources in a page.
|
428
|
+
# @param options [Google::Gax::CallOptions]
|
429
|
+
# Overrides the default settings for this call, e.g, timeout,
|
430
|
+
# retries, etc.
|
431
|
+
# @yield [result, operation] Access the result along with the RPC operation
|
432
|
+
# @yieldparam result [Google::Gax::PagedEnumerable<Google::Monitoring::V3::Service>]
|
433
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
434
|
+
# @return [Google::Gax::PagedEnumerable<Google::Monitoring::V3::Service>]
|
435
|
+
# An enumerable of Google::Monitoring::V3::Service instances.
|
436
|
+
# See Google::Gax::PagedEnumerable documentation for other
|
437
|
+
# operations such as per-page iteration or access to the response
|
438
|
+
# object.
|
439
|
+
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
440
|
+
# @example
|
441
|
+
# require "google/cloud/monitoring"
|
442
|
+
#
|
443
|
+
# service_monitoring_client = Google::Cloud::Monitoring::ServiceMonitoring.new(version: :v3)
|
444
|
+
# formatted_parent = Google::Cloud::Monitoring::V3::ServiceMonitoringServiceClient.project_path("[PROJECT]")
|
445
|
+
#
|
446
|
+
# # Iterate over all results.
|
447
|
+
# service_monitoring_client.list_services(formatted_parent).each do |element|
|
448
|
+
# # Process element.
|
449
|
+
# end
|
450
|
+
#
|
451
|
+
# # Or iterate over results one page at a time.
|
452
|
+
# service_monitoring_client.list_services(formatted_parent).each_page do |page|
|
453
|
+
# # Process each page at a time.
|
454
|
+
# page.each do |element|
|
455
|
+
# # Process element.
|
456
|
+
# end
|
457
|
+
# end
|
458
|
+
|
459
|
+
def list_services \
|
460
|
+
parent,
|
461
|
+
filter: nil,
|
462
|
+
page_size: nil,
|
463
|
+
options: nil,
|
464
|
+
&block
|
465
|
+
req = {
|
466
|
+
parent: parent,
|
467
|
+
filter: filter,
|
468
|
+
page_size: page_size
|
469
|
+
}.delete_if { |_, v| v.nil? }
|
470
|
+
req = Google::Gax::to_proto(req, Google::Monitoring::V3::ListServicesRequest)
|
471
|
+
@list_services.call(req, options, &block)
|
472
|
+
end
|
473
|
+
|
474
|
+
# Update this `Service`.
|
475
|
+
#
|
476
|
+
# @param service [Google::Monitoring::V3::Service | Hash]
|
477
|
+
# The `Service` to draw updates from.
|
478
|
+
# The given `name` specifies the resource to update.
|
479
|
+
# A hash of the same form as `Google::Monitoring::V3::Service`
|
480
|
+
# can also be provided.
|
481
|
+
# @param update_mask [Google::Protobuf::FieldMask | Hash]
|
482
|
+
# A set of field paths defining which fields to use for the update.
|
483
|
+
# A hash of the same form as `Google::Protobuf::FieldMask`
|
484
|
+
# can also be provided.
|
485
|
+
# @param options [Google::Gax::CallOptions]
|
486
|
+
# Overrides the default settings for this call, e.g, timeout,
|
487
|
+
# retries, etc.
|
488
|
+
# @yield [result, operation] Access the result along with the RPC operation
|
489
|
+
# @yieldparam result [Google::Monitoring::V3::Service]
|
490
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
491
|
+
# @return [Google::Monitoring::V3::Service]
|
492
|
+
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
493
|
+
# @example
|
494
|
+
# require "google/cloud/monitoring"
|
495
|
+
#
|
496
|
+
# service_monitoring_client = Google::Cloud::Monitoring::ServiceMonitoring.new(version: :v3)
|
497
|
+
#
|
498
|
+
# # TODO: Initialize `service`:
|
499
|
+
# service = {}
|
500
|
+
# response = service_monitoring_client.update_service(service)
|
501
|
+
|
502
|
+
def update_service \
|
503
|
+
service,
|
504
|
+
update_mask: nil,
|
505
|
+
options: nil,
|
506
|
+
&block
|
507
|
+
req = {
|
508
|
+
service: service,
|
509
|
+
update_mask: update_mask
|
510
|
+
}.delete_if { |_, v| v.nil? }
|
511
|
+
req = Google::Gax::to_proto(req, Google::Monitoring::V3::UpdateServiceRequest)
|
512
|
+
@update_service.call(req, options, &block)
|
513
|
+
end
|
514
|
+
|
515
|
+
# Soft delete this `Service`.
|
516
|
+
#
|
517
|
+
# @param name [String]
|
518
|
+
# Resource name of the `Service` to delete.
|
519
|
+
# Of the form `projects/{project_id}/service/{service_id}`.
|
520
|
+
# @param options [Google::Gax::CallOptions]
|
521
|
+
# Overrides the default settings for this call, e.g, timeout,
|
522
|
+
# retries, etc.
|
523
|
+
# @yield [result, operation] Access the result along with the RPC operation
|
524
|
+
# @yieldparam result []
|
525
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
526
|
+
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
527
|
+
# @example
|
528
|
+
# require "google/cloud/monitoring"
|
529
|
+
#
|
530
|
+
# service_monitoring_client = Google::Cloud::Monitoring::ServiceMonitoring.new(version: :v3)
|
531
|
+
# formatted_name = Google::Cloud::Monitoring::V3::ServiceMonitoringServiceClient.service_path("[PROJECT]", "[SERVICE]")
|
532
|
+
# service_monitoring_client.delete_service(formatted_name)
|
533
|
+
|
534
|
+
def delete_service \
|
535
|
+
name,
|
536
|
+
options: nil,
|
537
|
+
&block
|
538
|
+
req = {
|
539
|
+
name: name
|
540
|
+
}.delete_if { |_, v| v.nil? }
|
541
|
+
req = Google::Gax::to_proto(req, Google::Monitoring::V3::DeleteServiceRequest)
|
542
|
+
@delete_service.call(req, options, &block)
|
543
|
+
nil
|
544
|
+
end
|
545
|
+
|
546
|
+
# Create a `ServiceLevelObjective` for the given `Service`.
|
547
|
+
#
|
548
|
+
# @param parent [String]
|
549
|
+
# Resource name of the parent `Service`.
|
550
|
+
# Of the form `projects/{project_id}/services/{service_id}`.
|
551
|
+
# @param service_level_objective [Google::Monitoring::V3::ServiceLevelObjective | Hash]
|
552
|
+
# The `ServiceLevelObjective` to create.
|
553
|
+
# The provided `name` will be respected if no `ServiceLevelObjective` exists
|
554
|
+
# with this name.
|
555
|
+
# A hash of the same form as `Google::Monitoring::V3::ServiceLevelObjective`
|
556
|
+
# can also be provided.
|
557
|
+
# @param service_level_objective_id [String]
|
558
|
+
# Optional. The ServiceLevelObjective id to use for this
|
559
|
+
# ServiceLevelObjective. If omitted, an id will be generated instead. Must
|
560
|
+
# match the pattern [a-z0-9\-]+
|
561
|
+
# @param options [Google::Gax::CallOptions]
|
562
|
+
# Overrides the default settings for this call, e.g, timeout,
|
563
|
+
# retries, etc.
|
564
|
+
# @yield [result, operation] Access the result along with the RPC operation
|
565
|
+
# @yieldparam result [Google::Monitoring::V3::ServiceLevelObjective]
|
566
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
567
|
+
# @return [Google::Monitoring::V3::ServiceLevelObjective]
|
568
|
+
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
569
|
+
# @example
|
570
|
+
# require "google/cloud/monitoring"
|
571
|
+
#
|
572
|
+
# service_monitoring_client = Google::Cloud::Monitoring::ServiceMonitoring.new(version: :v3)
|
573
|
+
# formatted_parent = Google::Cloud::Monitoring::V3::ServiceMonitoringServiceClient.service_path("[PROJECT]", "[SERVICE]")
|
574
|
+
#
|
575
|
+
# # TODO: Initialize `service_level_objective`:
|
576
|
+
# service_level_objective = {}
|
577
|
+
# response = service_monitoring_client.create_service_level_objective(formatted_parent, service_level_objective)
|
578
|
+
|
579
|
+
def create_service_level_objective \
|
580
|
+
parent,
|
581
|
+
service_level_objective,
|
582
|
+
service_level_objective_id: nil,
|
583
|
+
options: nil,
|
584
|
+
&block
|
585
|
+
req = {
|
586
|
+
parent: parent,
|
587
|
+
service_level_objective: service_level_objective,
|
588
|
+
service_level_objective_id: service_level_objective_id
|
589
|
+
}.delete_if { |_, v| v.nil? }
|
590
|
+
req = Google::Gax::to_proto(req, Google::Monitoring::V3::CreateServiceLevelObjectiveRequest)
|
591
|
+
@create_service_level_objective.call(req, options, &block)
|
592
|
+
end
|
593
|
+
|
594
|
+
# Get a `ServiceLevelObjective` by name.
|
595
|
+
#
|
596
|
+
# @param name [String]
|
597
|
+
# Resource name of the `ServiceLevelObjective` to get.
|
598
|
+
# Of the form
|
599
|
+
# `projects/{project_id}/services/{service_id}/serviceLevelObjectives/{slo_name}`.
|
600
|
+
# @param view [Google::Monitoring::V3::ServiceLevelObjective::View]
|
601
|
+
# View of the `ServiceLevelObjective` to return. If `DEFAULT`, return the
|
602
|
+
# `ServiceLevelObjective` as originally defined. If `EXPLICIT` and the
|
603
|
+
# `ServiceLevelObjective` is defined in terms of a `BasicSli`, replace the
|
604
|
+
# `BasicSli` with a `RequestBasedSli` spelling out how the SLI is computed.
|
605
|
+
# @param options [Google::Gax::CallOptions]
|
606
|
+
# Overrides the default settings for this call, e.g, timeout,
|
607
|
+
# retries, etc.
|
608
|
+
# @yield [result, operation] Access the result along with the RPC operation
|
609
|
+
# @yieldparam result [Google::Monitoring::V3::ServiceLevelObjective]
|
610
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
611
|
+
# @return [Google::Monitoring::V3::ServiceLevelObjective]
|
612
|
+
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
613
|
+
# @example
|
614
|
+
# require "google/cloud/monitoring"
|
615
|
+
#
|
616
|
+
# service_monitoring_client = Google::Cloud::Monitoring::ServiceMonitoring.new(version: :v3)
|
617
|
+
# formatted_name = Google::Cloud::Monitoring::V3::ServiceMonitoringServiceClient.service_level_objective_path("[PROJECT]", "[SERVICE]", "[SERVICE_LEVEL_OBJECTIVE]")
|
618
|
+
# response = service_monitoring_client.get_service_level_objective(formatted_name)
|
619
|
+
|
620
|
+
def get_service_level_objective \
|
621
|
+
name,
|
622
|
+
view: nil,
|
623
|
+
options: nil,
|
624
|
+
&block
|
625
|
+
req = {
|
626
|
+
name: name,
|
627
|
+
view: view
|
628
|
+
}.delete_if { |_, v| v.nil? }
|
629
|
+
req = Google::Gax::to_proto(req, Google::Monitoring::V3::GetServiceLevelObjectiveRequest)
|
630
|
+
@get_service_level_objective.call(req, options, &block)
|
631
|
+
end
|
632
|
+
|
633
|
+
# List the `ServiceLevelObjective`s for the given `Service`.
|
634
|
+
#
|
635
|
+
# @param parent [String]
|
636
|
+
# Resource name of the parent `Service`.
|
637
|
+
# Of the form `projects/{project_id}/services/{service_id}`.
|
638
|
+
# @param filter [String]
|
639
|
+
# A filter specifying what `ServiceLevelObjective`s to return.
|
640
|
+
# @param page_size [Integer]
|
641
|
+
# The maximum number of resources contained in the underlying API
|
642
|
+
# response. If page streaming is performed per-resource, this
|
643
|
+
# parameter does not affect the return value. If page streaming is
|
644
|
+
# performed per-page, this determines the maximum number of
|
645
|
+
# resources in a page.
|
646
|
+
# @param view [Google::Monitoring::V3::ServiceLevelObjective::View]
|
647
|
+
# View of the `ServiceLevelObjective`s to return. If `DEFAULT`, return each
|
648
|
+
# `ServiceLevelObjective` as originally defined. If `EXPLICIT` and the
|
649
|
+
# `ServiceLevelObjective` is defined in terms of a `BasicSli`, replace the
|
650
|
+
# `BasicSli` with a `RequestBasedSli` spelling out how the SLI is computed.
|
651
|
+
# @param options [Google::Gax::CallOptions]
|
652
|
+
# Overrides the default settings for this call, e.g, timeout,
|
653
|
+
# retries, etc.
|
654
|
+
# @yield [result, operation] Access the result along with the RPC operation
|
655
|
+
# @yieldparam result [Google::Gax::PagedEnumerable<Google::Monitoring::V3::ServiceLevelObjective>]
|
656
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
657
|
+
# @return [Google::Gax::PagedEnumerable<Google::Monitoring::V3::ServiceLevelObjective>]
|
658
|
+
# An enumerable of Google::Monitoring::V3::ServiceLevelObjective instances.
|
659
|
+
# See Google::Gax::PagedEnumerable documentation for other
|
660
|
+
# operations such as per-page iteration or access to the response
|
661
|
+
# object.
|
662
|
+
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
663
|
+
# @example
|
664
|
+
# require "google/cloud/monitoring"
|
665
|
+
#
|
666
|
+
# service_monitoring_client = Google::Cloud::Monitoring::ServiceMonitoring.new(version: :v3)
|
667
|
+
# formatted_parent = Google::Cloud::Monitoring::V3::ServiceMonitoringServiceClient.service_path("[PROJECT]", "[SERVICE]")
|
668
|
+
#
|
669
|
+
# # Iterate over all results.
|
670
|
+
# service_monitoring_client.list_service_level_objectives(formatted_parent).each do |element|
|
671
|
+
# # Process element.
|
672
|
+
# end
|
673
|
+
#
|
674
|
+
# # Or iterate over results one page at a time.
|
675
|
+
# service_monitoring_client.list_service_level_objectives(formatted_parent).each_page do |page|
|
676
|
+
# # Process each page at a time.
|
677
|
+
# page.each do |element|
|
678
|
+
# # Process element.
|
679
|
+
# end
|
680
|
+
# end
|
681
|
+
|
682
|
+
def list_service_level_objectives \
|
683
|
+
parent,
|
684
|
+
filter: nil,
|
685
|
+
page_size: nil,
|
686
|
+
view: nil,
|
687
|
+
options: nil,
|
688
|
+
&block
|
689
|
+
req = {
|
690
|
+
parent: parent,
|
691
|
+
filter: filter,
|
692
|
+
page_size: page_size,
|
693
|
+
view: view
|
694
|
+
}.delete_if { |_, v| v.nil? }
|
695
|
+
req = Google::Gax::to_proto(req, Google::Monitoring::V3::ListServiceLevelObjectivesRequest)
|
696
|
+
@list_service_level_objectives.call(req, options, &block)
|
697
|
+
end
|
698
|
+
|
699
|
+
# Update the given `ServiceLevelObjective`.
|
700
|
+
#
|
701
|
+
# @param service_level_objective [Google::Monitoring::V3::ServiceLevelObjective | Hash]
|
702
|
+
# The `ServiceLevelObjective` to draw updates from.
|
703
|
+
# The given `name` specifies the resource to update.
|
704
|
+
# A hash of the same form as `Google::Monitoring::V3::ServiceLevelObjective`
|
705
|
+
# can also be provided.
|
706
|
+
# @param update_mask [Google::Protobuf::FieldMask | Hash]
|
707
|
+
# A set of field paths defining which fields to use for the update.
|
708
|
+
# A hash of the same form as `Google::Protobuf::FieldMask`
|
709
|
+
# can also be provided.
|
710
|
+
# @param options [Google::Gax::CallOptions]
|
711
|
+
# Overrides the default settings for this call, e.g, timeout,
|
712
|
+
# retries, etc.
|
713
|
+
# @yield [result, operation] Access the result along with the RPC operation
|
714
|
+
# @yieldparam result [Google::Monitoring::V3::ServiceLevelObjective]
|
715
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
716
|
+
# @return [Google::Monitoring::V3::ServiceLevelObjective]
|
717
|
+
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
718
|
+
# @example
|
719
|
+
# require "google/cloud/monitoring"
|
720
|
+
#
|
721
|
+
# service_monitoring_client = Google::Cloud::Monitoring::ServiceMonitoring.new(version: :v3)
|
722
|
+
#
|
723
|
+
# # TODO: Initialize `service_level_objective`:
|
724
|
+
# service_level_objective = {}
|
725
|
+
# response = service_monitoring_client.update_service_level_objective(service_level_objective)
|
726
|
+
|
727
|
+
def update_service_level_objective \
|
728
|
+
service_level_objective,
|
729
|
+
update_mask: nil,
|
730
|
+
options: nil,
|
731
|
+
&block
|
732
|
+
req = {
|
733
|
+
service_level_objective: service_level_objective,
|
734
|
+
update_mask: update_mask
|
735
|
+
}.delete_if { |_, v| v.nil? }
|
736
|
+
req = Google::Gax::to_proto(req, Google::Monitoring::V3::UpdateServiceLevelObjectiveRequest)
|
737
|
+
@update_service_level_objective.call(req, options, &block)
|
738
|
+
end
|
739
|
+
|
740
|
+
# Delete the given `ServiceLevelObjective`.
|
741
|
+
#
|
742
|
+
# @param name [String]
|
743
|
+
# Resource name of the `ServiceLevelObjective` to delete.
|
744
|
+
# Of the form
|
745
|
+
# `projects/{project_id}/services/{service_id}/serviceLevelObjectives/{slo_name}`.
|
746
|
+
# @param options [Google::Gax::CallOptions]
|
747
|
+
# Overrides the default settings for this call, e.g, timeout,
|
748
|
+
# retries, etc.
|
749
|
+
# @yield [result, operation] Access the result along with the RPC operation
|
750
|
+
# @yieldparam result []
|
751
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
752
|
+
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
753
|
+
# @example
|
754
|
+
# require "google/cloud/monitoring"
|
755
|
+
#
|
756
|
+
# service_monitoring_client = Google::Cloud::Monitoring::ServiceMonitoring.new(version: :v3)
|
757
|
+
# formatted_name = Google::Cloud::Monitoring::V3::ServiceMonitoringServiceClient.service_level_objective_path("[PROJECT]", "[SERVICE]", "[SERVICE_LEVEL_OBJECTIVE]")
|
758
|
+
# service_monitoring_client.delete_service_level_objective(formatted_name)
|
759
|
+
|
760
|
+
def delete_service_level_objective \
|
761
|
+
name,
|
762
|
+
options: nil,
|
763
|
+
&block
|
764
|
+
req = {
|
765
|
+
name: name
|
766
|
+
}.delete_if { |_, v| v.nil? }
|
767
|
+
req = Google::Gax::to_proto(req, Google::Monitoring::V3::DeleteServiceLevelObjectiveRequest)
|
768
|
+
@delete_service_level_objective.call(req, options, &block)
|
769
|
+
nil
|
770
|
+
end
|
771
|
+
end
|
772
|
+
end
|
773
|
+
end
|
774
|
+
end
|
775
|
+
end
|