google-cloud-error_reporting 0.21.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.
@@ -0,0 +1,24 @@
1
+
2
+ # Copyright 2016 Google Inc. All rights reserved.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+
16
+
17
+ require "google/cloud/error_reporting/v1beta1/error_group_service_api"
18
+ require "google/cloud/error_reporting/v1beta1/error_stats_service_api"
19
+ require "google/cloud/error_reporting/v1beta1/report_errors_service_api"
20
+ # Require the protobufs so we can create objects before GRPC is loaded.
21
+ require "google/devtools/clouderrorreporting/v1beta1/report_errors_service_pb"
22
+
23
+ require "google/cloud/core/environment"
24
+ require "google/cloud/error_reporting/middleware"
@@ -0,0 +1,229 @@
1
+ # Copyright 2016 Google Inc. All rights reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ #
15
+ # EDITING INSTRUCTIONS
16
+ # This file was generated from the file
17
+ # https://github.com/googleapis/googleapis/blob/master/google/devtools/clouderrorreporting/v1beta1/error_group_service.proto,
18
+ # and updates to that file get reflected here through a refresh process.
19
+ # For the short term, the refresh process will only be runnable by Google
20
+ # engineers.
21
+ #
22
+ # The only allowed edits are to method and file documentation. A 3-way
23
+ # merge preserves those additions if the generated source changes.
24
+
25
+ require "json"
26
+ require "pathname"
27
+
28
+ require "google/gax"
29
+ require "google/devtools/clouderrorreporting/v1beta1/error_group_service_pb"
30
+
31
+ module Google
32
+ module Cloud
33
+ module ErrorReporting
34
+ module V1beta1
35
+ # Service for retrieving and updating individual error groups.
36
+ #
37
+ # @!attribute [r] error_group_service_stub
38
+ # @return [Google::Devtools::Clouderrorreporting::V1beta1::ErrorGroupService::Stub]
39
+ class ErrorGroupServiceApi
40
+ attr_reader :error_group_service_stub
41
+
42
+ # The default address of the service.
43
+ SERVICE_ADDRESS = "clouderrorreporting.googleapis.com".freeze
44
+
45
+ # The default port of the service.
46
+ DEFAULT_SERVICE_PORT = 443
47
+
48
+ CODE_GEN_NAME_VERSION = "gapic/0.1.0".freeze
49
+
50
+ DEFAULT_TIMEOUT = 30
51
+
52
+ # The scopes needed to make gRPC calls to all of the methods defined in
53
+ # this service.
54
+ ALL_SCOPES = [
55
+ "https://www.googleapis.com/auth/cloud-platform"
56
+ ].freeze
57
+
58
+ GROUP_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
59
+ "projects/{project}/groups/{group}"
60
+ )
61
+
62
+ private_constant :GROUP_PATH_TEMPLATE
63
+
64
+ # Returns a fully-qualified group resource name string.
65
+ # @param project [String]
66
+ # @param group [String]
67
+ # @return [String]
68
+ def self.group_path project, group
69
+ GROUP_PATH_TEMPLATE.render(
70
+ :"project" => project,
71
+ :"group" => group
72
+ )
73
+ end
74
+
75
+ # Parses the project from a group resource.
76
+ # @param group_name [String]
77
+ # @return [String]
78
+ def self.match_project_from_group_name group_name
79
+ GROUP_PATH_TEMPLATE.match(group_name)["project"]
80
+ end
81
+
82
+ # Parses the group from a group resource.
83
+ # @param group_name [String]
84
+ # @return [String]
85
+ def self.match_group_from_group_name group_name
86
+ GROUP_PATH_TEMPLATE.match(group_name)["group"]
87
+ end
88
+
89
+ # @param service_path [String]
90
+ # The domain name of the API remote host.
91
+ # @param port [Integer]
92
+ # The port on which to connect to the remote host.
93
+ # @param channel [Channel]
94
+ # A Channel object through which to make calls.
95
+ # @param chan_creds [Grpc::ChannelCredentials]
96
+ # A ChannelCredentials for the setting up the RPC client.
97
+ # @param client_config[Hash]
98
+ # A Hash for call options for each method. See
99
+ # Google::Gax#construct_settings for the structure of
100
+ # this data. Falls back to the default config if not specified
101
+ # or the specified config is missing data points.
102
+ # @param timeout [Numeric]
103
+ # The default timeout, in seconds, for calls made through this client.
104
+ # @param app_name [String]
105
+ # The codename of the calling service.
106
+ # @param app_version [String]
107
+ # The version of the calling service.
108
+ def initialize \
109
+ service_path: SERVICE_ADDRESS,
110
+ port: DEFAULT_SERVICE_PORT,
111
+ channel: nil,
112
+ chan_creds: nil,
113
+ scopes: ALL_SCOPES,
114
+ client_config: {},
115
+ timeout: DEFAULT_TIMEOUT,
116
+ app_name: "gax",
117
+ app_version: Google::Gax::VERSION
118
+ # These require statements are intentionally placed here to initialize
119
+ # the gRPC module only when it's required.
120
+ # See https://github.com/googleapis/toolkit/issues/446
121
+ require "google/gax/grpc"
122
+ require "google/devtools/clouderrorreporting/v1beta1/error_group_service_services_pb"
123
+
124
+ google_api_client = "#{app_name}/#{app_version} " \
125
+ "#{CODE_GEN_NAME_VERSION} gax/#{Google::Gax::VERSION} " \
126
+ "ruby/#{RUBY_VERSION}".freeze
127
+ headers = { :"x-goog-api-client" => google_api_client }
128
+ client_config_file = Pathname.new(__dir__).join(
129
+ "error_group_service_client_config.json"
130
+ )
131
+ defaults = client_config_file.open do |f|
132
+ Google::Gax.construct_settings(
133
+ "google.devtools.clouderrorreporting.v1beta1.ErrorGroupService",
134
+ JSON.parse(f.read),
135
+ client_config,
136
+ Google::Gax::Grpc::STATUS_CODE_NAMES,
137
+ timeout,
138
+ errors: Google::Gax::Grpc::API_ERRORS,
139
+ kwargs: headers
140
+ )
141
+ end
142
+ @error_group_service_stub = Google::Gax::Grpc.create_stub(
143
+ service_path,
144
+ port,
145
+ chan_creds: chan_creds,
146
+ channel: channel,
147
+ scopes: scopes,
148
+ &Google::Devtools::Clouderrorreporting::V1beta1::ErrorGroupService::Stub.method(:new)
149
+ )
150
+
151
+ @get_group = Google::Gax.create_api_call(
152
+ @error_group_service_stub.method(:get_group),
153
+ defaults["get_group"]
154
+ )
155
+ @update_group = Google::Gax.create_api_call(
156
+ @error_group_service_stub.method(:update_group),
157
+ defaults["update_group"]
158
+ )
159
+ end
160
+
161
+ # Service calls
162
+
163
+ # Get the specified group.
164
+ #
165
+ # @param group_name [String]
166
+ # [Required] The group resource name. Written as
167
+ # <code>projects/<var>projectID</var>/groups/<var>group_name</var></code>.
168
+ # Call
169
+ # <a href="/error-reporting/reference/rest/v1beta1/projects.groupStats/list">
170
+ # <code>groupStats.list</code></a> to return a list of groups belonging to
171
+ # this project.
172
+ #
173
+ # Example: <code>projects/my-project-123/groups/my-group</code>
174
+ # @param options [Google::Gax::CallOptions]
175
+ # Overrides the default settings for this call, e.g, timeout,
176
+ # retries, etc.
177
+ # @return [Google::Devtools::Clouderrorreporting::V1beta1::ErrorGroup]
178
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
179
+ # @example
180
+ # require "google/cloud/error_reporting/v1beta1/error_group_service_api"
181
+ #
182
+ # ErrorGroupServiceApi = Google::Cloud::ErrorReporting::V1beta1::ErrorGroupServiceApi
183
+ #
184
+ # error_group_service_api = ErrorGroupServiceApi.new
185
+ # formatted_group_name = ErrorGroupServiceApi.group_path("[PROJECT]", "[GROUP]")
186
+ # response = error_group_service_api.get_group(formatted_group_name)
187
+
188
+ def get_group \
189
+ group_name,
190
+ options: nil
191
+ req = Google::Devtools::Clouderrorreporting::V1beta1::GetGroupRequest.new(
192
+ group_name: group_name
193
+ )
194
+ @get_group.call(req, options)
195
+ end
196
+
197
+ # Replace the data for the specified group.
198
+ # Fails if the group does not exist.
199
+ #
200
+ # @param group [Google::Devtools::Clouderrorreporting::V1beta1::ErrorGroup]
201
+ # [Required] The group which replaces the resource on the server.
202
+ # @param options [Google::Gax::CallOptions]
203
+ # Overrides the default settings for this call, e.g, timeout,
204
+ # retries, etc.
205
+ # @return [Google::Devtools::Clouderrorreporting::V1beta1::ErrorGroup]
206
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
207
+ # @example
208
+ # require "google/cloud/error_reporting/v1beta1/error_group_service_api"
209
+ #
210
+ # ErrorGroup = Google::Devtools::Clouderrorreporting::V1beta1::ErrorGroup
211
+ # ErrorGroupServiceApi = Google::Cloud::ErrorReporting::V1beta1::ErrorGroupServiceApi
212
+ #
213
+ # error_group_service_api = ErrorGroupServiceApi.new
214
+ # group = ErrorGroup.new
215
+ # response = error_group_service_api.update_group(group)
216
+
217
+ def update_group \
218
+ group,
219
+ options: nil
220
+ req = Google::Devtools::Clouderrorreporting::V1beta1::UpdateGroupRequest.new(
221
+ group: group
222
+ )
223
+ @update_group.call(req, options)
224
+ end
225
+ end
226
+ end
227
+ end
228
+ end
229
+ end
@@ -0,0 +1,38 @@
1
+ {
2
+ "interfaces": {
3
+ "google.devtools.clouderrorreporting.v1beta1.ErrorGroupService": {
4
+ "retry_codes": {
5
+ "retry_codes_def": {
6
+ "idempotent": [
7
+ "DEADLINE_EXCEEDED",
8
+ "UNAVAILABLE"
9
+ ],
10
+ "non_idempotent": []
11
+ }
12
+ },
13
+ "retry_params": {
14
+ "default": {
15
+ "initial_retry_delay_millis": 100,
16
+ "retry_delay_multiplier": 1.3,
17
+ "max_retry_delay_millis": 60000,
18
+ "initial_rpc_timeout_millis": 20000,
19
+ "rpc_timeout_multiplier": 1.0,
20
+ "max_rpc_timeout_millis": 20000,
21
+ "total_timeout_millis": 600000
22
+ }
23
+ },
24
+ "methods": {
25
+ "GetGroup": {
26
+ "timeout_millis": 60000,
27
+ "retry_codes_name": "idempotent",
28
+ "retry_params_name": "default"
29
+ },
30
+ "UpdateGroup": {
31
+ "timeout_millis": 60000,
32
+ "retry_codes_name": "idempotent",
33
+ "retry_params_name": "default"
34
+ }
35
+ }
36
+ }
37
+ }
38
+ }
@@ -0,0 +1,371 @@
1
+ # Copyright 2016 Google Inc. All rights reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ #
15
+ # EDITING INSTRUCTIONS
16
+ # This file was generated from the file
17
+ # https://github.com/googleapis/googleapis/blob/master/google/devtools/clouderrorreporting/v1beta1/error_stats_service.proto,
18
+ # and updates to that file get reflected here through a refresh process.
19
+ # For the short term, the refresh process will only be runnable by Google
20
+ # engineers.
21
+ #
22
+ # The only allowed edits are to method and file documentation. A 3-way
23
+ # merge preserves those additions if the generated source changes.
24
+
25
+ require "json"
26
+ require "pathname"
27
+
28
+ require "google/gax"
29
+ require "google/devtools/clouderrorreporting/v1beta1/error_stats_service_pb"
30
+
31
+ module Google
32
+ module Cloud
33
+ module ErrorReporting
34
+ module V1beta1
35
+ # An API for retrieving and managing error statistics as well as data for
36
+ # individual events.
37
+ #
38
+ # @!attribute [r] error_stats_service_stub
39
+ # @return [Google::Devtools::Clouderrorreporting::V1beta1::ErrorStatsService::Stub]
40
+ class ErrorStatsServiceApi
41
+ attr_reader :error_stats_service_stub
42
+
43
+ # The default address of the service.
44
+ SERVICE_ADDRESS = "clouderrorreporting.googleapis.com".freeze
45
+
46
+ # The default port of the service.
47
+ DEFAULT_SERVICE_PORT = 443
48
+
49
+ CODE_GEN_NAME_VERSION = "gapic/0.1.0".freeze
50
+
51
+ DEFAULT_TIMEOUT = 30
52
+
53
+ PAGE_DESCRIPTORS = {
54
+ "list_group_stats" => Google::Gax::PageDescriptor.new(
55
+ "page_token",
56
+ "next_page_token",
57
+ "error_group_stats"),
58
+ "list_events" => Google::Gax::PageDescriptor.new(
59
+ "page_token",
60
+ "next_page_token",
61
+ "error_events")
62
+ }.freeze
63
+
64
+ private_constant :PAGE_DESCRIPTORS
65
+
66
+ # The scopes needed to make gRPC calls to all of the methods defined in
67
+ # this service.
68
+ ALL_SCOPES = [
69
+ "https://www.googleapis.com/auth/cloud-platform"
70
+ ].freeze
71
+
72
+ PROJECT_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
73
+ "projects/{project}"
74
+ )
75
+
76
+ private_constant :PROJECT_PATH_TEMPLATE
77
+
78
+ # Returns a fully-qualified project resource name string.
79
+ # @param project [String]
80
+ # @return [String]
81
+ def self.project_path project
82
+ PROJECT_PATH_TEMPLATE.render(
83
+ :"project" => project
84
+ )
85
+ end
86
+
87
+ # Parses the project from a project resource.
88
+ # @param project_name [String]
89
+ # @return [String]
90
+ def self.match_project_from_project_name project_name
91
+ PROJECT_PATH_TEMPLATE.match(project_name)["project"]
92
+ end
93
+
94
+ # @param service_path [String]
95
+ # The domain name of the API remote host.
96
+ # @param port [Integer]
97
+ # The port on which to connect to the remote host.
98
+ # @param channel [Channel]
99
+ # A Channel object through which to make calls.
100
+ # @param chan_creds [Grpc::ChannelCredentials]
101
+ # A ChannelCredentials for the setting up the RPC client.
102
+ # @param client_config[Hash]
103
+ # A Hash for call options for each method. See
104
+ # Google::Gax#construct_settings for the structure of
105
+ # this data. Falls back to the default config if not specified
106
+ # or the specified config is missing data points.
107
+ # @param timeout [Numeric]
108
+ # The default timeout, in seconds, for calls made through this client.
109
+ # @param app_name [String]
110
+ # The codename of the calling service.
111
+ # @param app_version [String]
112
+ # The version of the calling service.
113
+ def initialize \
114
+ service_path: SERVICE_ADDRESS,
115
+ port: DEFAULT_SERVICE_PORT,
116
+ channel: nil,
117
+ chan_creds: nil,
118
+ scopes: ALL_SCOPES,
119
+ client_config: {},
120
+ timeout: DEFAULT_TIMEOUT,
121
+ app_name: "gax",
122
+ app_version: Google::Gax::VERSION
123
+ # These require statements are intentionally placed here to initialize
124
+ # the gRPC module only when it's required.
125
+ # See https://github.com/googleapis/toolkit/issues/446
126
+ require "google/gax/grpc"
127
+ require "google/devtools/clouderrorreporting/v1beta1/error_stats_service_services_pb"
128
+
129
+ google_api_client = "#{app_name}/#{app_version} " \
130
+ "#{CODE_GEN_NAME_VERSION} gax/#{Google::Gax::VERSION} " \
131
+ "ruby/#{RUBY_VERSION}".freeze
132
+ headers = { :"x-goog-api-client" => google_api_client }
133
+ client_config_file = Pathname.new(__dir__).join(
134
+ "error_stats_service_client_config.json"
135
+ )
136
+ defaults = client_config_file.open do |f|
137
+ Google::Gax.construct_settings(
138
+ "google.devtools.clouderrorreporting.v1beta1.ErrorStatsService",
139
+ JSON.parse(f.read),
140
+ client_config,
141
+ Google::Gax::Grpc::STATUS_CODE_NAMES,
142
+ timeout,
143
+ page_descriptors: PAGE_DESCRIPTORS,
144
+ errors: Google::Gax::Grpc::API_ERRORS,
145
+ kwargs: headers
146
+ )
147
+ end
148
+ @error_stats_service_stub = Google::Gax::Grpc.create_stub(
149
+ service_path,
150
+ port,
151
+ chan_creds: chan_creds,
152
+ channel: channel,
153
+ scopes: scopes,
154
+ &Google::Devtools::Clouderrorreporting::V1beta1::ErrorStatsService::Stub.method(:new)
155
+ )
156
+
157
+ @list_group_stats = Google::Gax.create_api_call(
158
+ @error_stats_service_stub.method(:list_group_stats),
159
+ defaults["list_group_stats"]
160
+ )
161
+ @list_events = Google::Gax.create_api_call(
162
+ @error_stats_service_stub.method(:list_events),
163
+ defaults["list_events"]
164
+ )
165
+ @delete_events = Google::Gax.create_api_call(
166
+ @error_stats_service_stub.method(:delete_events),
167
+ defaults["delete_events"]
168
+ )
169
+ end
170
+
171
+ # Service calls
172
+
173
+ # Lists the specified groups.
174
+ #
175
+ # @param project_name [String]
176
+ # [Required] The resource name of the Google Cloud Platform project. Written
177
+ # as <code>projects/</code> plus the
178
+ # <a href="https://support.google.com/cloud/answer/6158840">Google Cloud
179
+ # Platform project ID</a>.
180
+ #
181
+ # Example: <code>projects/my-project-123</code>.
182
+ # @param group_id [Array<String>]
183
+ # [Optional] List all <code>ErrorGroupStats</code> with these IDs.
184
+ # @param service_filter [Google::Devtools::Clouderrorreporting::V1beta1::ServiceContextFilter]
185
+ # [Optional] List only <code>ErrorGroupStats</code> which belong to a service
186
+ # context that matches the filter.
187
+ # Data for all service contexts is returned if this field is not specified.
188
+ # @param time_range [Google::Devtools::Clouderrorreporting::V1beta1::QueryTimeRange]
189
+ # [Required] List data for the given time range.
190
+ # Only <code>ErrorGroupStats</code> with a non-zero count in the given time
191
+ # range are returned, unless the request contains an explicit group_id list.
192
+ # If a group_id list is given, also <code>ErrorGroupStats</code> with zero
193
+ # occurrences are returned.
194
+ # @param timed_count_duration [Google::Protobuf::Duration]
195
+ # [Optional] The preferred duration for a single returned +TimedCount+.
196
+ # If not set, no timed counts are returned.
197
+ # @param alignment [Google::Devtools::Clouderrorreporting::V1beta1::TimedCountAlignment]
198
+ # [Optional] The alignment of the timed counts to be returned.
199
+ # Default is +ALIGNMENT_EQUAL_AT_END+.
200
+ # @param alignment_time [Google::Protobuf::Timestamp]
201
+ # [Optional] Time where the timed counts shall be aligned if rounded
202
+ # alignment is chosen. Default is 00:00 UTC.
203
+ # @param order [Google::Devtools::Clouderrorreporting::V1beta1::ErrorGroupOrder]
204
+ # [Optional] The sort order in which the results are returned.
205
+ # Default is +COUNT_DESC+.
206
+ # @param page_size [Integer]
207
+ # The maximum number of resources contained in the underlying API
208
+ # response. If page streaming is performed per-resource, this
209
+ # parameter does not affect the return value. If page streaming is
210
+ # performed per-page, this determines the maximum number of
211
+ # resources in a page.
212
+ # @param options [Google::Gax::CallOptions]
213
+ # Overrides the default settings for this call, e.g, timeout,
214
+ # retries, etc.
215
+ # @return [Google::Gax::PagedEnumerable<Google::Devtools::Clouderrorreporting::V1beta1::ErrorGroupStats>]
216
+ # An enumerable of Google::Devtools::Clouderrorreporting::V1beta1::ErrorGroupStats instances.
217
+ # See Google::Gax::PagedEnumerable documentation for other
218
+ # operations such as per-page iteration or access to the response
219
+ # object.
220
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
221
+ # @example
222
+ # require "google/cloud/error_reporting/v1beta1/error_stats_service_api"
223
+ #
224
+ # ErrorStatsServiceApi = Google::Cloud::ErrorReporting::V1beta1::ErrorStatsServiceApi
225
+ # QueryTimeRange = Google::Devtools::Clouderrorreporting::V1beta1::QueryTimeRange
226
+ #
227
+ # error_stats_service_api = ErrorStatsServiceApi.new
228
+ # formatted_project_name = ErrorStatsServiceApi.project_path("[PROJECT]")
229
+ # time_range = QueryTimeRange.new
230
+ #
231
+ # # Iterate over all results.
232
+ # error_stats_service_api.list_group_stats(formatted_project_name, time_range).each do |element|
233
+ # # Process element.
234
+ # end
235
+ #
236
+ # # Or iterate over results one page at a time.
237
+ # error_stats_service_api.list_group_stats(formatted_project_name, time_range).each_page do |page|
238
+ # # Process each page at a time.
239
+ # page.each do |element|
240
+ # # Process element.
241
+ # end
242
+ # end
243
+
244
+ def list_group_stats \
245
+ project_name,
246
+ time_range,
247
+ group_id: nil,
248
+ service_filter: nil,
249
+ timed_count_duration: nil,
250
+ alignment: nil,
251
+ alignment_time: nil,
252
+ order: nil,
253
+ page_size: nil,
254
+ options: nil
255
+ req = Google::Devtools::Clouderrorreporting::V1beta1::ListGroupStatsRequest.new(
256
+ project_name: project_name,
257
+ time_range: time_range
258
+ )
259
+ req.group_id = group_id unless group_id.nil?
260
+ req.service_filter = service_filter unless service_filter.nil?
261
+ req.timed_count_duration = timed_count_duration unless timed_count_duration.nil?
262
+ req.alignment = alignment unless alignment.nil?
263
+ req.alignment_time = alignment_time unless alignment_time.nil?
264
+ req.order = order unless order.nil?
265
+ req.page_size = page_size unless page_size.nil?
266
+ @list_group_stats.call(req, options)
267
+ end
268
+
269
+ # Lists the specified events.
270
+ #
271
+ # @param project_name [String]
272
+ # [Required] The resource name of the Google Cloud Platform project. Written
273
+ # as +projects/+ plus the
274
+ # {Google Cloud Platform project ID}[https://support.google.com/cloud/answer/6158840].
275
+ # Example: +projects/my-project-123+.
276
+ # @param group_id [String]
277
+ # [Required] The group for which events shall be returned.
278
+ # @param service_filter [Google::Devtools::Clouderrorreporting::V1beta1::ServiceContextFilter]
279
+ # [Optional] List only ErrorGroups which belong to a service context that
280
+ # matches the filter.
281
+ # Data for all service contexts is returned if this field is not specified.
282
+ # @param time_range [Google::Devtools::Clouderrorreporting::V1beta1::QueryTimeRange]
283
+ # [Optional] List only data for the given time range.
284
+ # @param page_size [Integer]
285
+ # The maximum number of resources contained in the underlying API
286
+ # response. If page streaming is performed per-resource, this
287
+ # parameter does not affect the return value. If page streaming is
288
+ # performed per-page, this determines the maximum number of
289
+ # resources in a page.
290
+ # @param options [Google::Gax::CallOptions]
291
+ # Overrides the default settings for this call, e.g, timeout,
292
+ # retries, etc.
293
+ # @return [Google::Gax::PagedEnumerable<Google::Devtools::Clouderrorreporting::V1beta1::ErrorEvent>]
294
+ # An enumerable of Google::Devtools::Clouderrorreporting::V1beta1::ErrorEvent instances.
295
+ # See Google::Gax::PagedEnumerable documentation for other
296
+ # operations such as per-page iteration or access to the response
297
+ # object.
298
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
299
+ # @example
300
+ # require "google/cloud/error_reporting/v1beta1/error_stats_service_api"
301
+ #
302
+ # ErrorStatsServiceApi = Google::Cloud::ErrorReporting::V1beta1::ErrorStatsServiceApi
303
+ #
304
+ # error_stats_service_api = ErrorStatsServiceApi.new
305
+ # formatted_project_name = ErrorStatsServiceApi.project_path("[PROJECT]")
306
+ # group_id = ''
307
+ #
308
+ # # Iterate over all results.
309
+ # error_stats_service_api.list_events(formatted_project_name, group_id).each do |element|
310
+ # # Process element.
311
+ # end
312
+ #
313
+ # # Or iterate over results one page at a time.
314
+ # error_stats_service_api.list_events(formatted_project_name, group_id).each_page do |page|
315
+ # # Process each page at a time.
316
+ # page.each do |element|
317
+ # # Process element.
318
+ # end
319
+ # end
320
+
321
+ def list_events \
322
+ project_name,
323
+ group_id,
324
+ service_filter: nil,
325
+ time_range: nil,
326
+ page_size: nil,
327
+ options: nil
328
+ req = Google::Devtools::Clouderrorreporting::V1beta1::ListEventsRequest.new(
329
+ project_name: project_name,
330
+ group_id: group_id
331
+ )
332
+ req.service_filter = service_filter unless service_filter.nil?
333
+ req.time_range = time_range unless time_range.nil?
334
+ req.page_size = page_size unless page_size.nil?
335
+ @list_events.call(req, options)
336
+ end
337
+
338
+ # Deletes all error events of a given project.
339
+ #
340
+ # @param project_name [String]
341
+ # [Required] The resource name of the Google Cloud Platform project. Written
342
+ # as +projects/+ plus the
343
+ # {Google Cloud Platform project ID}[https://support.google.com/cloud/answer/6158840].
344
+ # Example: +projects/my-project-123+.
345
+ # @param options [Google::Gax::CallOptions]
346
+ # Overrides the default settings for this call, e.g, timeout,
347
+ # retries, etc.
348
+ # @return [Google::Devtools::Clouderrorreporting::V1beta1::DeleteEventsResponse]
349
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
350
+ # @example
351
+ # require "google/cloud/error_reporting/v1beta1/error_stats_service_api"
352
+ #
353
+ # ErrorStatsServiceApi = Google::Cloud::ErrorReporting::V1beta1::ErrorStatsServiceApi
354
+ #
355
+ # error_stats_service_api = ErrorStatsServiceApi.new
356
+ # formatted_project_name = ErrorStatsServiceApi.project_path("[PROJECT]")
357
+ # response = error_stats_service_api.delete_events(formatted_project_name)
358
+
359
+ def delete_events \
360
+ project_name,
361
+ options: nil
362
+ req = Google::Devtools::Clouderrorreporting::V1beta1::DeleteEventsRequest.new(
363
+ project_name: project_name
364
+ )
365
+ @delete_events.call(req, options)
366
+ end
367
+ end
368
+ end
369
+ end
370
+ end
371
+ end