Class: DrawCloud::NetworkInterface

Inherits:
Base
  • Object
show all
Defined in:
lib/draw_cloud/network_interface.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#as_groups, #as_launch_configurations, #deletion_policy, #depends_on, #ec2_instances, #elastic_ips, #gateways, #iam_access_keys, #iam_policies, #iam_users, #mappings, #metadata, #network_acls, #network_interfaces, #outputs, #parameters, #parent, #rdses, #resources, #route_tables, #sns_topics, #subnets, #vpcs, #wait_handles

Instance Method Summary collapse

Methods inherited from Base

#[], #accessor, #add_standard_properties, #create_as_group, #create_as_launch_configuration, #create_ec2_instance, #create_ec2_instance_template, #create_elastic_ip, #create_iam_access_key, #create_iam_policy, #create_iam_user, #create_mapping, #create_network_acl, #create_network_interface, #create_output, #create_parameter, #create_rds, #create_route_table, #create_security_group, #create_service, #create_sns_topic, #create_subnet, #create_vpc, #create_wait_handle, #ref

Methods included from Locations

#arn_s3

Methods included from Utilities

#desplice, #fnbase64, #fngetatt, #fnjoin, #hash_to_tag_array, #region, #resource_style, #splice, #stack_name

Constructor Details

#initialize(name, options = {}, &block) ⇒ NetworkInterface

Returns a new instance of NetworkInterface.



26
27
28
29
30
# File 'lib/draw_cloud/network_interface.rb', line 26

def initialize(name, options={}, &block)
  @name = name
  @tags = {}
  super(options, &block)
end

Instance Attribute Details

#descriptionObject

Returns the value of attribute description.



21
22
23
# File 'lib/draw_cloud/network_interface.rb', line 21

def description
  @description
end

#group_setObject Also known as: security_groups

Returns the value of attribute group_set.



21
22
23
# File 'lib/draw_cloud/network_interface.rb', line 21

def group_set
  @group_set
end

#nameObject

Returns the value of attribute name.



21
22
23
# File 'lib/draw_cloud/network_interface.rb', line 21

def name
  @name
end

#private_ip_addressObject

Returns the value of attribute private_ip_address.



21
22
23
# File 'lib/draw_cloud/network_interface.rb', line 21

def private_ip_address
  @private_ip_address
end

#source_dest_checkObject

Returns the value of attribute source_dest_check.



21
22
23
# File 'lib/draw_cloud/network_interface.rb', line 21

def source_dest_check
  @source_dest_check
end

#subnet_idObject Also known as: subnet

Returns the value of attribute subnet_id.



21
22
23
# File 'lib/draw_cloud/network_interface.rb', line 21

def subnet_id
  @subnet_id
end

#tagsObject

Returns the value of attribute tags.



21
22
23
# File 'lib/draw_cloud/network_interface.rb', line 21

def tags
  @tags
end

Instance Method Details

#default_tagsObject



49
50
51
# File 'lib/draw_cloud/network_interface.rb', line 49

def default_tags
  {"Name" => resource_style(name)}
end

#elastic_ip=(eip) ⇒ Object



45
46
47
# File 'lib/draw_cloud/network_interface.rb', line 45

def elastic_ip=(eip)
  eip.instance_id = self
end

#load_into_config(config) ⇒ Object



36
37
38
39
# File 'lib/draw_cloud/network_interface.rb', line 36

def load_into_config(config)
  config.cf_add_resource resource_name, self
  super(config)
end

#network_interfaceObject



32
33
34
# File 'lib/draw_cloud/network_interface.rb', line 32

def network_interface
  self
end

#resource_nameObject



41
42
43
# File 'lib/draw_cloud/network_interface.rb', line 41

def resource_name
  resource_style(name) + "ElasticNetworkInterface"
end

#to_hObject



53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/draw_cloud/network_interface.rb', line 53

def to_h
  h = {
    "Type" => "AWS::EC2::NetworkInterface",
    "Properties" => {
      "SubnetId" => DrawCloud.ref(subnet_id)
    }
  }
  p = h["Properties"]
  p["Description"] = description unless description.nil?
  p["GroupSet"] = group_set.collect {|g| DrawCloud.ref(g)} unless (group_set.nil? || group_set.empty?)
  p["PrivateIpAddress"] = private_ip_address unless private_ip_address.nil?
  p["SourceDestCheck"] = source_dest_check unless source_dest_check.nil?
  all_tags = default_tags.merge(tags)
  p["Tags"] = hash_to_tag_array(all_tags) unless all_tags.empty?
  add_standard_properties(h)
end