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
@@ -14,111 +14,110 @@ require 'io/console'
14
14
  using Rainbow
15
15
 
16
16
  module Aspera
17
- module Preview
18
- module Backend
19
- # Base decoder that rescales image data to the current terminal geometry.
20
- class Base
21
- # Rows and columns used when the size of the terminal is unknown
22
- DEFAULT_TERMINAL_SIZE = [24, 80].freeze
23
- private_constant :DEFAULT_TERMINAL_SIZE
24
- # @param reserve [Integer] number of terminal rows reserved for non-image output
25
- # @param double [Boolean] when `true`, render two image rows in one terminal row
26
- # @param font_ratio [Float] terminal font aspect ratio: height divided by width
27
- def initialize(reserve:, double:, font_ratio:)
28
- @reserve = reserve
29
- @height_ratio = double ? 2.0 : 1.0
30
- @font_ratio = font_ratio
31
- end
32
- Aspera.require_method!(:terminal_pixels)
33
- # Compute output dimensions that fit inside the terminal while preserving aspect ratio.
34
- #
35
- # @param rows [Integer] source image height in pixels
36
- # @param columns [Integer] source image width in pixels
37
- # @return [Array<Integer>] scaled width and height for terminal rendering
38
- def terminal_scaling(rows, columns)
39
- (term_rows, term_columns) = IO.console&.winsize
40
- # A terminal that does not know its size (e.g. a pseudo-terminal created without size) reports 0 x 0
41
- (term_rows, term_columns) = DEFAULT_TERMINAL_SIZE unless term_rows&.positive? && term_columns&.positive?
42
- term_rows = [term_rows - @reserve, 2].max
43
- fit_term_ratio = [term_rows.to_f * @font_ratio / rows.to_f, term_columns.to_f / columns.to_f].min
44
- [(columns * fit_term_ratio).to_i, (rows * fit_term_ratio * @height_ratio / @font_ratio).to_i]
17
+ module Cli
18
+ # Render an image for terminal output.
19
+ # Uses either colored text blocks or the iTerm2 inline-image protocol when available.
20
+ class TerminalImage
21
+ module Backend
22
+ # Base decoder that rescales image data to the current terminal geometry.
23
+ class Base
24
+ # Rows and columns used when the size of the terminal is unknown
25
+ DEFAULT_TERMINAL_SIZE = [24, 80].freeze
26
+ private_constant :DEFAULT_TERMINAL_SIZE
27
+ # @param reserve [Integer] number of terminal rows reserved for non-image output
28
+ # @param double [Boolean] when `true`, render two image rows in one terminal row
29
+ # @param font_ratio [Float] terminal font aspect ratio: height divided by width
30
+ def initialize(reserve:, double:, font_ratio:)
31
+ @reserve = reserve
32
+ @height_ratio = double ? 2.0 : 1.0
33
+ @font_ratio = font_ratio
34
+ end
35
+ Aspera.require_method!(:terminal_pixels)
36
+ # Compute output dimensions that fit inside the terminal while preserving aspect ratio.
37
+ #
38
+ # @param rows [Integer] source image height in pixels
39
+ # @param columns [Integer] source image width in pixels
40
+ # @return [Array<Integer>] scaled width and height for terminal rendering
41
+ def terminal_scaling(rows, columns)
42
+ (term_rows, term_columns) = IO.console&.winsize
43
+ # A terminal that does not know its size (e.g. a pseudo-terminal created without size) reports 0 x 0
44
+ (term_rows, term_columns) = DEFAULT_TERMINAL_SIZE unless term_rows&.positive? && term_columns&.positive?
45
+ term_rows = [term_rows - @reserve, 2].max
46
+ fit_term_ratio = [term_rows.to_f * @font_ratio / rows.to_f, term_columns.to_f / columns.to_f].min
47
+ [(columns * fit_term_ratio).to_i, (rows * fit_term_ratio * @height_ratio / @font_ratio).to_i]
48
+ end
45
49
  end
46
- end
47
50
 
