google-cloud-monitoring-v3 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (88) hide show
  1. checksums.yaml +7 -0
  2. data/.yardopts +12 -0
  3. data/AUTHENTICATION.md +169 -0
  4. data/LICENSE.md +203 -0
  5. data/README.md +71 -0
  6. data/lib/google-cloud-monitoring-v3.rb +21 -0
  7. data/lib/google/cloud/monitoring/v3.rb +40 -0
  8. data/lib/google/cloud/monitoring/v3/alert_policy_service.rb +57 -0
  9. data/lib/google/cloud/monitoring/v3/alert_policy_service/client.rb +772 -0
  10. data/lib/google/cloud/monitoring/v3/alert_policy_service/credentials.rb +53 -0
  11. data/lib/google/cloud/monitoring/v3/alert_policy_service/paths.rb +185 -0
  12. data/lib/google/cloud/monitoring/v3/group_service.rb +60 -0
  13. data/lib/google/cloud/monitoring/v3/group_service/client.rb +862 -0
  14. data/lib/google/cloud/monitoring/v3/group_service/credentials.rb +53 -0
  15. data/lib/google/cloud/monitoring/v3/group_service/paths.rb +127 -0
  16. data/lib/google/cloud/monitoring/v3/metric_service.rb +50 -0
  17. data/lib/google/cloud/monitoring/v3/metric_service/client.rb +1040 -0
  18. data/lib/google/cloud/monitoring/v3/metric_service/credentials.rb +54 -0
  19. data/lib/google/cloud/monitoring/v3/metric_service/paths.rb +179 -0
  20. data/lib/google/cloud/monitoring/v3/notification_channel_service.rb +50 -0
  21. data/lib/google/cloud/monitoring/v3/notification_channel_service/client.rb +1213 -0
  22. data/lib/google/cloud/monitoring/v3/notification_channel_service/credentials.rb +53 -0
  23. data/lib/google/cloud/monitoring/v3/notification_channel_service/paths.rb +179 -0
  24. data/lib/google/cloud/monitoring/v3/service_monitoring_service.rb +52 -0
  25. data/lib/google/cloud/monitoring/v3/service_monitoring_service/client.rb +1168 -0
  26. data/lib/google/cloud/monitoring/v3/service_monitoring_service/credentials.rb +53 -0
  27. data/lib/google/cloud/monitoring/v3/service_monitoring_service/paths.rb +185 -0
  28. data/lib/google/cloud/monitoring/v3/uptime_check_service.rb +56 -0
  29. data/lib/google/cloud/monitoring/v3/uptime_check_service/client.rb +822 -0
  30. data/lib/google/cloud/monitoring/v3/uptime_check_service/credentials.rb +53 -0
  31. data/lib/google/cloud/monitoring/v3/uptime_check_service/paths.rb +127 -0
  32. data/lib/google/cloud/monitoring/v3/version.rb +28 -0
  33. data/lib/google/monitoring/v3/alert_pb.rb +84 -0
  34. data/lib/google/monitoring/v3/alert_service_pb.rb +56 -0
  35. data/lib/google/monitoring/v3/alert_service_services_pb.rb +64 -0
  36. data/lib/google/monitoring/v3/common_pb.rb +98 -0
  37. data/lib/google/monitoring/v3/dropped_labels_pb.rb +22 -0
  38. data/lib/google/monitoring/v3/group_pb.rb +27 -0
  39. data/lib/google/monitoring/v3/group_service_pb.rb +76 -0
  40. data/lib/google/monitoring/v3/group_service_services_pb.rb +67 -0
  41. data/lib/google/monitoring/v3/metric_pb.rb +85 -0
  42. data/lib/google/monitoring/v3/metric_service_pb.rb +133 -0
  43. data/lib/google/monitoring/v3/metric_service_services_pb.rb +67 -0
  44. data/lib/google/monitoring/v3/mutation_record_pb.rb +24 -0
  45. data/lib/google/monitoring/v3/notification_pb.rb +50 -0
  46. data/lib/google/monitoring/v3/notification_service_pb.rb +93 -0
  47. data/lib/google/monitoring/v3/notification_service_services_pb.rb +95 -0
  48. data/lib/google/monitoring/v3/service_pb.rb +152 -0
  49. data/lib/google/monitoring/v3/service_service_pb.rb +89 -0
  50. data/lib/google/monitoring/v3/service_service_services_pb.rb +66 -0
  51. data/lib/google/monitoring/v3/span_context_pb.rb +22 -0
  52. data/lib/google/monitoring/v3/uptime_pb.rb +126 -0
  53. data/lib/google/monitoring/v3/uptime_service_pb.rb +66 -0
  54. data/lib/google/monitoring/v3/uptime_service_services_pb.rb +68 -0
  55. data/proto_docs/README.md +4 -0
  56. data/proto_docs/google/api/distribution.rb +225 -0
  57. data/proto_docs/google/api/field_behavior.rb +59 -0
  58. data/proto_docs/google/api/label.rb +49 -0
  59. data/proto_docs/google/api/launch_stage.rb +65 -0
  60. data/proto_docs/google/api/metric.rb +203 -0
  61. data/proto_docs/google/api/monitored_resource.rb +137 -0
  62. data/proto_docs/google/api/resource.rb +247 -0
  63. data/proto_docs/google/monitoring/v3/alert.rb +359 -0
  64. data/proto_docs/google/monitoring/v3/alert_service.rb +162 -0
  65. data/proto_docs/google/monitoring/v3/common.rb +464 -0
  66. data/proto_docs/google/monitoring/v3/dropped_labels.rb +58 -0
  67. data/proto_docs/google/monitoring/v3/group.rb +84 -0
  68. data/proto_docs/google/monitoring/v3/group_service.rb +197 -0
  69. data/proto_docs/google/monitoring/v3/metric.rb +249 -0
  70. data/proto_docs/google/monitoring/v3/metric_service.rb +366 -0
  71. data/proto_docs/google/monitoring/v3/mutation_record.rb +38 -0
  72. data/proto_docs/google/monitoring/v3/notification.rb +186 -0
  73. data/proto_docs/google/monitoring/v3/notification_service.rb +266 -0
  74. data/proto_docs/google/monitoring/v3/service.rb +424 -0
  75. data/proto_docs/google/monitoring/v3/service_service.rb +239 -0
  76. data/proto_docs/google/monitoring/v3/span_context.rb +49 -0
  77. data/proto_docs/google/monitoring/v3/uptime.rb +403 -0
  78. data/proto_docs/google/monitoring/v3/uptime_service.rb +166 -0
  79. data/proto_docs/google/protobuf/any.rb +138 -0
  80. data/proto_docs/google/protobuf/duration.rb +98 -0
  81. data/proto_docs/google/protobuf/empty.rb +36 -0
  82. data/proto_docs/google/protobuf/field_mask.rb +229 -0
  83. data/proto_docs/google/protobuf/struct.rb +96 -0
  84. data/proto_docs/google/protobuf/timestamp.rb +120 -0
  85. data/proto_docs/google/protobuf/wrappers.rb +121 -0
  86. data/proto_docs/google/rpc/status.rb +46 -0
  87. data/proto_docs/google/type/calendar_period.rb +55 -0
  88. 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 GroupService
