google-cloud-error_reporting-v1beta1 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) 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 +75 -0
  6. data/lib/google-cloud-error_reporting-v1beta1.rb +21 -0
  7. data/lib/google/cloud/error_reporting/v1beta1.rb +37 -0
  8. data/lib/google/cloud/error_reporting/v1beta1/error_group_service.rb +49 -0
  9. data/lib/google/cloud/error_reporting/v1beta1/error_group_service/client.rb +456 -0
  10. data/lib/google/cloud/error_reporting/v1beta1/error_group_service/credentials.rb +51 -0
  11. data/lib/google/cloud/error_reporting/v1beta1/error_group_service/paths.rb +50 -0
  12. data/lib/google/cloud/error_reporting/v1beta1/error_stats_service.rb +50 -0
  13. data/lib/google/cloud/error_reporting/v1beta1/error_stats_service/client.rb +587 -0
  14. data/lib/google/cloud/error_reporting/v1beta1/error_stats_service/credentials.rb +51 -0
  15. data/lib/google/cloud/error_reporting/v1beta1/error_stats_service/paths.rb +47 -0
  16. data/lib/google/cloud/error_reporting/v1beta1/report_errors_service.rb +49 -0
  17. data/lib/google/cloud/error_reporting/v1beta1/report_errors_service/client.rb +385 -0
  18. data/lib/google/cloud/error_reporting/v1beta1/report_errors_service/credentials.rb +51 -0
  19. data/lib/google/cloud/error_reporting/v1beta1/report_errors_service/paths.rb +47 -0
  20. data/lib/google/cloud/error_reporting/v1beta1/version.rb +28 -0
  21. data/lib/google/devtools/clouderrorreporting/v1beta1/common_pb.rb +65 -0
  22. data/lib/google/devtools/clouderrorreporting/v1beta1/error_group_service_pb.rb +31 -0
  23. data/lib/google/devtools/clouderrorreporting/v1beta1/error_group_service_services_pb.rb +49 -0
  24. data/lib/google/devtools/clouderrorreporting/v1beta1/error_stats_service_pb.rb +117 -0
  25. data/lib/google/devtools/clouderrorreporting/v1beta1/error_stats_service_services_pb.rb +51 -0
  26. data/lib/google/devtools/clouderrorreporting/v1beta1/report_errors_service_pb.rb +39 -0
  27. data/lib/google/devtools/clouderrorreporting/v1beta1/report_errors_service_services_pb.rb +54 -0
  28. data/proto_docs/README.md +4 -0
  29. data/proto_docs/google/api/field_behavior.rb +59 -0
  30. data/proto_docs/google/api/resource.rb +247 -0
  31. data/proto_docs/google/devtools/clouderrorreporting/v1beta1/common.rb +183 -0
  32. data/proto_docs/google/devtools/clouderrorreporting/v1beta1/error_group_service.rb +49 -0
  33. data/proto_docs/google/devtools/clouderrorreporting/v1beta1/error_stats_service.rb +348 -0
  34. data/proto_docs/google/devtools/clouderrorreporting/v1beta1/report_errors_service.rb +92 -0
  35. data/proto_docs/google/protobuf/duration.rb +98 -0
  36. data/proto_docs/google/protobuf/timestamp.rb +120 -0
  37. metadata +218 -0