48
- class RMagick < Base
49
- # Initialize the RMagick-backed decoder for a binary image payload.
50
- #
51
- # @param blob [String] encoded image binary content
52
- # @param kwargs [Hash] forwarding options accepted by [`initialize`](lib/aspera/preview/terminal.rb:16)
53
- def initialize(blob, **kwargs)
54
- super(**kwargs)
55
- # Load lazily because this dependency is optional.
56
- require 'rmagick' # https://rmagick.github.io/index.html
57
- @image = Magick::ImageList.new.from_blob(blob)
58
- end
51
+ class RMagick < Base
52
+ # Initialize the RMagick-backed decoder for a binary image payload.
53
+ #
54
+ # @param blob [String] encoded image binary content
55
+ # @param kwargs [Hash] forwarding options accepted by [`initialize`](lib/aspera/cli/terminal_image.rb:16)
56
+ def initialize(blob, **kwargs)
57
+ super(**kwargs)
58
+ # Load lazily because this dependency is optional.
59
+ require 'rmagick' # https://rmagick.github.io/index.html
60
+ @image = Magick::ImageList.new.from_blob(blob)
61
+ end
59
62
 
60
- # Decode the image and return RGB pixels scaled for terminal rendering.
61
- #
62
- # @return [Array<Array<Array<Integer>>>] rows of `[red, green, blue]` pixel triplets
63
- def terminal_pixels
64
- # ImageMagick channel depth is typically 8 or 16 bits.
65
- # See: `magick xc: -format "%q" info:`
66
- shift_for_8_bit = Magick::MAGICKCORE_QUANTUM_DEPTH - 8
67
- # Extract RGB values and normalize them to 8-bit channels for Rainbow.
68
- pixel_colors = []
69
- @image.scale(*terminal_scaling(@image.rows, @image.columns)).each_pixel do |pixel, col, row|
70
- pixel_rgb = [pixel.red, pixel.green, pixel.blue]
71
- pixel_rgb = pixel_rgb.map { |color| color >> shift_for_8_bit } unless shift_for_8_bit.eql?(0)
72
- # Initialize the destination 2D pixel matrix row by row.
73
- pixel_colors[row] ||= []
74
- pixel_colors[row][col] = pixel_rgb
63
+ # Decode the image and return RGB pixels scaled for terminal rendering.
64
+ #
65
+ # @return [Array<Array<Array<Integer>>>] rows of `[red, green, blue]` pixel triplets
66
+ def terminal_pixels
67
+ # ImageMagick channel depth is typically 8 or 16 bits.
68
+ # See: `magick xc: -format "%q" info:`
69
+ shift_for_8_bit = Magick::MAGICKCORE_QUANTUM_DEPTH - 8
70
+ # Extract RGB values and normalize them to 8-bit channels for Rainbow.
71
+ pixel_colors = []
72
+ @image.scale(*terminal_scaling(@image.rows, @image.columns)).each_pixel do |pixel, col, row|
73
+ pixel_rgb = [pixel.red, pixel.green, pixel.blue]
74
+ pixel_rgb = pixel_rgb.map { |color| color >> shift_for_8_bit } unless shift_for_8_bit.eql?(0)
75
+ # Initialize the destination 2D pixel matrix row by row.
76
+ pixel_colors[row] ||= []
77
+ pixel_colors[row][col] = pixel_rgb
78
+ end
79
+ pixel_colors
75
80
  end
76
- pixel_colors
77
81
  end
78
- end
79
82
 
80
- class ChunkyPNG < Base
81
- # Initialize the ChunkyPNG-backed decoder for a PNG payload.
82
- #
83
- # @param blob [String] PNG binary content
84
- # @param kwargs [Hash] forwarding options accepted by [`initialize`](lib/aspera/preview/terminal.rb:16)
85
- def initialize(blob, **kwargs)
86
- super(**kwargs)
87
- require 'chunky_png'
88
- @png = ::ChunkyPNG::Image.from_blob(blob)
89
- end
83
+ class ChunkyPNG < Base
84
+ # Initialize the ChunkyPNG-backed decoder for a PNG payload.
85
+ #
86
+ # @param blob [String] PNG binary content
87
+ # @param kwargs [Hash] forwarding options accepted by [`initialize`](lib/aspera/cli/terminal_image.rb:16)
88
+ def initialize(blob, **kwargs)
89
+ super(**kwargs)
90
+ require 'chunky_png'
91
+ @png = ::ChunkyPNG::Image.from_blob(blob)
92
+ end
90
93
 
