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.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +4 -4
- data/CHANGELOG.md +119 -0
- data/CONTRIBUTING.md +8 -1
- data/README.md +2 -0
- data/TODO.md +4 -5
- data/bin/asession +2 -2
- data/docs/README.md +616 -86
- data/docs/test-mcp-with-ai.md +4 -0
- data/lib/aspera/agent/base.rb +62 -6
- data/lib/aspera/agent/factory.rb +127 -20
- data/lib/aspera/ascp/data_repository.rb +71 -0
- data/lib/aspera/ascp/installation.rb +16 -11
- data/lib/aspera/ascp/log_analyzer/lines.rb +4 -4
- data/lib/aspera/ascp/log_analyzer/log_file.rb +5 -3
- data/lib/aspera/ascp/log_analyzer/records.rb +11 -6
- data/lib/aspera/ascp/log_analyzer.rb +43 -18
- data/lib/aspera/ascp/log_locations.rb +2 -2
- data/lib/aspera/assert.rb +8 -0
- data/lib/aspera/bundle_registry.rb +528 -0
- data/lib/aspera/cli/argument.rb +110 -0
- data/lib/aspera/cli/bool_value.rb +41 -0
- data/lib/aspera/cli/bootstrapper.rb +31 -24
- data/lib/aspera/cli/command/mount.rb +53 -0
- data/lib/aspera/cli/command/registry.rb +434 -0
- data/lib/aspera/cli/command.rb +95 -0
- data/lib/aspera/cli/command_line.rb +91 -91
- data/lib/aspera/cli/complete.rb +22 -0
- data/lib/aspera/cli/completion_actions.rb +28 -26
- data/lib/aspera/cli/context.rb +29 -6
- data/lib/aspera/cli/error.rb +39 -0
- data/lib/aspera/cli/extended_value.rb +25 -4
- data/lib/aspera/cli/formatter.rb +8 -8
- data/lib/aspera/cli/hints.rb +17 -52
- data/lib/aspera/cli/http.rb +17 -12
- data/lib/aspera/cli/mailer.rb +7 -24
- data/lib/aspera/cli/mcp/tool.rb +10 -2
- data/lib/aspera/cli/option/declarator.rb +80 -0
- data/lib/aspera/cli/option/registry.rb +74 -0
- data/lib/aspera/cli/option/source.rb +38 -0
- data/lib/aspera/cli/option/type.rb +37 -0
- data/lib/aspera/cli/option/value.rb +376 -0
- data/lib/aspera/cli/option.rb +78 -0
- data/lib/aspera/cli/options.schema.yaml +28 -783
- data/lib/aspera/cli/parser.rb +73 -41
- data/lib/aspera/cli/plugins/base.rb +122 -42
- data/lib/aspera/cli/plugins/basic_auth.rb +13 -2
- data/lib/aspera/cli/plugins/config.rb +101 -167
- data/lib/aspera/cli/plugins/factory.rb +139 -43
- data/lib/aspera/cli/plugins/mcp.rb +61 -54
- data/lib/aspera/cli/plugins/oauth.rb +19 -6
- data/lib/aspera/cli/poll.rb +14 -20
- data/lib/aspera/cli/preset_actions.rb +11 -3
- data/lib/aspera/cli/preset_manager.rb +16 -6
- data/lib/aspera/cli/result.rb +2 -2
- data/lib/aspera/cli/runner.rb +71 -99
- data/lib/aspera/cli/secret_finder.rb +1 -1
- data/lib/aspera/cli/security.rb +102 -4
- data/lib/aspera/{preview/terminal.rb → cli/terminal_image.rb} +93 -94
- data/lib/aspera/cli/vault_manager.rb +3 -3
- data/lib/aspera/cli/version.rb +1 -1
- data/lib/aspera/cli/wizard.rb +9 -3
- data/lib/aspera/coverage.rb +1 -2
- data/lib/aspera/line_logger.rb +35 -6
- data/lib/aspera/log.rb +3 -2
- data/lib/aspera/oauth/client/base.rb +19 -1
- data/lib/aspera/oauth/client/factory.rb +1 -7
- data/lib/aspera/plugin.schema.yaml +178 -0
- data/lib/aspera/plugins/alee/api.rb +25 -0
- data/lib/aspera/{cli/plugins/alee.rb → plugins/alee/commands.rb} +10 -8
- data/lib/aspera/plugins/alee/plugin.yaml +3 -0
- data/lib/aspera/plugins/aoc/admin_resources.rb +148 -0
- data/lib/aspera/plugins/aoc/api.rb +783 -0
- data/lib/aspera/{cli/plugins/aoc.rb → plugins/aoc/commands.rb} +404 -330
- data/lib/aspera/plugins/aoc/graphql.rb +45 -0
- data/lib/aspera/plugins/aoc/plugin.yaml +31 -0
- data/lib/aspera/{schema → plugins/aoc/schemas}/IBM Aspera on Cloud API-0.2.6-enhanced.yaml +15042 -7076
- data/lib/aspera/plugins/aoc/schemas/options.yaml +47 -0
- data/lib/aspera/plugins/ats/api.rb +51 -0
- data/lib/aspera/{cli/plugins/ats.rb → plugins/ats/commands.rb} +33 -33
- data/lib/aspera/plugins/ats/plugin.yaml +6 -0
- data/lib/aspera/plugins/connect/agent.rb +199 -0
- data/lib/aspera/plugins/connect/plugin.yaml +11 -0
- data/lib/aspera/plugins/connect/schemas/agent_options.yaml +6 -0
- data/lib/aspera/{cli/plugins/console.rb → plugins/console/commands.rb} +41 -33
- data/lib/aspera/plugins/console/plugin.yaml +8 -0
- data/lib/aspera/plugins/cos/api.rb +114 -0
- data/lib/aspera/{cli/plugins/cos.rb → plugins/cos/commands.rb} +19 -16
- data/lib/aspera/plugins/cos/plugin.yaml +9 -0
- data/lib/aspera/plugins/cos/schemas/options.yaml +30 -0
- data/lib/aspera/plugins/desktop/agent.rb +165 -0
- data/lib/aspera/plugins/desktop/plugin.yaml +11 -0
- data/lib/aspera/plugins/desktop/schemas/agent_options.yaml +6 -0
- data/lib/aspera/plugins/direct/agent.rb +518 -0
- data/lib/aspera/plugins/direct/plugin.yaml +11 -0
- data/lib/aspera/plugins/direct/schemas/agent_options.yaml +86 -0
- data/lib/aspera/plugins/faspex4/gateway_options.rb +18 -0
- data/lib/aspera/plugins/faspex4/gw_servlet.rb +122 -0
- data/lib/aspera/plugins/faspex4/plugin.yaml +7 -0
- data/lib/aspera/plugins/faspex4/schemas/options.yaml +57 -0
- data/lib/aspera/plugins/faspex5/api.rb +269 -0
- data/lib/aspera/{cli/plugins/faspex5.rb → plugins/faspex5/commands.rb} +152 -114
- data/lib/aspera/plugins/faspex5/faspex4_post_proc_servlet.rb +241 -0
- data/lib/aspera/plugins/faspex5/plugin.yaml +14 -0
- data/lib/aspera/{schema → plugins/faspex5/schemas}/IBM Aspera Faspex API-5.0-enhanced.yaml +279 -76
- data/lib/aspera/plugins/faspex5/schemas/options.yaml +87 -0
- data/lib/aspera/{cli/plugins/faspio.rb → plugins/faspio/commands.rb} +11 -7
- data/lib/aspera/plugins/faspio/plugin.yaml +8 -0
- data/lib/aspera/{schema → plugins/faspio/schemas}/IBM Aspera faspio Gateway API-1.0.0-enhanced.yaml +4 -2
- data/lib/aspera/plugins/httpgw/agent.rb +126 -0
- data/lib/aspera/plugins/httpgw/api.rb +411 -0
- data/lib/aspera/{cli/plugins/httpgw.rb → plugins/httpgw/commands.rb} +9 -9
- data/lib/aspera/plugins/httpgw/plugin.yaml +12 -0
- data/lib/aspera/plugins/httpgw/schemas/agent_options.yaml +24 -0
- data/lib/aspera/plugins/node/agent.rb +184 -0
- data/lib/aspera/plugins/node/api.rb +699 -0
- data/lib/aspera/{cli/plugins/node.rb → plugins/node/commands.rb} +166 -141
- data/lib/aspera/plugins/node/emulator.rb +774 -0
- data/lib/aspera/plugins/node/plugin.yaml +20 -0
- data/lib/aspera/plugins/node/schemas/agent_options.yaml +20 -0
- data/lib/aspera/plugins/node/schemas/options.yaml +190 -0
- data/lib/aspera/{cli/plugins/orchestrator.rb → plugins/orchestrator/commands.rb} +139 -110
- data/lib/aspera/plugins/orchestrator/plugin.yaml +34 -0
- data/lib/aspera/{schema → plugins/orchestrator/schemas}/IBM Aspera Orchestrator API-v1-enhanced.yaml +486 -16
- data/lib/aspera/plugins/orchestrator/schemas/options.yaml +143 -0
- data/lib/aspera/plugins/orchestrator/workflow_checker.rb +692 -0
- data/lib/aspera/{cli/plugins/preview.rb → plugins/preview/commands.rb} +53 -51
- data/lib/aspera/plugins/preview/file_types.rb +121 -0
- data/lib/aspera/plugins/preview/generator.rb +350 -0
- data/lib/aspera/plugins/preview/plugin.yaml +12 -0
- data/lib/aspera/{preview/options.schema.yaml → plugins/preview/schemas/options.yaml} +1 -1
- data/lib/aspera/plugins/preview/utils.rb +213 -0
- data/lib/aspera/plugins/server/ascmd.rb +374 -0
- data/lib/aspera/{cli/plugins/server.rb → plugins/server/commands.rb} +48 -32
- data/lib/aspera/plugins/server/plugin.yaml +9 -0
- data/lib/aspera/plugins/server/schemas/options.yaml +30 -0
- data/lib/aspera/{cli/plugins/shares.rb → plugins/shares/commands.rb} +29 -21
- data/lib/aspera/plugins/shares/plugin.yaml +10 -0
- data/lib/aspera/plugins/shares/shares_web.rb +97 -0
- data/lib/aspera/plugins/transferd/agent.rb +258 -0
- data/lib/aspera/plugins/transferd/api.rb +180 -0
- data/lib/aspera/plugins/transferd/client.rb +67 -0
- data/lib/aspera/{cli/plugins/transferd.rb → plugins/transferd/commands.rb} +43 -42
- data/lib/aspera/plugins/transferd/config_commands.rb +38 -0
- data/lib/aspera/plugins/transferd/plugin.yaml +27 -0
- data/lib/aspera/plugins/transferd/product.rb +146 -0
- data/lib/aspera/plugins/transferd/schemas/agent_options.yaml +31 -0
- data/lib/aspera/plugins/transferd/schemas/options.yaml +80 -0
- data/lib/aspera/plugins/transferd/service.rb +617 -0
- data/lib/aspera/plugins/xfer/ascp_actions.rb +131 -0
- data/lib/aspera/plugins/xfer/ascp_logs_actions.rb +198 -0
- data/lib/aspera/plugins/xfer/async_transfer_store.rb +131 -0
- data/lib/aspera/plugins/xfer/config_commands.rb +119 -0
- data/lib/aspera/plugins/xfer/helper.rb +19 -0
- data/lib/aspera/plugins/xfer/plugin.yaml +42 -0
- data/lib/aspera/plugins/xfer/schemas/agent_extension.schema.yaml +26 -0
- data/lib/aspera/plugins/xfer/schemas/options.yaml +125 -0
- data/lib/aspera/plugins/xfer/sync_actions.rb +253 -0
- data/lib/aspera/plugins/xfer/transfer_actions.rb +176 -0
- data/lib/aspera/plugins/xfer/transfer_agent.rb +505 -0
- data/lib/aspera/products/cli_v3.rb +34 -0
- data/lib/aspera/products/connect.rb +1 -1
- data/lib/aspera/products/drive.rb +29 -0
- data/lib/aspera/products/hsts.rb +34 -0
- data/lib/aspera/products/transferd.rb +25 -3
- data/lib/aspera/products.rb +54 -0
- data/lib/aspera/prompt.rb +184 -0
- data/lib/aspera/proxy_auto_config.rb +3 -3
- data/lib/aspera/rest/aspera_errors.rb +4 -38
- data/lib/aspera/rest/error_analyzer.rb +6 -2
- data/lib/aspera/rest/list.rb +4 -5
- data/lib/aspera/schema/reader.rb +15 -0
- data/lib/aspera/schema/registry.rb +239 -45
- data/lib/aspera/schema/validator.rb +63 -17
- data/lib/aspera/sealed_hash.rb +4 -0
- data/lib/aspera/secret/hider.rb +159 -24
- data/lib/aspera/secret/reference.rb +8 -0
- data/lib/aspera/secret/resolver.rb +8 -4
- data/lib/aspera/secret/store/base.rb +10 -9
- data/lib/aspera/secret/store/encrypted_hash.rb +6 -6
- data/lib/aspera/secret/store/hashicorp_vault.rb +3 -3
- data/lib/aspera/secret/store/keeper.rb +2 -2
- data/lib/aspera/secret/store/macos_security.rb +2 -3
- data/lib/aspera/secret/store/one_password_api.rb +2 -2
- data/lib/aspera/secret/store/one_password_cli.rb +3 -3
- data/lib/aspera/secret/store/secret_service.rb +2 -2
- data/lib/aspera/ssl.rb +3 -3
- data/lib/aspera/standard_input.rb +20 -0
- data/lib/aspera/{schema → sync}/async_tables.yaml +1 -1
- data/lib/aspera/sync/database.rb +7 -0
- data/lib/aspera/sync/log_parser.rb +138 -0
- data/lib/aspera/sync/operations.rb +59 -34
- data/lib/aspera/transfer/command_line_builder.rb +248 -0
- data/lib/aspera/transfer/command_line_converter.rb +37 -0
- data/lib/aspera/transfer/faux_file.rb +2 -2
- data/lib/aspera/transfer/parameters.rb +9 -10
- data/lib/aspera/transfer/spec.rb +28 -1
- data/lib/aspera/transfer/spec.schema.yaml +30 -5
- data/lib/aspera/units/decimal.rb +1 -1
- data/lib/aspera/units/timestamp.rb +84 -0
- data/lib/aspera/uri_reader.rb +2 -2
- data/lib/aspera/web_auth/paste.rb +2 -2
- data/lib/aspera/web_server_simple.rb +10 -4
- data.tar.gz.sig +0 -0
- metadata +137 -80
- metadata.gz.sig +0 -0
- data/lib/aspera/agent/connect.rb +0 -188
- data/lib/aspera/agent/desktop.rb +0 -154
- data/lib/aspera/agent/direct.rb +0 -496
- data/lib/aspera/agent/httpgw.rb +0 -100
- data/lib/aspera/agent/node.rb +0 -166
- data/lib/aspera/agent/transferd.rb +0 -341
- data/lib/aspera/api/alee.rb +0 -19
- data/lib/aspera/api/aoc.rb +0 -776
- data/lib/aspera/api/ats.rb +0 -49
- data/lib/aspera/api/cos_node.rb +0 -107
- data/lib/aspera/api/faspex.rb +0 -258
- data/lib/aspera/api/httpgw.rb +0 -409
- data/lib/aspera/api/node.rb +0 -684
- data/lib/aspera/ascmd.rb +0 -248
- data/lib/aspera/cli/ascp_actions.rb +0 -113
- data/lib/aspera/cli/ascp_logs_actions.rb +0 -188
- data/lib/aspera/cli/async_transfer_store.rb +0 -129
- data/lib/aspera/cli/command_registry.rb +0 -371
- data/lib/aspera/cli/command_spec.rb +0 -273
- data/lib/aspera/cli/option_declarator.rb +0 -74
- data/lib/aspera/cli/option_registry.rb +0 -72
- data/lib/aspera/cli/option_types.rb +0 -120
- data/lib/aspera/cli/option_value.rb +0 -345
- data/lib/aspera/cli/prompt.rb +0 -186
- data/lib/aspera/cli/sync_actions.rb +0 -181
- data/lib/aspera/cli/transfer_actions.rb +0 -98
- data/lib/aspera/cli/transfer_agent.rb +0 -348
- data/lib/aspera/command_line_builder.rb +0 -244
- data/lib/aspera/command_line_converter.rb +0 -35
- data/lib/aspera/data_repository.rb +0 -69
- data/lib/aspera/faspex_gw.rb +0 -172
- data/lib/aspera/faspex_postproc.rb +0 -237
- data/lib/aspera/graphql.rb +0 -41
- data/lib/aspera/node_emulator.rb +0 -758
- data/lib/aspera/oauth/client/shares_web.rb +0 -94
- data/lib/aspera/orchestrator_workflow_checker.rb +0 -688
- data/lib/aspera/preview/file_types.rb +0 -119
- data/lib/aspera/preview/generator.rb +0 -345
- data/lib/aspera/preview/utils.rb +0 -211
- data/lib/aspera/products/other.rb +0 -92
- data/lib/aspera/products/transferd_service.rb +0 -610
- /data/lib/aspera/{data → ascp/data}/1 +0 -0
- /data/lib/aspera/{data → ascp/data}/2 +0 -0
- /data/lib/aspera/{data → ascp/data}/3 +0 -0
- /data/lib/aspera/{data → ascp/data}/4 +0 -0
- /data/lib/aspera/{data → ascp/data}/5 +0 -0
- /data/lib/aspera/{data → ascp/data}/6 +0 -0
- /data/lib/aspera/{api → plugins/aoc}/queries/bss_subscription_account.graphql +0 -0
- /data/lib/aspera/{api → plugins/aoc}/queries/bss_subscription_usage.graphql +0 -0
- /data/lib/aspera/{schema → plugins/aoc/schemas}/IBM Aspera on Cloud Automation API-1.0.5-enhanced.yaml +0 -0
- /data/lib/aspera/{schema → plugins/console/schemas}/IBM Aspera Console-enhanced.yaml +0 -0
- /data/lib/aspera/{schema → plugins/node/schemas}/IBM Aspera Node API-4.4.6.yaml +0 -0
- /data/lib/aspera/{preview → plugins/preview}/image_error.png +0 -0
- /data/lib/aspera/{preview → plugins/preview}/video_error.png +0 -0
- /data/lib/aspera/{schema → plugins/shares/schemas}/IBM_Aspera_Shares.yaml +0 -0
- /data/lib/{transferd_pb.rb → aspera/plugins/transferd/grpc/transferd_pb.rb} +0 -0
- /data/lib/{transferd_services_pb.rb → aspera/plugins/transferd/grpc/transferd_services_pb.rb} +0 -0
- /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
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
@
|
|
29
|
-
@
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
#
|
|
41
|
-
(
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
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
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
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
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
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
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
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
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
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
|
data/lib/aspera/cli/version.rb
CHANGED
data/lib/aspera/cli/wizard.rb
CHANGED
|
@@ -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 =
|
|
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
|
-
|
|
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
|
|
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
|
data/lib/aspera/coverage.rb
CHANGED
data/lib/aspera/line_logger.rb
CHANGED
|
@@ -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
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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
|
-
|
|
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
|