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
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
openapi: 3.1.0
|
|
2
|
+
info:
|
|
3
|
+
title: Options of bundle faspex5
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
description: Schema definitions of the options of bundle `faspex5`
|
|
6
|
+
license:
|
|
7
|
+
name: Apache-2.0
|
|
8
|
+
identifier: Apache-2.0
|
|
9
|
+
paths: {}
|
|
10
|
+
components:
|
|
11
|
+
schemas:
|
|
12
|
+
Faspex4PostProcOptions:
|
|
13
|
+
description: >-
|
|
14
|
+
Configuration for the Faspex 4-style post-processing webhook receiver (`faspex5 postprocessing`).
|
|
15
|
+
The command starts a local HTTP(S) server that Faspex 5 calls after each package upload.
|
|
16
|
+
It maps the URL path to a script under `script_folder` and executes it with the values of the
|
|
17
|
+
webhook JSON body whose key starts with `faspex_` as environment variables.
|
|
18
|
+
By default the server binds to loopback; use a routable address only when Faspex containers
|
|
19
|
+
must reach the host: then `secret_token` or `allowed_ips` is required.
|
|
20
|
+
allOf:
|
|
21
|
+
# Schema of the framework, copied when this file is read: see `Schema::Registry`
|
|
22
|
+
- $ref: "opts:#/components/schemas/WebServerOptions"
|
|
23
|
+
- type: object
|
|
24
|
+
additionalProperties: false
|
|
25
|
+
properties:
|
|
26
|
+
# Listed solely to allow them under additionalProperties: false (defined in WebServerOptions).
|
|
27
|
+
url: {}
|
|
28
|
+
cert: {}
|
|
29
|
+
key: {}
|
|
30
|
+
chain: {}
|
|
31
|
+
script_folder:
|
|
32
|
+
type: string
|
|
33
|
+
x-cli-complete: folder
|
|
34
|
+
description: >-
|
|
35
|
+
Folder containing the post-processing scripts.
|
|
36
|
+
The URL path (after the base path) is appended to this folder to locate the script to execute.
|
|
37
|
+
default: "."
|
|
38
|
+
examples:
|
|
39
|
+
- /opt/faspex/scripts
|
|
40
|
+
fail_on_error:
|
|
41
|
+
type: boolean
|
|
42
|
+
description: >-
|
|
43
|
+
When `true`, return HTTP 500 if the script exits with a non-zero status code.
|
|
44
|
+
When `false` (default), the exit code is reported in the response body but HTTP 200 is returned.
|
|
45
|
+
default: false
|
|
46
|
+
timeout_seconds:
|
|
47
|
+
type: integer
|
|
48
|
+
minimum: 1
|
|
49
|
+
description: >-
|
|
50
|
+
Maximum time in seconds to wait for the script to complete before killing it.
|
|
51
|
+
default: 60
|
|
52
|
+
secret_token:
|
|
53
|
+
type: string
|
|
54
|
+
minLength: 1
|
|
55
|
+
description: >-
|
|
56
|
+
Shared secret for webhook authentication.
|
|
57
|
+
When set, every incoming request must include `?token=<value>` in the URL;
|
|
58
|
+
requests without the correct token are rejected with HTTP 401.
|
|
59
|
+
Configure the Faspex webhook URL as `http://host:port/path/script.sh?token=<value>`.
|
|
60
|
+
This parameter or `allowed_ips` is required when `url` is not a local address.
|
|
61
|
+
Generate it with `openssl rand -hex 32`: a weak token is refused (see `secret_token_min_bits`).
|
|
62
|
+
secret_token_min_bits:
|
|
63
|
+
type: integer
|
|
64
|
+
minimum: 0
|
|
65
|
+
default: 80
|
|
66
|
+
description: >-
|
|
67
|
+
Minimum estimated strength of `secret_token`, in bits (log2 of the number of guesses to find it).
|
|
68
|
+
The strength is estimated with gem `zxcvbn` if installed, else with a built-in estimate
|
|
69
|
+
that detects repeats, sequences, keyboard rows, words and years.
|
|
70
|
+
`0` disables the check.
|
|
71
|
+
A random token of 32 bytes (`openssl rand -hex 32`) is far above the default.
|
|
72
|
+
allowed_ips:
|
|
73
|
+
description: >-
|
|
74
|
+
IP address or network (CIDR, e.g. `10.89.0.0/24`), or list of them, allowed to call the listener.
|
|
75
|
+
Requests from any other source IP are rejected with HTTP 403.
|
|
76
|
+
When not set, no IP restriction is applied.
|
|
77
|
+
This parameter or `secret_token` is required when `url` is not a local address.
|
|
78
|
+
oneOf:
|
|
79
|
+
- type: string
|
|
80
|
+
examples:
|
|
81
|
+
- "192.168.1.10"
|
|
82
|
+
- type: array
|
|
83
|
+
items:
|
|
84
|
+
type: string
|
|
85
|
+
examples:
|
|
86
|
+
- - "192.168.1.10"
|
|
87
|
+
- "10.89.0.0/24"
|
|
@@ -5,12 +5,16 @@
|
|
|
5
5
|
|
|
6
6
|
require_relative '../../rest'
|
|
7
7
|
require_relative '../../nagios'
|
|
8
|
-
require_relative '
|
|
8
|
+
require_relative '../../oauth/client/jwt'
|
|
9
|
+
require_relative '../../cli/plugins/basic_auth'
|
|
9
10
|
|
|
10
11
|
module Aspera
|
|
11
|
-
module
|
|
12
|
-
module
|
|
13
|
-
class
|
|
12
|
+
module Plugins
|
|
13
|
+
module Faspio
|
|
14
|
+
class Commands < Cli::Plugins::Base
|
|
15
|
+
include Cli::Plugins::BasicAuth
|
|
16
|
+
|
|
17
|
+
API_SCHEMA = 'faspio'
|
|
14
18
|
application_name 'faspio Gateway'
|
|
15
19
|
|
|
16
20
|
class << self
|
|
@@ -69,7 +73,7 @@ module Aspera
|
|
|
69
73
|
api: :build_api,
|
|
70
74
|
operations: %i[create list show delete],
|
|
71
75
|
lookup: %w[name],
|
|
72
|
-
body_component:
|
|
76
|
+
body_component: API_SCHEMA
|
|
73
77
|
end
|
|
74
78
|
|
|
75
79
|
option :auth, description: 'Type of authentication', allowed: %i[basic jwt none]
|
|
@@ -121,11 +125,11 @@ module Aspera
|
|
|
121
125
|
rescue StandardError => e
|
|
122
126
|
nagios.add_critical('api', e.to_s)
|
|
123
127
|
end
|
|
124
|
-
Result::ObjectList.new(nagios.status_list)
|
|
128
|
+
Cli::Result::ObjectList.new(nagios.status_list)
|
|
125
129
|
end
|
|
126
130
|
|
|
127
131
|
def action_metrics(**)
|
|
128
|
-
Result::Text.new(build_api.read('metrics', headers: {'Accept' => 'text/plain'}))
|
|
132
|
+
Cli::Result::Text.new(build_api.read('metrics', headers: {'Accept' => 'text/plain'}))
|
|
129
133
|
end
|
|
130
134
|
end
|
|
131
135
|
end
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
name: faspio
|
|
2
|
+
title: IBM Aspera faspio Gateway
|
|
3
|
+
commands: true
|
|
4
|
+
schemas:
|
|
5
|
+
- key: faspio
|
|
6
|
+
file: schemas/IBM Aspera faspio Gateway API-1.0.0-enhanced.yaml
|
|
7
|
+
source:
|
|
8
|
+
url: https://raw.githubusercontent.com/laurent-martin/aspera-api-examples/refs/heads/main/openapi/IBM%20Aspera%20faspio%20Gateway%20API-1.0.0-enhanced.yaml
|
data/lib/aspera/{schema → plugins/faspio/schemas}/IBM Aspera faspio Gateway API-1.0.0-enhanced.yaml
RENAMED
|
@@ -709,7 +709,8 @@ components:
|
|
|
709
709
|
description: |
|
|
710
710
|
Protocol accepted on the local side. Typically `tcp` or `udp`.
|
|
711
711
|
example: tcp
|
|
712
|
-
|
|
712
|
+
allOf:
|
|
713
|
+
- $ref: '#/components/schemas/Protocol'
|
|
713
714
|
tls_enabled:
|
|
714
715
|
description: |
|
|
715
716
|
When `true`, the local abutment expects TLS-wrapped connections.
|
|
@@ -754,7 +755,8 @@ components:
|
|
|
754
755
|
description: |
|
|
755
756
|
Protocol used to connect to the remote peer. Typically `fasp` for acceleration.
|
|
756
757
|
example: fasp
|
|
757
|
-
|
|
758
|
+
allOf:
|
|
759
|
+
- $ref: '#/components/schemas/Protocol'
|
|
758
760
|
tls_enabled:
|
|
759
761
|
description: |
|
|
760
762
|
When `true`, the outgoing connection to the remote peer is TLS-wrapped.
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# SPDX-FileCopyrightText: IBM Corp.
|
|
4
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
|
|
6
|
+
require_relative '../../agent/base'
|
|
7
|
+
require_relative 'api'
|
|
8
|
+
require_relative '../../log'
|
|
9
|
+
require_relative '../../assert'
|
|
10
|
+
require 'securerandom'
|
|
11
|
+
|
|
12
|
+
module Aspera
|
|
13
|
+
module Plugins
|
|
14
|
+
module Httpgw
|
|
15
|
+
class Agent < Aspera::Agent::Base
|
|
16
|
+
class << self
|
|
17
|
+
# Reads and writes the local files through this process: refused at level `high` (see `Cli::Security`).
|
|
18
|
+
def required_security_level(_options) = :medium
|
|
19
|
+
|
|
20
|
+
# Re-query the status of an httpgw transfer that was started in-process.
|
|
21
|
+
# Only works if the same Ruby process is still alive (e.g. MCP mode).
|
|
22
|
+
# agent_params must contain '_agent_ref' pointing to the live Httpgw instance.
|
|
23
|
+
# @param transfer_id [String] job_id returned by last_job_id
|
|
24
|
+
# @param agent_params [Hash] '_agent_ref' is the live agent instance
|
|
25
|
+
# @return [Hash] status hash with at least 'status' key
|
|
26
|
+
def transfer_status(transfer_id, agent_params)
|
|
27
|
+
agent = agent_params['_agent_ref']
|
|
28
|
+
return {'status' => 'unknown', 'note' => 'httpgw agent not available (different process?)'} if agent.nil?
|
|
29
|
+
return {'status' => 'unknown', 'note' => 'no transfer started'} if agent.instance_variable_get(:@transfer_thread).nil?
|
|
30
|
+
if agent.instance_variable_get(:@transfer_thread).alive?
|
|
31
|
+
{'status' => 'running'}
|
|
32
|
+
elsif (err = agent.instance_variable_get(:@transfer_error))
|
|
33
|
+
{'status' => 'failed', 'error' => err.message}
|
|
34
|
+
else
|
|
35
|
+
{'status' => 'completed'}
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# Base options used: `progress`, `url_provider` (when `url` is not given)
|
|
41
|
+
# @param url [String] URL of the HTTP Gateway, else from base option `url_provider`
|
|
42
|
+
# @param api_version [String] Version of the API of the gateway
|
|
43
|
+
# @param upload_chunk_size [Integer] Size in bytes of each upload chunk
|
|
44
|
+
# @param synchronous [Boolean] Wait for acknowledgment after each message
|
|
45
|
+
# @param base_options [Hash] base options (see `Base#initialize`)
|
|
46
|
+
def initialize(
|
|
47
|
+
url: nil,
|
|
48
|
+
api_version: Api::API_V2,
|
|
49
|
+
upload_chunk_size: 64_000,
|
|
50
|
+
synchronous: false,
|
|
51
|
+
**base_options
|
|
52
|
+
)
|
|
53
|
+
super(**base_options)
|
|
54
|
+
if url.nil?
|
|
55
|
+
Aspera.assert(!url_provider.nil?, type: ArgumentError) { 'missing keyword: :url' }
|
|
56
|
+
Log.log.debug('retrieving HTTPGW URL from webapp')
|
|
57
|
+
url = url_provider.call
|
|
58
|
+
end
|
|
59
|
+
@gw_api = Api.new(
|
|
60
|
+
# remove /v1 from end of user-provided GW url: we need the base url only
|
|
61
|
+
url: url,
|
|
62
|
+
api_version: api_version,
|
|
63
|
+
upload_chunk_size: upload_chunk_size,
|
|
64
|
+
synchronous: synchronous,
|
|
65
|
+
notify_cb: ->(*pa, **ka) { notify_progress(*pa, **ka) }
|
|
66
|
+
)
|
|
67
|
+
@last_job_id = nil
|
|
68
|
+
@transfer_thread = nil
|
|
69
|
+
@transfer_error = nil
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
# Start FASP transfer based on transfer spec (hash table).
|
|
73
|
+
# Non-blocking: the actual upload/download runs in a dedicated thread.
|
|
74
|
+
# HTTP download only supports file list.
|
|
75
|
+
# :reek:UnusedParameters token_regenerator
|
|
76
|
+
def start_transfer(transfer_spec, token_regenerator: nil)
|
|
77
|
+
Aspera.assert(!@gw_api.nil?, 'GW URL must be set')
|
|
78
|
+
Aspera.assert_type(transfer_spec['paths'], Array) { 'paths' }
|
|
79
|
+
Aspera.assert_type(transfer_spec['token'], String, type: ParameterError) { 'only token based transfer is supported in GW' }
|
|
80
|
+
Log.dump(:user_spec, transfer_spec)
|
|
81
|
+
transfer_spec['authentication'] ||= 'token'
|
|
82
|
+
@last_job_id = SecureRandom.uuid
|
|
83
|
+
@transfer_error = nil
|
|
84
|
+
@transfer_thread = Thread.new { run_transfer(transfer_spec) }
|
|
85
|
+
@last_job_id
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
# Wait for the transfer thread to complete.
|
|
89
|
+
# @return [Array] list of :success or error
|
|
90
|
+
def wait_for_transfers_completion
|
|
91
|
+
@transfer_thread&.join
|
|
92
|
+
return [@transfer_error || :success]
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
# @return [String, nil] job_id of the last submitted transfer
|
|
96
|
+
attr_reader :last_job_id
|
|
97
|
+
|
|
98
|
+
# @return [String, nil] the job id: for `transfer_status`
|
|
99
|
+
def transfer_id
|
|
100
|
+
last_job_id
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
# @return [Boolean] `true`: the transfer runs in a thread of this process
|
|
104
|
+
def in_process?
|
|
105
|
+
true
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
private
|
|
109
|
+
|
|
110
|
+
# Execute the actual transfer (runs inside the transfer thread).
|
|
111
|
+
def run_transfer(transfer_spec)
|
|
112
|
+
case transfer_spec['direction']
|
|
113
|
+
when Aspera::Transfer::Spec::DIRECTION_SEND
|
|
114
|
+
@gw_api.upload(transfer_spec)
|
|
115
|
+
when Aspera::Transfer::Spec::DIRECTION_RECEIVE
|
|
116
|
+
@gw_api.download(transfer_spec)
|
|
117
|
+
else Aspera.error_unexpected_value(transfer_spec['direction']) { 'direction' }
|
|
118
|
+
end
|
|
119
|
+
rescue => e
|
|
120
|
+
@transfer_error = e
|
|
121
|
+
Log.log.error { "httpgw transfer thread error: #{e}" }
|
|
122
|
+
end
|
|
123
|
+
end
|
|
124
|
+
end
|
|
125
|
+
end
|
|
126
|
+
end
|