google-cloud-monitoring-v3 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/lib/google/cloud/monitoring/v3.rb +1 -0
  3. data/lib/google/cloud/monitoring/v3/alert_policy_service/client.rb +6 -5
  4. data/lib/google/cloud/monitoring/v3/alert_policy_service/paths.rb +25 -6
  5. data/lib/google/cloud/monitoring/v3/group_service/paths.rb +25 -6
  6. data/lib/google/cloud/monitoring/v3/metric_service/client.rb +8 -2
  7. data/lib/google/cloud/monitoring/v3/metric_service/paths.rb +33 -0
  8. data/lib/google/cloud/monitoring/v3/notification_channel_service/paths.rb +25 -6
  9. data/lib/google/cloud/monitoring/v3/query_service.rb +50 -0
  10. data/lib/google/cloud/monitoring/v3/query_service/client.rb +388 -0
  11. data/lib/google/cloud/monitoring/v3/query_service/credentials.rb +53 -0
  12. data/lib/google/cloud/monitoring/v3/service_monitoring_service/client.rb +10 -6
  13. data/lib/google/cloud/monitoring/v3/service_monitoring_service/paths.rb +33 -14
  14. data/lib/google/cloud/monitoring/v3/uptime_check_service/paths.rb +33 -14
  15. data/lib/google/cloud/monitoring/v3/version.rb +1 -1
  16. data/lib/google/monitoring/v3/alert_pb.rb +8 -0
  17. data/lib/google/monitoring/v3/alert_service_pb.rb +1 -0
  18. data/lib/google/monitoring/v3/alert_service_services_pb.rb +1 -1
  19. data/lib/google/monitoring/v3/metric_pb.rb +2 -0
  20. data/lib/google/monitoring/v3/metric_service_pb.rb +2 -0
  21. data/lib/google/monitoring/v3/notification_pb.rb +3 -0
  22. data/lib/google/monitoring/v3/notification_service_pb.rb +1 -0
  23. data/lib/google/monitoring/v3/query_service_pb.rb +23 -0
  24. data/lib/google/monitoring/v3/query_service_services_pb.rb +47 -0
  25. data/lib/google/monitoring/v3/service_pb.rb +7 -1
  26. data/proto_docs/google/monitoring/v3/alert.rb +47 -11
  27. data/proto_docs/google/monitoring/v3/alert_service.rb +9 -4
  28. data/proto_docs/google/monitoring/v3/common.rb +28 -19
  29. data/proto_docs/google/monitoring/v3/dropped_labels.rb +10 -9
  30. data/proto_docs/google/monitoring/v3/metric.rb +14 -3
  31. data/proto_docs/google/monitoring/v3/metric_service.rb +19 -3
  32. data/proto_docs/google/monitoring/v3/notification.rb +10 -1
  33. data/proto_docs/google/monitoring/v3/notification_service.rb +4 -0
  34. data/proto_docs/google/monitoring/v3/service.rb +33 -2
  35. data/proto_docs/google/monitoring/v3/service_service.rb +10 -6
  36. data/proto_docs/google/monitoring/v3/uptime.rb +24 -13
  37. metadata +9 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3a49d15cbf2240ef19c4af17fbd0c6f014f609bc14f78ab56c3b190d5f7461b8
4
- data.tar.gz: eb6dda9731ed3eaaaa6b8d72f2d96e80f7aad9418d5c5c39ecfb85210b5f470b
3
+ metadata.gz: 7dde825c6bd5681f684e54850a39ab1605ad97a9cab57c95f8a5f2ed7a1b2f0f
4
+ data.tar.gz: 23ee04f8d2788c456cf9db967c894c8282f04d9c4b68ea0fa5f39c1f13c32090
5
5
  SHA512:
