Class: Aspera::Cli::Plugins::Cos
- Defined in:
- lib/aspera/cli/plugins/cos.rb
Constant Summary
Constants inherited from Base
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(**_) ⇒ Cos
constructor
A new instance of Cos.
-
#setup_cos_node ⇒ Hash
Build the COS Node API and plugin from CLI options.
Methods inherited from Base
#action_for, #add_manual_header, application_name, #bulk_result, command, command_registry, commands_under, #config, crud_commands, declare_options, define_action_method, #dispatch_child, #dispatch_from_registry, #dispatch_leaf, #entity_create, #entity_delete, entity_display_name, #entity_list, #entity_modify, #entity_res_path, #entity_show, #execute_action, #execute_leaf, file_matcher, #formatter, #generate_help, #http_config, #invoke_action, option, #options, #persistency, #presets, #progress_bar, #query_read_delete, #resolve_argument, root_setup, #transfer, use_options, used_option_sources
Constructor Details
#initialize(**_) ⇒ Cos
Returns a new instance of Cos.
32 33 34 35 |
# File 'lib/aspera/cli/plugins/cos.rb', line 32 def initialize(**_) super . end |
Instance Method Details
#setup_cos_node ⇒ Hash
Build the COS Node API and plugin from CLI options.
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/aspera/cli/plugins/cos.rb', line 39 def setup_cos_node(**) # get service credentials, Hash, e.g. @json:@file:... service_credentials = .get_option(:service_credentials) cos_node_params = { auth_url: .get_option(:identity, mandatory: true), bucket: .get_option(:bucket, mandatory: true), endpoint: .get_option(:endpoint) } if service_credentials.nil? Aspera.assert(!cos_node_params[:endpoint].nil?, 'endpoint required when service credentials not provided', type: Cli::BadArgument) cos_node_params[:api_key] = .get_option(:apikey, mandatory: true) cos_node_params[:instance_id] = .get_option(:crn, mandatory: true) else Aspera.assert(cos_node_params[:endpoint].nil?, 'endpoint not allowed when service credentials provided', type: Cli::BadArgument) cos_node_params.merge!(Api::CosNode.parameters_from_svc_credentials(service_credentials, .get_option(:region, mandatory: true))) end api_node = Api::CosNode.new(**cos_node_params) {node_plugin: Node.new(context: context, api: api_node)} end |