forest_admin_datasource_rpc 1.22.0 → 1.22.1
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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ee7aa557c745a41ad9255d6e71ba5fab30ed3b6f3b9c48d7ff24c4d031280d4b
|
|
4
|
+
data.tar.gz: 600f4cae467a95b84779dff19568b9a572f4ce64f12f49f6851112d165fb6bc4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ebbf43da8ccca6679c0e33f9765af986ac3b138b30db72bcc1a9e6775038db90f85469301ff3176721dd544c13d5c1d2371b6da15b99a77c578d011ce21eaaf6
|
|
7
|
+
data.tar.gz: 0f1eb73352ca77a4380548e657fc8dfaeff4910a971fc571fee401903880069ce6dec6251d74522a91a3769e89c990c0cd6642a2a1dbfd2fa042cd9a89986a84
|
|
@@ -60,7 +60,21 @@ module ForestAdminDatasourceRpc
|
|
|
60
60
|
def make_request(endpoint, caller: nil, method: :get, payload: nil, symbolize_keys: false, if_none_match: nil)
|
|
61
61
|
log_request_start(method, endpoint, if_none_match)
|
|
62
62
|
|
|
63
|
-
client =
|
|
63
|
+
client = build_faraday_client(symbolize_keys)
|
|
64
|
+
headers = build_request_headers(caller, if_none_match)
|
|
65
|
+
|
|
66
|
+
response = client.send(method, endpoint, payload, headers)
|
|
67
|
+
log_request_complete(response, endpoint)
|
|
68
|
+
response
|
|
69
|
+
rescue Faraday::ConnectionFailed => e
|
|
70
|
+
handle_connection_failed(endpoint, e)
|
|
71
|
+
rescue Faraday::TimeoutError => e
|
|
72
|
+
handle_timeout_error(endpoint, e)
|
|
73
|
+
end
|
|
74
|
+
# rubocop:enable Metrics/ParameterLists
|
|
75
|
+
|
|
76
|
+
def build_faraday_client(symbolize_keys)
|
|
77
|
+
Faraday.new(url: @api_url) do |faraday|
|
|
64
78
|
faraday.request :json
|
|
65
79
|
faraday.response :json, parser_options: { symbolize_names: symbolize_keys }
|
|
66
80
|
faraday.adapter Faraday.default_adapter
|
|
@@ -68,7 +82,9 @@ module ForestAdminDatasourceRpc
|
|
|
68
82
|
faraday.options.timeout = DEFAULT_TIMEOUT
|
|
69
83
|
faraday.options.open_timeout = DEFAULT_OPEN_TIMEOUT
|
|
70
84
|
end
|
|
85
|
+
end
|
|
71
86
|
|
|
87
|
+
def build_request_headers(caller, if_none_match)
|
|
72
88
|
timestamp = Time.now.utc.iso8601(3)
|
|
73
89
|
signature = generate_signature(timestamp)
|
|
74
90
|
|
|
@@ -80,12 +96,26 @@ module ForestAdminDatasourceRpc
|
|
|
80
96
|
|
|
81
97
|
headers['forest_caller'] = caller.to_json if caller
|
|
82
98
|
headers['If-None-Match'] = %("#{if_none_match}") if if_none_match
|
|
99
|
+
headers
|
|
100
|
+
end
|
|
83
101
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
102
|
+
def handle_connection_failed(endpoint, error)
|
|
103
|
+
ForestAdminAgent::Facades::Container.logger&.log(
|
|
104
|
+
'Error',
|
|
105
|
+
"[RPC Client] Connection failed to #{@api_url}#{endpoint}: #{error.message}"
|
|
106
|
+
)
|
|
107
|
+
raise ForestAdminDatasourceToolkit::Exceptions::ForestException,
|
|
108
|
+
"RPC connection failed: Unable to connect to #{@api_url}. Please check if the RPC server is running."
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
def handle_timeout_error(endpoint, error)
|
|
112
|
+
ForestAdminAgent::Facades::Container.logger&.log(
|
|
113
|
+
'Error',
|
|
114
|
+
"[RPC Client] Request timeout to #{@api_url}#{endpoint}: #{error.message}"
|
|
115
|
+
)
|
|
116
|
+
raise ForestAdminDatasourceToolkit::Exceptions::ForestException,
|
|
117
|
+
"RPC request timeout: The RPC server at #{@api_url} did not respond in time."
|
|
87
118
|
end
|
|
88
|
-
# rubocop:enable Metrics/ParameterLists
|
|
89
119
|
|
|
90
120
|
def generate_signature(timestamp)
|
|
91
121
|
OpenSSL::HMAC.hexdigest('SHA256', @auth_secret, timestamp)
|
|
@@ -69,6 +69,8 @@ module ForestAdminDatasourceRpc
|
|
|
69
69
|
log_connection_error(e)
|
|
70
70
|
rescue ForestAdminAgent::Http::Exceptions::AuthenticationOpenIdClient => e
|
|
71
71
|
log_authentication_error(e)
|
|
72
|
+
rescue ForestAdminDatasourceToolkit::Exceptions::ForestException => e
|
|
73
|
+
log_rpc_error(e)
|
|
72
74
|
rescue StandardError => e
|
|
73
75
|
log_unexpected_error(e)
|
|
74
76
|
end
|
|
@@ -108,7 +110,8 @@ module ForestAdminDatasourceRpc
|
|
|
108
110
|
|
|
109
111
|
@introspection_schema = nil
|
|
110
112
|
rescue Faraday::ConnectionFailed, Faraday::TimeoutError,
|
|
111
|
-
ForestAdminAgent::Http::Exceptions::AuthenticationOpenIdClient,
|
|
113
|
+
ForestAdminAgent::Http::Exceptions::AuthenticationOpenIdClient,
|
|
114
|
+
ForestAdminDatasourceToolkit::Exceptions::ForestException, StandardError => e
|
|
112
115
|
handle_initial_fetch_error(e)
|
|
113
116
|
end
|
|
114
117
|
|
|
@@ -213,6 +216,13 @@ module ForestAdminDatasourceRpc
|
|
|
213
216
|
)
|
|
214
217
|
end
|
|
215
218
|
|
|
219
|
+
def log_rpc_error(error)
|
|
220
|
+
ForestAdminAgent::Facades::Container.logger&.log(
|
|
221
|
+
'Warn',
|
|
222
|
+
"[Schema Polling] RPC error: #{error.message}"
|
|
223
|
+
)
|
|
224
|
+
end
|
|
225
|
+
|
|
216
226
|
def log_authentication_error(error)
|
|
217
227
|
ForestAdminAgent::Facades::Container.logger&.log(
|
|
218
228
|
'Error',
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: forest_admin_datasource_rpc
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.22.
|
|
4
|
+
version: 1.22.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Matthieu
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: exe
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2026-01-
|
|
12
|
+
date: 2026-01-13 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: base64
|