aspera-cli 4.29.1 → 4.30.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 (264) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +4 -4
  3. data/CHANGELOG.md +119 -0
  4. data/CONTRIBUTING.md +8 -1
  5. data/README.md +2 -0
  6. data/TODO.md +4 -5
  7. data/bin/asession +2 -2
  8. data/docs/README.md +616 -86
  9. data/docs/test-mcp-with-ai.md +4 -0
  10. data/lib/aspera/agent/base.rb +62 -6
  11. data/lib/aspera/agent/factory.rb +127 -20
  12. data/lib/aspera/ascp/data_repository.rb +71 -0
  13. data/lib/aspera/ascp/installation.rb +16 -11
  14. data/lib/aspera/ascp/log_analyzer/lines.rb +4 -4
  15. data/lib/aspera/ascp/log_analyzer/log_file.rb +5 -3
  16. data/lib/aspera/ascp/log_analyzer/records.rb +11 -6
  17. data/lib/aspera/ascp/log_analyzer.rb +43 -18
  18. data/lib/aspera/ascp/log_locations.rb +2 -2
  19. data/lib/aspera/assert.rb +8 -0
  20. data/lib/aspera/bundle_registry.rb +528 -0
  21. data/lib/aspera/cli/argument.rb +110 -0
  22. data/lib/aspera/cli/bool_value.rb +41 -0
  23. data/lib/aspera/cli/bootstrapper.rb +31 -24
  24. data/lib/aspera/cli/command/mount.rb +53 -0
  25. data/lib/aspera/cli/command/registry.rb +434 -0
  26. data/lib/aspera/cli/command.rb +95 -0
  27. data/lib/aspera/cli/command_line.rb +91 -91
  28. data/lib/aspera/cli/complete.rb +22 -0
  29. data/lib/aspera/cli/completion_actions.rb +28 -26
  30. data/lib/aspera/cli/context.rb +29 -6
  31. data/lib/aspera/cli/error.rb +39 -0
  32. data/lib/aspera/cli/extended_value.rb +25 -4
  33. data/lib/aspera/cli/formatter.rb +8 -8
  34. data/lib/aspera/cli/hints.rb +17 -52
  35. data/lib/aspera/cli/http.rb +17 -12
  36. data/lib/aspera/cli/mailer.rb +7 -24
  37. data/lib/aspera/cli/mcp/tool.rb +10 -2
  38. data/lib/aspera/cli/option/declarator.rb +80 -0
  39. data/lib/aspera/cli/option/registry.rb +74 -0
  40. data/lib/aspera/cli/option/source.rb +38 -0
  41. data/lib/aspera/cli/option/type.rb +37 -0
  42. data/lib/aspera/cli/option/value.rb +376 -0
  43. data/lib/aspera/cli/option.rb +78 -0
  44. data/lib/aspera/cli/options.schema.yaml +28 -783
  45. data/lib/aspera/cli/parser.rb +73 -41
  46. data/lib/aspera/cli/plugins/base.rb +122 -42
  47. data/lib/aspera/cli/plugins/basic_auth.rb +13 -2
  48. data/lib/aspera/cli/plugins/config.rb +101 -167
  49. data/lib/aspera/cli/plugins/factory.rb +139 -43
  50. data/lib/aspera/cli/plugins/mcp.rb +61 -54
  51. data/lib/aspera/cli/plugins/oauth.rb +19 -6
  52. data/lib/aspera/cli/poll.rb +14 -20
  53. data/lib/aspera/cli/preset_actions.rb +11 -3
  54. data/lib/aspera/cli/preset_manager.rb +16 -6
  55. data/lib/aspera/cli/result.rb +2 -2
  56. data/lib/aspera/cli/runner.rb +71 -99
  57. data/lib/aspera/cli/secret_finder.rb +1 -1
  58. data/lib/aspera/cli/security.rb +102 -4
  59. data/lib/aspera/{preview/terminal.rb → cli/terminal_image.rb} +93 -94
  60. data/lib/aspera/cli/vault_manager.rb +3 -3
  61. data/lib/aspera/cli/version.rb +1 -1
  62. data/lib/aspera/cli/wizard.rb +9 -3
  63. data/lib/aspera/coverage.rb +1 -2
  64. data/lib/aspera/line_logger.rb +35 -6
  65. data/lib/aspera/log.rb +3 -2
  66. data/lib/aspera/oauth/client/base.rb +19 -1
  67. data/lib/aspera/oauth/client/factory.rb +1 -7
  68. data/lib/aspera/plugin.schema.yaml +178 -0
  69. data/lib/aspera/plugins/alee/api.rb +25 -0
  70. data/lib/aspera/{cli/plugins/alee.rb → plugins/alee/commands.rb} +10 -8
  71. data/lib/aspera/plugins/alee/plugin.yaml +3 -0
  72. data/lib/aspera/plugins/aoc/admin_resources.rb +148 -0
  73. data/lib/aspera/plugins/aoc/api.rb +783 -0
  74. data/lib/aspera/{cli/plugins/aoc.rb → plugins/aoc/commands.rb} +404 -330
  75. data/lib/aspera/plugins/aoc/graphql.rb +45 -0
  76. data/lib/aspera/plugins/aoc/plugin.yaml +31 -0
  77. data/lib/aspera/{schema → plugins/aoc/schemas}/IBM Aspera on Cloud API-0.2.6-enhanced.yaml +15042 -7076
  78. data/lib/aspera/plugins/aoc/schemas/options.yaml +47 -0
  79. data/lib/aspera/plugins/ats/api.rb +51 -0
  80. data/lib/aspera/{cli/plugins/ats.rb → plugins/ats/commands.rb} +33 -33
  81. data/lib/aspera/plugins/ats/plugin.yaml +6 -0
  82. data/lib/aspera/plugins/connect/agent.rb +199 -0
  83. data/lib/aspera/plugins/connect/plugin.yaml +11 -0
  84. data/lib/aspera/plugins/connect/schemas/agent_options.yaml +6 -0
  85. data/lib/aspera/{cli/plugins/console.rb → plugins/console/commands.rb} +41 -33
  86. data/lib/aspera/plugins/console/plugin.yaml +8 -0
  87. data/lib/aspera/plugins/cos/api.rb +114 -0
  88. data/lib/aspera/{cli/plugins/cos.rb → plugins/cos/commands.rb} +19 -16
  89. data/lib/aspera/plugins/cos/plugin.yaml +9 -0
  90. data/lib/aspera/plugins/cos/schemas/options.yaml +30 -0
  91. data/lib/aspera/plugins/desktop/agent.rb +165 -0
  92. data/lib/aspera/plugins/desktop/plugin.yaml +11 -0
  93. data/lib/aspera/plugins/desktop/schemas/agent_options.yaml +6 -0
  94. data/lib/aspera/plugins/direct/agent.rb +518 -0
  95. data/lib/aspera/plugins/direct/plugin.yaml +11 -0
  96. data/lib/aspera/plugins/direct/schemas/agent_options.yaml +86 -0
  97. data/lib/aspera/plugins/faspex4/gateway_options.rb +18 -0
  98. data/lib/aspera/plugins/faspex4/gw_servlet.rb +122 -0
  99. data/lib/aspera/plugins/faspex4/plugin.yaml +7 -0
  100. data/lib/aspera/plugins/faspex4/schemas/options.yaml +57 -0
  101. data/lib/aspera/plugins/faspex5/api.rb +269 -0
  102. data/lib/aspera/{cli/plugins/faspex5.rb → plugins/faspex5/commands.rb} +152 -114
  103. data/lib/aspera/plugins/faspex5/faspex4_post_proc_servlet.rb +241 -0
  104. data/lib/aspera/plugins/faspex5/plugin.yaml +14 -0
  105. data/lib/aspera/{schema → plugins/faspex5/schemas}/IBM Aspera Faspex API-5.0-enhanced.yaml +279 -76
  106. data/lib/aspera/plugins/faspex5/schemas/options.yaml +87 -0
  107. data/lib/aspera/{cli/plugins/faspio.rb → plugins/faspio/commands.rb} +11 -7
  108. data/lib/aspera/plugins/faspio/plugin.yaml +8 -0
  109. data/lib/aspera/{schema → plugins/faspio/schemas}/IBM Aspera faspio Gateway API-1.0.0-enhanced.yaml +4 -2
  110. data/lib/aspera/plugins/httpgw/agent.rb +126 -0
  111. data/lib/aspera/plugins/httpgw/api.rb +411 -0
  112. data/lib/aspera/{cli/plugins/httpgw.rb → plugins/httpgw/commands.rb} +9 -9
  113. data/lib/aspera/plugins/httpgw/plugin.yaml +12 -0
  114. data/lib/aspera/plugins/httpgw/schemas/agent_options.yaml +24 -0
  115. data/lib/aspera/plugins/node/agent.rb +184 -0
  116. data/lib/aspera/plugins/node/api.rb +699 -0
  117. data/lib/aspera/{cli/plugins/node.rb → plugins/node/commands.rb} +166 -141
  118. data/lib/aspera/plugins/node/emulator.rb +774 -0
  119. data/lib/aspera/plugins/node/plugin.yaml +20 -0
  120. data/lib/aspera/plugins/node/schemas/agent_options.yaml +20 -0
  121. data/lib/aspera/plugins/node/schemas/options.yaml +190 -0
  122. data/lib/aspera/{cli/plugins/orchestrator.rb → plugins/orchestrator/commands.rb} +139 -110
  123. data/lib/aspera/plugins/orchestrator/plugin.yaml +34 -0
  124. data/lib/aspera/{schema → plugins/orchestrator/schemas}/IBM Aspera Orchestrator API-v1-enhanced.yaml +486 -16
  125. data/lib/aspera/plugins/orchestrator/schemas/options.yaml +143 -0
  126. data/lib/aspera/plugins/orchestrator/workflow_checker.rb +692 -0
  127. data/lib/aspera/{cli/plugins/preview.rb → plugins/preview/commands.rb} +53 -51
  128. data/lib/aspera/plugins/preview/file_types.rb +121 -0
  129. data/lib/aspera/plugins/preview/generator.rb +350 -0
  130. data/lib/aspera/plugins/preview/plugin.yaml +12 -0
  131. data/lib/aspera/{preview/options.schema.yaml → plugins/preview/schemas/options.yaml} +1 -1
  132. data/lib/aspera/plugins/preview/utils.rb +213 -0
  133. data/lib/aspera/plugins/server/ascmd.rb +374 -0
  134. data/lib/aspera/{cli/plugins/server.rb → plugins/server/commands.rb} +48 -32
  135. data/lib/aspera/plugins/server/plugin.yaml +9 -0
  136. data/lib/aspera/plugins/server/schemas/options.yaml +30 -0
  137. data/lib/aspera/{cli/plugins/shares.rb → plugins/shares/commands.rb} +29 -21
  138. data/lib/aspera/plugins/shares/plugin.yaml +10 -0
  139. data/lib/aspera/plugins/shares/shares_web.rb +97 -0
  140. data/lib/aspera/plugins/transferd/agent.rb +258 -0
  141. data/lib/aspera/plugins/transferd/api.rb +180 -0
  142. data/lib/aspera/plugins/transferd/client.rb +67 -0
  143. data/lib/aspera/{cli/plugins/transferd.rb → plugins/transferd/commands.rb} +43 -42
  144. data/lib/aspera/plugins/transferd/config_commands.rb +38 -0
  145. data/lib/aspera/plugins/transferd/plugin.yaml +27 -0
  146. data/lib/aspera/plugins/transferd/product.rb +146 -0
  147. data/lib/aspera/plugins/transferd/schemas/agent_options.yaml +31 -0
  148. data/lib/aspera/plugins/transferd/schemas/options.yaml +80 -0
  149. data/lib/aspera/plugins/transferd/service.rb +617 -0
  150. data/lib/aspera/plugins/xfer/ascp_actions.rb +131 -0
  151. data/lib/aspera/plugins/xfer/ascp_logs_actions.rb +198 -0
  152. data/lib/aspera/plugins/xfer/async_transfer_store.rb +131 -0
  153. data/lib/aspera/plugins/xfer/config_commands.rb +119 -0
  154. data/lib/aspera/plugins/xfer/helper.rb +19 -0
  155. data/lib/aspera/plugins/xfer/plugin.yaml +42 -0
  156. data/lib/aspera/plugins/xfer/schemas/agent_extension.schema.yaml +26 -0
  157. data/lib/aspera/plugins/xfer/schemas/options.yaml +125 -0
  158. data/lib/aspera/plugins/xfer/sync_actions.rb +253 -0
  159. data/lib/aspera/plugins/xfer/transfer_actions.rb +176 -0
  160. data/lib/aspera/plugins/xfer/transfer_agent.rb +505 -0
  161. data/lib/aspera/products/cli_v3.rb +34 -0
  162. data/lib/aspera/products/connect.rb +1 -1
  163. data/lib/aspera/products/drive.rb +29 -0
  164. data/lib/aspera/products/hsts.rb +34 -0
  165. data/lib/aspera/products/transferd.rb +25 -3
  166. data/lib/aspera/products.rb +54 -0
  167. data/lib/aspera/prompt.rb +184 -0
  168. data/lib/aspera/proxy_auto_config.rb +3 -3
  169. data/lib/aspera/rest/aspera_errors.rb +4 -38
  170. data/lib/aspera/rest/error_analyzer.rb +6 -2
  171. data/lib/aspera/rest/list.rb +4 -5
  172. data/lib/aspera/schema/reader.rb +15 -0
  173. data/lib/aspera/schema/registry.rb +239 -45
  174. data/lib/aspera/schema/validator.rb +63 -17
  175. data/lib/aspera/sealed_hash.rb +4 -0
  176. data/lib/aspera/secret/hider.rb +159 -24
  177. data/lib/aspera/secret/reference.rb +8 -0
  178. data/lib/aspera/secret/resolver.rb +8 -4
  179. data/lib/aspera/secret/store/base.rb +10 -9
  180. data/lib/aspera/secret/store/encrypted_hash.rb +6 -6
  181. data/lib/aspera/secret/store/hashicorp_vault.rb +3 -3
  182. data/lib/aspera/secret/store/keeper.rb +2 -2
  183. data/lib/aspera/secret/store/macos_security.rb +2 -3
  184. data/lib/aspera/secret/store/one_password_api.rb +2 -2
  185. data/lib/aspera/secret/store/one_password_cli.rb +3 -3
  186. data/lib/aspera/secret/store/secret_service.rb +2 -2
  187. data/lib/aspera/ssl.rb +3 -3
  188. data/lib/aspera/standard_input.rb +20 -0
  189. data/lib/aspera/{schema → sync}/async_tables.yaml +1 -1
  190. data/lib/aspera/sync/database.rb +7 -0
  191. data/lib/aspera/sync/log_parser.rb +138 -0
  192. data/lib/aspera/sync/operations.rb +59 -34
  193. data/lib/aspera/transfer/command_line_builder.rb +248 -0
  194. data/lib/aspera/transfer/command_line_converter.rb +37 -0
  195. data/lib/aspera/transfer/faux_file.rb +2 -2
  196. data/lib/aspera/transfer/parameters.rb +9 -10
  197. data/lib/aspera/transfer/spec.rb +28 -1
  198. data/lib/aspera/transfer/spec.schema.yaml +30 -5
  199. data/lib/aspera/units/decimal.rb +1 -1
  200. data/lib/aspera/units/timestamp.rb +84 -0
  201. data/lib/aspera/uri_reader.rb +2 -2
  202. data/lib/aspera/web_auth/paste.rb +2 -2
  203. data/lib/aspera/web_server_simple.rb +10 -4
  204. data.tar.gz.sig +0 -0
  205. metadata +137 -80
  206. metadata.gz.sig +0 -0
  207. data/lib/aspera/agent/connect.rb +0 -188
  208. data/lib/aspera/agent/desktop.rb +0 -154
  209. data/lib/aspera/agent/direct.rb +0 -496
  210. data/lib/aspera/agent/httpgw.rb +0 -100
  211. data/lib/aspera/agent/node.rb +0 -166
  212. data/lib/aspera/agent/transferd.rb +0 -341
  213. data/lib/aspera/api/alee.rb +0 -19
  214. data/lib/aspera/api/aoc.rb +0 -776
  215. data/lib/aspera/api/ats.rb +0 -49
  216. data/lib/aspera/api/cos_node.rb +0 -107
  217. data/lib/aspera/api/faspex.rb +0 -258
  218. data/lib/aspera/api/httpgw.rb +0 -409
  219. data/lib/aspera/api/node.rb +0 -684
  220. data/lib/aspera/ascmd.rb +0 -248
  221. data/lib/aspera/cli/ascp_actions.rb +0 -113
  222. data/lib/aspera/cli/ascp_logs_actions.rb +0 -188
  223. data/lib/aspera/cli/async_transfer_store.rb +0 -129
  224. data/lib/aspera/cli/command_registry.rb +0 -371
  225. data/lib/aspera/cli/command_spec.rb +0 -273
  226. data/lib/aspera/cli/option_declarator.rb +0 -74
  227. data/lib/aspera/cli/option_registry.rb +0 -72
  228. data/lib/aspera/cli/option_types.rb +0 -120
  229. data/lib/aspera/cli/option_value.rb +0 -345
  230. data/lib/aspera/cli/prompt.rb +0 -186
  231. data/lib/aspera/cli/sync_actions.rb +0 -181
  232. data/lib/aspera/cli/transfer_actions.rb +0 -98
  233. data/lib/aspera/cli/transfer_agent.rb +0 -348
  234. data/lib/aspera/command_line_builder.rb +0 -244
  235. data/lib/aspera/command_line_converter.rb +0 -35
  236. data/lib/aspera/data_repository.rb +0 -69
  237. data/lib/aspera/faspex_gw.rb +0 -172
  238. data/lib/aspera/faspex_postproc.rb +0 -237
  239. data/lib/aspera/graphql.rb +0 -41
  240. data/lib/aspera/node_emulator.rb +0 -758
  241. data/lib/aspera/oauth/client/shares_web.rb +0 -94
  242. data/lib/aspera/orchestrator_workflow_checker.rb +0 -688
  243. data/lib/aspera/preview/file_types.rb +0 -119
  244. data/lib/aspera/preview/generator.rb +0 -345
  245. data/lib/aspera/preview/utils.rb +0 -211
  246. data/lib/aspera/products/other.rb +0 -92
  247. data/lib/aspera/products/transferd_service.rb +0 -610
  248. /data/lib/aspera/{data → ascp/data}/1 +0 -0
  249. /data/lib/aspera/{data → ascp/data}/2 +0 -0
  250. /data/lib/aspera/{data → ascp/data}/3 +0 -0
  251. /data/lib/aspera/{data → ascp/data}/4 +0 -0
  252. /data/lib/aspera/{data → ascp/data}/5 +0 -0
  253. /data/lib/aspera/{data → ascp/data}/6 +0 -0
  254. /data/lib/aspera/{api → plugins/aoc}/queries/bss_subscription_account.graphql +0 -0
  255. /data/lib/aspera/{api → plugins/aoc}/queries/bss_subscription_usage.graphql +0 -0
  256. /data/lib/aspera/{schema → plugins/aoc/schemas}/IBM Aspera on Cloud Automation API-1.0.5-enhanced.yaml +0 -0
  257. /data/lib/aspera/{schema → plugins/console/schemas}/IBM Aspera Console-enhanced.yaml +0 -0
  258. /data/lib/aspera/{schema → plugins/node/schemas}/IBM Aspera Node API-4.4.6.yaml +0 -0
  259. /data/lib/aspera/{preview → plugins/preview}/image_error.png +0 -0
  260. /data/lib/aspera/{preview → plugins/preview}/video_error.png +0 -0
  261. /data/lib/aspera/{schema → plugins/shares/schemas}/IBM_Aspera_Shares.yaml +0 -0
  262. /data/lib/{transferd_pb.rb → aspera/plugins/transferd/grpc/transferd_pb.rb} +0 -0
  263. /data/lib/{transferd_services_pb.rb → aspera/plugins/transferd/grpc/transferd_services_pb.rb} +0 -0
  264. /data/lib/aspera/{schema → plugins/transferd/schemas}/transferd-config.schema.json +0 -0
