Class: Bcome::Node::Server::Dynamic::Ec2

Inherits:
Base show all
Defined in:
lib/objects/node/server/dynamic/ec2.rb

Constant Summary

Constants inherited from Base

Base::DEFAULT_IDENTIFIER

Constants included from Draw

Draw::BLIP, Draw::BOTTOM_ANCHOR, Draw::BOX_BOTTOM_LEFT, Draw::BOX_BOTTOM_RIGHT, Draw::BOX_HORIZONTAL_LINE, Draw::BOX_SIDE, Draw::BOX_TOP_LEFT, Draw::BOX_TOP_RIGHT, Draw::BRANCH, Draw::INGRESS, Draw::LEFT_PADDING, Draw::MID_SHIPS

Constants included from LocalMetaDataFactory

LocalMetaDataFactory::META_DATA_FILE_PATH_PREFIX

Instance Attribute Summary

Attributes inherited from Base

#origin_object_id

Attributes inherited from Base

#identifier, #params, #parent, #views

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

override_identifier

Methods inherited from Base

#add_list_attributes, #cache_data, #close_ssh_connection, #cloud_tags, #do_run, #dup_with_new_parent, #dynamic_server?, #enabled_menu_items, #execute_script, #get, #has_description?, #has_no_ssh_connection?, #has_ssh_connection?, #has_tagged_value?, #initialize, #is_same_machine?, #list_attributes, #local_network?, #local_port_forward, #ls, #machines, #menu_items, #open_ssh_connection, #origin_namespace, #ping, #print_ping_result, #pseudo_tty, #put, #put_str, #reopen_ssh_connection, #requires_description?, #requires_type?, #rsync, #run, #server?, #set_list_attributes, #set_network_configuration_overrides, #set_view_attributes, #ssh, #static_server?, #tags, #tags_h, #type, #update_identifier, #update_parent

Methods inherited from Base

#close_ssh_connections, #collection?, const_missing, #data_print_from_hash, #enabled_menu_items, #execute_local, #execute_script, #has_parent?, #has_proxy?, #hide?, #initialize, #inspect, #inventory?, #invoke, #is_top_level_node?, #keyed_namespace, #list_attributes, #list_key, #method_missing, #namespace, #no_nodes?, #nodes_loaded!, #nodes_loaded?, #prompt_breadcrumb, #proxy, #proxy_chain, #proxy_chain_link, #put, #put_str, #recurse_resource_for_identifier, #requires_description?, #requires_type?, #resource_for_identifier, #resources, #rsync, #scoped_resources, #scp, #server?, #ssh_connect, #validate_attributes, #validate_identifier

Methods included from LoadingBar::Handler

#cursor, #do_signal, #fork_process, #signal_failure, #signal_stop, #signal_success, #start_indicator, #stop_indicator, #wrap_indicator

Methods included from Tree

#build_tree, #deduce_tree_structure, #namespace_tree_line, #network_namespace_tree_data, #recurse_tree_lines, #routes, #routing_tree_data, #routing_tree_line, #to_nested_hash, #tree

Methods included from Draw

#box_it, #max_box_line_length

Methods included from RegistryManagement

#registry, #user_command_wrapper

Methods included from LocalMetaDataFactory

#do_create_metadata, #meta, #metadata, #metadata_for_namespace, #raw_metadata

Methods included from WorkspaceMenu

#item_spacing, #menu, #menu_group_names, #menu_item_spacing_length, #menu_items, #mode, #print_menu_items, #tab_spacing

Methods included from Attributes

#filters, #identifier, #network_data, #network_driver, #recurse_hash_data_for_instance_key, #ssh_data, #ssh_driver, #ssh_driver=

Methods included from WorkspaceCommands

#cd, #clear!, #disable, #disable!, #enable, #enable!, #interactive, #is_node_level_method?, #ls, #lsa, #method_in_registry?, #method_is_available_on_node?, #new_line, #parents, #ping, #pretty_description, #resource_identifiers, #run, #ssh_connect, #tree_descriptions, #visual_hierarchy, #workon

Methods included from Context

#current_context?, #irb_workspace=, #previous_irb_workspace=

Constructor Details

This class inherits a constructor from Bcome::Node::Server::Base

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Bcome::Node::Base

Class Method Details

.dynamic_server_typeObject



6
7
8
# File 'lib/objects/node/server/dynamic/ec2.rb', line 6

def dynamic_server_type
  :ec2
end

.new_from_fog_instance(fog_instance, parent) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/objects/node/server/dynamic/ec2.rb', line 10

def new_from_fog_instance(fog_instance, parent)
  identifier = fog_instance.tags['Name']

  params = {
    identifier: identifier,
    internal_ip_address: fog_instance.private_ip_address,
    public_ip_address: fog_instance.public_ip_address,
    role: fog_instance.tags['function'],
    description: "EC2 server - #{identifier}",
    ec2_server: fog_instance
  }

  new(parent: parent, views: params)
end

Instance Method Details

#cloud_serverObject



35
36
37
# File 'lib/objects/node/server/dynamic/ec2.rb', line 35

def cloud_server
  views[:ec2_server]
end

#do_generate_cloud_tagsObject



30
31
32
33
# File 'lib/objects/node/server/dynamic/ec2.rb', line 30

def do_generate_cloud_tags
  raw_tags = cloud_server ? cloud_server.tags.deep_symbolize_keys : {}
  ::Bcome::Node::Meta::Cloud.new(raw_tags)
end

#hostObject



26
27
28
# File 'lib/objects/node/server/dynamic/ec2.rb', line 26

def host
  'EC2'
end