6
- metadata.gz: 1e2c4b356b1dd4f74c3f0d6c41d63c5b6ba3bf43fb457bd245042c3739f3f50c16faf7db0bd13804e0f6c81f5ad99acf87797693be992429e57896bc38e16c56
7
- data.tar.gz: 5594f323ce10891d65ee521003e403da29c7b797d0eac56a0300cedd6e6c8770b0a46e12930047b7b088f77d04dfb5b150c63572c98c73e397b5a726c4184525
6
+ metadata.gz: '029fcf7c8b30890bc1f7338f75c32bc5f7cfe3ba7ceb371dba5b62b7a1b2e6ce149ee6f7749daddf89dddae006a2744c047b0b5ba3d34a1fde8f19837bfd8a97'
7
+ data.tar.gz: 5c1d9ef62f8b18cf57d0bb9a587f30d1dacda859b2a7fbca89f0fcd455141f24a39626eee514e5fac860e482407bdf210b48e7de7d41c7d2f83202e3dda9bfef
@@ -20,6 +20,7 @@ require "google/cloud/monitoring/v3/alert_policy_service"
20
20
  require "google/cloud/monitoring/v3/group_service"
21
21
  require "google/cloud/monitoring/v3/metric_service"
22
22
  require "google/cloud/monitoring/v3/notification_channel_service"
23
+ require "google/cloud/monitoring/v3/query_service"
23
24
  require "google/cloud/monitoring/v3/service_monitoring_service"
24
25
  require "google/cloud/monitoring/v3/uptime_check_service"
25
26
  require "google/cloud/monitoring/v3/version"
@@ -187,7 +187,7 @@ module Google
187
187
  # Service calls
188
188
 
189
189
  ##
190
- # Lists the existing alerting policies for the project.
190
+ # Lists the existing alerting policies for the workspace.
191
191
  #
192
192
  # @overload list_alert_policies(request, options = nil)
193
193
  # Pass arguments to `list_alert_policies` via a request object, either of type
@@ -372,10 +372,11 @@ module Google
372
372
  # projects/[PROJECT_ID_OR_NUMBER]
373
373
  #
374
374
  # Note that this field names the parent container in which the alerting
375
- # policy will be written, not the name of the created policy. The alerting
376
- # policy that is returned will have a name that contains a normalized
377
- # representation of this name as a prefix but adds a suffix of the form
378
- # `/alertPolicies/[ALERT_POLICY_ID]`, identifying the policy in the
375
+ # policy will be written, not the name of the created policy. |name| must be
376
+ # a host project of a workspace, otherwise INVALID_ARGUMENT error will
377
+ # return. The alerting policy that is returned will have a name that contains
378
+ # a normalized representation of this name as a prefix but adds a suffix of
379
+ # the form `/alertPolicies/[ALERT_POLICY_ID]`, identifying the policy in the
379
380
  # container.
380
381
  # @param alert_policy [::Google::Cloud::Monitoring::V3::AlertPolicy, ::Hash]
381
382
  # Required. The requested alerting policy. You should omit the `name` field in this
@@ -163,17 +163,36 @@ module Google
163
163
  end
164
164
 
165
165
  ##
166
- # Create a fully-qualified Project resource string.
166
+ # Create a fully-qualified Workspace resource string.
167
167
  #
168
- # The resource will be in the following format:
168
+ # @overload workspace_path(project:)
169
+ # The resource will be in the following format:
170
+ #
171
+ # `projects/{project}`
172
+ #
173
+ # @param project [String]
174
+ #
175
+ # @overload workspace_path(workspace:)
176
+ # The resource will be in the following format:
169
177
  #
170
- # `projects/{project}`
178
+ # `workspaces/{workspace}`
171
179
  #
172
- # @param project [String]
180
+ # @param workspace [String]
173
181
  #
174
182
  # @return [::String]
175
- def project_path project:
176
- "projects/#{project}"
183
+ def workspace_path **args
184
+ resources = {
185
+ "project" => (proc do |project:|
186
+ "projects/#{project}"
187
+ end),
188
+ "workspace" => (proc do |workspace:|
189
+ "workspaces/#{workspace}"
190
+ end)
191
+ }
192
+
193
+ resource = resources[args.keys.sort.join(":")]
194
+ raise ::ArgumentError, "no resource found for values #{args.keys}" if resource.nil?
195
+ resource.call(**args)
177
196
  end
178
197
 
179
198
  extend self
@@ -105,17 +105,36 @@ module Google
105
105
  end
106
106
 
107
107
  ##