91
- # Resize the PNG using nearest-neighbor sampling and return RGB pixel rows.
92
- #
93
- # @return [Array<Array<Array<Integer>>>] rows of `[red, green, blue]` pixel triplets
94
- def terminal_pixels
95
- src_w = @png.width
96
- src_h = @png.height
97
- dst_w, dst_h = terminal_scaling(src_h, src_w)
98
- dst_w = [dst_w, 1].max
99
- dst_h = [dst_h, 1].max
100
- pixel_colors = Array.new(dst_h) { Array.new(dst_w) }
101
- x_ratio = src_w.to_f / dst_w
102
- y_ratio = src_h.to_f / dst_h
103
- dst_h.times do |dy|
104
- sy = (dy * y_ratio).floor
105
- sy = src_h - 1 if sy >= src_h
106
- dst_w.times do |dx|
107
- sx = (dx * x_ratio).floor
108
- sx = src_w - 1 if sx >= src_w
109
- rgba = @png.get_pixel(sx, sy)
110
- # ChunkyPNG stores pixels as 0xRRGGBBAA; extract 8-bit RGB channels.
111
- pixel_colors[dy][dx] = %i[r g b].map { |i| ::ChunkyPNG::Color.send(i, rgba) }
94
+ # Resize the PNG using nearest-neighbor sampling and return RGB pixel rows.
95
+ #
96
+ # @return [Array<Array<Array<Integer>>>] rows of `[red, green, blue]` pixel triplets
97
+ def terminal_pixels
98
+ src_w = @png.width
99
+ src_h = @png.height
100
+ dst_w, dst_h = terminal_scaling(src_h, src_w)
101
+ dst_w = [dst_w, 1].max
102
+ dst_h = [dst_h, 1].max
103
+ pixel_colors = Array.new(dst_h) { Array.new(dst_w) }
104
+ x_ratio = src_w.to_f / dst_w
105
+ y_ratio = src_h.to_f / dst_h
106
+ dst_h.times do |dy|
107
+ sy = (dy * y_ratio).floor
108
+ sy = src_h - 1 if sy >= src_h
109
+ dst_w.times do |dx|
110
+ sx = (dx * x_ratio).floor
111
+ sx = src_w - 1 if sx >= src_w
112
+ rgba = @png.get_pixel(sx, sy)
113
+ # ChunkyPNG stores pixels as 0xRRGGBBAA; extract 8-bit RGB channels.
114
+ pixel_colors[dy][dx] = %i[r g b].map { |i| ::ChunkyPNG::Color.send(i, rgba) }
115
+ end
112
116
  end
117
+ pixel_colors
113
118
  end
114
- pixel_colors
115
119
  end
116
120
  end
117
- end
118
-
119
- # Render an image for terminal output.
120
- # Uses either colored text blocks or the iTerm2 inline-image protocol when available.
121
- class Terminal
122
121
  # Rainbow only supports 8-bit color values.
123
122
  # Environment variables inspected to detect compatible terminal implementations.
124
123
  TERM_ENV_VARS = %w[TERM_PROGRAM LC_TERMINAL].freeze
@@ -78,18 +78,18 @@ module Aspera
78
78
  @resolver.store(@default) unless @default.nil?
79
79
  end
80
80
 
81
- # Value of `@vault:`
81
+ # Value of `@vault:`, declared as read from the configuration: a secret of the vault can be sent only to a URL of the configuration, see `Security#check_credential_host`
82
82
  # @param name [String] `<label>.<field>` or `//<store>/<path>[?<options>][#<field>]`
83
83
  # @return [String] Value of secret
84
84
  def value(name)
85
- return resolver(mandatory: true).resolve(reference_text(name)) if name.start_with?(REFERENCE_PREFIX)
85
+ return Security.instance.add_configured(resolver(mandatory: true).resolve(reference_text(name))) if name.start_with?(REFERENCE_PREFIX)
86
86
  # Label may contain dots (e.g. preset name)
87
87
  label, _, param = name.rpartition('.')
88
88
  Aspera.assert(!label.empty? && !param.empty?, type: BadArgument) { 'vault name shall match <name>.<param>' }
89
89
  info = store(mandatory: true).get(label: label)
90
90
  value = info[param.to_sym]
91
91
  raise "no such entry value: #{param}" if value.nil?
92
- value
92
+ Security.instance.add_configured(value)
93
93
  end
94
94
 
95
95
  # Checks that a reference can be read, without its value
@@ -7,6 +7,6 @@ module Aspera
7
7
  module Cli
8
8
  # For beta add extension : .beta1
9
9
  # For dev version add extension : .pre
10
- VERSION = '4.29.1'
10
+ VERSION = '4.30.0'
11
11
  end
