Class: DTK::Client::NodeTemplate
- Inherits:
-
CommandBaseThor
- Object
- Thor
- CommandBaseThor
- DTK::Client::NodeTemplate
- Defined in:
- lib/commands/thor/node_template.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
- #add_node_template(context_params) ⇒ Object
- #delete_node_template(context_params) ⇒ Object
- #image_upgrade(context_params) ⇒ Object
- #list(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
.extended_context ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/commands/thor/node_template.rb', line 25 def self.extended_context() { :context => { :add_component => "component_template" } } end |
.pretty_print_cols ⇒ Object
21 22 23 |
# File 'lib/commands/thor/node_template.rb', line 21 def self.pretty_print_cols() PPColumns.get(:node) end |
.validation_list(context_params) ⇒ Object
33 34 35 |
# File 'lib/commands/thor/node_template.rb', line 33 def self.validation_list(context_params) get_cached_response(:node_template, "node/list", {:subtype => 'template'}) end |
Instance Method Details
#add_node_template(context_params) ⇒ Object
70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/commands/thor/node_template.rb', line 70 def add_node_template(context_params) node_template_name = context_params.retrieve_arguments([:option_1!],method_argument_names) size_array = [:size] && [:size].split(',') post_body = post_body( :node_template_name => node_template_name, :target_id => ['target'], :operating_system => required_option('os'), :image_id => required_option('image-id'), :size_array => size_array ) post rest_url("node/add_node_template"), post_body end |
#delete_node_template(context_params) ⇒ Object
85 86 87 88 89 90 91 |
# File 'lib/commands/thor/node_template.rb', line 85 def delete_node_template(context_params) node_template_name = context_params.retrieve_arguments([:option_1!],method_argument_names) post_body = post_body( :node_template_name => node_template_name ) post rest_url("node/delete_node_template"), post_body end |
#image_upgrade(context_params) ⇒ Object
56 57 58 59 60 61 62 63 |
# File 'lib/commands/thor/node_template.rb', line 56 def image_upgrade(context_params) old_image_id, new_image_id = context_params.retrieve_arguments([:option_1!, :option_2!],method_argument_names) post_body = { :old_image_id => old_image_id, :new_image_id => new_image_id } post rest_url("node/image_upgrade"), post_body end |
#list(context_params) ⇒ Object
44 45 46 47 48 49 50 51 52 |
# File 'lib/commands/thor/node_template.rb', line 44 def list(context_params) post_body = { :subtype => 'template', :target_indentifier => .target_identifier, :is_list_all => .all } response = post rest_url("node/list"), post_body response.render_table(.all ? :node_template_all : :node_template) end |