26
+ # Credentials for the GroupService 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,127 @@
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 GroupService
25
+ # Path helper methods for the GroupService API.
26
+ module Paths
27
+ ##
28
+ # Create a fully-qualified Folder resource string.
29
+ #
30
+ # The resource will be in the following format:
31
+ #
32
+ # `folders/{folder}`
33
+ #
34
+ # @param folder [String]
35
+ #
36
+ # @return [::String]
37
+ def folder_path folder:
38
+ "folders/#{folder}"
39
+ end
40
+
41
+ ##
42
+ # Create a fully-qualified Group resource string.
43
+ #
44
+ # @overload group_path(project:, group:)
45
+ # The resource will be in the following format:
46
+ #
47
+ # `projects/{project}/groups/{group}`
48
+ #
49
+ # @param project [String]
50
+ # @param group [String]
51
+ #
52
+ # @overload group_path(organization:, group:)
53
+ # The resource will be in the following format:
54
+ #
55
+ # `organizations/{organization}/groups/{group}`
56
+ #
57
+ # @param organization [String]
58
+ # @param group [String]
59
+ #
60
+ # @overload group_path(folder:, group:)
61
+ # The resource will be in the following format:
62
+ #
63
+ # `folders/{folder}/groups/{group}`
64
+ #
65
+ # @param folder [String]
66
+ # @param group [String]
67
+ #
68
+ # @return [::String]
69
+ def group_path **args
70
+ resources = {
71
+ "group:project" => (proc do |project:, group:|
72
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
73
+
74
+ "projects/#{project}/groups/#{group}"
75
+ end),
76
+ "group:organization" => (proc do |organization:, group:|
77
+ raise ::ArgumentError, "organization cannot contain /" if organization.to_s.include? "/"
78
+
79
+ "organizations/#{organization}/groups/#{group}"
80
+ end),
81
+ "folder:group" => (proc do |folder:, group:|
82
+ raise ::ArgumentError, "folder cannot contain /" if folder.to_s.include? "/"
83
+
84
+ "folders/#{folder}/groups/#{group}"
85
+ end)
86
+ }
87
+
88
+ resource = resources[args.keys.sort.join(":")]
89
+ raise ::ArgumentError, "no resource found for values #{args.keys}" if resource.nil?
90
+ resource.call(**args)
91
+ end
92
+
93
+ ##
94
+ # Create a fully-qualified Organization resource string.
95
+ #
96
+ # The resource will be in the following format:
97
+ #
98
+ # `organizations/{organization}`
99
+ #
100
+ # @param organization [String]
101
+ #
102
+ # @return [::String]
103
+ def organization_path organization:
104
+ "organizations/#{organization}"
105
+ end
106
+
107
+ ##
108
+ # Create a fully-qualified Project resource string.
109
+ #
110
+ # The resource will be in the following format:
111
+ #
112
+ # `projects/{project}`
113
+ #
114
+ # @param project [String]
115
+ #
116
+ # @return [::String]
117
+ def project_path project:
118
+ "projects/#{project}"
119
+ end
120
+
121
+ extend self
122
+ end
123
+ end
124
+ end
125
+ end
126
+ end
127
+ end
@@ -0,0 +1,50 @@
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/metric_service/credentials"
26
+ require "google/cloud/monitoring/v3/metric_service/paths"
27
+ require "google/cloud/monitoring/v3/metric_service/client"
28
+
29
+ module Google
30
+ module Cloud
31
+ module Monitoring
32
+ module V3
33
+ ##
34
+ # Manages metric descriptors, monitored resource descriptors, and
35
+ # time series data.
36
+ #
37
+ # To load this service and instantiate a client:
38
+ #
39
+ # require "google/cloud/monitoring/v3/metric_service"
40
+ # client = ::Google::Cloud::Monitoring::V3::MetricService::Client.new
41
+ #
42
+ module MetricService
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
48
+
49
+ helper_path = ::File.join __dir__, "metric_service", "helpers.rb"
50
+ require "google/cloud/monitoring/v3/metric_service/helpers" if ::File.file? helper_path
@@ -0,0 +1,1040 @@
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/metric_service_pb"
21
+
22
+ module Google
23
+ module Cloud
24
+ module Monitoring
25
+ module V3
26
+ module MetricService
27
+ ##
28
+ # Client for the MetricService service.
29
+ #
30
+ # Manages metric descriptors, monitored resource descriptors, and
31
+ # time series data.
32
+ #
33
+ class Client
34
+ include Paths
35
+
36
+ # @private
37
+ attr_reader :metric_service_stub
38
+
39
+ ##
40
+ # Configure the MetricService Client class.
41
+ #
42
+ # See {::Google::Cloud::Monitoring::V3::MetricService::Client::Configuration}
43
+ # for a description of the configuration fields.
44
+ #
45
+ # ## Example
46
+ #
47
+ # To modify the configuration for all MetricService clients:
48
+ #
49
+ # ::Google::Cloud::Monitoring::V3::MetricService::Client.configure do |config|
50
+ # config.timeout = 10.0
51
+ # end
52
+ #
53
+ # @yield [config] Configure the Client client.
54
+ # @yieldparam config [Client::Configuration]
55
+ #
56
+ # @return [Client::Configuration]
57
+ #
58
+ def self.configure
59
+ @configure ||= begin
60
+ namespace = ["Google", "Cloud", "Monitoring", "V3"]
61
+ parent_config = while namespace.any?
62
+ parent_name = namespace.join "::"
63
+ parent_const = const_get parent_name
64
+ break parent_const.configure if parent_const&.respond_to? :configure
65
+ namespace.pop
66
+ end
67
+ default_config = Client::Configuration.new parent_config
68
+
69
+ default_config.rpcs.list_monitored_resource_descriptors.timeout = 30.0
70
+ default_config.rpcs.list_monitored_resource_descriptors.retry_policy = {
71
+ initial_delay: 0.1,
72
+ max_delay: 30.0,
73
+ multiplier: 1.3,
74
+ retry_codes: ["DEADLINE_EXCEEDED", "UNAVAILABLE"]
75
+ }
76
+
77
+ default_config.rpcs.get_monitored_resource_descriptor.timeout = 30.0
78
+ default_config.rpcs.get_monitored_resource_descriptor.retry_policy = {
79
+ initial_delay: 0.1,
80
+ max_delay: 30.0,
81
+ multiplier: 1.3,
82
+ retry_codes: ["DEADLINE_EXCEEDED", "UNAVAILABLE"]
83
+ }
84
+
85
+ default_config.rpcs.list_metric_descriptors.timeout = 30.0
86
+ default_config.rpcs.list_metric_descriptors.retry_policy = {
87
+ initial_delay: 0.1,
88
+ max_delay: 30.0,
89
+ multiplier: 1.3,
90
+ retry_codes: ["DEADLINE_EXCEEDED", "UNAVAILABLE"]
91
+ }
92
+
93
+ default_config.rpcs.get_metric_descriptor.timeout = 30.0
94
+ default_config.rpcs.get_metric_descriptor.retry_policy = {
95
+ initial_delay: 0.1,
96
+ max_delay: 30.0,
97
+ multiplier: 1.3,
98
+ retry_codes: ["DEADLINE_EXCEEDED", "UNAVAILABLE"]
99
+ }
100
+
101
+ default_config.rpcs.create_metric_descriptor.timeout = 12.0
102
+
103
+ default_config.rpcs.delete_metric_descriptor.timeout = 30.0
104
+ default_config.rpcs.delete_metric_descriptor.retry_policy = {
105
+ initial_delay: 0.1,
106
+ max_delay: 30.0,
107
+ multiplier: 1.3,
108
+ retry_codes: ["DEADLINE_EXCEEDED", "UNAVAILABLE"]
109
+ }
110
+
111
+ default_config.rpcs.list_time_series.timeout = 30.0
112
+ default_config.rpcs.list_time_series.retry_policy = {
113
+ initial_delay: 0.1,
114
+ max_delay: 30.0,
115
+ multiplier: 1.3,
116
+ retry_codes: ["DEADLINE_EXCEEDED", "UNAVAILABLE"]
117
+ }
118
+
119
+ default_config.rpcs.create_time_series.timeout = 12.0
120
+
121
+ default_config
122
+ end
123
+ yield @configure if block_given?
124
+ @configure
125
+ end
126
+
127
+ ##
128
+ # Configure the MetricService 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::MetricService::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 MetricService client object.
149
+ #
150
+ # ## Examples
151
+ #
152
+ # To create a new MetricService client with the default
153
+ # configuration:
154
+ #
155
+ # client = ::Google::Cloud::Monitoring::V3::MetricService::Client.new
156
+ #
157
+ # To create a new MetricService client with a custom
158
+ # configuration:
159
+ #
160
+ # client = ::Google::Cloud::Monitoring::V3::MetricService::Client.new do |config|
161
+ # config.timeout = 10.0
162
+ # end
163
+ #
164
+ # @yield [config] Configure the MetricService 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/metric_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
+ @metric_service_stub = ::Gapic::ServiceStub.new(
190
+ ::Google::Cloud::Monitoring::V3::MetricService::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 monitored resource descriptors that match a filter. This method does not require a Workspace.
202
+ #
203
+ # @overload list_monitored_resource_descriptors(request, options = nil)
204
+ # Pass arguments to `list_monitored_resource_descriptors` via a request object, either of type
205
+ # {::Google::Cloud::Monitoring::V3::ListMonitoredResourceDescriptorsRequest} or an equivalent Hash.
206
+ #
207
+ # @param request [::Google::Cloud::Monitoring::V3::ListMonitoredResourceDescriptorsRequest, ::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_monitored_resource_descriptors(name: nil, filter: nil, page_size: nil, page_token: nil)
214
+ # Pass arguments to `list_monitored_resource_descriptors` 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 on which to execute the request. The format is:
220
+ #
221
+ # projects/[PROJECT_ID_OR_NUMBER]
222
+ # @param filter [::String]
223
+ # An optional [filter](https://cloud.google.com/monitoring/api/v3/filters)
224
+ # describing the descriptors to be returned. The filter can reference the
225
+ # descriptor's type and labels. For example, the following filter returns
226
+ # only Google Compute Engine descriptors that have an `id` label:
227
+ #
228
+ # resource.type = starts_with("gce_") AND resource.label:id
229
+ # @param page_size [::Integer]
230
+ # A positive number that is the maximum number of results to return.
231
+ # @param page_token [::String]
232
+ # If this field is not empty then it must contain the `nextPageToken` value
233
+ # returned by a previous call to this method. Using this field causes the
234
+ # method to return additional results from the previous method call.
235
+ #
236
+ # @yield [response, operation] Access the result along with the RPC operation
237
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Api::MonitoredResourceDescriptor>]
238
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
239
+ #
240
+ # @return [::Gapic::PagedEnumerable<::Google::Api::MonitoredResourceDescriptor>]
241
+ #
242
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
243
+ #
244
+ def list_monitored_resource_descriptors request, options = nil
245
+ raise ::ArgumentError, "request must be provided" if request.nil?
246
+
247
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Monitoring::V3::ListMonitoredResourceDescriptorsRequest
248
+
249
+ # Converts hash and nil to an options object
250
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
251
+
252
+ # Customize the options with defaults
253
+ metadata = @config.rpcs.list_monitored_resource_descriptors.metadata.to_h
254
+
255
+ # Set x-goog-api-client and x-goog-user-project headers
256
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
257
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
258
+ gapic_version: ::Google::Cloud::Monitoring::V3::VERSION
259
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
260
+
261
+ header_params = {
262
+ "name" => request.name
263
+ }
264
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
265
+ metadata[:"x-goog-request-params"] ||= request_params_header
266
+
267
+ options.apply_defaults timeout: @config.rpcs.list_monitored_resource_descriptors.timeout,
268
+ metadata: metadata,
269
+ retry_policy: @config.rpcs.list_monitored_resource_descriptors.retry_policy
270
+ options.apply_defaults metadata: @config.metadata,
271
+ retry_policy: @config.retry_policy
272
+
273
+ @metric_service_stub.call_rpc :list_monitored_resource_descriptors, request, options: options do |response, operation|
274
+ response = ::Gapic::PagedEnumerable.new @metric_service_stub, :list_monitored_resource_descriptors, request, response, operation, options
275
+ yield response, operation if block_given?
276
+ return response
277
+ end
278
+ rescue ::GRPC::BadStatus => e
279
+ raise ::Google::Cloud::Error.from_error(e)
280
+ end
281
+
282
+ ##
283
+ # Gets a single monitored resource descriptor. This method does not require a Workspace.
284
+ #
285
+ # @overload get_monitored_resource_descriptor(request, options = nil)
286
+ # Pass arguments to `get_monitored_resource_descriptor` via a request object, either of type
287
+ # {::Google::Cloud::Monitoring::V3::GetMonitoredResourceDescriptorRequest} or an equivalent Hash.
288
+ #
289
+ # @param request [::Google::Cloud::Monitoring::V3::GetMonitoredResourceDescriptorRequest, ::Hash]
290
+ # A request object representing the call parameters. Required. To specify no
291
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
292
+ # @param options [::Gapic::CallOptions, ::Hash]
293
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
294
+ #
295
+ # @overload get_monitored_resource_descriptor(name: nil)
296
+ # Pass arguments to `get_monitored_resource_descriptor` via keyword arguments. Note that at
297
+ # least one keyword argument is required. To specify no parameters, or to keep all
298
+ # the default parameter values, pass an empty Hash as a request object (see above).
299
+ #
300
+ # @param name [::String]
301
+ # Required. The monitored resource descriptor to get. The format is:
302
+ #
303
+ # projects/[PROJECT_ID_OR_NUMBER]/monitoredResourceDescriptors/[RESOURCE_TYPE]
304
+ #
305
+ # The `[RESOURCE_TYPE]` is a predefined type, such as
306
+ # `cloudsql_database`.
307
+ #
308
+ # @yield [response, operation] Access the result along with the RPC operation
309
+ # @yieldparam response [::Google::Api::MonitoredResourceDescriptor]
310
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
311
+ #
312
+ # @return [::Google::Api::MonitoredResourceDescriptor]
313
+ #
314
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
315
+ #
316
+ def get_monitored_resource_descriptor request, options = nil
317
+ raise ::ArgumentError, "request must be provided" if request.nil?
318
+
319
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Monitoring::V3::GetMonitoredResourceDescriptorRequest
320
+
321
+ # Converts hash and nil to an options object
322
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
323
+
324
+ # Customize the options with defaults
325
+ metadata = @config.rpcs.get_monitored_resource_descriptor.metadata.to_h
326
+
327
+ # Set x-goog-api-client and x-goog-user-project headers
328
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
329
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
330
+ gapic_version: ::Google::Cloud::Monitoring::V3::VERSION
331
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
332
+
333
+ header_params = {
334
+ "name" => request.name
335
+ }
336
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
337
+ metadata[:"x-goog-request-params"] ||= request_params_header
338
+
339
+ options.apply_defaults timeout: @config.rpcs.get_monitored_resource_descriptor.timeout,
340
+ metadata: metadata,
341
+ retry_policy: @config.rpcs.get_monitored_resource_descriptor.retry_policy
342
+ options.apply_defaults metadata: @config.metadata,
343
+ retry_policy: @config.retry_policy
344
+
345
+ @metric_service_stub.call_rpc :get_monitored_resource_descriptor, request, options: options do |response, operation|
346
+ yield response, operation if block_given?
347
+ return response
348
+ end
349
+ rescue ::GRPC::BadStatus => e
350
+ raise ::Google::Cloud::Error.from_error(e)
351
+ end
352
+
353
+ ##
354
+ # Lists metric descriptors that match a filter. This method does not require a Workspace.
355
+ #
356
+ # @overload list_metric_descriptors(request, options = nil)
357
+ # Pass arguments to `list_metric_descriptors` via a request object, either of type
358
+ # {::Google::Cloud::Monitoring::V3::ListMetricDescriptorsRequest} or an equivalent Hash.
359
+ #
360
+ # @param request [::Google::Cloud::Monitoring::V3::ListMetricDescriptorsRequest, ::Hash]
361
+ # A request object representing the call parameters. Required. To specify no
362
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
363
+ # @param options [::Gapic::CallOptions, ::Hash]
364
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
365
+ #
366
+ # @overload list_metric_descriptors(name: nil, filter: nil, page_size: nil, page_token: nil)
367
+ # Pass arguments to `list_metric_descriptors` via keyword arguments. Note that at
368
+ # least one keyword argument is required. To specify no parameters, or to keep all
369
+ # the default parameter values, pass an empty Hash as a request object (see above).
370
+ #
371
+ # @param name [::String]
372
+ # Required. The project on which to execute the request. The format is:
373
+ #
374
+ # projects/[PROJECT_ID_OR_NUMBER]
375
+ # @param filter [::String]
376
+ # If this field is empty, all custom and
377
+ # system-defined metric descriptors are returned.
378
+ # Otherwise, the [filter](https://cloud.google.com/monitoring/api/v3/filters)
379
+ # specifies which metric descriptors are to be
380
+ # returned. For example, the following filter matches all
381
+ # [custom metrics](https://cloud.google.com/monitoring/custom-metrics):
382
+ #
383
+ # metric.type = starts_with("custom.googleapis.com/")
384
+ # @param page_size [::Integer]
385
+ # A positive number that is the maximum number of results to return.
386
+ # @param page_token [::String]
387
+ # If this field is not empty then it must contain the `nextPageToken` value
388
+ # returned by a previous call to this method. Using this field causes the
389
+ # method to return additional results from the previous method call.
390
+ #
391
+ # @yield [response, operation] Access the result along with the RPC operation
392
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Api::MetricDescriptor>]
393
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
394
+ #
395
+ # @return [::Gapic::PagedEnumerable<::Google::Api::MetricDescriptor>]
396
+ #
397
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
398
+ #
399
+ def list_metric_descriptors request, options = nil
400
+ raise ::ArgumentError, "request must be provided" if request.nil?
401
+
402
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Monitoring::V3::ListMetricDescriptorsRequest
403
+
404
+ # Converts hash and nil to an options object
405
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
406
+
407
+ # Customize the options with defaults
408
+ metadata = @config.rpcs.list_metric_descriptors.metadata.to_h
409
+
410
+ # Set x-goog-api-client and x-goog-user-project headers
411
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
412
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
413
+ gapic_version: ::Google::Cloud::Monitoring::V3::VERSION
414
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
415
+
416
+ header_params = {
417
+ "name" => request.name
418
+ }
419
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
420
+ metadata[:"x-goog-request-params"] ||= request_params_header
421
+
422
+ options.apply_defaults timeout: @config.rpcs.list_metric_descriptors.timeout,
423
+ metadata: metadata,
424
+ retry_policy: @config.rpcs.list_metric_descriptors.retry_policy
425
+ options.apply_defaults metadata: @config.metadata,
426
+ retry_policy: @config.retry_policy
427
+
428
+ @metric_service_stub.call_rpc :list_metric_descriptors, request, options: options do |response, operation|
429
+ response = ::Gapic::PagedEnumerable.new @metric_service_stub, :list_metric_descriptors, request, response, operation, options
430
+ yield response, operation if block_given?
431
+ return response
432
+ end
433
+ rescue ::GRPC::BadStatus => e
434
+ raise ::Google::Cloud::Error.from_error(e)
435
+ end
436
+
437
+ ##
438
+ # Gets a single metric descriptor. This method does not require a Workspace.
439
+ #
440
+ # @overload get_metric_descriptor(request, options = nil)
441
+ # Pass arguments to `get_metric_descriptor` via a request object, either of type
442
+ # {::Google::Cloud::Monitoring::V3::GetMetricDescriptorRequest} or an equivalent Hash.
443
+ #
444
+ # @param request [::Google::Cloud::Monitoring::V3::GetMetricDescriptorRequest, ::Hash]
445
+ # A request object representing the call parameters. Required. To specify no
446
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
447
+ # @param options [::Gapic::CallOptions, ::Hash]
448
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
449
+ #
450
+ # @overload get_metric_descriptor(name: nil)
451
+ # Pass arguments to `get_metric_descriptor` via keyword arguments. Note that at
452
+ # least one keyword argument is required. To specify no parameters, or to keep all
453
+ # the default parameter values, pass an empty Hash as a request object (see above).
454
+ #
455
+ # @param name [::String]
456
+ # Required. The metric descriptor on which to execute the request. The format is:
457
+ #
458
+ # projects/[PROJECT_ID_OR_NUMBER]/metricDescriptors/[METRIC_ID]
459
+ #
460
+ # An example value of `[METRIC_ID]` is
461
+ # `"compute.googleapis.com/instance/disk/read_bytes_count"`.
462
+ #
463
+ # @yield [response, operation] Access the result along with the RPC operation
464
+ # @yieldparam response [::Google::Api::MetricDescriptor]
465
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
466
+ #
467
+ # @return [::Google::Api::MetricDescriptor]
468
+ #
469
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
470
+ #
471
+ def get_metric_descriptor request, options = nil
472
+ raise ::ArgumentError, "request must be provided" if request.nil?
473
+
474
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Monitoring::V3::GetMetricDescriptorRequest
475
+
476
+ # Converts hash and nil to an options object
477
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
478
+
479
+ # Customize the options with defaults
480
+ metadata = @config.rpcs.get_metric_descriptor.metadata.to_h
481
+
482
+ # Set x-goog-api-client and x-goog-user-project headers
483
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
484
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
485
+ gapic_version: ::Google::Cloud::Monitoring::V3::VERSION
486
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
487
+
488
+ header_params = {
489
+ "name" => request.name
490
+ }
491
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
492
+ metadata[:"x-goog-request-params"] ||= request_params_header
493
+
494
+ options.apply_defaults timeout: @config.rpcs.get_metric_descriptor.timeout,
495
+ metadata: metadata,
496
+ retry_policy: @config.rpcs.get_metric_descriptor.retry_policy
497
+ options.apply_defaults metadata: @config.metadata,
498
+ retry_policy: @config.retry_policy
499
+
500
+ @metric_service_stub.call_rpc :get_metric_descriptor, request, options: options do |response, operation|
501
+ yield response, operation if block_given?
502
+ return response
503
+ end
504
+ rescue ::GRPC::BadStatus => e
505
+ raise ::Google::Cloud::Error.from_error(e)
506
+ end
507
+
508
+ ##
509
+ # Creates a new metric descriptor.
510
+ # User-created metric descriptors define
511
+ # [custom metrics](https://cloud.google.com/monitoring/custom-metrics).
512
+ #
513
+ # @overload create_metric_descriptor(request, options = nil)
514
+ # Pass arguments to `create_metric_descriptor` via a request object, either of type
515
+ # {::Google::Cloud::Monitoring::V3::CreateMetricDescriptorRequest} or an equivalent Hash.
516
+ #
517
+ # @param request [::Google::Cloud::Monitoring::V3::CreateMetricDescriptorRequest, ::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 create_metric_descriptor(name: nil, metric_descriptor: nil)
524
+ # Pass arguments to `create_metric_descriptor` 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 project on which to execute the request. The format is:
530
+ #
531
+ # projects/[PROJECT_ID_OR_NUMBER]
532
+ # @param metric_descriptor [::Google::Api::MetricDescriptor, ::Hash]
533
+ # Required. The new [custom metric](https://cloud.google.com/monitoring/custom-metrics)
534
+ # descriptor.
535
+ #
536
+ # @yield [response, operation] Access the result along with the RPC operation
537
+ # @yieldparam response [::Google::Api::MetricDescriptor]
538
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
539
+ #
540
+ # @return [::Google::Api::MetricDescriptor]
541
+ #
542
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
543
+ #
544
+ def create_metric_descriptor request, options = nil
545
+ raise ::ArgumentError, "request must be provided" if request.nil?
546
+
547
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Monitoring::V3::CreateMetricDescriptorRequest
548
+
549
+ # Converts hash and nil to an options object
550
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
551
+
552
+ # Customize the options with defaults
553
+ metadata = @config.rpcs.create_metric_descriptor.metadata.to_h
554
+
555
+ # Set x-goog-api-client and x-goog-user-project headers
556
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
557
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
558
+ gapic_version: ::Google::Cloud::Monitoring::V3::VERSION
559
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
560
+
561
+ header_params = {
562
+ "name" => request.name
563
+ }
564
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
565
+ metadata[:"x-goog-request-params"] ||= request_params_header
566
+
567
+ options.apply_defaults timeout: @config.rpcs.create_metric_descriptor.timeout,
568
+ metadata: metadata,
569
+ retry_policy: @config.rpcs.create_metric_descriptor.retry_policy
570
+ options.apply_defaults metadata: @config.metadata,
571
+ retry_policy: @config.retry_policy
572
+
573
+ @metric_service_stub.call_rpc :create_metric_descriptor, request, options: options do |response, operation|
574
+ yield response, operation if block_given?
575
+ return response
576
+ end
577
+ rescue ::GRPC::BadStatus => e
578
+ raise ::Google::Cloud::Error.from_error(e)
579
+ end
580
+
581
+ ##
582
+ # Deletes a metric descriptor. Only user-created
583
+ # [custom metrics](https://cloud.google.com/monitoring/custom-metrics) can be
584
+ # deleted.
585
+ #
586
+ # @overload delete_metric_descriptor(request, options = nil)
587
+ # Pass arguments to `delete_metric_descriptor` via a request object, either of type
588
+ # {::Google::Cloud::Monitoring::V3::DeleteMetricDescriptorRequest} or an equivalent Hash.
589
+ #
590
+ # @param request [::Google::Cloud::Monitoring::V3::DeleteMetricDescriptorRequest, ::Hash]
591
+ # A request object representing the call parameters. Required. To specify no
592
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
593
+ # @param options [::Gapic::CallOptions, ::Hash]
594
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
595
+ #
596
+ # @overload delete_metric_descriptor(name: nil)
597
+ # Pass arguments to `delete_metric_descriptor` via keyword arguments. Note that at
598
+ # least one keyword argument is required. To specify no parameters, or to keep all
599
+ # the default parameter values, pass an empty Hash as a request object (see above).
600
+ #
601
+ # @param name [::String]
602
+ # Required. The metric descriptor on which to execute the request. The format is:
603
+ #
604
+ # projects/[PROJECT_ID_OR_NUMBER]/metricDescriptors/[METRIC_ID]
605
+ #
606
+ # An example of `[METRIC_ID]` is:
607
+ # `"custom.googleapis.com/my_test_metric"`.
608
+ #
609
+ # @yield [response, operation] Access the result along with the RPC operation
610
+ # @yieldparam response [::Google::Protobuf::Empty]
611
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
612
+ #
613
+ # @return [::Google::Protobuf::Empty]
614
+ #
615
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
616
+ #
617
+ def delete_metric_descriptor request, options = nil
618
+ raise ::ArgumentError, "request must be provided" if request.nil?
619
+
620
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Monitoring::V3::DeleteMetricDescriptorRequest
621
+
622
+ # Converts hash and nil to an options object
623
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
624
+
625
+ # Customize the options with defaults
626
+ metadata = @config.rpcs.delete_metric_descriptor.metadata.to_h
627
+
628
+ # Set x-goog-api-client and x-goog-user-project headers
629
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
630
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
631
+ gapic_version: ::Google::Cloud::Monitoring::V3::VERSION
632
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
633
+
634
+ header_params = {
635
+ "name" => request.name
636
+ }
637
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
638
+ metadata[:"x-goog-request-params"] ||= request_params_header
639
+
640
+ options.apply_defaults timeout: @config.rpcs.delete_metric_descriptor.timeout,
641
+ metadata: metadata,
642
+ retry_policy: @config.rpcs.delete_metric_descriptor.retry_policy
643
+ options.apply_defaults metadata: @config.metadata,
644
+ retry_policy: @config.retry_policy
645
+
646
+ @metric_service_stub.call_rpc :delete_metric_descriptor, request, options: options do |response, operation|
647
+ yield response, operation if block_given?
648
+ return response
649
+ end
650
+ rescue ::GRPC::BadStatus => e
651
+ raise ::Google::Cloud::Error.from_error(e)
652
+ end
653
+
654
+ ##
655
+ # Lists time series that match a filter. This method does not require a Workspace.
656
+ #
657
+ # @overload list_time_series(request, options = nil)
658
+ # Pass arguments to `list_time_series` via a request object, either of type
659
+ # {::Google::Cloud::Monitoring::V3::ListTimeSeriesRequest} or an equivalent Hash.
660
+ #
661
+ # @param request [::Google::Cloud::Monitoring::V3::ListTimeSeriesRequest, ::Hash]
662
+ # A request object representing the call parameters. Required. To specify no
663
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
664
+ # @param options [::Gapic::CallOptions, ::Hash]
665
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
666
+ #
667
+ # @overload list_time_series(name: nil, filter: nil, interval: nil, aggregation: nil, order_by: nil, view: nil, page_size: nil, page_token: nil)
668
+ # Pass arguments to `list_time_series` via keyword arguments. Note that at
669
+ # least one keyword argument is required. To specify no parameters, or to keep all
670
+ # the default parameter values, pass an empty Hash as a request object (see above).
671
+ #
672
+ # @param name [::String]
673
+ # Required. The project on which to execute the request. The format is:
674
+ #
675
+ # projects/[PROJECT_ID_OR_NUMBER]
676
+ # @param filter [::String]
677
+ # Required. A [monitoring filter](https://cloud.google.com/monitoring/api/v3/filters)
678
+ # that specifies which time series should be returned. The filter must
679
+ # specify a single metric type, and can additionally specify metric labels
680
+ # and other information. For example:
681
+ #
682
+ # metric.type = "compute.googleapis.com/instance/cpu/usage_time" AND
683
+ # metric.labels.instance_name = "my-instance-name"
684
+ # @param interval [::Google::Cloud::Monitoring::V3::TimeInterval, ::Hash]
685
+ # Required. The time interval for which results should be returned. Only time series
686
+ # that contain data points in the specified interval are included
687
+ # in the response.
688
+ # @param aggregation [::Google::Cloud::Monitoring::V3::Aggregation, ::Hash]
689
+ # Specifies the alignment of data points in individual time series as
690
+ # well as how to combine the retrieved time series across specified labels.
691
+ #
692
+ # By default (if no `aggregation` is explicitly specified), the raw time
693
+ # series data is returned.
694
+ # @param order_by [::String]
695
+ # Unsupported: must be left blank. The points in each time series are
696
+ # currently returned in reverse time order (most recent to oldest).
697
+ # @param view [::Google::Cloud::Monitoring::V3::ListTimeSeriesRequest::TimeSeriesView]
698
+ # Required. Specifies which information is returned about the time series.
699
+ # @param page_size [::Integer]
700
+ # A positive number that is the maximum number of results to return. If
701
+ # `page_size` is empty or more than 100,000 results, the effective
702
+ # `page_size` is 100,000 results. If `view` is set to `FULL`, this is the
703
+ # maximum number of `Points` returned. If `view` is set to `HEADERS`, this is
704
+ # the maximum number of `TimeSeries` returned.
705
+ # @param page_token [::String]
706
+ # If this field is not empty then it must contain the `nextPageToken` value
707
+ # returned by a previous call to this method. Using this field causes the
708
+ # method to return additional results from the previous method call.
709
+ #
710
+ # @yield [response, operation] Access the result along with the RPC operation
711
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Monitoring::V3::TimeSeries>]
712
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
713
+ #
714
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::Monitoring::V3::TimeSeries>]
715
+ #
716
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
717
+ #
718
+ def list_time_series request, options = nil
719
+ raise ::ArgumentError, "request must be provided" if request.nil?
720
+
721
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Monitoring::V3::ListTimeSeriesRequest
722
+
723
+ # Converts hash and nil to an options object
724
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
725
+
726
+ # Customize the options with defaults
727
+ metadata = @config.rpcs.list_time_series.metadata.to_h
728
+
729
+ # Set x-goog-api-client and x-goog-user-project headers
730
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
731
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
732
+ gapic_version: ::Google::Cloud::Monitoring::V3::VERSION
733
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
734
+
735
+ header_params = {
736
+ "name" => request.name
737
+ }
738
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
739
+ metadata[:"x-goog-request-params"] ||= request_params_header
740
+
741
+ options.apply_defaults timeout: @config.rpcs.list_time_series.timeout,
742
+ metadata: metadata,
743
+ retry_policy: @config.rpcs.list_time_series.retry_policy
744
+ options.apply_defaults metadata: @config.metadata,
745
+ retry_policy: @config.retry_policy
746
+
747
+ @metric_service_stub.call_rpc :list_time_series, request, options: options do |response, operation|
748
+ response = ::Gapic::PagedEnumerable.new @metric_service_stub, :list_time_series, request, response, operation, options
749
+ yield response, operation if block_given?
750
+ return response
751
+ end
752
+ rescue ::GRPC::BadStatus => e
753
+ raise ::Google::Cloud::Error.from_error(e)
754
+ end
755
+
756
+ ##
757
+ # Creates or adds data to one or more time series.
758
+ # The response is empty if all time series in the request were written.
759
+ # If any time series could not be written, a corresponding failure message is
760
+ # included in the error response.
761
+ #
762
+ # @overload create_time_series(request, options = nil)
763
+ # Pass arguments to `create_time_series` via a request object, either of type
764
+ # {::Google::Cloud::Monitoring::V3::CreateTimeSeriesRequest} or an equivalent Hash.
765
+ #
766
+ # @param request [::Google::Cloud::Monitoring::V3::CreateTimeSeriesRequest, ::Hash]
767
+ # A request object representing the call parameters. Required. To specify no
768
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
769
+ # @param options [::Gapic::CallOptions, ::Hash]
770
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
771
+ #
772
+ # @overload create_time_series(name: nil, time_series: nil)
773
+ # Pass arguments to `create_time_series` via keyword arguments. Note that at
774
+ # least one keyword argument is required. To specify no parameters, or to keep all
775
+ # the default parameter values, pass an empty Hash as a request object (see above).
776
+ #
777
+ # @param name [::String]
778
+ # Required. The project on which to execute the request. The format is:
779
+ #
780
+ # projects/[PROJECT_ID_OR_NUMBER]
781
+ # @param time_series [::Array<::Google::Cloud::Monitoring::V3::TimeSeries, ::Hash>]
782
+ # Required. The new data to be added to a list of time series.
783
+ # Adds at most one data point to each of several time series. The new data
784
+ # point must be more recent than any other point in its time series. Each
785
+ # `TimeSeries` value must fully specify a unique time series by supplying
786
+ # all label values for the metric and the monitored resource.
787
+ #
788
+ # The maximum number of `TimeSeries` objects per `Create` request is 200.
789
+ #
790
+ # @yield [response, operation] Access the result along with the RPC operation
791
+ # @yieldparam response [::Google::Protobuf::Empty]
792
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
793
+ #
794
+ # @return [::Google::Protobuf::Empty]
795
+ #
796
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
797
+ #
798
+ def create_time_series request, options = nil
799
+ raise ::ArgumentError, "request must be provided" if request.nil?
800
+
801
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Monitoring::V3::CreateTimeSeriesRequest
802
+
803
+ # Converts hash and nil to an options object
804
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
805
+
806
+ # Customize the options with defaults
807
+ metadata = @config.rpcs.create_time_series.metadata.to_h
808
+
809
+ # Set x-goog-api-client and x-goog-user-project headers
810
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
811
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
812
+ gapic_version: ::Google::Cloud::Monitoring::V3::VERSION
813
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
814
+
815
+ header_params = {
816
+ "name" => request.name
817
+ }
818
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
819
+ metadata[:"x-goog-request-params"] ||= request_params_header
820
+
821
+ options.apply_defaults timeout: @config.rpcs.create_time_series.timeout,
822
+ metadata: metadata,
823
+ retry_policy: @config.rpcs.create_time_series.retry_policy
824
+ options.apply_defaults metadata: @config.metadata,
825
+ retry_policy: @config.retry_policy
826
+
827
+ @metric_service_stub.call_rpc :create_time_series, request, options: options do |response, operation|
828
+ yield response, operation if block_given?
829
+ return response
830
+ end
831
+ rescue ::GRPC::BadStatus => e
832
+ raise ::Google::Cloud::Error.from_error(e)
833
+ end
834
+
835
+ ##
836
+ # Configuration class for the MetricService API.
837
+ #
838
+ # This class represents the configuration for MetricService,
839
+ # providing control over timeouts, retry behavior, logging, transport
840
+ # parameters, and other low-level controls. Certain parameters can also be
841
+ # applied individually to specific RPCs. See
842
+ # {::Google::Cloud::Monitoring::V3::MetricService::Client::Configuration::Rpcs}
843
+ # for a list of RPCs that can be configured independently.
844
+ #
845
+ # Configuration can be applied globally to all clients, or to a single client
846
+ # on construction.
847
+ #
848
+ # # Examples
849
+ #
850
+ # To modify the global config, setting the timeout for list_monitored_resource_descriptors
851
+ # to 20 seconds, and all remaining timeouts to 10 seconds:
852
+ #
853
+ # ::Google::Cloud::Monitoring::V3::MetricService::Client.configure do |config|
854
+ # config.timeout = 10.0
855
+ # config.rpcs.list_monitored_resource_descriptors.timeout = 20.0
856
+ # end
857
+ #
858
+ # To apply the above configuration only to a new client:
859
+ #
860
+ # client = ::Google::Cloud::Monitoring::V3::MetricService::Client.new do |config|
861
+ # config.timeout = 10.0
862
+ # config.rpcs.list_monitored_resource_descriptors.timeout = 20.0
863
+ # end
864
+ #
865
+ # @!attribute [rw] endpoint
866
+ # The hostname or hostname:port of the service endpoint.
867
+ # Defaults to `"monitoring.googleapis.com"`.
868
+ # @return [::String]
869
+ # @!attribute [rw] credentials
870
+ # Credentials to send with calls. You may provide any of the following types:
871
+ # * (`String`) The path to a service account key file in JSON format
872
+ # * (`Hash`) A service account key as a Hash
873
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
874
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
875
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
876
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
877
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
878
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
879
+ # * (`nil`) indicating no credentials
880
+ # @return [::Object]
881
+ # @!attribute [rw] scope
882
+ # The OAuth scopes
883
+ # @return [::Array<::String>]
884
+ # @!attribute [rw] lib_name
885
+ # The library name as recorded in instrumentation and logging
886
+ # @return [::String]
887
+ # @!attribute [rw] lib_version
888
+ # The library version as recorded in instrumentation and logging
889
+ # @return [::String]
890
+ # @!attribute [rw] channel_args
891
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
892
+ # `GRPC::Core::Channel` object is provided as the credential.
893
+ # @return [::Hash]
894
+ # @!attribute [rw] interceptors
895
+ # An array of interceptors that are run before calls are executed.
896
+ # @return [::Array<::GRPC::ClientInterceptor>]
897
+ # @!attribute [rw] timeout
898
+ # The call timeout in seconds.
899
+ # @return [::Numeric]
900
+ # @!attribute [rw] metadata
901
+ # Additional gRPC headers to be sent with the call.
902
+ # @return [::Hash{::Symbol=>::String}]
903
+ # @!attribute [rw] retry_policy
904
+ # The retry policy. The value is a hash with the following keys:
905
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
906
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
907
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
908
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
909
+ # trigger a retry.
910
+ # @return [::Hash]
911
+ # @!attribute [rw] quota_project
912
+ # A separate project against which to charge quota.
913
+ # @return [::String]
914
+ #
915
+ class Configuration
916
+ extend ::Gapic::Config
917
+
918
+ config_attr :endpoint, "monitoring.googleapis.com", ::String
919
+ config_attr :credentials, nil do |value|
920
+ allowed = [::String, ::Hash, ::Proc, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
921
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
922
+ allowed.any? { |klass| klass === value }
923
+ end
924
+ config_attr :scope, nil, ::String, ::Array, nil
925
+ config_attr :lib_name, nil, ::String, nil
926
+ config_attr :lib_version, nil, ::String, nil
927
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
928
+ config_attr :interceptors, nil, ::Array, nil
929
+ config_attr :timeout, nil, ::Numeric, nil
930
+ config_attr :metadata, nil, ::Hash, nil
931
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
932
+ config_attr :quota_project, nil, ::String, nil
933
+
934
+ # @private
935
+ def initialize parent_config = nil
936
+ @parent_config = parent_config unless parent_config.nil?
937
+
938
+ yield self if block_given?
939
+ end
940
+
941
+ ##
942
+ # Configurations for individual RPCs
943
+ # @return [Rpcs]
944
+ #
945
+ def rpcs
946
+ @rpcs ||= begin
947
+ parent_rpcs = nil
948
+ parent_rpcs = @parent_config.rpcs if @parent_config&.respond_to? :rpcs
949
+ Rpcs.new parent_rpcs
950
+ end
951
+ end
952
+
953
+ ##
954
+ # Configuration RPC class for the MetricService API.
955
+ #
956
+ # Includes fields providing the configuration for each RPC in this service.
957
+ # Each configuration object is of type `Gapic::Config::Method` and includes
958
+ # the following configuration fields:
959
+ #
960
+ # * `timeout` (*type:* `Numeric`) - The call timeout in milliseconds
961
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
962
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
963
+ # include the following keys:
964
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
965
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
966
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
967
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
968
+ # trigger a retry.
969
+ #
970
+ class Rpcs
971
+ ##
972
+ # RPC-specific configuration for `list_monitored_resource_descriptors`
973
+ # @return [::Gapic::Config::Method]
974
+ #
975
+ attr_reader :list_monitored_resource_descriptors
976
+ ##
977
+ # RPC-specific configuration for `get_monitored_resource_descriptor`
978
+ # @return [::Gapic::Config::Method]
979
+ #
980
+ attr_reader :get_monitored_resource_descriptor
981
+ ##
982
+ # RPC-specific configuration for `list_metric_descriptors`
983
+ # @return [::Gapic::Config::Method]
984
+ #
985
+ attr_reader :list_metric_descriptors
986
+ ##
987
+ # RPC-specific configuration for `get_metric_descriptor`
988
+ # @return [::Gapic::Config::Method]
989
+ #
990
+ attr_reader :get_metric_descriptor
991
+ ##
992
+ # RPC-specific configuration for `create_metric_descriptor`
993
+ # @return [::Gapic::Config::Method]
994
+ #
995
+ attr_reader :create_metric_descriptor
996
+ ##
997
+ # RPC-specific configuration for `delete_metric_descriptor`
998
+ # @return [::Gapic::Config::Method]
999
+ #
1000
+ attr_reader :delete_metric_descriptor
1001
+ ##
1002
+ # RPC-specific configuration for `list_time_series`
1003
+ # @return [::Gapic::Config::Method]
1004
+ #
1005
+ attr_reader :list_time_series
1006
+ ##
1007
+ # RPC-specific configuration for `create_time_series`
1008
+ # @return [::Gapic::Config::Method]
1009
+ #
1010
+ attr_reader :create_time_series
1011
+
1012
+ # @private
1013
+ def initialize parent_rpcs = nil
1014
+ list_monitored_resource_descriptors_config = parent_rpcs&.list_monitored_resource_descriptors if parent_rpcs&.respond_to? :list_monitored_resource_descriptors
1015
+ @list_monitored_resource_descriptors = ::Gapic::Config::Method.new list_monitored_resource_descriptors_config
1016
+ get_monitored_resource_descriptor_config = parent_rpcs&.get_monitored_resource_descriptor if parent_rpcs&.respond_to? :get_monitored_resource_descriptor
1017
+ @get_monitored_resource_descriptor = ::Gapic::Config::Method.new get_monitored_resource_descriptor_config
1018
+ list_metric_descriptors_config = parent_rpcs&.list_metric_descriptors if parent_rpcs&.respond_to? :list_metric_descriptors
1019
+ @list_metric_descriptors = ::Gapic::Config::Method.new list_metric_descriptors_config
1020
+ get_metric_descriptor_config = parent_rpcs&.get_metric_descriptor if parent_rpcs&.respond_to? :get_metric_descriptor
1021
+ @get_metric_descriptor = ::Gapic::Config::Method.new get_metric_descriptor_config
1022
+ create_metric_descriptor_config = parent_rpcs&.create_metric_descriptor if parent_rpcs&.respond_to? :create_metric_descriptor
1023
+ @create_metric_descriptor = ::Gapic::Config::Method.new create_metric_descriptor_config
1024
+ delete_metric_descriptor_config = parent_rpcs&.delete_metric_descriptor if parent_rpcs&.respond_to? :delete_metric_descriptor
1025
+ @delete_metric_descriptor = ::Gapic::Config::Method.new delete_metric_descriptor_config
1026
+ list_time_series_config = parent_rpcs&.list_time_series if parent_rpcs&.respond_to? :list_time_series
1027
+ @list_time_series = ::Gapic::Config::Method.new list_time_series_config
1028
+ create_time_series_config = parent_rpcs&.create_time_series if parent_rpcs&.respond_to? :create_time_series
1029
+ @create_time_series = ::Gapic::Config::Method.new create_time_series_config
1030
+
1031
+ yield self if block_given?
1032
+ end
1033
+ end
1034
+ end
1035
+ end
1036
+ end
1037
+ end
1038
+ end
1039
+ end
1040
+ end