@@ -0,0 +1,51 @@
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 ErrorReporting
24
+ module V1beta1
25
+ module ErrorGroupService
26
+ # Credentials for the ErrorGroupService API.
27
+ class Credentials < ::Google::Auth::Credentials
28
+ self.scope = [
29
+ "https://www.googleapis.com/auth/cloud-platform"
30
+ ]
31
+ self.env_vars = [
32
+ "ERROR_REPORTING_CREDENTIALS",
33
+ "ERROR_REPORTING_KEYFILE",
34
+ "GOOGLE_CLOUD_CREDENTIALS",
35
+ "GOOGLE_CLOUD_KEYFILE",
36
+ "GCLOUD_KEYFILE",
37
+ "ERROR_REPORTING_CREDENTIALS_JSON",
38
+ "ERROR_REPORTING_KEYFILE_JSON",
39
+ "GOOGLE_CLOUD_CREDENTIALS_JSON",
40
+ "GOOGLE_CLOUD_KEYFILE_JSON",
41
+ "GCLOUD_KEYFILE_JSON"
42
+ ]
43
+ self.paths = [
44
+ "~/.config/google_cloud/application_default_credentials.json"
45
+ ]
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
51
+ 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
+
20
+ module Google
21
+ module Cloud
22
+ module ErrorReporting
23
+ module V1beta1
24
+ module ErrorGroupService
25
+ # Path helper methods for the ErrorGroupService API.
26
+ module Paths
27
+ ##
28
+ # Create a fully-qualified ErrorGroup resource string.
29
+ #
30
+ # The resource will be in the following format:
31
+ #
32
+ # `projects/{project}/groups/{group}`
33
+ #
34
+ # @param project [String]
35
+ # @param group [String]
36
+ #
37
+ # @return [::String]
38
+ def error_group_path project:, group:
39
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
40
+
41
+ "projects/#{project}/groups/#{group}"
42
+ end
43
+
44
+ extend self
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
50
+ 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/error_reporting/v1beta1/version"
24
+
25
+ require "google/cloud/error_reporting/v1beta1/error_stats_service/credentials"
26
+ require "google/cloud/error_reporting/v1beta1/error_stats_service/paths"
27
+ require "google/cloud/error_reporting/v1beta1/error_stats_service/client"
28
+
29
+ module Google
30
+ module Cloud
31
+ module ErrorReporting
32
+ module V1beta1
33
+ ##
34
+ # An API for retrieving and managing error statistics as well as data for
35
+ # individual events.
36
+ #
37
+ # To load this service and instantiate a client:
38
+ #
39
+ # require "google/cloud/error_reporting/v1beta1/error_stats_service"
40
+ # client = ::Google::Cloud::ErrorReporting::V1beta1::ErrorStatsService::Client.new
41
+ #
42
+ module ErrorStatsService
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
48
+
49
+ helper_path = ::File.join __dir__, "error_stats_service", "helpers.rb"
50
+ require "google/cloud/error_reporting/v1beta1/error_stats_service/helpers" if ::File.file? helper_path
@@ -0,0 +1,587 @@
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/devtools/clouderrorreporting/v1beta1/error_stats_service_pb"
21
+
22
+ module Google
23
+ module Cloud
24
+ module ErrorReporting
25
+ module V1beta1
26
+ module ErrorStatsService
27
+ ##
28
+ # Client for the ErrorStatsService service.
29
+ #
30
+ # An API for retrieving and managing error statistics as well as data for
31
+ # individual events.
32
+ #
33
+ class Client
34
+ include Paths
35
+
36
+ # @private
37
+ attr_reader :error_stats_service_stub
38
+
39
+ ##
40
+ # Configure the ErrorStatsService Client class.
41
+ #
42
+ # See {::Google::Cloud::ErrorReporting::V1beta1::ErrorStatsService::Client::Configuration}
43
+ # for a description of the configuration fields.
44
+ #
45
+ # ## Example
46
+ #
47
+ # To modify the configuration for all ErrorStatsService clients:
48
+ #
49
+ # ::Google::Cloud::ErrorReporting::V1beta1::ErrorStatsService::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", "ErrorReporting", "V1beta1"]
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.timeout = 600.0
70
+ default_config.retry_policy = {
71
+ initial_delay: 0.1,
72
+ max_delay: 60.0,
73
+ multiplier: 1.3,
74
+ retry_codes: ["UNAVAILABLE", "DEADLINE_EXCEEDED"]
75
+ }
76
+
77
+ default_config
78
+ end
79
+ yield @configure if block_given?
80
+ @configure
81
+ end
82
+
83
+ ##
84
+ # Configure the ErrorStatsService Client instance.
85
+ #
86
+ # The configuration is set to the derived mode, meaning that values can be changed,
87
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
88
+ # should be made on {Client.configure}.
89
+ #
90
+ # See {::Google::Cloud::ErrorReporting::V1beta1::ErrorStatsService::Client::Configuration}
91
+ # for a description of the configuration fields.
92
+ #
93
+ # @yield [config] Configure the Client client.
94
+ # @yieldparam config [Client::Configuration]
95
+ #
96
+ # @return [Client::Configuration]
97
+ #
98
+ def configure
99
+ yield @config if block_given?
100
+ @config
101
+ end
102
+
103
+ ##
104
+ # Create a new ErrorStatsService client object.
105
+ #
106
+ # ## Examples
107
+ #
108
+ # To create a new ErrorStatsService client with the default
109
+ # configuration:
110
+ #
111
+ # client = ::Google::Cloud::ErrorReporting::V1beta1::ErrorStatsService::Client.new
112
+ #
113
+ # To create a new ErrorStatsService client with a custom
114
+ # configuration:
115
+ #
116
+ # client = ::Google::Cloud::ErrorReporting::V1beta1::ErrorStatsService::Client.new do |config|
117
+ # config.timeout = 10.0
118
+ # end
119
+ #
120
+ # @yield [config] Configure the ErrorStatsService client.
121
+ # @yieldparam config [Client::Configuration]
122
+ #
123
+ def initialize
124
+ # These require statements are intentionally placed here to initialize
125
+ # the gRPC module only when it's required.
126
+ # See https://github.com/googleapis/toolkit/issues/446
127
+ require "gapic/grpc"
128
+ require "google/devtools/clouderrorreporting/v1beta1/error_stats_service_services_pb"
129
+
130
+ # Create the configuration object
131
+ @config = Configuration.new Client.configure
132
+
133
+ # Yield the configuration if needed
134
+ yield @config if block_given?
135
+
136
+ # Create credentials
137
+ credentials = @config.credentials
138
+ credentials ||= Credentials.default scope: @config.scope
139
+ if credentials.is_a?(String) || credentials.is_a?(Hash)
140
+ credentials = Credentials.new credentials, scope: @config.scope
141
+ end
142
+ @quota_project_id = @config.quota_project
143
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
144
+
145
+ @error_stats_service_stub = ::Gapic::ServiceStub.new(
146
+ ::Google::Cloud::ErrorReporting::V1beta1::ErrorStatsService::Stub,
147
+ credentials: credentials,
148
+ endpoint: @config.endpoint,
149
+ channel_args: @config.channel_args,
150
+ interceptors: @config.interceptors
151
+ )
152
+ end
153
+
154
+ # Service calls
155
+
156
+ ##
157
+ # Lists the specified groups.
158
+ #
159
+ # @overload list_group_stats(request, options = nil)
160
+ # Pass arguments to `list_group_stats` via a request object, either of type
161
+ # {::Google::Cloud::ErrorReporting::V1beta1::ListGroupStatsRequest} or an equivalent Hash.
162
+ #
163
+ # @param request [::Google::Cloud::ErrorReporting::V1beta1::ListGroupStatsRequest, ::Hash]
164
+ # A request object representing the call parameters. Required. To specify no
165
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
166
+ # @param options [::Gapic::CallOptions, ::Hash]
167
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
168
+ #
169
+ # @overload list_group_stats(project_name: nil, group_id: nil, service_filter: nil, time_range: nil, timed_count_duration: nil, alignment: nil, alignment_time: nil, order: nil, page_size: nil, page_token: nil)
170
+ # Pass arguments to `list_group_stats` via keyword arguments. Note that at
171
+ # least one keyword argument is required. To specify no parameters, or to keep all
172
+ # the default parameter values, pass an empty Hash as a request object (see above).
173
+ #
174
+ # @param project_name [::String]
175
+ # Required. The resource name of the Google Cloud Platform project. Written
176
+ # as <code>projects/</code> plus the
177
+ # <a href="https://support.google.com/cloud/answer/6158840">Google Cloud
178
+ # Platform project ID</a>.
179
+ #
180
+ # Example: <code>projects/my-project-123</code>.
181
+ # @param group_id [::Array<::String>]
182
+ # Optional. List all <code>ErrorGroupStats</code> with these IDs.
183
+ # @param service_filter [::Google::Cloud::ErrorReporting::V1beta1::ServiceContextFilter, ::Hash]
184
+ # Optional. List only <code>ErrorGroupStats</code> which belong to a service
185
+ # context that matches the filter.
186
+ # Data for all service contexts is returned if this field is not specified.
187
+ # @param time_range [::Google::Cloud::ErrorReporting::V1beta1::QueryTimeRange, ::Hash]
188
+ # Optional. List data for the given time range.
189
+ # If not set, a default time range is used. The field
190
+ # <code>time_range_begin</code> in the response will specify the beginning
191
+ # of this time range.
192
+ # Only <code>ErrorGroupStats</code> with a non-zero count in the given time
193
+ # range are returned, unless the request contains an explicit
194
+ # <code>group_id</code> list. If a <code>group_id</code> list is given, also
195
+ # <code>ErrorGroupStats</code> with zero occurrences are returned.
196
+ # @param timed_count_duration [::Google::Protobuf::Duration, ::Hash]
197
+ # Optional. The preferred duration for a single returned `TimedCount`.
198
+ # If not set, no timed counts are returned.
199
+ # @param alignment [::Google::Cloud::ErrorReporting::V1beta1::TimedCountAlignment]
200
+ # Optional. The alignment of the timed counts to be returned.
201
+ # Default is `ALIGNMENT_EQUAL_AT_END`.
202
+ # @param alignment_time [::Google::Protobuf::Timestamp, ::Hash]
203
+ # Optional. Time where the timed counts shall be aligned if rounded
204
+ # alignment is chosen. Default is 00:00 UTC.
205
+ # @param order [::Google::Cloud::ErrorReporting::V1beta1::ErrorGroupOrder]
206
+ # Optional. The sort order in which the results are returned.
207
+ # Default is `COUNT_DESC`.
208
+ # @param page_size [::Integer]
209
+ # Optional. The maximum number of results to return per response.
210
+ # Default is 20.
211
+ # @param page_token [::String]
212
+ # Optional. A `next_page_token` provided by a previous response. To view
213
+ # additional results, pass this token along with the identical query
214
+ # parameters as the first request.
215
+ #
216
+ # @yield [response, operation] Access the result along with the RPC operation
217
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::ErrorReporting::V1beta1::ErrorGroupStats>]
218
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
219
+ #
220
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::ErrorReporting::V1beta1::ErrorGroupStats>]
221
+ #
222
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
223
+ #
224
+ def list_group_stats request, options = nil
225
+ raise ::ArgumentError, "request must be provided" if request.nil?
226
+
227
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ErrorReporting::V1beta1::ListGroupStatsRequest
228
+
229
+ # Converts hash and nil to an options object
230
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
231
+
232
+ # Customize the options with defaults
233
+ metadata = @config.rpcs.list_group_stats.metadata.to_h
234
+
235
+ # Set x-goog-api-client and x-goog-user-project headers
236
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
237
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
238
+ gapic_version: ::Google::Cloud::ErrorReporting::V1beta1::VERSION
239
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
240
+
241
+ header_params = {
242
+ "project_name" => request.project_name
243
+ }
244
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
245
+ metadata[:"x-goog-request-params"] ||= request_params_header
246
+
247
+ options.apply_defaults timeout: @config.rpcs.list_group_stats.timeout,
248
+ metadata: metadata,
249
+ retry_policy: @config.rpcs.list_group_stats.retry_policy
250
+ options.apply_defaults metadata: @config.metadata,
251
+ retry_policy: @config.retry_policy
252
+
253
+ @error_stats_service_stub.call_rpc :list_group_stats, request, options: options do |response, operation|
254
+ response = ::Gapic::PagedEnumerable.new @error_stats_service_stub, :list_group_stats, request, response, operation, options
255
+ yield response, operation if block_given?
256
+ return response
257
+ end
258
+ rescue ::GRPC::BadStatus => e
259
+ raise ::Google::Cloud::Error.from_error(e)
260
+ end
261
+
262
+ ##
263
+ # Lists the specified events.
264
+ #
265
+ # @overload list_events(request, options = nil)
266
+ # Pass arguments to `list_events` via a request object, either of type
267
+ # {::Google::Cloud::ErrorReporting::V1beta1::ListEventsRequest} or an equivalent Hash.
268
+ #
269
+ # @param request [::Google::Cloud::ErrorReporting::V1beta1::ListEventsRequest, ::Hash]
270
+ # A request object representing the call parameters. Required. To specify no
271
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
272
+ # @param options [::Gapic::CallOptions, ::Hash]
273
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
274
+ #
275
+ # @overload list_events(project_name: nil, group_id: nil, service_filter: nil, time_range: nil, page_size: nil, page_token: nil)
276
+ # Pass arguments to `list_events` via keyword arguments. Note that at
277
+ # least one keyword argument is required. To specify no parameters, or to keep all
278
+ # the default parameter values, pass an empty Hash as a request object (see above).
279
+ #
280
+ # @param project_name [::String]
281
+ # Required. The resource name of the Google Cloud Platform project. Written
282
+ # as `projects/` plus the
283
+ # [Google Cloud Platform project
284
+ # ID](https://support.google.com/cloud/answer/6158840).
285
+ # Example: `projects/my-project-123`.
286
+ # @param group_id [::String]
287
+ # Required. The group for which events shall be returned.
288
+ # @param service_filter [::Google::Cloud::ErrorReporting::V1beta1::ServiceContextFilter, ::Hash]
289
+ # Optional. List only ErrorGroups which belong to a service context that
290
+ # matches the filter.
291
+ # Data for all service contexts is returned if this field is not specified.
292
+ # @param time_range [::Google::Cloud::ErrorReporting::V1beta1::QueryTimeRange, ::Hash]
293
+ # Optional. List only data for the given time range.
294
+ # If not set a default time range is used. The field time_range_begin
295
+ # in the response will specify the beginning of this time range.
296
+ # @param page_size [::Integer]
297
+ # Optional. The maximum number of results to return per response.
298
+ # @param page_token [::String]
299
+ # Optional. A `next_page_token` provided by a previous response.
300
+ #
301
+ # @yield [response, operation] Access the result along with the RPC operation
302
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::ErrorReporting::V1beta1::ErrorEvent>]
303
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
304
+ #
305
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::ErrorReporting::V1beta1::ErrorEvent>]
306
+ #
307
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
308
+ #
309
+ def list_events request, options = nil
310
+ raise ::ArgumentError, "request must be provided" if request.nil?
311
+
312
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ErrorReporting::V1beta1::ListEventsRequest
313
+
314
+ # Converts hash and nil to an options object
315
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
316
+
317
+ # Customize the options with defaults
318
+ metadata = @config.rpcs.list_events.metadata.to_h
319
+
320
+ # Set x-goog-api-client and x-goog-user-project headers
321
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
322
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
323
+ gapic_version: ::Google::Cloud::ErrorReporting::V1beta1::VERSION
324
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
325
+
326
+ header_params = {
327
+ "project_name" => request.project_name
328
+ }
329
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
330
+ metadata[:"x-goog-request-params"] ||= request_params_header
331
+
332
+ options.apply_defaults timeout: @config.rpcs.list_events.timeout,
333
+ metadata: metadata,
334
+ retry_policy: @config.rpcs.list_events.retry_policy
335
+ options.apply_defaults metadata: @config.metadata,
336
+ retry_policy: @config.retry_policy
337
+
338
+ @error_stats_service_stub.call_rpc :list_events, request, options: options do |response, operation|
339
+ response = ::Gapic::PagedEnumerable.new @error_stats_service_stub, :list_events, request, response, operation, options
340
+ yield response, operation if block_given?
341
+ return response
342
+ end
343
+ rescue ::GRPC::BadStatus => e
344
+ raise ::Google::Cloud::Error.from_error(e)
345
+ end
346
+
347
+ ##
348
+ # Deletes all error events of a given project.
349
+ #
350
+ # @overload delete_events(request, options = nil)
351
+ # Pass arguments to `delete_events` via a request object, either of type
352
+ # {::Google::Cloud::ErrorReporting::V1beta1::DeleteEventsRequest} or an equivalent Hash.
353
+ #
354
+ # @param request [::Google::Cloud::ErrorReporting::V1beta1::DeleteEventsRequest, ::Hash]
355
+ # A request object representing the call parameters. Required. To specify no
356
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
357
+ # @param options [::Gapic::CallOptions, ::Hash]
358
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
359
+ #
360
+ # @overload delete_events(project_name: nil)
361
+ # Pass arguments to `delete_events` via keyword arguments. Note that at
362
+ # least one keyword argument is required. To specify no parameters, or to keep all
363
+ # the default parameter values, pass an empty Hash as a request object (see above).
364
+ #
365
+ # @param project_name [::String]
366
+ # Required. The resource name of the Google Cloud Platform project. Written
367
+ # as `projects/` plus the
368
+ # [Google Cloud Platform project
369
+ # ID](https://support.google.com/cloud/answer/6158840).
370
+ # Example: `projects/my-project-123`.
371
+ #
372
+ # @yield [response, operation] Access the result along with the RPC operation
373
+ # @yieldparam response [::Google::Cloud::ErrorReporting::V1beta1::DeleteEventsResponse]
374
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
375
+ #
376
+ # @return [::Google::Cloud::ErrorReporting::V1beta1::DeleteEventsResponse]
377
+ #
378
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
379
+ #
380
+ def delete_events request, options = nil
381
+ raise ::ArgumentError, "request must be provided" if request.nil?
382
+
383
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ErrorReporting::V1beta1::DeleteEventsRequest
384
+
385
+ # Converts hash and nil to an options object
386
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
387
+
388
+ # Customize the options with defaults
389
+ metadata = @config.rpcs.delete_events.metadata.to_h
390
+
391
+ # Set x-goog-api-client and x-goog-user-project headers
392
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
393
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
394
+ gapic_version: ::Google::Cloud::ErrorReporting::V1beta1::VERSION
395
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
396
+
397
+ header_params = {
398
+ "project_name" => request.project_name
399
+ }
400
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
401
+ metadata[:"x-goog-request-params"] ||= request_params_header
402
+
403
+ options.apply_defaults timeout: @config.rpcs.delete_events.timeout,
404
+ metadata: metadata,
405
+ retry_policy: @config.rpcs.delete_events.retry_policy
406
+ options.apply_defaults metadata: @config.metadata,
407
+ retry_policy: @config.retry_policy
408
+
409
+ @error_stats_service_stub.call_rpc :delete_events, request, options: options do |response, operation|
410
+ yield response, operation if block_given?
411
+ return response
412
+ end
413
+ rescue ::GRPC::BadStatus => e
414
+ raise ::Google::Cloud::Error.from_error(e)
415
+ end
416
+
417
+ ##
418
+ # Configuration class for the ErrorStatsService API.
419
+ #
420
+ # This class represents the configuration for ErrorStatsService,
421
+ # providing control over timeouts, retry behavior, logging, transport
422
+ # parameters, and other low-level controls. Certain parameters can also be
423
+ # applied individually to specific RPCs. See
424
+ # {::Google::Cloud::ErrorReporting::V1beta1::ErrorStatsService::Client::Configuration::Rpcs}
425
+ # for a list of RPCs that can be configured independently.
426
+ #
427
+ # Configuration can be applied globally to all clients, or to a single client
428
+ # on construction.
429
+ #
430
+ # # Examples
431
+ #
432
+ # To modify the global config, setting the timeout for list_group_stats
433
+ # to 20 seconds, and all remaining timeouts to 10 seconds:
434
+ #
435
+ # ::Google::Cloud::ErrorReporting::V1beta1::ErrorStatsService::Client.configure do |config|
436
+ # config.timeout = 10.0
437
+ # config.rpcs.list_group_stats.timeout = 20.0
438
+ # end
439
+ #
440
+ # To apply the above configuration only to a new client:
441
+ #
442
+ # client = ::Google::Cloud::ErrorReporting::V1beta1::ErrorStatsService::Client.new do |config|
443
+ # config.timeout = 10.0
444
+ # config.rpcs.list_group_stats.timeout = 20.0
445
+ # end
446
+ #
447
+ # @!attribute [rw] endpoint
448
+ # The hostname or hostname:port of the service endpoint.
449
+ # Defaults to `"clouderrorreporting.googleapis.com"`.
450
+ # @return [::String]
451
+ # @!attribute [rw] credentials
452
+ # Credentials to send with calls. You may provide any of the following types:
453
+ # * (`String`) The path to a service account key file in JSON format
454
+ # * (`Hash`) A service account key as a Hash
455
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
456
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
457
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
458
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
459
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
460
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
461
+ # * (`nil`) indicating no credentials
462
+ # @return [::Object]
463
+ # @!attribute [rw] scope
464
+ # The OAuth scopes
465
+ # @return [::Array<::String>]
466
+ # @!attribute [rw] lib_name
467
+ # The library name as recorded in instrumentation and logging
468
+ # @return [::String]
469
+ # @!attribute [rw] lib_version
470
+ # The library version as recorded in instrumentation and logging
471
+ # @return [::String]
472
+ # @!attribute [rw] channel_args
473
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
474
+ # `GRPC::Core::Channel` object is provided as the credential.
475
+ # @return [::Hash]
476
+ # @!attribute [rw] interceptors
477
+ # An array of interceptors that are run before calls are executed.
478
+ # @return [::Array<::GRPC::ClientInterceptor>]
479
+ # @!attribute [rw] timeout
480
+ # The call timeout in seconds.
481
+ # @return [::Numeric]
482
+ # @!attribute [rw] metadata
483
+ # Additional gRPC headers to be sent with the call.
484
+ # @return [::Hash{::Symbol=>::String}]
485
+ # @!attribute [rw] retry_policy
486
+ # The retry policy. The value is a hash with the following keys:
487
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
488
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
489
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
490
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
491
+ # trigger a retry.
492
+ # @return [::Hash]
493
+ # @!attribute [rw] quota_project
494
+ # A separate project against which to charge quota.
495
+ # @return [::String]
496
+ #
497
+ class Configuration
498
+ extend ::Gapic::Config
499
+
500
+ config_attr :endpoint, "clouderrorreporting.googleapis.com", ::String
501
+ config_attr :credentials, nil do |value|
502
+ allowed = [::String, ::Hash, ::Proc, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
503
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
504
+ allowed.any? { |klass| klass === value }
505
+ end
506
+ config_attr :scope, nil, ::String, ::Array, nil
507
+ config_attr :lib_name, nil, ::String, nil
508
+ config_attr :lib_version, nil, ::String, nil
509
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
510
+ config_attr :interceptors, nil, ::Array, nil
511
+ config_attr :timeout, nil, ::Numeric, nil
512
+ config_attr :metadata, nil, ::Hash, nil
513
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
514
+ config_attr :quota_project, nil, ::String, nil
515
+
516
+ # @private
517
+ def initialize parent_config = nil
518
+ @parent_config = parent_config unless parent_config.nil?
519
+
520
+ yield self if block_given?
521
+ end
522
+
523
+ ##
524
+ # Configurations for individual RPCs
525
+ # @return [Rpcs]
526
+ #
527
+ def rpcs
528
+ @rpcs ||= begin
529
+ parent_rpcs = nil
530
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config&.respond_to?(:rpcs)
531
+ Rpcs.new parent_rpcs
532
+ end
533
+ end
534
+
535
+ ##
536
+ # Configuration RPC class for the ErrorStatsService API.
537
+ #
538
+ # Includes fields providing the configuration for each RPC in this service.
539
+ # Each configuration object is of type `Gapic::Config::Method` and includes
540
+ # the following configuration fields:
541
+ #
542
+ # * `timeout` (*type:* `Numeric`) - The call timeout in milliseconds
543
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
544
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
545
+ # include the following keys:
546
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
547
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
548
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
549
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
550
+ # trigger a retry.
551
+ #
552
+ class Rpcs
553
+ ##
554
+ # RPC-specific configuration for `list_group_stats`
555
+ # @return [::Gapic::Config::Method]
556
+ #
557
+ attr_reader :list_group_stats
558
+ ##
559
+ # RPC-specific configuration for `list_events`
560
+ # @return [::Gapic::Config::Method]
561
+ #
562
+ attr_reader :list_events
563
+ ##
564
+ # RPC-specific configuration for `delete_events`
565
+ # @return [::Gapic::Config::Method]
566
+ #
567
+ attr_reader :delete_events
568
+
569
+ # @private
570
+ def initialize parent_rpcs = nil
571
+ list_group_stats_config = parent_rpcs&.list_group_stats if parent_rpcs&.respond_to? :list_group_stats
572
+ @list_group_stats = ::Gapic::Config::Method.new list_group_stats_config
573
+ list_events_config = parent_rpcs&.list_events if parent_rpcs&.respond_to? :list_events
574
+ @list_events = ::Gapic::Config::Method.new list_events_config
575
+ delete_events_config = parent_rpcs&.delete_events if parent_rpcs&.respond_to? :delete_events
576
+ @delete_events = ::Gapic::Config::Method.new delete_events_config
577
+
578
+ yield self if block_given?
579
+ end
580
+ end
581
+ end
582
+ end
583
+ end
584
+ end
585
+ end
586
+ end
587
+ end