gapic-generator 0.6.5 → 0.6.6
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/gapic/generator/version.rb +1 -1
- data/lib/gapic/grpc_service_config/parser.rb +42 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 23b2c33b7bbae1c69924aa5c4df7ce43324ba16cee3e581aa353cb4ddf961ec3
|
4
|
+
data.tar.gz: ec1125f2cf0614188c1106039c4f562602e3dff6ec574d96d0bca0b5fa904ec2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bbb0b136b92843f0859bd8f65b8cbf3a64e5d1e52af69aec02975fdb99ab584918152ffd00f71dc1dc4e333bb617a0975228e0f269a357c749e06b2e73b07854
|
7
|
+
data.tar.gz: 1b5481f342bc4aef038f5c2cf9fd71fb032192e7c644129f9165b59eec30137d8b75c172b679d36d2edf8740af0ee7fbf458c84a55dd180237122c7eba74461d
|
data/CHANGELOG.md
CHANGED
@@ -40,6 +40,31 @@ module Gapic
|
|
40
40
|
MULTIPLIER_JSON_KEY = "backoffMultiplier"
|
41
41
|
STATUS_CODES_JSON_KEY = "retryableStatusCodes"
|
42
42
|
|
43
|
+
# See https://grpc.github.io/grpc/core/md_doc_statuscodes.html for a
|
44
|
+
# list of error codes.
|
45
|
+
ERROR_CODE_MAPPING = [
|
46
|
+
"OK",
|
47
|
+
"CANCELLED",
|
48
|
+
"UNKNOWN",
|
49
|
+
"INVALID_ARGUMENT",
|
50
|
+
"DEADLINE_EXCEEDED",
|
51
|
+
"NOT_FOUND",
|
52
|
+
"ALREADY_EXISTS",
|
53
|
+
"PERMISSION_DENIED",
|
54
|
+
"RESOURCE_EXHAUSTED",
|
55
|
+
"FAILED_PRECONDITION",
|
56
|
+
"ABORTED",
|
57
|
+
"OUT_OF_RANGE",
|
58
|
+
"UNIMPLEMENTED",
|
59
|
+
"INTERNAL",
|
60
|
+
"UNAVAILABLE",
|
61
|
+
"DATA_LOSS",
|
62
|
+
"UNAUTHENTICATED"
|
63
|
+
].freeze
|
64
|
+
|
65
|
+
ERROR_STRING_MAPPING = ERROR_CODE_MAPPING.each_with_index.each_with_object({}) do |(str, num), hash|
|
66
|
+
hash[str] = num
|
67
|
+
end.freeze
|
43
68
|
|
44
69
|
##
|
45
70
|
# Parses ServiceConfig from a json of a GRPC service config
|
@@ -146,11 +171,26 @@ module Gapic
|
|
146
171
|
initial_delay_seconds = parse_interval_seconds get(retry_policy_json, INITIAL_DELAY_JSON_KEY)
|
147
172
|
max_delay_seconds = parse_interval_seconds get(retry_policy_json, MAX_DELAY_JSON_KEY)
|
148
173
|
multiplier = get retry_policy_json, MULTIPLIER_JSON_KEY
|
149
|
-
status_codes = get retry_policy_json, STATUS_CODES_JSON_KEY
|
174
|
+
status_codes = convert_codes get retry_policy_json, STATUS_CODES_JSON_KEY
|
150
175
|
|
151
176
|
RetryPolicy.new initial_delay_seconds, max_delay_seconds, multiplier, status_codes
|
152
177
|
end
|
153
178
|
|
179
|
+
##
|
180
|
+
# Interpret input status codes. Convert strings to their associated integer codes.
|
181
|
+
#
|
182
|
+
def self.convert_codes input_codes
|
183
|
+
return nil if input_codes.nil?
|
184
|
+
Array(input_codes).map do |obj|
|
185
|
+
case obj
|
186
|
+
when String
|
187
|
+
ERROR_STRING_MAPPING[obj]
|
188
|
+
when Integer
|
189
|
+
obj
|
190
|
+
end
|
191
|
+
end.compact
|
192
|
+
end
|
193
|
+
|
154
194
|
##
|
155
195
|
# Parses time expressed in secondds from the GRPC service config json
|
156
196
|
# The time is encoded is a string as float or integer with a letter 's' afterwards
|
@@ -212,7 +252,7 @@ module Gapic
|
|
212
252
|
end
|
213
253
|
|
214
254
|
private_class_method :parse_service_names, :filter_service_method_names, :parse_config,
|
215
|
-
:parse_retry_policy, :parse_interval_seconds, :valid_float
|
255
|
+
:parse_retry_policy, :parse_interval_seconds, :valid_float?, :convert_codes
|
216
256
|
end
|
217
257
|
end
|
218
258
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gapic-generator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ernest Landrito
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2020-
|
13
|
+
date: 2020-08-05 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: actionpack
|