Class: DTK::Client::Library
- Inherits:
-
CommandBaseThor
- Object
- Thor
- CommandBaseThor
- DTK::Client::Library
- Defined in:
- lib/commands/thor/library.rb
Constant Summary
Constants inherited from CommandBaseThor
CommandBaseThor::ALT_IDENTIFIER_SEPARATOR, CommandBaseThor::EXTENDED_TIMEOUT, CommandBaseThor::HIDE_FROM_BASE_CONTEXT, CommandBaseThor::TIME_DIFF
Constants included from CommandHelperMixin
Constants included from ReparseMixin
ReparseMixin::YamlDTKMetaFiles
Constants included from Poller
Constants inherited from Thor
Thor::HIDE_FROM_BASE_CONTEXT_HELP
Class Method Summary collapse
Instance Method Summary collapse
- #create(context_params) ⇒ Object
- #delete(context_params) ⇒ Object
- #import_service_module(context_params) ⇒ Object
- #info(context_params) ⇒ Object
- #list(context_params) ⇒ Object
- #list_assemblies(context_params) ⇒ Object
- #list_components(context_params) ⇒ Object
- #list_nodes(context_params) ⇒ Object
Methods inherited from CommandBaseThor
action_on_revalidation_response, basename, create_context_arguments, execute_from_cli, generate_cached_id, get_cached_response, get_identifiers, get_usage_info, #help, #initialize, invalidate_entities, invisible_context_list, list_method_supported?, task_names, tiered_task_names, valid_id?
Methods included from CommandBase
#get, #get_connection, handle_argument_error, #post, #post_file, #rest_url, #rotate_args
Methods included from TaskStatusMixin
#list_task_info_aux, #task_status_aux, #task_status_stream
Methods included from Console
confirmation_prompt, confirmation_prompt_additional_options, confirmation_prompt_multiple_choice, confirmation_prompt_simple, unix_shell, wait_animation
Methods included from CommandHelperMixin
Methods included from ReparseMixin
Methods included from PushCloneChangesMixin
Methods included from CommandBaseThor::CommonOptionDefs::ClassMixin
Methods included from Poller
#poller_response, #print_response, #resolve_type
Methods inherited from Thor
get_alternative_identifiers, help, match_help_item_changes, overriden_help, printable_tasks, replace_if_matched!, set_context
Constructor Details
This class inherits a constructor from DTK::Client::CommandBaseThor
Class Method Details
.pretty_print_cols ⇒ Object
23 24 25 |
# File 'lib/commands/thor/library.rb', line 23 def self.pretty_print_cols() PPColumns.get(:library) end |
.whoami ⇒ Object
27 28 29 |
# File 'lib/commands/thor/library.rb', line 27 def self.whoami() return :library, "library/list", nil end |
Instance Method Details
#create(context_params) ⇒ Object
98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/commands/thor/library.rb', line 98 def create(context_params) library_id, module_name = context_params.retrieve_arguments([:library_id, :option_1!],method_argument_names) post_body = { :module_name => module_name } post_body.merge!(:library_id => library_id) if library_id response = post rest_url("service_module/create"), post_body # when changing context send request for getting latest libraries instead of getting from cache @@invalidate_map << :library return response end |
#delete(context_params) ⇒ Object
112 113 114 115 116 117 118 119 120 121 122 123 |
# File 'lib/commands/thor/library.rb', line 112 def delete(context_params) library_id, component_module_id = context_params.retrieve_arguments([:library_id, :option_1!],method_argument_names) post_body = { :component_module_id => component_module_id } post_body.merge!(:library_id => library_id) if library_id response = post rest_url("component_module/delete"), post_body # when changing context send request for getting latest libraries instead of getting from cache @@invalidate_map << :library return response end |
#import_service_module(context_params) ⇒ Object
86 87 88 89 90 91 92 93 94 95 |
# File 'lib/commands/thor/library.rb', line 86 def import_service_module(context_params) library_id, service_modules = context_params.retrieve_arguments([:library_id, :option_1!],method_argument_names) post_body = { :remote_module_name => service_modules, :rsa_pub_key => SSHUtil.rsa_pub_key_content() } post_body.merge!(:library_id => library_id) if library_id post rest_url("service_module/import"), post_body end |
#info(context_params) ⇒ Object
32 33 34 35 |
# File 'lib/commands/thor/library.rb', line 32 def info(context_params) library_id = context_params.retrieve_arguments([:library_id],method_argument_names) not_implemented end |
#list(context_params) ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/commands/thor/library.rb', line 56 def list(context_params) library_id, about = context_params.retrieve_arguments([:library_id, :option_1],method_argument_names||="") if library_id.nil? search_hash = SearchHash.new() search_hash.cols = pretty_print_cols() response = post rest_url("library/list"), search_hash.post_body_hash response.render_table(:library) else # sets data type to be used when printing table case about when "assemblies" data_type = :assembly_template when "nodes" data_type = :node_template when "components" data_type = :component else raise_validation_error_method_usage('list') end post_body = { :library_id => library_id, :about => about } response = post rest_url("library/info_about"), post_body response.render_table(data_type) end end |
#list_assemblies(context_params) ⇒ Object
50 51 52 53 |
# File 'lib/commands/thor/library.rb', line 50 def list_assemblies(context_params) context_params.method_arguments = ["assemblies"] list(context_params) end |
#list_components(context_params) ⇒ Object
44 45 46 47 |
# File 'lib/commands/thor/library.rb', line 44 def list_components(context_params) context_params.method_arguments = ["components"] list(context_params) end |
#list_nodes(context_params) ⇒ Object
38 39 40 41 |
# File 'lib/commands/thor/library.rb', line 38 def list_nodes(context_params) context_params.method_arguments = ["nodes"] list(context_params) end |