aspera-cli 4.25.2 → 4.25.4

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.
data/CONTRIBUTING.md CHANGED
@@ -2,22 +2,23 @@
2
2
 
3
3
  ## Reporting Issues and Vulnerabilities
4
4
 
5
- If you encounter a problem or a security vulnerability, please report it on [GitHub Issues](https://github.com/IBM/aspera-cli/issues).
5
+ If you encounter a bug or a security vulnerability, please report it via [GitHub Issues](https://github.com/IBM/aspera-cli/issues).
6
6
 
7
- Before submitting a new issue:
7
+ Before submitting a new report:
8
8
 
9
- - Search existing issues to see if your problem has already been reported or resolved.
9
+ - **Search existing issues** to determine if the problem has already been documented or resolved.
10
10
 
11
- To help us assist you efficiently, include the following in your report:
11
+ To help us diagnose and resolve the issue efficiently, please include the following in your report:
12
12
 
13
- - The version of `ascli` you are using:
13
+ - The `ascli` version you are using:
14
14
 
15
15
  ```bash
16
- ascli version
16
+ ascli -v
17
17
  ```
18
18
 
19
- - Confirmation that you are using the latest version (update it if needed).
20
- - Your Ruby version information:
19
+ - **Update confirmation**: Verify that you are running the latest version.
20
+
21
+ - **Your Ruby environment details**:
21
22
 
22
23
  ```bash
23
24
  ruby -v
@@ -29,7 +30,7 @@ We welcome contributions to improve the `aspera-cli` project!
29
30
 
30
31
  ### Getting Started
31
32
 
32
- Clone the repository and navigate to the project's root directory:
33
+ Clone the repository to initialize the development environment:
33
34
 
34
35
  ```bash
35
36
  git clone https://github.com/IBM/aspera-cli.git
@@ -38,55 +39,55 @@ bundle install
38
39
  bundle exec rake -T
39
40
  ```
40
41
 
41
- For testing instructions, refer to [Running Tests](#running-tests).
42
+ For detailed testing instructions, please refer to [Running Tests](#running-tests).
42
43
 
43
44
  ### How to Contribute
44
45
 
45
- To submit a contribution:
46
+ To submit a contribution, follow these steps:
46
47
 
47
48
  1. **Fork** the repository on GitHub.
48
49
 
49
- 1. **Create a feature branch** for your changes.
50
+ 1. **Create a feature branch** specifically for your changes.
50
51
 
51
52
  1. **Implement** your feature or bug fix.
52
53
 
53
54
  1. **Write tests** to ensure your changes are robust and prevent regressions.
54
55
 
55
- 1. Run `rubocop` to ensure your code follows the Ruby style guide.
56
+ 1. **Run** `rubocop` to ensure your code adheres to the Ruby style guide.
56
57
 
57
- 1. Update `CHANGELOG.md` with a summary of your changes.
58
+ 1. **Update** `CHANGELOG.md` with a concise summary of your changes.
58
59
 
59
- 1. Submit a **pull request** with a clear description of your contribution.
60
+ 1. **Submit a pull request** with a detailed description of your work.
60
61
 
61
62
  > [!TIP]
62
- > Make sure your pull request is focused and includes only relevant changes.
63
+ > Keep pull requests focused; include only changes relevant to the specific feature or fix.
63
64
 
64
65
  ## Architecture
65
66
 
66
- The overall architecture of `aspera-cli` is modular and extensible.
67
+ The `aspera-cli` architecture is designed to be modular and extensible.
67
68
 
68
69
  ![Architecture](docs/architecture.png)
69
70
 
70
71
  ### Structure Highlights
71
72
 
72
- - Entry Point:
73
+ - **Entry Point**:
73
74
 
74
- `lib/aspera/cli/main.rb`, CLI startup logic.
75
+ `lib/aspera/cli/main.rb` contains the core CLI startup logic.
75
76
 
76
- - Plugins:
77
+ - **Plugins**:
77
78
 
78
- Located in `lib/aspera/cli/plugins`; plugins extend CLI functionality and encapsulate specific features.
79
+ Located in `lib/aspera/cli/plugins`, these extend CLI functionality and encapsulate specific features.
79
80
 
80
- - Transfer Agents:
81
+ - **Transfer Agents**:
81
82
 
82
- Found in `lib/aspera/agent`, these handle data transfer operations.
83
+ Located in `lib/aspera/agent`, these components manage data transfer operations.
83
84
 
84
- Class diagrams are provided in <docs/uml.png>
85
+ Detailed class diagrams are available in <docs/uml.png>
85
86
 
86
87
  ## Ruby Environment
87
88
 
88
- `aspera-cli` is written in Ruby.
89
- You can install Ruby using any method you prefer (e.g., `rbenv`, `rvm`, system package manager).
89
+ `aspera-cli` is built with Ruby.
90
+ You can manage your Ruby installation using your preferred tool (e.g., `rbenv`, `rvm`, or a system package manager).
90
91
 
91
92
  To start with a clean state and remove all installed gems:
92
93
 
@@ -95,34 +96,34 @@ bundle exec rake tools:clean_gems
95
96
  ```
96
97
 
97
98
  > [!TIP]
98
- > This is especially useful before testing across different Ruby versions or preparing for a release.
99
+ > This is particularly useful when testing across different Ruby versions or preparing for a new release.
99
100
 
100
101
  ## Toolchain
101
102
 
102
- The build system uses Ruby's `rake`.
103
+ The build system is powered by Ruby's `rake`.
103
104
 
104
- ### Environment
105
+ ### Environment Configuration
105
106
 
106
- A few macros and environment variables control certain aspects of the build:
107
+ The following environment variables and macros control specific build behaviors:
107
108
 
108
- | Environment variable | Description |
109
- |-----------------------------|-----------------------------------------------------|
110
- | `ASPERA_CLI_TEST_CONF_URL` | URL for configuration file with secrets for tests. |
111
- | `ASPERA_CLI_DOC_CHECK_LINKS`| Check links still exist during doc generation. |
112
- | `LOG_LEVEL` | Change log level in `rake` tasks. |
113
- | `ENABLE_COVERAGE` | Enable test coverage analysis when set. |
114
- | `SIGNING_KEY` | Path to the signing key used to build the gem file. |
115
- | `SIGNING_KEY_PEM` | PEM of signing key. |
109
+ | Environment variable | Contents | Description |
110
+ |-----------------------------|------------| -------------------------------------------------------------|
111
+ | `ASPERA_CLI_TEST_CONF_URL` | URL | URL for the configuration file containing secrets for tests. |
112
+ | `ASPERA_CLI_DOC_CHECK_LINKS`| yes/no | Validates that links exist during documentation generation. |
113
+ | `LOG_SECRETS` | yes/no | Toggles the logging of secrets in `rake` tasks. |
114
+ | `LOG_LEVEL` | debug, ... | Sets the logging verbosity for `rake` tasks. |
115
+ | `ENABLE_COVERAGE` | set/unset | Enables test coverage analysis when defined. |
116
+ | `SIGNING_KEY` | File path | Path to the signing key used for building the gem file. |
117
+ | `SIGNING_KEY_PEM` | PEM Value | The PEM content of the signing key. |
116
118
 
117
- These can be set either as environment variables or directly on the `rake` command line.
119
+ These values can be set as standard environment variables or passed directly to the `rake` command.
118
120
 
119
- Setting `SIGNING_KEY_PEM` creates file `$HOME/.gem/signing_key.pem` and sets `SIGNING_KEY`.
121
+ Setting `SIGNING_KEY_PEM` automatically generates a file at `$HOME/.gem/signing_key.pem` and sets the `SIGNING_KEY` variable accordingly.
120
122
 
121
123
  > [!NOTE]
122
- > Environment variables `ASPERA_CLI_*` are typically set in the user’s shell profile for development.
123
- > Others are intended for use on the command line.
124
+ > `ASPERA_CLI_*` variables are typically defined in your shell profile for development, while others are intended for ad-hoc command-line use.
124
125
 
125
- To use the CLI directly from the development environment, add this to your shell profile (adapt the real path):
126
+ To run the CLI directly from your source directory, add the following to your shell profile (adjust the path as necessary):
126
127
 
127
128
  ```bash
128
129
  dev_ascli=$HOME/github/aspera-cli
@@ -134,39 +135,46 @@ export RUBYLIB=$dev_ascli/lib:$RUBYLIB
134
135
 
135
136
  Documentation is generated with `pandoc` and `LaTeX`.
136
137
 
137
- The IBM `Plex` font is used; for installation instructions, see [IBM Plex](https://www.ibm.com/plex/).
138
+ The project utilizes the **IBM Plex font**.
139
+ Installation instructions can be found at [IBM Plex](https://www.ibm.com/plex/).
138
140
 
139
- On macOS, to install `lualatex` and all packages:
141
+ On macOS, install `lualatex` and required packages via Homebrew:
140
142
 
141
143
  ```bash
142
144
  brew install texlive
143
145
  ```
144
146
 
145
- If `lualatex` is installed using another method, ensure that the following packages are installed:
147
+ If using an alternative installation method, ensure the following packages are present:
146
148
 
147
149
  ```bash
148
150
  tlmgr update --self
149
151
  tlmgr install fvextra selnolig lualatex-math
150
152
  ```
151
153
 
152
- To check URLs during documentation generation, set the environment variable: `ASPERA_CLI_DOC_CHECK_LINKS=1`.
154
+ - To validate URLs during generation: `ASPERA_CLI_DOC_CHECK_LINKS=1`.
155
+
156
+ - To debug the generation process: `ASPERA_CLI_DOC_DEBUG=debug`.
153
157
 
154
- To debug documentation generation, set the environment variable: `ASPERA_CLI_DOC_DEBUG=debug`.
158
+ - To build the documentation:
159
+
160
+ ```bash
161
+ rake doc:build
162
+ ```
155
163
 
156
164
  ## Test Environment
157
165
 
158
- Refer to <tests/README.md>.
166
+ Detailed testing information can be found in <tests/README.md>.
159
167
 
160
168
  ## Build
161
169
 
162
- The unsigned gem is built with:
170
+ To build an unsigned gem:
163
171
 
164
172
  ```bash
165
173
  bundle install
166
174
  bundle exec rake unsigned
167
175
  ```
168
176
 
169
- If you don't want to install optional gems:
177
+ To exclude optional gems from the installation:
170
178
 
171
179
  ```bash
172
180
  bundle config set without optional
@@ -174,35 +182,34 @@ bundle config set without optional
174
182
 
175
183
  ### Signed gem
176
184
 
177
- A private key is required to generate a signed gem.
178
- Its path must be set using environment variable `SIGNING_KEY`.
179
- The gem is signed with the public certificate found in `certs` and the private key specified by `SIGNING_KEY` (kept secret by the maintainer).
185
+ Generating a signed gem requires a **private key**, specified via the `SIGNING_KEY` environment variable.
186
+ The gem is signed using the public certificate in `certs` and the **private key**.
180
187
 
181
188
  ```bash
182
189
  bundle exec rake SIGNING_KEY=/path/to/vault/gem-private_key.pem
183
190
  ```
184
191
 
185
- Refer to <certs/README.md>.
192
+ For more details, see <certs/README.md>.
186
193
 
187
- ### gRPC stubs for transfer SDK
194
+ ### gRPC stubs for Transfer SDK
188
195
 
189
- Update with:
196
+ To update the stubs:
190
197
 
191
198
  ```bash
192
199
  bundle exec rake tools:grpc
193
200
  ```
194
201
 
195
- It downloads the latest `proto` file and then compiles it.
202
+ This task downloads the latest `.proto` files and compiles them into the Ruby source files included in the repository.
196
203
 
197
204
  ## Container image build
198
205
 
199
- See [Container build](./container/README.md).
206
+ Refer to the [Container build guide](./container/README.md).
200
207
 
201
208
  ## Single executable build
202
209
 
203
- See [Executable build](build/binary/README.md).
210
+ Refer to the [Executable build guide](build/binary/README.md).
204
211
 
205
- To list operations:
212
+ To list related `rake` tasks:
206
213
 
207
214
  ```bash
208
215
  bundle exec rake -T ^binary:
@@ -212,85 +219,89 @@ bundle exec rake -T ^binary:
212
219
 
213
220
  ### Branching Strategy
214
221
 
215
- This project uses a single `main` branch for development. During the development cycle, the version in `lib/aspera/cli/version.rb` uses a `.pre` suffix (e.g., `x.y.z.pre`) to indicate a pre-release state.
222
+ This project maintains a single `main` branch.
223
+ During development, the version in `lib/aspera/cli/version.rb` includes a `.pre` suffix (e.g., `x.y.z.pre`).
224
+
225
+ Contributions are handled as follows:
216
226
 
217
- Feature development and bug fixes can be done either:
227
+ - **Direct commits** to `main`: Permitted for minor changes.
218
228
 
219
- - Directly on `main` for small changes
220
- - Via feature branches with pull requests for larger changes
229
+ - **Feature branches**: Required for significant changes via pull requests.
221
230
 
222
- ### Checklist Before a New Release
231
+ ### Pre-Release Checklist
223
232
 
224
- When preparing for a new release, do the following:
233
+ Before a new release, ensure the following:
225
234
 
226
- - Run the test suite:
235
+ - **Pass all tests**:
227
236
 
228
237
  ```bash
229
238
  bundle exec rake test:run
230
239
  ```
231
240
 
232
- - Verify that the container builds successfully (using the beta version):
241
+ - **Verify container builds** (using the local gem):
233
242
 
234
243
  ```bash
235
- bundle exec rake container:build
244
+ bundle exec rake container:build'[local]'
236
245
  bundle exec rake container:test
237
246
  ```
238
247
 
239
248
  ### Automated Release Process
240
249
 
241
- Releases are triggered via the GitHub Actions UI using the **Release** workflow (`.github/workflows/release.yml`).
250
+ Releases are managed through the GitHub Actions UI via the **New Release on GitHub** workflow (`.github/workflows/release.yml`).
251
+
252
+ 1. Navigate to **Actions** > **New Release on GitHub**
253
+ 2. Select **Run workflow**
254
+ 3. (Optionally) Specify:
255
+ - **Release version**: Defaults to the current `version.rb` value (minus the `.pre` suffix).
242
256
 
243
- To create a release:
257
+ e.g. current `a.b.c.pre` &rarr; `a.b.c`.
258
+ - **Next development version**: Defaults to an incremented minor version with the `.pre` suffix.
244
259
 
245
- 1. Navigate to **Actions** > **Release** in the GitHub repository
246
- 2. Click **Run workflow**
247
- 3. Optionally specify:
248
- - **Release version**: The version to release. If left empty, uses the current version from `version.rb` without the `.pre` suffix.
249
- - **Next development version**: The next version to prepare for. If left empty, auto-increments the minor version. The `.pre` suffix is added automatically.
260
+ e.g. release `a.b.c` &rarr; `a.(b+1).0.pre`.
250
261
  4. Click **Run workflow**
251
262
 
252
- The workflow automatically:
263
+ The automated workflow performs the following:
253
264
 
254
- 1. Updates `version.rb` with the release version
255
- 2. Rebuilds documentation (PDF manual, README)
265
+ 1. Updates `version.rb` to the release version
266
+ 2. Rebuilds all documentation (PDF and Markdown)
256
267
  3. Commits the changes
257
268
  4. Creates and pushes the release tag
258
269
  5. Triggers the `deploy` workflow to publish to [rubygems.org](https://rubygems.org/gems/aspera-cli)
259
- 6. Updates `version.rb` to the next development version with `.pre` suffix
260
- 7. Commits and pushes the version bump
270
+ 6. Increments `version.rb` to the next development version.
271
+ 7. Commits and pushes the version bump to `main`.
261
272
 
262
273
  ### Manual Release Process (Alternative)
263
274
 
264
- If needed, releases can still be done manually:
275
+ If necessary, you can mirror the automated process manually:
265
276
 
266
277
  - Update the version in `lib/aspera/cli/version.rb` (remove `.pre` suffix)
267
278
 
268
- - Build the PDF manual in `pkg`:
279
+ - Build the PDF manual:
269
280
 
270
281
  ```shell
271
282
  bundle exec rake doc:build
272
283
  ```
273
284
 
274
- - Build the signed `.gem` in `pkg`:
285
+ - Build the signed gem:
275
286
 
276
287
  ```shell
277
288
  bundle exec rake SIGNING_KEY=/path/to/vault/gem-private_key.pem
278
289
  ```
279
290
 
280
- - Create the release version tag and push it to GitHub:
291
+ - Tag the release and push to GitHub:
281
292
 
282
293
  ```shell
283
294
  bundle exec rake release_tag
284
295
  ```
285
296
 
286
- This will trigger the action `.github/workflows/deploy.yml`, which builds the gem file and pushes it to RubyGems.
297
+ This triggers the `.github/workflows/deploy.yml` action to publish to RubyGems.
287
298
 
288
- - After release, update `version.rb` to the next development version with `.pre` suffix
299
+ - Update `version.rb` to the next `.pre` development version.
289
300
 
290
301
  ## Future Improvements
291
302
 
292
- - Replace custom REST and OAuth classes with standard Ruby gems ?
293
- - <https://github.com/rest-client/rest-client>
294
- - <https://github.com/oauth-xx/oauth2>
295
- - Use the `thor` gem <http://whatisthor.com/> (or other standard Ruby CLI manager)
296
- - Look at <https://github.com/phusion/traveling-ruby>
303
+ - Evaluate replacing custom REST and OAuth implementations with standard gems:
304
+ - [rest-client](https://github.com/rest-client/rest-client)
305
+ - [oauth2](https://github.com/oauth-xx/oauth2)
306
+ - Integrate `thor` <http://whatisthor.com/> or another standard Ruby CLI framework.
307
+ - Explore [Traveling Ruby](https://github.com/phusion/traveling-ruby) for distribution.
data/README.md CHANGED
@@ -9,17 +9,20 @@
9
9
  Use it from the terminal or in scripts to:
10
10
 
11
11
  - Drive **Aspera on Cloud**, **Faspex**, **Shares**, **Node**, **Console**, **Orchestrator**, and **High-Speed Transfer Server**
12
- - Call REST APIs and run high-speed transfers (FASP)
12
+ - Call REST APIs and run high-speed transfers (**FASP**)
13
13
  - Automate workflows with config, presets, and scripting
14
14
 
15
15
  ## Documentation
16
16
 
17
+ Choose what best suits you:
18
+
17
19
  | Resource | Link |
18
- |----------|------|
20
+ | -------- | ---- |
19
21
  | **Online manual** | [docs/README.md](docs/README.md) |
20
22
  | **PDF manual** | In [releases](https://github.com/IBM/aspera-cli/releases) |
21
23
  | **RubyGems** | [rubygems.org/gems/aspera-cli](https://rubygems.org/gems/aspera-cli) |
22
24
  | **RubyDoc** | [rubydoc.info/gems/aspera-cli](https://www.rubydoc.info/gems/aspera-cli) |
25
+ | **Docsify** | [online](https://docsify-this.net/?basePath=https://raw.githubusercontent.com/IBM/aspera-cli/main/docs&homepage=README.md&sidebar=true&browser-tab-title=Aspera%20CLI%20Manual&hide-credits=true&maxLevel=4&externalLinkTarget=_blank&image-captions=true&dark-mode=auto) |
23
26
 
24
27
  ## Install
25
28
 
@@ -30,7 +33,7 @@ gem install aspera-cli
30
33
  ascli config transferd install
31
34
  ```
32
35
 
33
- The second command installs the FASP transfer engine (`ascp`).
36
+ The second command installs the **FASP** transfer engine (`ascp`).
34
37
  For other install methods (single executable, Docker, Chocolatey, Homebrew), see the [user manual](docs/README.md#installation).
35
38
 
36
39
  **Quick check:**
@@ -142,11 +142,13 @@ module Aspera
142
142
  }
143
143
  end
144
144
 
145
- # Call block with same query using paging and response information.
146
- # Block must return an Array with data and http response
147
- # @return [Hash] {items: , total: }
148
- def call_paging(query: nil, formatter: nil)
149
- query = {} if query.nil?
145
+ # Call `block` with same query using paging and response information.
146
+ # Block must return a 2 element `Array` with data and http response
147
+ # @param query [Hash] Additionnal query parameters
148
+ # @return [Hash] Items and total number of items
149
+ # @option return [Array<Hash>] :items The list of items
150
+ # @option return [Integer] :total The total number of items
151
+ def call_paging(query: {})
150
152
  Aspera.assert_type(query, Hash){'query'}
151
153
  Aspera.assert(block_given?)
152
154
  # set default large page if user does not specify own parameters. AoC Caps to 1000 anyway
@@ -174,9 +176,9 @@ module Aspera
174
176
  break if !max_items.nil? && item_list.count >= max_items
175
177
  break if !max_pages.nil? && page_count >= max_pages
176
178
  break if total_count&.<=(item_list.count)
177
- formatter&.long_operation_running("#{item_list.count} / #{total_count}") unless total_count.eql?(item_list.count.to_s)
179
+ RestParameters.instance.spinner_cb.call("#{item_list.count} / #{total_count}") unless total_count.eql?(item_list.count.to_s)
178
180
  end
179
- formatter&.long_operation_terminated
181
+ RestParameters.instance.spinner_cb.call(action: :success)
180
182
  item_list = item_list[0..max_items - 1] if !max_items.nil? && item_list.count > max_items
181
183
  return {items: item_list, total: total_count}
182
184
  end
@@ -299,10 +301,12 @@ module Aspera
299
301
  )
300
302
  end
301
303
 
302
- # read using the query and paging
304
+ # Read using the query and paging
305
+ # @param subpath [String] Entity path
306
+ # @param query [nil, Hash] Additional query
303
307
  # @return [Hash] {items: , total: }
304
- def read_with_paging(subpath, query = nil, formatter: nil)
305
- return self.class.call_paging(query: query, formatter: formatter) do |paged_query|
308
+ def read_with_paging(subpath, query = nil)
309
+ return self.class.call_paging(query: query) do |paged_query|
306
310
  read(subpath, query: paged_query, ret: :both)
307
311
  end
308
312
  end
@@ -710,7 +714,7 @@ module Aspera
710
714
  # (optional). The name of the folder to be displayed to the destination user.
711
715
  # Use it if its value is different from the "share_as" field.
712
716
  event_creation['link_name'] = app_info[:opt_link_name] unless app_info[:opt_link_name].nil?
713
- create('events', event_creation)
717
+ create('events', event_creation, query: {admin: true})
714
718
  end
715
719
  end
716
720
  end
@@ -10,6 +10,7 @@ module Aspera
10
10
  class CosNode < Node
11
11
  IBM_CLOUD_TOKEN_URL = 'https://iam.cloud.ibm.com/identity'
12
12
  TOKEN_FIELD = 'delegated_refresh_token'
13
+ FASP_INFO_KEYS = %w[ATSEndpoint AccessKey].freeze
13
14
  class << self
14
15
  def parameters_from_svc_credentials(service_credentials, bucket_region)
15
16
  # check necessary contents
@@ -60,6 +61,9 @@ module Aspera
60
61
  ).body
