Class: DrawCloud::NetworkInterface
- Defined in:
- lib/draw_cloud/network_interface.rb
Instance Attribute Summary collapse
-
#description ⇒ Object
Returns the value of attribute description.
-
#group_set ⇒ Object
(also: #security_groups)
Returns the value of attribute group_set.
-
#name ⇒ Object
Returns the value of attribute name.
-
#private_ip_address ⇒ Object
Returns the value of attribute private_ip_address.
-
#source_dest_check ⇒ Object
Returns the value of attribute source_dest_check.
-
#subnet_id ⇒ Object
(also: #subnet)
Returns the value of attribute subnet_id.
-
#tags ⇒ Object
Returns the value of attribute tags.
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
- #default_tags ⇒ Object
- #elastic_ip=(eip) ⇒ Object
-
#initialize(name, options = {}, &block) ⇒ NetworkInterface
constructor
A new instance of NetworkInterface.
- #load_into_config(config) ⇒ Object
- #network_interface ⇒ Object
- #resource_name ⇒ Object
- #to_h ⇒ Object
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
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, ={}, &block) @name = name @tags = {} super(, &block) end |
Instance Attribute Details
#description ⇒ Object
Returns the value of attribute description.
21 22 23 |
# File 'lib/draw_cloud/network_interface.rb', line 21 def description @description end |
#group_set ⇒ Object 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 |
#name ⇒ Object
Returns the value of attribute name.
21 22 23 |
# File 'lib/draw_cloud/network_interface.rb', line 21 def name @name end |
#private_ip_address ⇒ Object
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_check ⇒ Object
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_id ⇒ Object 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 |
#tags ⇒ Object
Returns the value of attribute tags.
21 22 23 |
# File 'lib/draw_cloud/network_interface.rb', line 21 def @tags end |
Instance Method Details
#default_tags ⇒ Object
49 50 51 |
# File 'lib/draw_cloud/network_interface.rb', line 49 def {"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_interface ⇒ Object
32 33 34 |
# File 'lib/draw_cloud/network_interface.rb', line 32 def network_interface self end |
#resource_name ⇒ Object
41 42 43 |
# File 'lib/draw_cloud/network_interface.rb', line 41 def resource_name resource_style(name) + "ElasticNetworkInterface" end |
#to_h ⇒ Object
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? = .merge() p["Tags"] = hash_to_tag_array() unless .empty? add_standard_properties(h) end |