google-cloud-error_reporting 0.35.1 → 0.42.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/AUTHENTICATION.md +4 -2
  3. data/CHANGELOG.md +47 -0
  4. data/CONTRIBUTING.md +4 -7
  5. data/LOGGING.md +1 -1
  6. data/OVERVIEW.md +1 -2
  7. data/TROUBLESHOOTING.md +2 -8
  8. data/lib/google-cloud-error_reporting.rb +8 -14
  9. data/lib/google/cloud/error_reporting.rb +16 -13
  10. data/lib/google/cloud/error_reporting/async_error_reporter.rb +2 -2
  11. data/lib/google/cloud/error_reporting/credentials.rb +2 -2
  12. data/lib/google/cloud/error_reporting/error_event.rb +14 -18
  13. data/lib/google/cloud/error_reporting/middleware.rb +8 -13
  14. data/lib/google/cloud/error_reporting/rails.rb +2 -2
  15. data/lib/google/cloud/error_reporting/service.rb +15 -36
  16. data/lib/google/cloud/error_reporting/version.rb +1 -1
  17. metadata +11 -72
  18. data/lib/google/cloud/error_reporting/v1beta1.rb +0 -19
  19. data/lib/google/cloud/error_reporting/v1beta1/credentials.rb +0 -41
  20. data/lib/google/cloud/error_reporting/v1beta1/doc/google/devtools/clouderrorreporting/v1beta1/common.rb +0 -158
  21. data/lib/google/cloud/error_reporting/v1beta1/doc/google/devtools/clouderrorreporting/v1beta1/error_group_service.rb +0 -41
  22. data/lib/google/cloud/error_reporting/v1beta1/doc/google/devtools/clouderrorreporting/v1beta1/error_stats_service.rb +0 -314
  23. data/lib/google/cloud/error_reporting/v1beta1/doc/google/devtools/clouderrorreporting/v1beta1/report_errors_service.rb +0 -79
  24. data/lib/google/cloud/error_reporting/v1beta1/doc/google/protobuf/duration.rb +0 -91
  25. data/lib/google/cloud/error_reporting/v1beta1/doc/google/protobuf/timestamp.rb +0 -113
  26. data/lib/google/cloud/error_reporting/v1beta1/error_group_service_client.rb +0 -285
  27. data/lib/google/cloud/error_reporting/v1beta1/error_group_service_client_config.json +0 -36
  28. data/lib/google/cloud/error_reporting/v1beta1/error_stats_service_client.rb +0 -457
  29. data/lib/google/cloud/error_reporting/v1beta1/error_stats_service_client_config.json +0 -41
  30. data/lib/google/cloud/error_reporting/v1beta1/report_errors_service_client.rb +0 -254
  31. data/lib/google/cloud/error_reporting/v1beta1/report_errors_service_client_config.json +0 -31
  32. data/lib/google/devtools/clouderrorreporting/v1beta1/common_pb.rb +0 -64
  33. data/lib/google/devtools/clouderrorreporting/v1beta1/error_group_service_pb.rb +0 -30
  34. data/lib/google/devtools/clouderrorreporting/v1beta1/error_group_service_services_pb.rb +0 -50
  35. data/lib/google/devtools/clouderrorreporting/v1beta1/error_stats_service_pb.rb +0 -116
  36. data/lib/google/devtools/clouderrorreporting/v1beta1/error_stats_service_services_pb.rb +0 -52
  37. data/lib/google/devtools/clouderrorreporting/v1beta1/report_errors_service_pb.rb +0 -38
  38. data/lib/google/devtools/clouderrorreporting/v1beta1/report_errors_service_services_pb.rb +0 -55