61
62
  ats_info = XmlSimple.xml_in(xml_result_text, {'ForceArray' => false})
62
63
  Log.dump(:ats_info, ats_info)
64
+ Aspera.assert_hash_all(ats_info, String, nil){'ats_info'}
65
+ Aspera.assert((FASP_INFO_KEYS - ats_info.keys).empty?){'ats_info missing required keys'}
66
+ Aspera.assert_hash_all(ats_info['AccessKey'], String, String){'ats_info'}
63
67
  @storage_credentials = {
64
68
  'type' => 'token',
65
69
  'token' => {TOKEN_FIELD => nil}
@@ -60,25 +60,38 @@ module Aspera
60
60
  PATH_AUTH = 'auth'
61
61
  PATH_API_V5 = 'api/v5'
62
62
  PATH_HEALTH = 'configuration/ping'
63
- private_constant :PATH_API_V5,
64
- :PATH_HEALTH,
65
- :PATH_AUTH
63
+ private_constant :PATH_AUTH,
64
+ :PATH_API_V5,
65
+ :PATH_HEALTH
66
66
  RECIPIENT_TYPES = %w[user workgroup external_user distribution_list shared_inbox].freeze
67
67
  PACKAGE_TERMINATED = %w[completed failed].freeze
68
68
  # list of supported mailbox types (to list packages)
69
- API_LIST_MAILBOX_TYPES = %w[inbox inbox_history inbox_all inbox_all_history outbox outbox_history pending pending_history all].freeze
69
+ SENT_MAILBOX_TYPES = %w[outbox outbox_history].freeze
70
+ API_LIST_MAILBOX_TYPES = (%w[inbox inbox_history inbox_all inbox_all_history pending pending_history all] + SENT_MAILBOX_TYPES).freeze
70
71
  # PACKAGE_SEND_FROM_REMOTE_SOURCE = 'remote_source'
71
72
  # Faspex API v5: get transfer spec for connect
72
73
  TRANSFER_CONNECT = 'connect'
73
74
  ADMIN_RESOURCES = %i[
74
- accounts distribution_lists contacts jobs workgroups shared_inboxes nodes oauth_clients registrations saml_configs
75
- metadata_profiles email_notifications alternate_addresses webhooks
75
+ accounts
76
+ distribution_lists
77
+ contacts
78
+ jobs
79
+ workgroups
80
+ shared_inboxes
81
+ nodes
82
+ oauth_clients
83
+ registrations
84
+ saml_configs
85
+ metadata_profiles
86
+ email_notifications
87
+ alternate_addresses
88
+ webhooks
76
89
  ].freeze
77
90
  # states for jobs not in final state
78
91
  JOB_RUNNING = %w[queued working].freeze
79
92
  PATH_STANDARD_ROOT = '/aspera/faspex'
80
93
  PATH_API_DETECT = "#{PATH_API_V5}/#{PATH_HEALTH}"
81
- HEADER_ITERATION_TOKEN = 'X-Aspera-Next-Iteration-Token'
94
+ HEADER_X_NEXT_ITER_TOKEN = 'X-Aspera-Next-Iteration-Token'
82
95
  HEADER_FASPEX_VERSION = 'X-IBM-Aspera'
83
96
  EMAIL_NOTIF_LIST = %w[
84
97
  welcome_email
@@ -114,9 +127,24 @@ module Aspera
114
127
  def public_link?(url)
115
128
  url.include?('?context=')
116
129
  end
130
+
131
+ # Depending on box, the package files are either: `received` or `sent`
132
+ # @return [:sent, :received] the type of mailbox
133
+ def box_type(box)
134
+ SENT_MAILBOX_TYPES.include?(box) || box == 'ALL' ? :sent : :received
135
+ end
117
136
  end
118
137
  attr_reader :pub_link_context
119
138
 
139
+ # @param url Faspex URL, can be a public link
140
+ # @param auth Authentication method: :boot (token in header), :web (open browser), :jwt (client_id + private key), :public_link (context in URL)
141
+ # @param password For :boot auth, the token copied directly from browser in developer mode
142
+ # @param client_id For :web and :jwt auth, the client_id of web UI application
143
+ # @param client_secret For :web auth, the client_secret of web UI application (not needed for :jwt)
144
+ # @param redirect_uri For :web auth, the redirect_uri of web UI application (must be the same as in application configuration)
145
+ # @param username For :jwt auth, the username of the user to impersonate
146
+ # @param private_key For :jwt auth, the private key to sign JWT token
147
+ # @param passphrase For :jwt auth, the passphrase of the private key
120
148
  def initialize(
121
149
  url:,
122
150
  auth:,