108
- # Create a fully-qualified Project resource string.
108
+ # Create a fully-qualified Workspace resource string.
109
109
  #
110
- # The resource will be in the following format:
110
+ # @overload workspace_path(project:)
111
+ # The resource will be in the following format:
112
+ #
113
+ # `projects/{project}`
114
+ #
115
+ # @param project [String]
116
+ #
117
+ # @overload workspace_path(workspace:)
118
+ # The resource will be in the following format:
111
119
  #
112
- # `projects/{project}`
120
+ # `workspaces/{workspace}`
113
121
  #
114
- # @param project [String]
122
+ # @param workspace [String]
115
123
  #
116
124
  # @return [::String]
117
- def project_path project:
118
- "projects/#{project}"
125
+ def workspace_path **args
126
+ resources = {
127
+ "project" => (proc do |project:|
128
+ "projects/#{project}"
129
+ end),
130
+ "workspace" => (proc do |workspace:|
131
+ "workspaces/#{workspace}"
132
+ end)
133
+ }
134
+
135
+ resource = resources[args.keys.sort.join(":")]
136
+ raise ::ArgumentError, "no resource found for values #{args.keys}" if resource.nil?
137
+ resource.call(**args)
119
138
  end
120
139
 
121
140
  extend self
@@ -670,15 +670,18 @@ module Google
670
670
  # @param options [::Gapic::CallOptions, ::Hash]
671
671
  # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
672
672
  #
673
- # @overload list_time_series(name: nil, filter: nil, interval: nil, aggregation: nil, order_by: nil, view: nil, page_size: nil, page_token: nil)
673
+ # @overload list_time_series(name: nil, filter: nil, interval: nil, aggregation: nil, secondary_aggregation: nil, order_by: nil, view: nil, page_size: nil, page_token: nil)
674
674
  # Pass arguments to `list_time_series` via keyword arguments. Note that at
675
675
  # least one keyword argument is required. To specify no parameters, or to keep all
676
676
  # the default parameter values, pass an empty Hash as a request object (see above).
677
677
  #
678
678
  # @param name [::String]
679
- # Required. The project on which to execute the request. The format is:
679
+ # Required. The project, organization or folder on which to execute the request. The
680
+ # format is:
680
681
  #
681
682
  # projects/[PROJECT_ID_OR_NUMBER]
683
+ # organizations/[ORGANIZATION_ID]
684
+ # folders/[FOLDER_ID]
682
685
  # @param filter [::String]
683
686
  # Required. A [monitoring filter](https://cloud.google.com/monitoring/api/v3/filters)
684
687
  # that specifies which time series should be returned. The filter must
@@ -697,6 +700,9 @@ module Google
697
700
  #
698
701
  # By default (if no `aggregation` is explicitly specified), the raw time
699
702
  # series data is returned.
703
+ # @param secondary_aggregation [::Google::Cloud::Monitoring::V3::Aggregation, ::Hash]
704
+ # Apply a second aggregation after `aggregation` is applied. May only be
705
+ # specified if `aggregation` is specified.
700
706
  # @param order_by [::String]
701
707
  # Unsupported: must be left blank. The points in each time series are
702
708
  # currently returned in reverse time order (most recent to oldest).
@@ -170,6 +170,39 @@ module Google
170
170
  "projects/#{project}"
171
171
  end
172
172
 
173
+ ##
174
+ # Create a fully-qualified Workspace resource string.
175
+ #
176
+ # @overload workspace_path(project:)
177
+ # The resource will be in the following format:
178
+ #
179
+ # `projects/{project}`
180
+ #
181
+ # @param project [String]
182
+ #
183
+ # @overload workspace_path(workspace:)
184
+ # The resource will be in the following format:
185
+ #
186
+ # `workspaces/{workspace}`
187
+ #
188
+ # @param workspace [String]
189
+ #
190
+ # @return [::String]
191
+ def workspace_path **args
192
+ resources = {
193
+ "project" => (proc do |project:|
194
+ "projects/#{project}"
195
+ end),
196
+ "workspace" => (proc do |workspace:|
197
+ "workspaces/#{workspace}"
198
+ end)
199
+ }
200
+
201
+ resource = resources[args.keys.sort.join(":")]
202
+ raise ::ArgumentError, "no resource found for values #{args.keys}" if resource.nil?
203
+ resource.call(**args)
204
+ end
205
+
173
206
  extend self