@@ -1,113 +0,0 @@
1
- # Copyright 2020 Google LLC
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # https://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
-
16
- module Google
17
- module Protobuf
18
- # A Timestamp represents a point in time independent of any time zone or local
19
- # calendar, encoded as a count of seconds and fractions of seconds at
20
- # nanosecond resolution. The count is relative to an epoch at UTC midnight on
21
- # January 1, 1970, in the proleptic Gregorian calendar which extends the
22
- # Gregorian calendar backwards to year one.
23
- #
24
- # All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap
25
- # second table is needed for interpretation, using a [24-hour linear
26
- # smear](https://developers.google.com/time/smear).
27
- #
28
- # The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By
29
- # restricting to that range, we ensure that we can convert to and from [RFC
30
- # 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings.
31
- #
32
- # = Examples
33
- #
34
- # Example 1: Compute Timestamp from POSIX `time()`.
35
- #
36
- # Timestamp timestamp;
37
- # timestamp.set_seconds(time(NULL));
38
- # timestamp.set_nanos(0);
39
- #
40
- # Example 2: Compute Timestamp from POSIX `gettimeofday()`.
41
- #
42
- # struct timeval tv;
43
- # gettimeofday(&tv, NULL);
44
- #
45
- # Timestamp timestamp;
46
- # timestamp.set_seconds(tv.tv_sec);
47
- # timestamp.set_nanos(tv.tv_usec * 1000);
48
- #
49
- # Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.
50
- #
51
- # FILETIME ft;
52
- # GetSystemTimeAsFileTime(&ft);
53
- # UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
54
- #
55
- # // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z
56
- # // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.
57
- # Timestamp timestamp;
58
- # timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
59
- # timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));
60
- #
61
- # Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.
62
- #
63
- # long millis = System.currentTimeMillis();
64
- #
65
- # Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
66
- # .setNanos((int) ((millis % 1000) * 1000000)).build();
67
- #
68
- #
69
- # Example 5: Compute Timestamp from current time in Python.
70
- #
71
- # timestamp = Timestamp()
72
- # timestamp.GetCurrentTime()
73
- #
74
- # = JSON Mapping
75
- #
76
- # In JSON format, the Timestamp type is encoded as a string in the
77
- # [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the
78
- # format is "\\{year}-\\{month}-\\{day}T\\{hour}:\\{min}:\\{sec}[.\\{frac_sec}]Z"
79
- # where \\{year} is always expressed using four digits while \\{month}, \\{day},
80
- # \\{hour}, \\{min}, and \\{sec} are zero-padded to two digits each. The fractional
81
- # seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution),
82
- # are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone
83
- # is required. A proto3 JSON serializer should always use UTC (as indicated by
84
- # "Z") when printing the Timestamp type and a proto3 JSON parser should be
85
- # able to accept both UTC and other timezones (as indicated by an offset).
86
- #
87
- # For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past
88
- # 01:30 UTC on January 15, 2017.
89
- #
90
- # In JavaScript, one can convert a Date object to this format using the
91
- # standard
92
- # [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString)
93
- # method. In Python, a standard `datetime.datetime` object can be converted
94
- # to this format using
95
- # [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with
96
- # the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use
97
- # the Joda Time's [`ISODateTimeFormat.dateTime()`](
98
- # http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D
99
- # ) to obtain a formatter capable of generating timestamps in this format.
100
- # @!attribute [rw] seconds
101
- # @return [Integer]
102
- # Represents seconds of UTC time since Unix epoch
103
- # 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
104
- # 9999-12-31T23:59:59Z inclusive.
105
- # @!attribute [rw] nanos
106
- # @return [Integer]
107
- # Non-negative fractions of a second at nanosecond resolution. Negative
108
- # second values with fractions must still have non-negative nanos values
109
- # that count forward in time. Must be from 0 to 999,999,999
110
- # inclusive.
111
- class Timestamp; end
112
- end
113
- end
@@ -1,285 +0,0 @@
1
- # Copyright 2020 Google LLC
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # https://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
- #
15
- # EDITING INSTRUCTIONS
16
- # This file was generated from the file
17
- # https://github.com/googleapis/googleapis/blob/master/google/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
-
23
- require "json"
24
- require "pathname"
25
-
26
- require "google/gax"
27
-
28
- require "google/devtools/clouderrorreporting/v1beta1/error_group_service_pb"
29
- require "google/cloud/error_reporting/v1beta1/credentials"
30
- require "google/cloud/error_reporting/version"
31
-
32
- module Google
33
- module Cloud
34
- module ErrorReporting
35
- module V1beta1
36
- # Service for retrieving and updating individual error groups.
37
- #
38
- # @!attribute [r] error_group_service_stub
39
- # @return [Google::Devtools::Clouderrorreporting::V1beta1::ErrorGroupService::Stub]
40
- class ErrorGroupServiceClient
41
- # @private
42
- attr_reader :error_group_service_stub
43
-
44
- # The default address of the service.
45
- SERVICE_ADDRESS = "clouderrorreporting.googleapis.com".freeze
46
-
47
- # The default port of the service.
48
- DEFAULT_SERVICE_PORT = 443
49
-
50
- # The default set of gRPC interceptors.
51
- GRPC_INTERCEPTORS = []
52
-
53
- DEFAULT_TIMEOUT = 30
54
-
55
- # The scopes needed to make gRPC calls to all of the methods defined in
56
- # this service.
57
- ALL_SCOPES = [
58
- "https://www.googleapis.com/auth/cloud-platform"
59
- ].freeze
60
-
61
-
62
- ERROR_GROUP_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
63
- "projects/{project}/groups/{group}"
64
- )
65
-
66
- private_constant :ERROR_GROUP_PATH_TEMPLATE
67
-
68
- # Returns a fully-qualified error_group resource name string.
69
- # @param project [String]
70
- # @param group [String]
71
- # @return [String]
72
- def self.error_group_path project, group
73
- ERROR_GROUP_PATH_TEMPLATE.render(
74
- :"project" => project,
75
- :"group" => group
76
- )
77
- end
78
-
79
- # @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
80
- # Provides the means for authenticating requests made by the client. This parameter can
81
- # be many types.
82
- # A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
83
- # authenticating requests made by this client.
84
- # A `String` will be treated as the path to the keyfile to be used for the construction of
85
- # credentials for this client.
86
- # A `Hash` will be treated as the contents of a keyfile to be used for the construction of
87
- # credentials for this client.
88
- # A `GRPC::Core::Channel` will be used to make calls through.
89
- # A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
90
- # should already be composed with a `GRPC::Core::CallCredentials` object.
91
- # A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
92
- # metadata for requests, generally, to give OAuth credentials.
93
- # @param scopes [Array<String>]
94
- # The OAuth scopes for this service. This parameter is ignored if
95
- # an updater_proc is supplied.
96
- # @param client_config [Hash]
97
- # A Hash for call options for each method. See
98
- # Google::Gax#construct_settings for the structure of
99
- # this data. Falls back to the default config if not specified
100
- # or the specified config is missing data points.
101
- # @param timeout [Numeric]
102
- # The default timeout, in seconds, for calls made through this client.
103
- # @param metadata [Hash]
104
- # Default metadata to be sent with each request. This can be overridden on a per call basis.
105
- # @param service_address [String]
106
- # Override for the service hostname, or `nil` to leave as the default.
107
- # @param service_port [Integer]
108
- # Override for the service port, or `nil` to leave as the default.
109
- # @param exception_transformer [Proc]
110
- # An optional proc that intercepts any exceptions raised during an API call to inject
111
- # custom error handling.
112
- def initialize \
113
- credentials: nil,
114
- scopes: ALL_SCOPES,
115
- client_config: {},
116
- timeout: DEFAULT_TIMEOUT,
117
- metadata: nil,
118
- service_address: nil,
119
- service_port: nil,
120
- exception_transformer: nil,
121
- lib_name: nil,
122
- lib_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_group_service_services_pb"
128
-
129
- credentials ||= Google::Cloud::ErrorReporting::V1beta1::Credentials.default
130
-
131
- if credentials.is_a?(String) || credentials.is_a?(Hash)
132
- updater_proc = Google::Cloud::ErrorReporting::V1beta1::Credentials.new(credentials).updater_proc
133
- end
134
- if credentials.is_a?(GRPC::Core::Channel)
135
- channel = credentials
136
- end
137
- if credentials.is_a?(GRPC::Core::ChannelCredentials)
138
- chan_creds = credentials
139
- end
140
- if credentials.is_a?(Proc)
141
- updater_proc = credentials
142
- end
143
- if credentials.is_a?(Google::Auth::Credentials)
144
- updater_proc = credentials.updater_proc
145
- end
146
-
147
- package_version = Google::Cloud::ErrorReporting::VERSION
148
-
149
- google_api_client = "gl-ruby/#{RUBY_VERSION}"
150
- google_api_client << " #{lib_name}/#{lib_version}" if lib_name
151
- google_api_client << " gapic/#{package_version} gax/#{Google::Gax::VERSION}"
152
- google_api_client << " grpc/#{GRPC::VERSION}"
153
- google_api_client.freeze
154
-
155
- headers = { :"x-goog-api-client" => google_api_client }
156
- if credentials.respond_to?(:quota_project_id) && credentials.quota_project_id
157
- headers[:"x-goog-user-project"] = credentials.quota_project_id
158
- end
159
- headers.merge!(metadata) unless metadata.nil?
160
- client_config_file = Pathname.new(__dir__).join(
161
- "error_group_service_client_config.json"
162
- )
163
- defaults = client_config_file.open do |f|
164
- Google::Gax.construct_settings(
165
- "google.devtools.clouderrorreporting.v1beta1.ErrorGroupService",
166
- JSON.parse(f.read),
167
- client_config,
168
- Google::Gax::Grpc::STATUS_CODE_NAMES,
169
- timeout,
170
- errors: Google::Gax::Grpc::API_ERRORS,
171
- metadata: headers
172
- )
173
- end
174
-
175
- # Allow overriding the service path/port in subclasses.
176
- service_path = service_address || self.class::SERVICE_ADDRESS
177
- port = service_port || self.class::DEFAULT_SERVICE_PORT
178
- interceptors = self.class::GRPC_INTERCEPTORS
179
- @error_group_service_stub = Google::Gax::Grpc.create_stub(
180
- service_path,
181
- port,
182
- chan_creds: chan_creds,
183
- channel: channel,
184
- updater_proc: updater_proc,
185
- scopes: scopes,
186
- interceptors: interceptors,
187
- &Google::Devtools::Clouderrorreporting::V1beta1::ErrorGroupService::Stub.method(:new)
188
- )
189
-
190
- @update_group = Google::Gax.create_api_call(
191
- @error_group_service_stub.method(:update_group),
192
- defaults["update_group"],
193
- exception_transformer: exception_transformer,
194
- params_extractor: proc do |request|
195
- {'group.name' => request.group.name}
196
- end
197
- )
198
- @get_group = Google::Gax.create_api_call(
199
- @error_group_service_stub.method(:get_group),
200
- defaults["get_group"],
201
- exception_transformer: exception_transformer,
202
- params_extractor: proc do |request|
203
- {'group_name' => request.group_name}
204
- end
205
- )
206
- end
207
-
208
- # Service calls
209
-
210
- # Replace the data for the specified group.
211
- # Fails if the group does not exist.
212
- #
213
- # @param group [Google::Devtools::Clouderrorreporting::V1beta1::ErrorGroup | Hash]
214
- # Required. The group which replaces the resource on the server.
215
- # A hash of the same form as `Google::Devtools::Clouderrorreporting::V1beta1::ErrorGroup`
216
- # can also be provided.
217
- # @param options [Google::Gax::CallOptions]
218
- # Overrides the default settings for this call, e.g, timeout,
219
- # retries, etc.
220
- # @yield [result, operation] Access the result along with the RPC operation
221
- # @yieldparam result [Google::Devtools::Clouderrorreporting::V1beta1::ErrorGroup]
222
- # @yieldparam operation [GRPC::ActiveCall::Operation]
223
- # @return [Google::Devtools::Clouderrorreporting::V1beta1::ErrorGroup]
224
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
225
- # @example
226
- # require "google/cloud/error_reporting"
227
- #
228
- # error_group_client = Google::Cloud::ErrorReporting::ErrorGroup.new(version: :v1beta1)
229
- #
230
- # # TODO: Initialize `group`:
231
- # group = {}
232
- # response = error_group_client.update_group(group)
233
-
234
- def update_group \
235
- group,
236
- options: nil,
237
- &block
238
- req = {
239
- group: group
240
- }.delete_if { |_, v| v.nil? }
241
- req = Google::Gax::to_proto(req, Google::Devtools::Clouderrorreporting::V1beta1::UpdateGroupRequest)
242
- @update_group.call(req, options, &block)
243
- end
244
-
245
- # Get the specified group.
246
- #
247
- # @param group_name [String]
248
- # Required. The group resource name. Written as
249
- # <code>projects/<var>projectID</var>/groups/<var>group_name</var></code>.
250
- # Call
251
- # <a href="/error-reporting/reference/rest/v1beta1/projects.groupStats/list">
252
- # <code>groupStats.list</code></a> to return a list of groups belonging to
253
- # this project.
254
- #
255
- # Example: <code>projects/my-project-123/groups/my-group</code>
256
- # @param options [Google::Gax::CallOptions]
257
- # Overrides the default settings for this call, e.g, timeout,
258
- # retries, etc.
259
- # @yield [result, operation] Access the result along with the RPC operation
260
- # @yieldparam result [Google::Devtools::Clouderrorreporting::V1beta1::ErrorGroup]
261
- # @yieldparam operation [GRPC::ActiveCall::Operation]
262
- # @return [Google::Devtools::Clouderrorreporting::V1beta1::ErrorGroup]
263
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
264
- # @example
265
- # require "google/cloud/error_reporting"
266
- #
267
- # error_group_client = Google::Cloud::ErrorReporting::ErrorGroup.new(version: :v1beta1)
268
- # formatted_group_name = Google::Cloud::ErrorReporting::V1beta1::ErrorGroupServiceClient.error_group_path("[PROJECT]", "[GROUP]")
269
- # response = error_group_client.get_group(formatted_group_name)
270
-
271
- def get_group \
272
- group_name,
273
- options: nil,
274
- &block
275
- req = {
276
- group_name: group_name
277
- }.delete_if { |_, v| v.nil? }
278
- req = Google::Gax::to_proto(req, Google::Devtools::Clouderrorreporting::V1beta1::GetGroupRequest)
279
- @get_group.call(req, options, &block)
280
- end
281
- end
282
- end
283
- end
284
- end
285
- end
@@ -1,36 +0,0 @@
1
- {
2
- "interfaces": {
3
- "google.devtools.clouderrorreporting.v1beta1.ErrorGroupService": {
4
- "retry_codes": {
5
- "idempotent": [
6
- "DEADLINE_EXCEEDED",
7
- "UNAVAILABLE"
8
- ],
9
- "non_idempotent": []
10
- },
11
- "retry_params": {
12
- "default": {
13
- "initial_retry_delay_millis": 100,
14
- "retry_delay_multiplier": 1.3,
15
- "max_retry_delay_millis": 60000,
16
- "initial_rpc_timeout_millis": 20000,
17
- "rpc_timeout_multiplier": 1.0,
18
- "max_rpc_timeout_millis": 20000,
19
- "total_timeout_millis": 600000
20
- }
21
- },
22
- "methods": {
23
- "UpdateGroup": {
24
- "timeout_millis": 60000,
25
- "retry_codes_name": "idempotent",
26
- "retry_params_name": "default"
27
- },
28
- "GetGroup": {
29
- "timeout_millis": 60000,
30
- "retry_codes_name": "idempotent",
31
- "retry_params_name": "default"
32
- }
33
- }
34
- }
35
- }
36
- }
@@ -1,457 +0,0 @@
1
- # Copyright 2020 Google LLC
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # https://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
- #
15
- # EDITING INSTRUCTIONS
16
- # This file was generated from the file
17
- # https://github.com/googleapis/googleapis/blob/master/google/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
-
23
- require "json"
24
- require "pathname"
25
-
26
- require "google/gax"
27
-
28
- require "google/devtools/clouderrorreporting/v1beta1/error_stats_service_pb"
29
- require "google/cloud/error_reporting/v1beta1/credentials"
30
- require "google/cloud/error_reporting/version"
31
-
32
- module Google
33
- module Cloud
34
- module ErrorReporting
35
- module V1beta1
36
- # An API for retrieving and managing error statistics as well as data for
37
- # individual events.
38
- #
39
- # @!attribute [r] error_stats_service_stub
40
- # @return [Google::Devtools::Clouderrorreporting::V1beta1::ErrorStatsService::Stub]
41
- class ErrorStatsServiceClient
42
- # @private
43
- attr_reader :error_stats_service_stub
44
-
45
- # The default address of the service.
46
- SERVICE_ADDRESS = "clouderrorreporting.googleapis.com".freeze
47
-
48
- # The default port of the service.
49
- DEFAULT_SERVICE_PORT = 443
50
-
51
- # The default set of gRPC interceptors.
52
- GRPC_INTERCEPTORS = []
53
-
54
- DEFAULT_TIMEOUT = 30
55
-
56
- PAGE_DESCRIPTORS = {
57
- "list_group_stats" => Google::Gax::PageDescriptor.new(
58
- "page_token",
59
- "next_page_token",
60
- "error_group_stats"),
61
- "list_events" => Google::Gax::PageDescriptor.new(
62
- "page_token",
63
- "next_page_token",
64
- "error_events")
65
- }.freeze
66
-
67
- private_constant :PAGE_DESCRIPTORS
68
-
69
- # The scopes needed to make gRPC calls to all of the methods defined in
70
- # this service.
71
- ALL_SCOPES = [
72
- "https://www.googleapis.com/auth/cloud-platform"
73
- ].freeze
74
-
75
-
76
- PROJECT_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
77
- "projects/{project}"
78
- )
79
-
80
- private_constant :PROJECT_PATH_TEMPLATE
81
-
82
- # Returns a fully-qualified project resource name string.
83
- # @param project [String]
84
- # @return [String]
85
- def self.project_path project
86
- PROJECT_PATH_TEMPLATE.render(
87
- :"project" => project
88
- )
89
- end
90
-
91
- # @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
92
- # Provides the means for authenticating requests made by the client. This parameter can
93
- # be many types.
94
- # A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
95
- # authenticating requests made by this client.
96
- # A `String` will be treated as the path to the keyfile to be used for the construction of
97
- # credentials for this client.
98
- # A `Hash` will be treated as the contents of a keyfile to be used for the construction of
99
- # credentials for this client.
100
- # A `GRPC::Core::Channel` will be used to make calls through.
101
- # A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
102
- # should already be composed with a `GRPC::Core::CallCredentials` object.
103
- # A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
104
- # metadata for requests, generally, to give OAuth credentials.
105
- # @param scopes [Array<String>]
106
- # The OAuth scopes for this service. This parameter is ignored if
107
- # an updater_proc is supplied.
108
- # @param client_config [Hash]
109
- # A Hash for call options for each method. See
110
- # Google::Gax#construct_settings for the structure of
111
- # this data. Falls back to the default config if not specified
112
- # or the specified config is missing data points.
113
- # @param timeout [Numeric]
114
- # The default timeout, in seconds, for calls made through this client.
115
- # @param metadata [Hash]
116
- # Default metadata to be sent with each request. This can be overridden on a per call basis.
117
- # @param service_address [String]
118
- # Override for the service hostname, or `nil` to leave as the default.
119
- # @param service_port [Integer]
120
- # Override for the service port, or `nil` to leave as the default.
121
- # @param exception_transformer [Proc]
122
- # An optional proc that intercepts any exceptions raised during an API call to inject
123
- # custom error handling.
124
- def initialize \
125
- credentials: nil,
126
- scopes: ALL_SCOPES,
127
- client_config: {},
128
- timeout: DEFAULT_TIMEOUT,
129
- metadata: nil,
130
- service_address: nil,
131
- service_port: nil,
132
- exception_transformer: nil,
133
- lib_name: nil,
134
- lib_version: ""
135
- # These require statements are intentionally placed here to initialize
136
- # the gRPC module only when it's required.
137
- # See https://github.com/googleapis/toolkit/issues/446
138
- require "google/gax/grpc"
139
- require "google/devtools/clouderrorreporting/v1beta1/error_stats_service_services_pb"
140
-
141
- credentials ||= Google::Cloud::ErrorReporting::V1beta1::Credentials.default
142
-
143
- if credentials.is_a?(String) || credentials.is_a?(Hash)
144
- updater_proc = Google::Cloud::ErrorReporting::V1beta1::Credentials.new(credentials).updater_proc
145
- end
146
- if credentials.is_a?(GRPC::Core::Channel)
147
- channel = credentials
148
- end
149
- if credentials.is_a?(GRPC::Core::ChannelCredentials)
150
- chan_creds = credentials
151
- end
152
- if credentials.is_a?(Proc)
153
- updater_proc = credentials
154
- end
155
- if credentials.is_a?(Google::Auth::Credentials)
156
- updater_proc = credentials.updater_proc
157
- end
158
-
159
- package_version = Google::Cloud::ErrorReporting::VERSION
160
-
161
- google_api_client = "gl-ruby/#{RUBY_VERSION}"
162
- google_api_client << " #{lib_name}/#{lib_version}" if lib_name
163
- google_api_client << " gapic/#{package_version} gax/#{Google::Gax::VERSION}"
164
- google_api_client << " grpc/#{GRPC::VERSION}"
165
- google_api_client.freeze
166
-
167
- headers = { :"x-goog-api-client" => google_api_client }
168
- if credentials.respond_to?(:quota_project_id) && credentials.quota_project_id
169
- headers[:"x-goog-user-project"] = credentials.quota_project_id
170
- end
171
- headers.merge!(metadata) unless metadata.nil?
172
- client_config_file = Pathname.new(__dir__).join(
173
- "error_stats_service_client_config.json"
174
- )
175
- defaults = client_config_file.open do |f|
176
- Google::Gax.construct_settings(
177
- "google.devtools.clouderrorreporting.v1beta1.ErrorStatsService",
178
- JSON.parse(f.read),
179
- client_config,
180
- Google::Gax::Grpc::STATUS_CODE_NAMES,
181
- timeout,
182
- page_descriptors: PAGE_DESCRIPTORS,
183
- errors: Google::Gax::Grpc::API_ERRORS,
184
- metadata: headers
185
- )
186
- end
187
-
188
- # Allow overriding the service path/port in subclasses.
189
- service_path = service_address || self.class::SERVICE_ADDRESS
190
- port = service_port || self.class::DEFAULT_SERVICE_PORT
191
- interceptors = self.class::GRPC_INTERCEPTORS
192
- @error_stats_service_stub = Google::Gax::Grpc.create_stub(
193
- service_path,
194
- port,
195
- chan_creds: chan_creds,
196
- channel: channel,
197
- updater_proc: updater_proc,
198
- scopes: scopes,
199
- interceptors: interceptors,
200
- &Google::Devtools::Clouderrorreporting::V1beta1::ErrorStatsService::Stub.method(:new)
201
- )
202
-
203
- @delete_events = Google::Gax.create_api_call(
204
- @error_stats_service_stub.method(:delete_events),
205
- defaults["delete_events"],
206
- exception_transformer: exception_transformer,
207
- params_extractor: proc do |request|
208
- {'project_name' => request.project_name}
209
- end
210
- )
211
- @list_group_stats = Google::Gax.create_api_call(
212
- @error_stats_service_stub.method(:list_group_stats),
213
- defaults["list_group_stats"],
214
- exception_transformer: exception_transformer,
215
- params_extractor: proc do |request|
216
- {'project_name' => request.project_name}
217
- end
218
- )
219
- @list_events = Google::Gax.create_api_call(
220
- @error_stats_service_stub.method(:list_events),
221
- defaults["list_events"],
222
- exception_transformer: exception_transformer,
223
- params_extractor: proc do |request|
224
- {'project_name' => request.project_name}
225
- end
226
- )
227
- end
228
-
229
- # Service calls
230
-
231
- # Deletes all error events of a given project.
232
- #
233
- # @param project_name [String]
234
- # Required. The resource name of the Google Cloud Platform project. Written
235
- # as `projects/` plus the
236
- # [Google Cloud Platform project
237
- # ID](https://support.google.com/cloud/answer/6158840).
238
- # Example: `projects/my-project-123`.
239
- # @param options [Google::Gax::CallOptions]
240
- # Overrides the default settings for this call, e.g, timeout,
241
- # retries, etc.
242
- # @yield [result, operation] Access the result along with the RPC operation
243
- # @yieldparam result [Google::Devtools::Clouderrorreporting::V1beta1::DeleteEventsResponse]
244
- # @yieldparam operation [GRPC::ActiveCall::Operation]
245
- # @return [Google::Devtools::Clouderrorreporting::V1beta1::DeleteEventsResponse]
246
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
247
- # @example
248
- # require "google/cloud/error_reporting"
249
- #
250
- # error_stats_client = Google::Cloud::ErrorReporting::ErrorStats.new(version: :v1beta1)
251
- # formatted_project_name = Google::Cloud::ErrorReporting::V1beta1::ErrorStatsServiceClient.project_path("[PROJECT]")
252
- # response = error_stats_client.delete_events(formatted_project_name)
253
-
254
- def delete_events \
255
- project_name,
256
- options: nil,
257
- &block
258
- req = {
259
- project_name: project_name
260
- }.delete_if { |_, v| v.nil? }
261
- req = Google::Gax::to_proto(req, Google::Devtools::Clouderrorreporting::V1beta1::DeleteEventsRequest)
262
- @delete_events.call(req, options, &block)
263
- end
264
-
265
- # Lists the specified groups.
266
- #
267
- # @param project_name [String]
268
- # Required. The resource name of the Google Cloud Platform project. Written
269
- # as <code>projects/</code> plus the
270
- # <a href="https://support.google.com/cloud/answer/6158840">Google Cloud
271
- # Platform project ID</a>.
272
- #
273
- # Example: <code>projects/my-project-123</code>.
274
- # @param group_id [Array<String>]
275
- # Optional. List all <code>ErrorGroupStats</code> with these IDs.
276
- # @param service_filter [Google::Devtools::Clouderrorreporting::V1beta1::ServiceContextFilter | Hash]
277
- # Optional. List only <code>ErrorGroupStats</code> which belong to a service
278
- # context that matches the filter.
279
- # Data for all service contexts is returned if this field is not specified.
280
- # A hash of the same form as `Google::Devtools::Clouderrorreporting::V1beta1::ServiceContextFilter`
281
- # can also be provided.
282
- # @param time_range [Google::Devtools::Clouderrorreporting::V1beta1::QueryTimeRange | Hash]
283
- # Optional. List data for the given time range.
284
- # If not set, a default time range is used. The field
285
- # <code>time_range_begin</code> in the response will specify the beginning
286
- # of this time range.
287
- # Only <code>ErrorGroupStats</code> with a non-zero count in the given time
288
- # range are returned, unless the request contains an explicit
289
- # <code>group_id</code> list. If a <code>group_id</code> list is given, also
290
- # <code>ErrorGroupStats</code> with zero occurrences are returned.
291
- # A hash of the same form as `Google::Devtools::Clouderrorreporting::V1beta1::QueryTimeRange`
292
- # can also be provided.
293
- # @param timed_count_duration [Google::Protobuf::Duration | Hash]
294
- # Optional. The preferred duration for a single returned `TimedCount`.
295
- # If not set, no timed counts are returned.
296
- # A hash of the same form as `Google::Protobuf::Duration`
297
- # can also be provided.
298
- # @param alignment [Google::Devtools::Clouderrorreporting::V1beta1::TimedCountAlignment]
299
- # Optional. The alignment of the timed counts to be returned.
300
- # Default is `ALIGNMENT_EQUAL_AT_END`.
301
- # @param alignment_time [Google::Protobuf::Timestamp | Hash]
302
- # Optional. Time where the timed counts shall be aligned if rounded
303
- # alignment is chosen. Default is 00:00 UTC.
304
- # A hash of the same form as `Google::Protobuf::Timestamp`
305
- # can also be provided.
306
- # @param order [Google::Devtools::Clouderrorreporting::V1beta1::ErrorGroupOrder]
307
- # Optional. The sort order in which the results are returned.
308
- # Default is `COUNT_DESC`.
309
- # @param page_size [Integer]
310
- # The maximum number of resources contained in the underlying API
311
- # response. If page streaming is performed per-resource, this
312
- # parameter does not affect the return value. If page streaming is
313
- # performed per-page, this determines the maximum number of
314
- # resources in a page.
315
- # @param options [Google::Gax::CallOptions]
316
- # Overrides the default settings for this call, e.g, timeout,
317
- # retries, etc.
318
- # @yield [result, operation] Access the result along with the RPC operation
319
- # @yieldparam result [Google::Gax::PagedEnumerable<Google::Devtools::Clouderrorreporting::V1beta1::ErrorGroupStats>]
320
- # @yieldparam operation [GRPC::ActiveCall::Operation]
321
- # @return [Google::Gax::PagedEnumerable<Google::Devtools::Clouderrorreporting::V1beta1::ErrorGroupStats>]
322
- # An enumerable of Google::Devtools::Clouderrorreporting::V1beta1::ErrorGroupStats instances.
323
- # See Google::Gax::PagedEnumerable documentation for other
324
- # operations such as per-page iteration or access to the response
325
- # object.
326
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
327
- # @example
328
- # require "google/cloud/error_reporting"
329
- #
330
- # error_stats_client = Google::Cloud::ErrorReporting::ErrorStats.new(version: :v1beta1)
331
- # formatted_project_name = Google::Cloud::ErrorReporting::V1beta1::ErrorStatsServiceClient.project_path("[PROJECT]")
332
- #
333
- # # Iterate over all results.
334
- # error_stats_client.list_group_stats(formatted_project_name).each do |element|
335
- # # Process element.
336
- # end
337
- #
338
- # # Or iterate over results one page at a time.
339
- # error_stats_client.list_group_stats(formatted_project_name).each_page do |page|
340
- # # Process each page at a time.
341
- # page.each do |element|
342
- # # Process element.
343
- # end
344
- # end
345
-
346
- def list_group_stats \
347
- project_name,
348
- group_id: nil,
349
- service_filter: nil,
350
- time_range: nil,
351
- timed_count_duration: nil,
352
- alignment: nil,
353
- alignment_time: nil,
354
- order: nil,
355
- page_size: nil,
356
- options: nil,
357
- &block
358
- req = {
359
- project_name: project_name,
360
- group_id: group_id,
361
- service_filter: service_filter,
362
- time_range: time_range,
363
- timed_count_duration: timed_count_duration,
364
- alignment: alignment,
365
- alignment_time: alignment_time,
366
- order: order,
367
- page_size: page_size
368
- }.delete_if { |_, v| v.nil? }
369
- req = Google::Gax::to_proto(req, Google::Devtools::Clouderrorreporting::V1beta1::ListGroupStatsRequest)
370
- @list_group_stats.call(req, options, &block)
371
- end
372
-
373
- # Lists the specified events.
374
- #
375
- # @param project_name [String]
376
- # Required. The resource name of the Google Cloud Platform project. Written
377
- # as `projects/` plus the
378
- # [Google Cloud Platform project
379
- # ID](https://support.google.com/cloud/answer/6158840).
380
- # Example: `projects/my-project-123`.
381
- # @param group_id [String]
382
- # Required. The group for which events shall be returned.
383
- # @param service_filter [Google::Devtools::Clouderrorreporting::V1beta1::ServiceContextFilter | Hash]
384
- # Optional. List only ErrorGroups which belong to a service context that
385
- # matches the filter.
386
- # Data for all service contexts is returned if this field is not specified.
387
- # A hash of the same form as `Google::Devtools::Clouderrorreporting::V1beta1::ServiceContextFilter`
388
- # can also be provided.
389
- # @param time_range [Google::Devtools::Clouderrorreporting::V1beta1::QueryTimeRange | Hash]
390
- # Optional. List only data for the given time range.
391
- # If not set a default time range is used. The field time_range_begin
392
- # in the response will specify the beginning of this time range.
393
- # A hash of the same form as `Google::Devtools::Clouderrorreporting::V1beta1::QueryTimeRange`
394
- # can also be provided.
395
- # @param page_size [Integer]
396
- # The maximum number of resources contained in the underlying API
397
- # response. If page streaming is performed per-resource, this
398
- # parameter does not affect the return value. If page streaming is
399
- # performed per-page, this determines the maximum number of
400
- # resources in a page.
401
- # @param options [Google::Gax::CallOptions]
402
- # Overrides the default settings for this call, e.g, timeout,
403
- # retries, etc.
404
- # @yield [result, operation] Access the result along with the RPC operation
405
- # @yieldparam result [Google::Gax::PagedEnumerable<Google::Devtools::Clouderrorreporting::V1beta1::ErrorEvent>]
406
- # @yieldparam operation [GRPC::ActiveCall::Operation]
407
- # @return [Google::Gax::PagedEnumerable<Google::Devtools::Clouderrorreporting::V1beta1::ErrorEvent>]
408
- # An enumerable of Google::Devtools::Clouderrorreporting::V1beta1::ErrorEvent instances.
409
- # See Google::Gax::PagedEnumerable documentation for other
410
- # operations such as per-page iteration or access to the response
411
- # object.
412
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
413
- # @example
414
- # require "google/cloud/error_reporting"
415
- #
416
- # error_stats_client = Google::Cloud::ErrorReporting::ErrorStats.new(version: :v1beta1)
417
- # formatted_project_name = Google::Cloud::ErrorReporting::V1beta1::ErrorStatsServiceClient.project_path("[PROJECT]")
418
- #
419
- # # TODO: Initialize `group_id`:
420
- # group_id = ''
421
- #
422
- # # Iterate over all results.
423
- # error_stats_client.list_events(formatted_project_name, group_id).each do |element|
424
- # # Process element.
425
- # end
426
- #
427
- # # Or iterate over results one page at a time.
428
- # error_stats_client.list_events(formatted_project_name, group_id).each_page do |page|
429
- # # Process each page at a time.
430
- # page.each do |element|
431
- # # Process element.
432
- # end
433
- # end
434
-
435
- def list_events \
436
- project_name,
437
- group_id,
438
- service_filter: nil,
439
- time_range: nil,
440
- page_size: nil,
441
- options: nil,
442
- &block
443
- req = {
444
- project_name: project_name,
445
- group_id: group_id,
446
- service_filter: service_filter,
447
- time_range: time_range,
448
- page_size: page_size
449
- }.delete_if { |_, v| v.nil? }
450
- req = Google::Gax::to_proto(req, Google::Devtools::Clouderrorreporting::V1beta1::ListEventsRequest)
451
- @list_events.call(req, options, &block)
452
- end
453
- end
454
- end
455
- end
456
- end
457
- end