Skip to content

Commit c1fdcbc

Browse files
#256 New sub command in shared_folder : admin workspace shared_folder <workspace ID> node <shared folder ID>, shortcut to node operations directly from the shared folder.
Signed-off-by: Laurent Martin <laurent.martin.l@gmail.com>
1 parent 10bdeee commit c1fdcbc

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ Released: [Place date of release here]
88

99
### New Features
1010

11+
* `aoc`: New sub command in `shared_folder` : `admin workspace shared_folder <workspace ID> node <shared folder ID>`, shortcut to node operations directly from the shared folder.
12+
1113
### Issues Fixed
1214

1315
### Breaking Changes

lib/aspera/cli/plugins/aoc.rb

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -503,12 +503,18 @@ def execute_resource_action(resource_type)
503503
query = options.get_option(:query) || Api::AoC.workspace_access(res_id).merge({'admin' => true})
504504
shared_folders = aoc_api.read_with_paging("#{resource_instance_path}/permissions", query)[:items]
505505
# inside a workspace
506-
command_shared = options.get_next_command(%i[list member])
506+
command_shared = options.get_next_command(%i[list node member])
507507
case command_shared
508508
when :list
509509
return Main.result_object_list(shared_folders, fields: %w[id node_name node_id file_id file.path tags.aspera.files.workspace.share_as])
510+
when :node
511+
shared_folder_id = options.instance_identifier(description: 'Shared folder ID')
512+
shared_folder = shared_folders.find{ |i| i['id'].eql?(shared_folder_id)}
513+
Aspera.assert(shared_folder)
514+
command_repo = options.get_next_command(FILES_COMMANDS)
515+
return execute_nodegen4_command(command_repo, shared_folder['node_id'], file_id: shared_folder['file_id'], scope: Api::Node::Scope::ADMIN)
510516
when :member
511-
shared_folder_id = options.instance_identifier
517+
shared_folder_id = options.instance_identifier(description: 'Shared folder ID')
512518
shared_folder = shared_folders.find{ |i| i['id'].eql?(shared_folder_id)}
513519
Aspera.assert(shared_folder)
514520
command_shared_member = options.get_next_command(%i[list])

0 commit comments

Comments
 (0)