12
12
  end
@@ -47,13 +47,19 @@ module Aspera
47
47
  app_url = url
48
48
  check_only = plugin_name&.to_sym
49
49
  found_apps = []
50
- my_self_plugin_sym = self.class.name.split('::').last.downcase.to_sym
50
+ my_self_plugin_sym = @parent.class.plugin_name.to_sym
51
51
  Plugins::Factory.instance.plugin_list.each do |plugin_name_sym|
52
52
  # No detection for internal plugin
53
53
  next if plugin_name_sym.eql?(my_self_plugin_sym)
54
54
  next if check_only && !check_only.eql?(plugin_name_sym)
55
55
  # Load plugin class
56
- plugin_klass = Plugins::Factory.instance.plugin_class(plugin_name_sym)
56
+ begin
57
+ plugin_klass = Plugins::Factory.instance.plugin_class(plugin_name_sym)
58
+ rescue Cli::Error => e
59
+ # A plugin that cannot be loaded is not a candidate
60
+ Log.log.warn(e.message)
61
+ next
62
+ end
57
63
  # Requires detection method
58
64
  next unless plugin_klass.respond_to?(:detect)
59
65
  detection_info = nil
@@ -76,7 +82,7 @@ module Aspera
76
82
  found_apps.push({product: plugin_name_sym, name: app_name, url: app_url, version: 'unknown'}.merge(detection_info))
77
83
  end
78
84
  Rest::Parameters.instance.spinner_cb.call(action: :success)
79
- Aspera.assert(!found_apps.empty?) { "No known application found at #{app_url}" }
85
+ Aspera.assert(!found_apps.empty?, type: Cli::Error) { "No known application found at #{app_url}" }
80
86
  Aspera.assert(found_apps.all? { |a| a.keys.all?(Symbol) }, 'all app info keys must be symbols')
81
87
  return found_apps
82
88
  end
@@ -26,8 +26,7 @@ module Aspera
26
26
  NO_COV_PATHS = %w[
27
27
  build/
28
28
  tmp/
29
- lib/transferd_pb.rb
30
- lib/transferd_services_pb.rb
29
+ lib/aspera/plugins/transferd/grpc/
31
30
  lib/aspera/secret/store/macos_security.rb
32
31
  lib/aspera/assert.rb
33
32
  ].freeze
@@ -4,23 +4,52 @@
4
4
  # SPDX-License-Identifier: Apache-2.0
5
5
 
6
6
  require_relative 'log'
7
+ require_relative 'secret/hider'
7
8
 
8
9
  module Aspera
9
- # used for logging http
10
+ # used for logging http: debug output of `Net::HTTP` (`set_debug_output`), one log line per line of output
10
11
  class LineLogger
12
+ # Data sent (`<-`) or received (`->`): one or several dumped strings (`String#dump`)
13
+ WIRE_DATA = /\A(?<direction><-|->) (?<data>".*")\z/
14
+ # One dumped string
15
+ DUMPED_STRING = /"(?:[^"\\]|\\.)*"/
16
+ private_constant :WIRE_DATA, :DUMPED_STRING
17
+
18
+ # @param level [Symbol] Log level
11
19
  def initialize(level)
12
20
  @level = level
13
21
  @buffer = []
14
22
  end
15
23
 
24
+ # Called by `Net::HTTP`
25
+ # @param string [String] Part of a line of debug output
16
26
  def <<(string)
17
27
  return if string.nil? || string.empty?
18
- if !string.end_with?("\n")
19
- @buffer.push(string)
20
- return
21
- end
22
- Log.log.send(@level, @buffer.join('') + string.chomp)
28
+ @buffer.push(string)
29
+ return unless string.end_with?("\n")
30
+ line = @buffer.join.chomp
23
31
  @buffer.clear
32
+ Log.log.send(@level) { hide_secrets(line) }
33
+ end
34
+
35
+ private
36
+
37
+ # Hides secrets by key name in the HTTP data of a line, e.g. a token in a JSON body (see `Secret::Hider#hide_serialized_secrets`):
38
+ # the data is dumped, its quotes escaped, so the patterns of the log formatter would not match
39
+ # @param line [String] Line of debug output
40
+ # @return [String] Line with secrets hidden
41
+ def hide_secrets(line)
42
+ match = WIRE_DATA.match(line)
43
+ return line if match.nil? || Secret::Hider.instance.log_secrets
44
+ data = match[:data].gsub(DUMPED_STRING) do |dumped|
45
+ text = dumped.undump
46
+ hidden = Secret::Hider.instance.hide_serialized_secrets(text)
47
+ hidden.eql?(text) ? dumped : hidden.inspect
48
+ rescue StandardError
49
+ # Not text, e.g. binary data
50
+ dumped
51
+ end
52
+ "#{match[:direction]} #{data}"
24
53
  end