174
207
  end
175
208
  end
@@ -157,17 +157,36 @@ module Google
157
157
  end
158
158
 
159
159
  ##
160
- # Create a fully-qualified Project resource string.
160
+ # Create a fully-qualified Workspace resource string.
161
161
  #
162
- # The resource will be in the following format:
162
+ # @overload workspace_path(project:)
163
+ # The resource will be in the following format:
164
+ #
165
+ # `projects/{project}`
166
+ #
167
+ # @param project [String]
168
+ #
169
+ # @overload workspace_path(workspace:)
170
+ # The resource will be in the following format:
163
171
  #
164
- # `projects/{project}`
172
+ # `workspaces/{workspace}`
165
173
  #
166
- # @param project [String]
174
+ # @param workspace [String]
167
175
  #
168
176
  # @return [::String]
169
- def project_path project:
170
- "projects/#{project}"
177
+ def workspace_path **args
178
+ resources = {
179
+ "project" => (proc do |project:|
180
+ "projects/#{project}"
181
+ end),
182
+ "workspace" => (proc do |workspace:|
183
+ "workspaces/#{workspace}"
184
+ end)
185
+ }
186
+
187
+ resource = resources[args.keys.sort.join(":")]
188
+ raise ::ArgumentError, "no resource found for values #{args.keys}" if resource.nil?
189
+ resource.call(**args)
171
190
  end
172
191
 
