class DTK::Client::NodeTemplate

Public Class Methods

extended_context() click to toggle source
# File lib/commands/thor/node_template.rb, line 25
def self.extended_context()
  {
    :context => {
      :add_component => "component_template"
    }
  }
end
pretty_print_cols() click to toggle source
# File lib/commands/thor/node_template.rb, line 21
def self.pretty_print_cols()
  PPColumns.get(:node)
end
validation_list(context_params) click to toggle source
# 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

Public Instance Methods

add_node_template(context_params) click to toggle source
# 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 = options[:size] && options[:size].split(',')

  post_body = post_body(
    :node_template_name => node_template_name,
    :target_id => options['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) click to toggle source
# 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) click to toggle source
# 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) click to toggle source
# File lib/commands/thor/node_template.rb, line 44
def list(context_params)
  post_body = {
    :subtype => 'template',
    :target_indentifier => options.target_identifier,
    :is_list_all => options.all
  }
  response = post rest_url("node/list"), post_body
  response.render_table(options.all ? :node_template_all : :node_template)
end