25
54
  end
26
55
  end
data/lib/aspera/log.rb CHANGED
@@ -113,8 +113,9 @@ module Aspera
113
113
  return unless instance.logger.send(:"#{level}?")
114
114
  Aspera.assert(object.nil? || block.nil?, 'Use either object, or block, not both')
115
115
  object = yield if block_given?
116
- # Secrets hidden by key name in the structure, whatever the dump format (the log formatter then hides secrets in text)
117
- object = Secret::Hider.instance.hidden_copy(object) unless Secret::Hider.instance.log_secrets
116
+ # Secrets hidden by key name in the structure, whatever the dump format (the log formatter then hides secrets in text),
117
+ # and in structures serialized in strings (e.g. raw HTTP body): the dump escapes their quotes, the formatter would not find them
118
+ object = Secret::Hider.instance.hidden_copy(object, serialized: true) unless Secret::Hider.instance.log_secrets
118
119
  dump_text =
119
120
  case instance.dump_format
120
121
  when :json
@@ -11,6 +11,7 @@ require_relative '../../mime'
11
11
  require_relative '../../rainbow'
12
12
  require 'date'
13
13
  require 'time'
14
+ require 'openssl'
14
15
  using Rainbow
15
16
 
16
17
  module Aspera
@@ -22,10 +23,24 @@ module Aspera
22
23
  # Bearer Token Usage: https://tools.ietf.org/html/rfc6750
23
24
  class Base
24
25
  Aspera.require_method!(:create_token)
26
+ # Parameters of a token request that are credentials, but whose names do not denote a secret (see `Secret::Hider#secret?`)
27
+ CREDENTIAL_PARAMS = %w[assertion code code_verifier].freeze
28
+ # Hexadecimal characters of the digest of the API client in the cache id: enough to separate the few clients of a user on a server
29
+ CLIENT_DIGEST_LENGTH = 8
30
+ private_constant :CREDENTIAL_PARAMS, :CLIENT_DIGEST_LENGTH
25
31
  class << self
26
32
  # @param path [String] Path of an end point
27
33
  # @return [Boolean] `true` if `path` is an absolute URL (`http` or `https`)
