Class: DTK::Client::Component

Inherits:
CommandBaseThor show all
Defined in:
lib/commands/thor/component.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

Poller::PERIOD_WAIT_TIME

Constants inherited from Thor

Thor::HIDE_FROM_BASE_CONTEXT_HELP

Class Method Summary collapse

Instance Method Summary collapse

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

#Helper

Methods included from ReparseMixin

#reparse_aux

Methods included from PushCloneChangesMixin

#push_clone_changes_aux

Methods included from DTK::Client::CommandBaseThor::CommonOptionDefs::ClassMixin

#version_method_option

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

.valid_child?(name_of_sub_context) ⇒ Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/commands/thor/component.rb', line 26

def self.valid_child?(name_of_sub_context)
  return Component.valid_children().include?(name_of_sub_context.to_sym)
end

.valid_childrenObject



21
22
23
24
# File 'lib/commands/thor/component.rb', line 21

def self.valid_children()
  # [:attribute]
  []
end

.validation_list(context_params) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/commands/thor/component.rb', line 30

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
    assembly_or_worspace_id, node_id, node_name = context_params.retrieve_arguments([[:service_id, :workspace_id], :node_id!, :node_name!])

    post_body = {
      :assembly_id => assembly_or_worspace_id,
      :node_id     => node_id,
      :subtype     => 'instance',
      :about       => 'components',
      :filter      => nil
    }

    if assembly_or_worspace_id
      response = get_cached_response(:service_node_component, "assembly/info_about", post_body)
    else
      response = get_cached_response(:node_component, "node/info_about", post_body)
    end

    modified_response = response.clone_me()
    modified_response['data'].each { |e| e['display_name'] = e['display_name'].split('/').last }

    return modified_response
  end
end

Instance Method Details

#set(context_params) ⇒ Object



59
60
61
62
63
64
65
66
67
# File 'lib/commands/thor/component.rb', line 59

def set(context_params)
  assembly_id, node_id, component_id, pattern, value = context_params.retrieve_arguments([:service_id, :node_id, :component_id, :option_1,:option_2],method_argument_names)
  post_body = {
    :assembly_id => assembly_id,
    :pattern => pattern,
    :value => value
  }
  post rest_url("assembly/set_attributes"), post_body
end