173
192
  extend self
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2021 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/query_service/credentials"
26
+ require "google/cloud/monitoring/v3/query_service/client"
27
+
28
+ module Google
29
+ module Cloud
30
+ module Monitoring
31
+ module V3
32
+ ##
33
+ # The QueryService API is used to manage time series data in Stackdriver
34
+ # Monitoring. Time series data is a collection of data points that describes
35
+ # the time-varying values of a metric.
36
+ #
37
+ # To load this service and instantiate a client:
38
+ #
39
+ # require "google/cloud/monitoring/v3/query_service"
40
+ # client = ::Google::Cloud::Monitoring::V3::QueryService::Client.new
41
+ #
42
+ module QueryService
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
48
+
49
+ helper_path = ::File.join __dir__, "query_service", "helpers.rb"
50
+ require "google/cloud/monitoring/v3/query_service/helpers" if ::File.file? helper_path
@@ -0,0 +1,388 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2021 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/query_service_pb"
21
+
22
+ module Google
23
+ module Cloud
24
+ module Monitoring
25
+ module V3
26
+ module QueryService
27
+ ##
28
+ # Client for the QueryService service.
29
+ #
30
+ # The QueryService API is used to manage time series data in Stackdriver
31
+ # Monitoring. Time series data is a collection of data points that describes
32
+ # the time-varying values of a metric.
33
+ #
34
+ class Client
35
+ # @private
36
+ attr_reader :query_service_stub
37
+
38
+ ##
39
+ # Configure the QueryService Client class.
40
+ #
41
+ # See {::Google::Cloud::Monitoring::V3::QueryService::Client::Configuration}
42
+ # for a description of the configuration fields.
43
+ #
44
+ # ## Example
45
+ #
46
+ # To modify the configuration for all QueryService clients:
47
+ #
48
+ # ::Google::Cloud::Monitoring::V3::QueryService::Client.configure do |config|
49
+ # config.timeout = 10.0
50
+ # end
51
+ #
52
+ # @yield [config] Configure the Client client.
53
+ # @yieldparam config [Client::Configuration]
54
+ #
55
+ # @return [Client::Configuration]
56
+ #
57
+ def self.configure
58
+ @configure ||= begin
59
+ namespace = ["Google", "Cloud", "Monitoring", "V3"]
60
+ parent_config = while namespace.any?
61
+ parent_name = namespace.join "::"
62
+ parent_const = const_get parent_name
63
+ break parent_const.configure if parent_const.respond_to? :configure
64
+ namespace.pop
65
+ end
66
+ default_config = Client::Configuration.new parent_config
67
+
68
+ default_config
69
+ end
70
+ yield @configure if block_given?
71
+ @configure
72
+ end
73
+
74
+ ##
75
+ # Configure the QueryService Client instance.
76
+ #
77
+ # The configuration is set to the derived mode, meaning that values can be changed,
78
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
79
+ # should be made on {Client.configure}.
80
+ #
81
+ # See {::Google::Cloud::Monitoring::V3::QueryService::Client::Configuration}
82
+ # for a description of the configuration fields.
83
+ #
84
+ # @yield [config] Configure the Client client.
85
+ # @yieldparam config [Client::Configuration]
86
+ #
87
+ # @return [Client::Configuration]
88
+ #
89
+ def configure
90
+ yield @config if block_given?
91
+ @config
92
+ end
93
+
94
+ ##
95
+ # Create a new QueryService client object.
96
+ #
97
+ # ## Examples
98
+ #
99
+ # To create a new QueryService client with the default
100
+ # configuration:
101
+ #
102
+ # client = ::Google::Cloud::Monitoring::V3::QueryService::Client.new
103
+ #
104
+ # To create a new QueryService client with a custom
105
+ # configuration:
106
+ #
107
+ # client = ::Google::Cloud::Monitoring::V3::QueryService::Client.new do |config|
108
+ # config.timeout = 10.0
109
+ # end
110
+ #
111
+ # @yield [config] Configure the QueryService client.
112
+ # @yieldparam config [Client::Configuration]
113
+ #
114
+ def initialize
115
+ # These require statements are intentionally placed here to initialize
116
+ # the gRPC module only when it's required.
117
+ # See https://github.com/googleapis/toolkit/issues/446
118
+ require "gapic/grpc"
119
+ require "google/monitoring/v3/query_service_services_pb"
120
+
121
+ # Create the configuration object
122
+ @config = Configuration.new Client.configure
123
+
124
+ # Yield the configuration if needed
125
+ yield @config if block_given?
126
+
127
+ # Create credentials
128
+ credentials = @config.credentials
129
+ # Use self-signed JWT if the scope and endpoint are unchanged from default,
130
+ # but only if the default endpoint does not have a region prefix.
131
+ enable_self_signed_jwt = @config.scope == Client.configure.scope &&
132
+ @config.endpoint == Client.configure.endpoint &&
133
+ !@config.endpoint.split(".").first.include?("-")
134
+ credentials ||= Credentials.default scope: @config.scope,
135
+ enable_self_signed_jwt: enable_self_signed_jwt
136
+ if credentials.is_a?(String) || credentials.is_a?(Hash)
137
+ credentials = Credentials.new credentials, scope: @config.scope
138
+ end
139
+ @quota_project_id = @config.quota_project
140
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
141
+
142
+ @query_service_stub = ::Gapic::ServiceStub.new(
143
+ ::Google::Cloud::Monitoring::V3::QueryService::Stub,
144
+ credentials: credentials,
145
+ endpoint: @config.endpoint,
146
+ channel_args: @config.channel_args,
147
+ interceptors: @config.interceptors
148
+ )
149
+ end
150
+
151
+ # Service calls
152
+
153
+ ##
154
+ # Queries time series using Monitoring Query Language. This method does not require a Workspace.
155
+ #
156
+ # @overload query_time_series(request, options = nil)
157
+ # Pass arguments to `query_time_series` via a request object, either of type
158
+ # {::Google::Cloud::Monitoring::V3::QueryTimeSeriesRequest} or an equivalent Hash.
159
+ #
160
+ # @param request [::Google::Cloud::Monitoring::V3::QueryTimeSeriesRequest, ::Hash]
161
+ # A request object representing the call parameters. Required. To specify no
162
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
163
+ # @param options [::Gapic::CallOptions, ::Hash]
164
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
165
+ #
166
+ # @overload query_time_series(name: nil, query: nil, page_size: nil, page_token: nil)
167
+ # Pass arguments to `query_time_series` via keyword arguments. Note that at
168
+ # least one keyword argument is required. To specify no parameters, or to keep all
169
+ # the default parameter values, pass an empty Hash as a request object (see above).
170
+ #
171
+ # @param name [::String]
172
+ # Required. The project on which to execute the request. The format is:
173
+ #
174
+ # projects/[PROJECT_ID_OR_NUMBER]
175
+ # @param query [::String]
176
+ # Required. The query in the [Monitoring Query
177
+ # Language](https://cloud.google.com/monitoring/mql/reference) format.
178
+ # The default time zone is in UTC.
179
+ # @param page_size [::Integer]
180
+ # A positive number that is the maximum number of time_series_data to return.
181
+ # @param page_token [::String]
182
+ # If this field is not empty then it must contain the `nextPageToken` value
183
+ # returned by a previous call to this method. Using this field causes the
184
+ # method to return additional results from the previous method call.
185
+ #
186
+ # @yield [response, operation] Access the result along with the RPC operation
187
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Monitoring::V3::TimeSeriesData>]
188
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
189
+ #
190
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::Monitoring::V3::TimeSeriesData>]
191
+ #
192
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
193
+ #
194
+ def query_time_series request, options = nil
195
+ raise ::ArgumentError, "request must be provided" if request.nil?
196
+
197
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Monitoring::V3::QueryTimeSeriesRequest
198
+
199
+ # Converts hash and nil to an options object
200
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
201
+
202
+ # Customize the options with defaults
203
+ metadata = @config.rpcs.query_time_series.metadata.to_h
204
+
205
+ # Set x-goog-api-client and x-goog-user-project headers
206
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
207
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
208
+ gapic_version: ::Google::Cloud::Monitoring::V3::VERSION
209
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
210
+
211
+ header_params = {
212
+ "name" => request.name
213
+ }
214
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
215
+ metadata[:"x-goog-request-params"] ||= request_params_header
216
+
217
+ options.apply_defaults timeout: @config.rpcs.query_time_series.timeout,
218
+ metadata: metadata,
219
+ retry_policy: @config.rpcs.query_time_series.retry_policy
220
+ options.apply_defaults metadata: @config.metadata,
221
+ retry_policy: @config.retry_policy
222
+
223
+ @query_service_stub.call_rpc :query_time_series, request, options: options do |response, operation|
224
+ response = ::Gapic::PagedEnumerable.new @query_service_stub, :query_time_series, request, response, operation, options
225
+ yield response, operation if block_given?
226
+ return response
227
+ end
228
+ rescue ::GRPC::BadStatus => e
229
+ raise ::Google::Cloud::Error.from_error(e)
230
+ end
231
+
232
+ ##
233
+ # Configuration class for the QueryService API.
234
+ #
235
+ # This class represents the configuration for QueryService,
236
+ # providing control over timeouts, retry behavior, logging, transport
237
+ # parameters, and other low-level controls. Certain parameters can also be
238
+ # applied individually to specific RPCs. See
239
+ # {::Google::Cloud::Monitoring::V3::QueryService::Client::Configuration::Rpcs}
240
+ # for a list of RPCs that can be configured independently.
241
+ #
242
+ # Configuration can be applied globally to all clients, or to a single client
243
+ # on construction.
244
+ #
245
+ # # Examples
246
+ #
247
+ # To modify the global config, setting the timeout for query_time_series
248
+ # to 20 seconds, and all remaining timeouts to 10 seconds:
249
+ #
250
+ # ::Google::Cloud::Monitoring::V3::QueryService::Client.configure do |config|
251
+ # config.timeout = 10.0
252
+ # config.rpcs.query_time_series.timeout = 20.0
253
+ # end
254
+ #
255
+ # To apply the above configuration only to a new client:
256
+ #
257
+ # client = ::Google::Cloud::Monitoring::V3::QueryService::Client.new do |config|
258
+ # config.timeout = 10.0
259
+ # config.rpcs.query_time_series.timeout = 20.0
260
+ # end
261
+ #
262
+ # @!attribute [rw] endpoint
263
+ # The hostname or hostname:port of the service endpoint.
264
+ # Defaults to `"monitoring.googleapis.com"`.
265
+ # @return [::String]
266
+ # @!attribute [rw] credentials
267
+ # Credentials to send with calls. You may provide any of the following types:
268
+ # * (`String`) The path to a service account key file in JSON format
269
+ # * (`Hash`) A service account key as a Hash
270
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
271
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
272
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
273
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
274
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
275
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
276
+ # * (`nil`) indicating no credentials
277
+ # @return [::Object]
278
+ # @!attribute [rw] scope
279
+ # The OAuth scopes
280
+ # @return [::Array<::String>]
281
+ # @!attribute [rw] lib_name
282
+ # The library name as recorded in instrumentation and logging
283
+ # @return [::String]
284
+ # @!attribute [rw] lib_version
285
+ # The library version as recorded in instrumentation and logging
286
+ # @return [::String]
287
+ # @!attribute [rw] channel_args
288
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
289
+ # `GRPC::Core::Channel` object is provided as the credential.
290
+ # @return [::Hash]
291
+ # @!attribute [rw] interceptors
292
+ # An array of interceptors that are run before calls are executed.
293
+ # @return [::Array<::GRPC::ClientInterceptor>]
294
+ # @!attribute [rw] timeout
295
+ # The call timeout in seconds.
296
+ # @return [::Numeric]
297
+ # @!attribute [rw] metadata
298
+ # Additional gRPC headers to be sent with the call.
299
+ # @return [::Hash{::Symbol=>::String}]
300
+ # @!attribute [rw] retry_policy
301
+ # The retry policy. The value is a hash with the following keys:
302
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
303
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
304
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
305
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
306
+ # trigger a retry.
307
+ # @return [::Hash]
308
+ # @!attribute [rw] quota_project
309
+ # A separate project against which to charge quota.
310
+ # @return [::String]
311
+ #
312
+ class Configuration
313
+ extend ::Gapic::Config
314
+
315
+ config_attr :endpoint, "monitoring.googleapis.com", ::String
316
+ config_attr :credentials, nil do |value|
317
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
318
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
319
+ allowed.any? { |klass| klass === value }
320
+ end
321
+ config_attr :scope, nil, ::String, ::Array, nil
322
+ config_attr :lib_name, nil, ::String, nil
323
+ config_attr :lib_version, nil, ::String, nil
324
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
325
+ config_attr :interceptors, nil, ::Array, nil
326
+ config_attr :timeout, nil, ::Numeric, nil
327
+ config_attr :metadata, nil, ::Hash, nil
328
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
329
+ config_attr :quota_project, nil, ::String, nil
330
+
331
+ # @private
332
+ def initialize parent_config = nil
333
+ @parent_config = parent_config unless parent_config.nil?
334
+
335
+ yield self if block_given?
336
+ end
337
+
338
+ ##
339
+ # Configurations for individual RPCs
340
+ # @return [Rpcs]
341
+ #
342
+ def rpcs
343
+ @rpcs ||= begin
344
+ parent_rpcs = nil
345
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
346
+ Rpcs.new parent_rpcs
347
+ end
348
+ end
349
+
350
+ ##
351
+ # Configuration RPC class for the QueryService API.
352
+ #
353
+ # Includes fields providing the configuration for each RPC in this service.
354
+ # Each configuration object is of type `Gapic::Config::Method` and includes
355
+ # the following configuration fields:
356
+ #
357
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
358
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
359
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
360
+ # include the following keys:
361
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
362
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
363
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
364
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
365
+ # trigger a retry.
366
+ #
367
+ class Rpcs
368
+ ##
369
+ # RPC-specific configuration for `query_time_series`
370
+ # @return [::Gapic::Config::Method]
371
+ #
372
+ attr_reader :query_time_series
373
+
374
+ # @private
375
+ def initialize parent_rpcs = nil
376
+ query_time_series_config = parent_rpcs.query_time_series if parent_rpcs.respond_to? :query_time_series
377
+ @query_time_series = ::Gapic::Config::Method.new query_time_series_config
378
+
379
+ yield self if block_given?
380
+ end
381
+ end
382
+ end
383
+ end
384
+ end
385
+ end
386
+ end
387
+ end
388
+ end