28
34
  def absolute_url?(path) = path.match?(%r{\Ahttps?://}i)
35
+
36
+ # A token is given to an API client: another client of the same server and user gets its own token.
37
+ # A digest, of fixed size, keeps the name of the cache file short, whatever the length of the identifier of the client.
38
+ # @param client_id [String, nil] Identifier of the API client
39
+ # @return [String, nil] Digest of the API client in the cache id, `nil`: no client (cache id unchanged)
40
+ def client_id_digest(client_id)
41
+ return if client_id.nil?
42
+ OpenSSL::Digest::SHA256.hexdigest(client_id.to_s)[0, CLIENT_DIGEST_LENGTH]
43
+ end
29
44
  end
30
45
  # @param params [Hash] Parameters for token creation (client_id, client_secret, scope, etc...)
31
46
  # @param path_token [String] API end point to create a token: path from base URL, or absolute URL (`http` or `https`), e.g. on another host
@@ -49,7 +64,7 @@ module Aspera
49
64
  @path_token = path_token
50
65
  @token_field = token_field
51
66
  @use_query = use_query
52
- @token_cache_id = Factory.cache_id(@api.base_url, self.class, *cache_ids, @params[:scope])
67
+ @token_cache_id = Factory.cache_id(@api.base_url, self.class, *cache_ids, self.class.client_id_digest(@params[:client_id]), @params[:scope])
53
68
  end
54
69
 
55
70
  # The OAuth API Object
@@ -92,6 +107,9 @@ module Aspera
92
107
  def create_token_base(include_secret: false, **other_params)
93
108
  Log.log.debug { 'Generating a new token'.bg(:green) }
94
109
  creation_params = base_parameters(include_secret: include_secret, **other_params)
110
+ # Credentials of the request are hidden wherever they appear, e.g. logs of its body or URL
111
+ Secret::Hider.instance.add_secrets_in(creation_params)
112
+ Secret::Hider.instance.add_secret_values(*creation_params.filter_map { |k, v| v if CREDENTIAL_PARAMS.include?(k.to_s) })
95
113
  token_api, subpath = endpoint_api(@path_token)
96
114
  return token_api.create(subpath, nil, query: creation_params, ret: :resp) if @use_query
97
115
  token_api.create(subpath, creation_params, content_type: Mime::WWW, ret: :resp)
@@ -211,18 +211,12 @@ module Aspera
211
211
  end
212
212
 
213
213
  # Create a token creator instance for the specified grant method
214
+ # The class of the grant method is registered by its file (`register_token_creator`): the caller requires it.
214
215
  # @param parameters [Hash] Parameters including :grant_method and creator-specific options
215
216
  # @return [Object] An instance of the registered token creator class
216
217
  def create(**parameters)
217
218
  Aspera.assert_type(parameters, Hash)
218
219
  id = parameters[:grant_method]
219
- unless @token_type_classes.key?(id)
220
- begin
221
- require "aspera/oauth/client/#{id}"
222
- rescue LoadError
223
- # ignored, handled by assert
224
- end
225
- end
226
220
  Aspera.assert(@token_type_classes.key?(id)) { "token grant method unknown: '#{id}'" }
227
221
  create_parameters = parameters.reject { |k, _v| k.eql?(:grant_method) }
228
222
  @token_type_classes[id].new(**create_parameters)
@@ -0,0 +1,178 @@
1
+ $schema: https://json-schema.org/draft/2020-12/schema
2
+ $id: https://github.com/IBM/aspera-cli/tree/main/lib/aspera/plugin.schema.yaml
3
+ title: Plugin bundle manifest
4
+ description: >-
5
+ Manifest `plugin.yaml` of a plugin bundle: folder `<name>/` of a plugin folder, with its commands, API client, transfer agent, schemas.
6
+ Data only: reading it never loads code of the bundle.
7
+ $comment: >-
8
+ Read by `BundleRegistry`. Class and module names are relative to `Aspera::Plugins::<Name>` (`<Name>` is `<name>` in CamelCase),
9
+ file names to the folder of the bundle. `additionalProperties: false` at each level, except in an entry of `extensions`:
10
+ its other fields are defined by the schema of the extension point.
11
+ type: object
12
+ additionalProperties: false
13
+ required:
14
+ - name
15
+ - title
16
+ properties:
17
+ name:
18
+ description: Name of the plugin, same as the folder of the bundle.
19
+ $ref: "#/$defs/Name"
20
+ title:
21
+ description: Name of the product, for listings and the MCP instructions.
22
+ type: string
23
+ minLength: 1
24
+ mcp:
25
+ description: >-
26
+ Section of the instructions of the MCP server for the AI client, about the use of the plugin (e.g. development guides).
27
+ `%{<point>}` is replaced by the list of the bundles that provide an entry of the extension point `<point>`, with their title.
28
+ type: string
29
+ minLength: 1
30
+ depends:
31
+ description: 'Bundles referenced by this one. One missing or unavailable: this bundle is unavailable.'
32
+ type: array
33
+ uniqueItems: true
34
+ items:
35
+ $ref: "#/$defs/Name"
36
+ default: []
37
+ gems:
38
+ description: 'Optional gems required by the code of the bundle: checked when the code is loaded, not when listed.'
39
+ type: array
40
+ uniqueItems: true
41
+ items:
42
+ type: string
43
+ pattern: '^[A-Za-z0-9][A-Za-z0-9._-]*$'
44
+ default: []
45
+ commands:
46
+ description: '`true`: `commands.rb` defines `Commands`, the top level command `<name>`.'
47
+ type: boolean
48
+ default: false
49
+ schemas:
50
+ description: Schemas added to `Schema::Registry`.
51
+ type: array
52
+ items:
53
+ type: object
54
+ additionalProperties: false
55
+ required:
56
+ - key
57
+ - file
58
+ properties:
59
+ key:
60
+ description: Key of the schema in `Schema::Registry`, unique.
61
+ $ref: "#/$defs/Name"
62
+ file:
63
+ description: Schema file (JSON or YAML).
64
+ $ref: "#/$defs/File"
65
+ owned:
66
+ description: '`false`: schema of a vendor API, not used to validate values.'
67
+ type: boolean
68
+ default: false
69
+ source:
70
+ description: Origin of a downloaded schema, used by `rake tools:openapi`.
71
+ type: object
72
+ additionalProperties: false
73
+ required:
74
+ - url
75
+ properties:
76
+ url:
77
+ description: URL of the original file.
78
+ type: string
79
+ pattern: '^https?://'
80
+ version:
81
+ description: Version of the API.
82
+ type: string
83
+ default: []
84
+ extension_points:
85
+ description: Points that other bundles extend.
86
+ type: array
87
+ items:
88
+ type: object
89
+ additionalProperties: false
90
+ required:
91
+ - name
92
+ - schema
93
+ properties:
94
+ name:
95
+ description: Name of the extension point, key in `extensions` of other bundles.
96
+ $ref: "#/$defs/Name"
97
+ schema:
98
+ description: Schema of one entry.
99
+ $ref: "#/$defs/File"
100
+ default: []
101
+ extensions:
102
+ description: Entries for the extension points of other bundles, by name of extension point.
103
+ type: object
104
+ propertyNames:
105
+ $ref: "#/$defs/Name"
106
+ additionalProperties:
107
+ type: array
108
+ items:
109
+ description: Data validated by the schema of the extension point, with the code of the entry.
110
+ type: object
111
+ # Open: the other fields are defined by the schema of the extension point, which checks them
112
+ additionalProperties: true
113
+ required:
114
+ - file
115
+ - class
116
+ properties:
117
+ file:
118
+ description: File of the code.
119
+ $ref: "#/$defs/File"
120
+ class:
121
+ description: Class defined by the file.
122
+ $ref: "#/$defs/Constant"
123
+ default: {}
124
+ mounts:
125
+ description: Modules added to the command tree of another plugin.
126
+ type: array
127
+ items:
128
+ type: object
129
+ additionalProperties: false
130
+ required:
131
+ - target
132
+ - file
133
+ - module
134
+ properties:
135
+ target:
136
+ description: Name of the plugin that includes the module.
137
+ $ref: "#/$defs/Name"
138
+ file:
139
+ description: File of the module.
140
+ $ref: "#/$defs/File"
141
+ module:
142
+ description: Module defined by the file.
143
+ $ref: "#/$defs/Constant"
144
+ default: []
145
+ services:
146
+ description: Objects shared through the context, created on first use.
147
+ type: array
148
+ items:
149
+ type: object
150
+ additionalProperties: false
151
+ required:
152
+ - name
153
+ - file
154
+ - class
155
+ properties:
156
+ name:
157
+ description: Name of the service.
158
+ $ref: "#/$defs/Name"
159
+ file:
160
+ description: File of the class.
161
+ $ref: "#/$defs/File"
162
+ class:
163
+ description: Class defined by the file.
164
+ $ref: "#/$defs/Constant"
165
+ default: []
166
+ $defs:
167
+ Name:
168
+ description: Lower case letters, digits and underscores, starting with a letter.
169
+ type: string
170
+ pattern: '^[a-z][a-z0-9_]*$'
171
+ File:
172
+ description: 'Path relative to the folder of the bundle: no segment starts with a dot (no `..`, no hidden file).'
173
+ type: string
174
+ pattern: '^[^./\\][^/\\]*(/[^./\\][^/\\]*)*$'
175
+ Constant:
176
+ description: Ruby constant path, relative to `Aspera::Plugins::<Name>`.
177
+ type: string
178
+ pattern: '^[A-Z][A-Za-z0-9_]*(::[A-Z][A-Za-z0-9_]*)*$'
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ # SPDX-FileCopyrightText: IBM Corp.
4
+ # SPDX-License-Identifier: Apache-2.0
5
+
6
+ require_relative '../../rest'
7
+
8
+ module Aspera
9
+ module Plugins
10
+ module Alee
11
+ # Aspera License Entitlement Engine API client
12
+ class Api < Rest::Client
13
+ # Same IBM Aspera SaaS domain as AoC
14
+ SAAS_DOMAIN_PROD = 'ibmaspera.com'
15
+
16
+ def initialize(entitlement_id, customer_id, api_domain: SAAS_DOMAIN_PROD, version: 'v1')
17
+ super(
18
+ base_url: "https://api.#{api_domain}/metering/#{version}",
19
+ headers: {'X-Aspera-Entitlement-Authorization' => Rest.basic_authorization(entitlement_id, customer_id)}
20
+ )
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end