@@ -1,100 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # SPDX-FileCopyrightText: IBM Corp.
4
- # SPDX-License-Identifier: Apache-2.0
5
-
6
- require_relative 'base'
7
- require_relative '../api/httpgw'
8
- require_relative '../log'
9
- require_relative '../assert'
10
- require 'securerandom'
11
-
12
- module Aspera
13
- module Agent
14
- class Httpgw < Base
15
- class << self
16
- # Re-query the status of an httpgw transfer that was started in-process.
17
- # Only works if the same Ruby process is still alive (e.g. MCP mode).
18
- # agent_params must contain '_agent_ref' pointing to the live Httpgw instance.
19
- # @param transfer_id [String] job_id returned by last_job_id
20
- # @param agent_params [Hash] '_agent_ref' is the live agent instance
21
- # @return [Hash] status hash with at least 'status' key
22
- def transfer_status(transfer_id, agent_params)
23
- agent = agent_params['_agent_ref']
24
- return {'status' => 'unknown', 'note' => 'httpgw agent not available (different process?)'} if agent.nil?
25
- return {'status' => 'unknown', 'note' => 'no transfer started'} if agent.instance_variable_get(:@transfer_thread).nil?
26
- if agent.instance_variable_get(:@transfer_thread).alive?
27
- {'status' => 'running'}
28
- elsif (err = agent.instance_variable_get(:@transfer_error))
29
- {'status' => 'failed', 'error' => err.message}
30
- else
31
- {'status' => 'completed'}
32
- end
33
- end
34
- end
35
-
36
- def initialize(
37
- url:,
38
- api_version: Api::Httpgw::API_V2,
39
- upload_chunk_size: 64_000,
40
- synchronous: false,
41
- **base_options
42
- )
43
- super(**base_options)
44
- @gw_api = Api::Httpgw.new(
45
- # remove /v1 from end of user-provided GW url: we need the base url only
46
- url: url,
47
- api_version: api_version,
48
- upload_chunk_size: upload_chunk_size,
49
- synchronous: synchronous,
50
- notify_cb: ->(*pa, **ka) { notify_progress(*pa, **ka) }
51
- )
52
- @last_job_id = nil
53
- @transfer_thread = nil
54
- @transfer_error = nil
55
- end
56
-
57
- # Start FASP transfer based on transfer spec (hash table).
58
- # Non-blocking: the actual upload/download runs in a dedicated thread.
59
- # HTTP download only supports file list.
60
- # :reek:UnusedParameters token_regenerator
61
- def start_transfer(transfer_spec, token_regenerator: nil)
62
- Aspera.assert(!@gw_api.nil?, 'GW URL must be set')
63
- Aspera.assert_type(transfer_spec['paths'], Array) { 'paths' }
64
- Aspera.assert_type(transfer_spec['token'], String) { 'only token based transfer is supported in GW' }
65
- Log.dump(:user_spec, transfer_spec)
66
- transfer_spec['authentication'] ||= 'token'
67
- @last_job_id = SecureRandom.uuid
68
- @transfer_error = nil
69
- @transfer_thread = Thread.new { run_transfer(transfer_spec) }
70
- @last_job_id
71
- end
72
-
73
- # Wait for the transfer thread to complete.
74
- # @return [Array] list of :success or error
75
- def wait_for_transfers_completion
76
- @transfer_thread&.join
77
- return [@transfer_error || :success]
78
- end
79
-
80
- # @return [String, nil] job_id of the last submitted transfer
81
- attr_reader :last_job_id
82
-
83
- private
84
-
85
- # Execute the actual transfer (runs inside the transfer thread).
86
- def run_transfer(transfer_spec)
87
- case transfer_spec['direction']
88
- when Transfer::Spec::DIRECTION_SEND
89
- @gw_api.upload(transfer_spec)
90
- when Transfer::Spec::DIRECTION_RECEIVE
91
- @gw_api.download(transfer_spec)
92
- else Aspera.error_unexpected_value(transfer_spec['direction']) { 'direction' }
93
- end
94
- rescue => e
95
- @transfer_error = e
96
- Log.log.error { "httpgw transfer thread error: #{e}" }
97
- end
98
- end
99
- end
100
- end
@@ -1,166 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # SPDX-FileCopyrightText: IBM Corp.
4
- # SPDX-License-Identifier: Apache-2.0
5
-
6
- require_relative 'base'
7
- require_relative '../transfer/spec'
8
- require_relative '../api/node'
9
- require_relative '../log'
10
- require_relative '../assert'
11
- require_relative '../oauth/client/factory'
12
-
13
- module Aspera
14
- module Agent
15
- # this singleton class is used by the CLI to provide a common interface to start a transfer
16
- # before using it, the use must set the `node_api` member.
17
- class Node < Base
18
- class << self
19
- # Re-query a previously started transfer via the Node REST API.
20
- # agent_params must contain 'url', 'username', 'password' (and optionally 'root_id').
21
- # @return [Hash] normalized status hash
22
- def transfer_status(transfer_id, agent_params)
23
- rest_params = {base_url: agent_params['url']}
24
- if OAuth::Factory.bearer_auth?(agent_params['password'])
25
- rest_params[:headers] = Api::Node.bearer_headers(agent_params['password'], access_key: agent_params['username'])
26
- else
27
- rest_params[:auth] = {type: :basic, username: agent_params['username'], password: agent_params['password']}
28
- end
29
- node_api = Rest::Client.new(**rest_params)
30
- data = node_api.read("ops/transfers/#{transfer_id}") || {'status' => 'unknown'}
31
- normalize_status(data)
32
- end
33
-
34
- # Normalize a node API transfer hash into the standard async-transfer fields.
35
- def normalize_status(data)
36
- result = {'bytes_transferred' => data['bytes_transferred'].to_i}
37
- case data['status']
38
- when 'completed'
39
- result['status'] = 'completed'
40
- result['ended_at'] = Time.now.utc.iso8601
41
- when 'failed'
42
- result.merge!('status' => 'failed', 'ended_at' => Time.now.utc.iso8601, 'error' => data['error_desc'].to_s)
43
- when 'canceled'
44
- result['status'] = 'cancelled'
45
- result['ended_at'] = Time.now.utc.iso8601
46
- else
47
- result['status'] = 'running'
48
- end
49
- result
50
- end
51
- end
52
-
53
- # @param url [String] the base url of the node api
54
- # @param username [String] the username to use for the node api
55
- # @param password [String] the password to use for the node api
56
- # @param root_id [String] root file id if the node is an access key
57
- # @param base_options [Hash] options for base class
58
- def initialize(
59
- url:,
60
- username:,
61
- password:,
62
- root_id: nil,
63
- **base_options
64
- )
65
- super(**base_options)
66
- # root id is required for access key
67
- @root_id = root_id
68
- rest_params = {base_url: url}
69
- if OAuth::Factory.bearer_auth?(password)
70
- Aspera.assert(!@root_id.nil?, 'root_id not allowed for access key')
71
- rest_params[:headers] = Api::Node.bearer_headers(password, access_key: username)
72
- else
73
- rest_params[:auth] = {
74
- type: :basic,
75
- username: username,
76
- password: password
77
- }
78
- end
79
- @node_api = Rest::Client.new(**rest_params)
80
- # TODO: currently only supports one transfer. This is bad shortcut. but ok for CLI.
81
- @transfer_id = nil
82
- end
83
-
84
- # Received files are written on the node, not on the local system
85
- # @return [Boolean] `false`
86
- def local_destination?
87
- false
88
- end
89
-
90
- # generic method
91
- # :reek:UnusedParameters token_regenerator
92
- def start_transfer(transfer_spec, token_regenerator: nil)
93
- # add root id if access key
94
- if !@root_id.nil?
95
- case transfer_spec['direction']
96
- when Transfer::Spec::DIRECTION_SEND then transfer_spec['source_root_id'] = @root_id
97
- when Transfer::Spec::DIRECTION_RECEIVE then transfer_spec['destination_root_id'] = @root_id
98
- else Aspera.error_unexpected_value(transfer_spec['direction'])
99
- end
100
- end
101
- # add mandatory retry parameter for node api
102
- ts_tags = transfer_spec['tags']
103
- ts_tags[Transfer::Spec::TAG_RESERVED]['xfer_retry'] ||= 150 if ts_tags.is_a?(Hash) && ts_tags[Transfer::Spec::TAG_RESERVED].is_a?(Hash)
104
- # Optimization in case of sending to the same node
105
- # TODO: probably remove this, as /etc/hosts shall be used for that on server side.
106
- transfer_spec['remote_host'] = '127.0.0.1' if !transfer_spec['wss_enabled'] && transfer_spec['remote_host'].eql?(URI.parse(node_api_.base_url).host)
107
- resp = node_api_.create('ops/transfers', transfer_spec)
108
- @transfer_id = resp['id']
109
- Log.log.debug { "tr_id=#{@transfer_id}" }
110
- return @transfer_id
111
- end
112
-
113
- # generic method
114
- def wait_for_transfers_completion
115
- # set to true when we know the total size of the transfer
116
- session_started = false
117
- bytes_expected = nil
118
- # lets emulate management events to display progress bar
119
- loop do
120
- # status is empty sometimes with status 200...
121
- transfer_data = node_api_.read("ops/transfers/#{@transfer_id}") || {'status' => 'unknown'} rescue {'status' => 'waiting(api error)'}
122
- case transfer_data['status']
123
- when 'waiting', 'partially_completed', 'paused', 'unknown', 'waiting(read error)', 'waiting(api error)'
124
- notify_progress(:sessions_init, info: transfer_data['status'])
125
- when 'running'
126
- if !session_started
127
- notify_progress(:session_start, session_id: @transfer_id)
128
- session_started = true
129
- end
130
- message = transfer_data['status']
131
- message = "#{message} (#{transfer_data['error_desc']})" if !transfer_data['error_desc']&.empty?
132
- notify_progress(:sessions_init, info: message)
133
- if bytes_expected.nil? &&
134
- transfer_data['precalc'].is_a?(Hash) &&
135
- transfer_data['precalc']['status'].eql?('ready')
136
- bytes_expected = transfer_data['precalc']['bytes_expected']
137
- notify_progress(:session_size, session_id: @transfer_id, info: bytes_expected)
138
- end
139
- notify_progress(:transfer, session_id: @transfer_id, info: transfer_data['bytes_transferred'])
140
- when 'completed'
141
- notify_progress(:transfer, session_id: @transfer_id, info: bytes_expected) if bytes_expected
142
- notify_progress(:session_end, session_id: @transfer_id)
143
- break
144
- when 'failed', 'canceled'
145
- notify_progress(:session_end, session_id: @transfer_id)
146
- # Bug in HSTS ? transfer is marked failed, but there is no reason
147
- break if transfer_data['status'].eql?('failed') && transfer_data['error_code'].eql?(0) && transfer_data['error_desc'].empty?
148
- raise Transfer::Error, "status: #{transfer_data['status']}. code: #{transfer_data['error_code']}. description: #{transfer_data['error_desc']}"
149
- else Aspera.error_unexpected_value(transfer_data['status']) { "transfer_data -> #{transfer_data}" }
150
- end
151
- sleep(1.0)
152
- end
153
- # TODO: get status of sessions
154
- return []
155
- end
156
-
157
- private
158
-
159
- # used internally to ensure node api is set before using.
160
- def node_api_
161
- Aspera.assert(!@node_api.nil?, 'Before using this object, set the node_api attribute to a Aspera::Rest::Client object')
162
- return @node_api
163
- end
164
- end
165
- end
166
- end
@@ -1,341 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # SPDX-FileCopyrightText: IBM Corp.
4
- # SPDX-License-Identifier: Apache-2.0
5
-
6
- require_relative '../environment'
7
- require_relative 'base'
8
- require_relative '../products/transferd'
9
- require_relative '../temp_file_manager'
10
- require_relative '../transfer/error'
11
- require_relative '../transfer/spec'
12
- require_relative '../../transferd_services_pb'
13
- require 'json'
14
- require 'time'
15
- require 'uri'
16
-
17
- module Aspera
18
- module Agent
19
- class Transferd < Base
20
- # Sends the API key of the daemon (`authentication` of its configuration) in the metadata `api_key` of each call
21
- class ApiKeyInterceptor < GRPC::ClientInterceptor
22
- # @param api_key [String] API key
23
- def initialize(api_key)
24
- super()
25
- @api_key = api_key
26
- end
27
-
28
- %i[request_response client_streamer server_streamer bidi_streamer].each do |rpc_type|
29
- define_method(rpc_type) do |metadata: nil, **_rest, &block|
30
- metadata['api_key'] = @api_key
31
- block.call
32
- end
33
- end
34
- end
35
-
36
- # https://github.com/grpc/grpc/blob/master/doc/naming.md
37
- # https://grpc.io/docs/guides/custom-name-resolution/
38
- LOCAL_SOCKET_ADDR = '127.0.0.1'
39
- PORT_SEP = ':'
40
- # port zero means select a random available high port
41
- AUTO_LOCAL_TCP_PORT = "#{PORT_SEP}0".freeze
42
- # Default timeout in seconds of the calls of `transfer_status` and `transfer_cancel` (`agent_params['timeout']`)
43
- CALL_TIMEOUT_SEC = 10
44
- # Status of the daemon → status of an asynchronous transfer (as other agents): other statuses are `running`
45
- ASYNC_STATUS = {
46
- COMPLETED: 'completed',
47
- FAILED: 'failed',
48
- CANCELED: 'cancelled',
49
- UNKNOWN_STATUS: 'unknown'
50
- }.freeze
51
- # Statuses of the daemon after which a transfer does not change
52
- FINAL_STATUSES = %i[COMPLETED FAILED CANCELED].freeze
53
- # Time in the daemon is in microseconds, but some versions give milliseconds: values below this are milliseconds
54
- MIN_USEC_EPOCH = 10**14
55
-
56
- private_constant :LOCAL_SOCKET_ADDR, :PORT_SEP, :AUTO_LOCAL_TCP_PORT, :ASYNC_STATUS, :MIN_USEC_EPOCH
57
-
58
- class << self
59
- # Client of a daemon
60
- # @param url [String] Endpoint of the daemon, e.g. `127.0.0.1:55002`
61
- # @param api_key [String, nil] API key, if the daemon has `authentication` enabled
62
- # @param ca_file [String, nil] File with the certificate authority of the daemon (PEM), if the daemon has `tls` enabled
63
- # @return [Transferd::Api::TransferService::Stub] gRPC client
64
- def create_client(url, api_key: nil, ca_file: nil)
65
- credentials = ca_file.nil? ? :this_channel_is_insecure : GRPC::Core::ChannelCredentials.new(File.read(ca_file))
66
- return ::Transferd::Api::TransferService::Stub.new(url, credentials) if api_key.nil?
67
- ::Transferd::Api::TransferService::Stub.new(url, credentials, interceptors: [ApiKeyInterceptor.new(api_key)])
68
- end
69
-
70
- # @param agent_params [Hash] `url`: endpoint of the daemon; optional `api_key`, `ca_file`
71
- # @return [Transferd::Api::TransferService::Stub] Client of the daemon
72
- def client(agent_params)
73
- Aspera.assert(agent_params['url'].is_a?(String) && !agent_params['url'].empty?) { 'agent_params: missing url' }
74
- create_client(agent_params['url'], api_key: agent_params['api_key'], ca_file: agent_params['ca_file'])
75
- end
76
-
77
- # Re-query a previously started transfer from a running transferd daemon (unary call `QueryTransfer`).
78
- # The daemon keeps a transfer for some time after its end (`workers.transfer_max_age` of its configuration): then it is `unknown`.
79
- # @param transfer_id [String] Identifier of transfer, given by the daemon (`transfer_id`)
80
- # @param agent_params [Hash] `url`: endpoint of the daemon, e.g. `127.0.0.1:55002`; optional `timeout`: seconds, `api_key`, `ca_file`
81
- # @return [Hash] Normalized status: `status` (`running`, `completed`, `failed`, `cancelled`, or `unknown` if the daemon cannot tell),
82
- # `bytes_transferred`, and when known: `state` (status of the daemon), `bytes_written` (by the receiver, with the bytes of a resumed transfer),
83
- # `files_completed`, `rate_kbps` (average), `target_rate_kbps`,
84
- # `elapsed_sec`, `started_at`, `ended_at`, `error_code`, `error`
85
- def transfer_status(transfer_id, agent_params)
86
- response = client(agent_params).query_transfer(::Transferd::Api::TransferInfoRequest.new(transferId: transfer_id), deadline: deadline(agent_params))
87
- # An unknown transfer is not an exception: status is not set, and error has code 404
88
- error = response.error&.description.to_s
89
- return {'status' => 'unknown', 'bytes_transferred' => 0, 'error' => error} if response.status.eql?(:UNKNOWN_STATUS) && !error.empty?
90
- normalize_status(response)
91
- rescue GRPC::BadStatus => e
92
- # Daemon not reachable, or timeout: the transfer may still run
93
- {'status' => 'unknown', 'bytes_transferred' => 0, 'error' => "#{e.class.name.split('::').last}: #{e.details}"}
94
- end
95
-
96
- # Information on a running daemon (unary call `GetInfo`)
97
- # @param agent_params [Hash] `url`: endpoint of the daemon; optional `timeout`: seconds, `api_key`, `ca_file`
98
- # @return [Hash] Version of the API (`apiVersion`) and information on the instance (`info`)
99
- # @raise [Transfer::Error] The daemon is not reachable, or gave an error
100
- def info(agent_params)
101
- response = client(agent_params).get_info(::Transferd::Api::InstanceInfoRequest.new, deadline: deadline(agent_params))
102
- error = response.error&.description.to_s
103
- Aspera.assert(error.empty?, type: Transfer::Error) { error }
104
- JSON.parse(response.to_h.except(:error).to_json)
105
- rescue GRPC::BadStatus => e
106
- raise Transfer::Error, "#{e.class.name.split('::').last}: #{e.details}"
107
- end
108
-
109
- # Stop a transfer (call `StopTransfer`)
110
- # @param transfer_id [String] Identifier of transfer, given by the daemon
111
- # @param agent_params [Hash] `url`: endpoint of the daemon; optional `timeout`: seconds, `api_key`, `ca_file`
112
- # @return [Boolean] `true`: stopped
113
- # @raise [Transfer::Error] The daemon did not stop it: unknown or terminated transfer
114
- def transfer_cancel(transfer_id, agent_params)
115
- response = client(agent_params).stop_transfer(::Transferd::Api::StopTransferRequest.new(transferId: [transfer_id]), deadline: deadline(agent_params))
116
- result = response.stopResult.find { |item| item.transferId.eql?(transfer_id) }
117
- Aspera.assert(!result.nil?, type: Transfer::Error) { "transfer id=#{transfer_id}: no result of stop" }
118
- Aspera.assert(result.stopped, type: Transfer::Error) { result.error&.description || "transfer id=#{transfer_id}: not stopped" }
119
- true
120
- end
121
-
122
- # @param response [Transferd::Api::QueryTransferResponse, Transferd::Api::TransferResponse] Response of the daemon
123
- # @return [Hash] Normalized status, see `transfer_status`
124
- def normalize_status(response)
125
- info = response.transferInfo
126
- result = {
127
- 'status' => ASYNC_STATUS.fetch(response.status, 'running'),
128
- 'state' => response.status.to_s.downcase,
129
- 'bytes_transferred' => info&.bytesTransferred.to_i
130
- }
131
- return result if info.nil?
132
- result.merge!(
133
- 'bytes_written' => info.bytesWritten,
134
- 'files_completed' => info.filesCompleted,
135
- 'rate_kbps' => info.averageRateKbps,
136
- 'target_rate_kbps' => info.targetRateKbps,
137
- 'elapsed_sec' => info.elapsedUsec / 1_000_000.0,
138
- 'started_at' => epoch_time(info.startTimeUsec),
139
- 'ended_at' => epoch_time(info.endTimeUsec)
140
- )
141
- if FINAL_STATUSES.include?(response.status)
142
- result['ended_at'] ||= Time.now.utc.iso8601
143
- else
144
- result.delete('ended_at')
145
- end
146
- error = info.errorDescription.to_s.strip
147
- error = response.error&.description.to_s if error.empty?
148
- unless error.empty?
149
- result['error_code'] = info.errorCode
150
- result['error'] = error
151
- end
152
- result.compact
153
- end
154
-
155
- private
156
-
157
- # @param agent_params [Hash] Optional `timeout`: seconds
158
- # @return [Time] Deadline of a call
159
- def deadline(agent_params)
160
- Time.now + (agent_params['timeout'] || CALL_TIMEOUT_SEC).to_f
161
- end
162
-
163
- # @param value [Integer] Time since epoch, in microseconds or milliseconds, 0 if not known
164
- # @return [String, nil] Time in ISO 8601, `nil` if not known
165
- def epoch_time(value)
166
- return if value.nil? || value <= 0
167
- seconds = value >= MIN_USEC_EPOCH ? value / 1_000_000.0 : value / 1000.0
168
- Time.at(seconds).utc.iso8601
169
- end
170
- end
171
-
172
- # @param url [String] URL of the transfer manager daemon
173
- # @param start [Boolean] If `false`, expect that an external daemon is already running
174
- # @param stop [Boolean] If `false`, do not shutdown daemon on exit
175
- # @param api_key [String, nil] API key of an external daemon with `authentication` enabled
176
- # @param ca_file [String, nil] Certificate authority (PEM file) of an external daemon with `tls` enabled
177
- # @param base [Hash] Base class options
178
- def initialize(
179
- url: AUTO_LOCAL_TCP_PORT,
180
- start: true,
181
- stop: true,
182
- api_key: nil,
183
- ca_file: nil,
184
- **base
185
- )
186
- super(**base)
187
- @transfer_id = nil
188
- @stop = stop
189
- is_local_auto_port = url.eql?(AUTO_LOCAL_TCP_PORT)
190
- Aspera.assert(!(is_local_auto_port && (!@stop || !start)), type: Error) { 'Cannot set options `stop` or `start` to false with port zero' }
191
- # keep PID for optional shutdown
192
- @daemon_pid = nil
193
- @daemon_endpoint = nil
194
- daemon_endpoint = url
195
- Log.dump(:daemon_endpoint, daemon_endpoint)
196
- # retry loop
197
- begin
198
- # no address: local bind
199
- daemon_endpoint = "#{LOCAL_SOCKET_ADDR}#{daemon_endpoint}" if daemon_endpoint.match?(/^#{PORT_SEP}[0-9]+$/o)
200
- # Create stub: no credentials for a daemon started here, API key and TLS only for an external daemon
201
- @transfer_client = self.class.create_client(daemon_endpoint, api_key: api_key, ca_file: ca_file)
202
- # Initiate actual connection
203
- get_info_response = @transfer_client.get_info(::Transferd::Api::InstanceInfoRequest.new)
204
- @daemon_endpoint = daemon_endpoint
205
- Log.log.debug { "Daemon info: #{get_info_response}" }
206
- Log.log.warn('Attached to existing daemon') unless @daemon_pid || !start || !@stop
207
- # `shutdown` is registered with `at_exit` only when the daemon is started here:
208
- # a long-running process (e.g. Orchestrator) that attaches to an external daemon for each transfer would accumulate them
209
- rescue GRPC::Unavailable => e
210
- # if transferd is external: do not start it, or other error
211
- raise if !start || !e.message.include?('failed to connect')
212
- # we already tried to start a daemon, but it failed
213
- Aspera.assert(@daemon_pid.nil?) { "Daemon started with PID #{@daemon_pid}, but connection failed to #{daemon_endpoint}" }
214
- Log.log.warn('no daemon present, starting daemon...') if !start
215
- # transferd only supports local ip and port
216
- daemon_uri = URI.parse("ipv4://#{daemon_endpoint}")
217
- Aspera.assert(daemon_uri.scheme.eql?('ipv4')) { "Invalid scheme daemon URI #{daemon_endpoint}" }
218
- # create a config file for daemon
219
- config = {
220
- address: daemon_uri.host,
221
- port: daemon_uri.port,
222
- fasp_runtime: {
223
- use_embedded: false,
224
- user_defined: {
225
- bin: Products::Transferd.sdk_directory,
226
- etc: Products::Transferd.sdk_directory
227
- }
228
- }
229
- }
230
- # config file and logs are created in same folder
231
- transferd_base_tmp = TempFileManager.instance.new_file_path_global('transferd')
232
- Log.log.debug { "transferd base tmp #{transferd_base_tmp}" }
233
- conf_file = "#{transferd_base_tmp}.conf"
234
- log_stdout = "#{transferd_base_tmp}.out"
235
- log_stderr = "#{transferd_base_tmp}.err"
236
- File.write(conf_file, config.to_json)
237
- @daemon_pid = Environment.secure_execute(
238
- Ascp::Installation.instance.path(:transferd), '--config', conf_file,
239
- mode: :background,
240
- out: log_stdout,
241
- err: log_stderr
242
- )
243
- begin
244
- # wait for process to initialize, max 2 seconds
245
- Timeout.timeout(2.0) do
246
- # this returns if process dies (within 2 seconds)
247
- _, status = ::Process.wait2(@daemon_pid)
248
- raise "Transfer daemon exited with status #{status.exitstatus}. Check files: #{log_stdout} and #{log_stderr}"
249
- end
250
- rescue Timeout::Error
251
- nil
252
- end
253
- Log.log.debug { "Daemon started with pid #{@daemon_pid}" }
254
- ::Process.detach(@daemon_pid) unless @stop
255
- at_exit { shutdown }
256
- # update port for next connection attempt (if auto high port was requested)
257
- daemon_endpoint = "#{LOCAL_SOCKET_ADDR}#{PORT_SEP}#{Products::Transferd.daemon_port_from_log(log_stdout)}" if is_local_auto_port
258
- # local daemon started, try again
259
- retry
260
- end
261
- end
262
-
263
- # Actual endpoint the daemon is listening on (resolved after connect, e.g. when port 0 was used)
264
- attr_reader :daemon_endpoint
265
- # Identifier of the last transfer started, given by the daemon: for `transfer_status` and `transfer_cancel`
266
- attr_reader :transfer_id
267
- # gRPC client of the daemon
268
- attr_reader :transfer_client
269
-
270
- # :reek:UnusedParameters token_regenerator
271
- def start_transfer(transfer_spec, token_regenerator: nil)
272
- Transfer::Spec.fix_transferd_resume_policy(transfer_spec)
273
- # create a transfer request
274
- transfer_request = ::Transferd::Api::TransferRequest.new(
275
- transferType: ::Transferd::Api::TransferType::FILE_REGULAR, # transfer type (file/stream)
276
- config: ::Transferd::Api::TransferConfig.new, # transfer configuration
277
- transferSpec: transfer_spec.to_json
278
- ) # transfer definition
279
- # send start transfer request to the transfer manager daemon
280
- start_response = @transfer_client.start_transfer(transfer_request)
281
- Aspera.assert(!start_response.status.eql?(:FAILED), type: Transfer::Error) { start_response.error.description }
282
- Log.log.debug { "start transfer response #{start_response}" }
283
- @transfer_id = start_response.transferId
284
- Log.log.debug { "transfer started with id #{@transfer_id}" }
285
- end
286
-
287
- def wait_for_transfers_completion
288
- # set to true when we know the total size of the transfer
289
- session_started = false
290
- bytes_expected = nil
291
- # monitor transfer status
292
- @transfer_client.monitor_transfers(::Transferd::Api::RegistrationRequest.new(transferId: [@transfer_id])) do |response|
293
- Log.dump(:response, response.to_h)
294
- # Log.log.debug{"#{response.sessionInfo.preTransferBytes} #{response.transferInfo.bytesTransferred}"}
295
- case response.status
296
- when :RUNNING
297
- if !session_started
298
- notify_progress(:session_start, session_id: @transfer_id)
299
- session_started = true
300
- end
301
- if bytes_expected.nil? &&
302
- !response.sessionInfo.preTransferBytes.eql?(0)
303
- bytes_expected = response.sessionInfo.preTransferBytes
304
- notify_progress(:session_size, session_id: @transfer_id, info: bytes_expected)
305
- end
306
- notify_progress(:transfer, session_id: @transfer_id, info: response.transferInfo.bytesTransferred)
307
- when :COMPLETED
308
- notify_progress(:transfer, session_id: @transfer_id, info: bytes_expected) if bytes_expected
309
- notify_progress(:session_end, session_id: @transfer_id)
310
- break
311
- when :FAILED, :CANCELED
312
- notify_progress(:session_end, session_id: @transfer_id)
313
- raise Transfer::Error, JSON.parse(response.message)['Description']
314
- when :QUEUED, :UNKNOWN_STATUS, :PAUSED, :ORPHANED
315
- notify_progress(:sessions_init, info: response.status.to_s.downcase)
316
- else
317
- Log.log.error { "unknown status#{response.status}" }
318
- end
319
- end
320
- # TODO: return status
321
- return []
322
- end
323
-
324
- def shutdown
325
- stop_daemon if @stop
326
- end
327
-
328
- private
329
-
330
- def stop_daemon
331
- if !@daemon_pid.nil?
332
- Log.log.debug("Stopping daemon #{@daemon_pid}")
333
- ::Process.kill(:KILL, @daemon_pid)
334
- _, status = ::Process.wait2(@daemon_pid)
335
- Log.log.debug("daemon stopped #{status}")
336
- @daemon_pid = nil
337
- end
338
- end
339
- end
340
- end
341
- end
@@ -1,19 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # SPDX-FileCopyrightText: IBM Corp.
4
- # SPDX-License-Identifier: Apache-2.0
5
-
6
- require_relative 'aoc'
7
- module Aspera
8
- module Api
9
- # Aspera License Entitlement Engine API client
10
- class Alee < Aspera::Rest::Client
11
- def initialize(entitlement_id, customer_id, api_domain: AoC::SAAS_DOMAIN_PROD, version: 'v1')
12
- super(
13
- base_url: "https://api.#{api_domain}/metering/#{version}",
14
- headers: {'X-Aspera-Entitlement-Authorization' => Rest.basic_authorization(entitlement_id, customer_id)}
15
- )
16
- end
17
- end
18
- end
19
- end