Class: DTK::Client::ComponentTemplate
- Inherits:
-
CommandBaseThor
- Object
- Thor
- CommandBaseThor
- DTK::Client::ComponentTemplate
- Defined in:
- lib/commands/thor/component_template.rb
Constant Summary
Constants inherited from CommandBaseThor
DTK::Client::CommandBaseThor::ALT_IDENTIFIER_SEPARATOR, DTK::Client::CommandBaseThor::EXTENDED_TIMEOUT, DTK::Client::CommandBaseThor::HIDE_FROM_BASE_CONTEXT, DTK::Client::CommandBaseThor::TIME_DIFF
Constants included from CommandHelperMixin
DTK::Client::CommandHelperMixin::Loaded
Constants included from ReparseMixin
ReparseMixin::YamlDTKMetaFiles
Constants included from Poller
Constants inherited from Thor
Thor::HIDE_FROM_BASE_CONTEXT_HELP
Class Method Summary collapse
-
.all_children ⇒ Object
this includes children of children.
- .override_allowed_methods ⇒ Object
- .pretty_print_cols ⇒ Object
- .valid_child?(name_of_sub_context) ⇒ Boolean
- .valid_children ⇒ Object
- .validation_list(context_params) ⇒ Object
Instance Method Summary collapse
- #info(context_params) ⇒ Object
- #list(context_params) ⇒ Object
- #list_nodes(context_params) ⇒ Object
- #stage(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 DTK::Client::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
.all_children ⇒ Object
this includes children of children
32 33 34 35 36 |
# File 'lib/commands/thor/component_template.rb', line 32 def self.all_children() # Amar: attribute context commented out per Rich suggeston #[:attribute] [] end |
.override_allowed_methods ⇒ Object
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/commands/thor/component_template.rb', line 55 def self.override_allowed_methods() return DTK::Shell::OverrideTasks.new({}) # Amar: attribute context commented out per Rich suggeston #return DTK::Shell::OverrideTasks.new( # { # :command_only => { # :attribute => [ # ['list',"list","List attributes for given component"] # ] # }, # :identifier_only => { # :attribute => [ # ['list',"list","List attributes for given component"] # ] # } # #}) end |
.pretty_print_cols ⇒ Object
21 22 23 |
# File 'lib/commands/thor/component_template.rb', line 21 def self.pretty_print_cols() PPColumns.get(:component) end |
.valid_child?(name_of_sub_context) ⇒ Boolean
38 39 40 |
# File 'lib/commands/thor/component_template.rb', line 38 def self.valid_child?(name_of_sub_context) return ComponentTemplate.valid_children().include?(name_of_sub_context.to_sym) end |
.valid_children ⇒ Object
25 26 27 28 29 |
# File 'lib/commands/thor/component_template.rb', line 25 def self.valid_children() # Amar: attribute context commented out per Rich suggeston #[:attribute] [] end |
.validation_list(context_params) ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/commands/thor/component_template.rb', line 42 def self.validation_list(context_params) if context_params.is_there_identifier?("component-module") component_module_id = context_params.retrieve_arguments([:component_module_id!]) res = get_cached_response(:component_template, "component_module/info_about", { :component_module_id => component_module_id, :about => :components}) else post_body = {:subtype => 'template', :ignore => 'test_module'} if assembly_id = context_params.retrieve_arguments([[:service_id, :workspace_id]]) post_body.merge!(:assembly_id => assembly_id) end get_cached_response(:component_template, "component/list", post_body) end end |
Instance Method Details
#info(context_params) ⇒ Object
76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/commands/thor/component_template.rb', line 76 def info(context_params) component_id = context_params.retrieve_arguments([:component_template_id!],method_argument_names) data_type = :component post_body = { :component_id => component_id, :subtype => 'template' } response = post rest_url("component/info"), post_body response.render_table(data_type) unless .list? return response end |
#list(context_params) ⇒ Object
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 |
# File 'lib/commands/thor/component_template.rb', line 108 def list(context_params) component_id, about, module_filter = context_params.retrieve_arguments([:component_template_id,:option_1,:option_1],method_argument_names) about ||= 'none' data_type = :component # Case when user provided '--module' / '-m' 'MODUL-NAME' if .module # Special case when user sends --module; until now --OPTION didn't have value attached to it if .module.eql?("module") module_id = module_filter else module_id = .module end context_params_for_service = DTK::Shell::ContextParams.new context_params_for_service.add_context_to_params("component_module", "component_module", module_id) response = DTK::Client::ContextRouter.routeTask("component_module", "list_components", context_params_for_service, @conn) else # Case without module filter post_body = { :component_id => component_id, :subtype => 'template', :about => about } case about when 'none' response = post rest_url("component/list") when 'nodes' response = post rest_url("component/list"), post_body else raise_validation_error_method_usage('list') end response.render_table(data_type) unless .list? end return response end |
#list_nodes(context_params) ⇒ Object
97 98 99 100 |
# File 'lib/commands/thor/component_template.rb', line 97 def list_nodes(context_params) context_params.method_arguments = ["nodes"] list(context_params) end |
#stage(context_params) ⇒ Object
152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 |
# File 'lib/commands/thor/component_template.rb', line 152 def stage(context_params) component_id, node_id = context_params.retrieve_arguments([:component_template_id!,:option_1!],method_argument_names) data_type = :component post_body = { :component_id => component_id } unless node_id.nil? post_body.merge!({:node_id => node_id}) end response = post rest_url("component/stage"), post_body @@invalidate_map << :component_template response.render_table(data_type) unless .list? response end |