class DTK::Client::ComponentTemplate
Public Class Methods
all_children()
click to toggle source
this includes children of children
# 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()
click to toggle source
# 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()
click to toggle source
# File lib/commands/thor/component_template.rb, line 21 def self.pretty_print_cols() PPColumns.get(:component) end
valid_child?(name_of_sub_context)
click to toggle source
# 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()
click to toggle source
# 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)
click to toggle source
# 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
Public Instance Methods
info(context_params)
click to toggle source
# 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 options.list? return response end
list(context_params)
click to toggle source
# 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 options.module # Special case when user sends --module; until now --OPTION didn't have value attached to it if options.module.eql?("module") module_id = module_filter else module_id = options.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 options.list? end return response end
list_nodes(context_params)
click to toggle source
# 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)
click to toggle source
# 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 options.list? response end