Class: DrawCloud::ElasticIp
Defined Under Namespace
Classes: ElasticIpAssociation
Instance Attribute Summary collapse
-
#domain ⇒ Object
Returns the value of attribute domain.
-
#instance_id ⇒ Object
Returns the value of attribute instance_id.
-
#name ⇒ Object
Returns the value of attribute name.
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, #security_groups, #sns_topics, #subnets, #vpcs, #wait_handles
Instance Method Summary collapse
- #association ⇒ Object
- #elastic_ip ⇒ Object
-
#initialize(name, options = {}, &block) ⇒ ElasticIp
constructor
A new instance of ElasticIp.
- #load_into_config(config) ⇒ 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) ⇒ ElasticIp
Returns a new instance of ElasticIp.
61 62 63 64 65 66 |
# File 'lib/draw_cloud/elastic_ip.rb', line 61 def initialize(name, ={}, &block) @name = name @domain = .fetch(:domain, nil) @instance_id = .fetch(:instance_id, nil) super(, &block) end |
Instance Attribute Details
#domain ⇒ Object
Returns the value of attribute domain.
60 61 62 |
# File 'lib/draw_cloud/elastic_ip.rb', line 60 def domain @domain end |
#instance_id ⇒ Object
Returns the value of attribute instance_id.
60 61 62 |
# File 'lib/draw_cloud/elastic_ip.rb', line 60 def instance_id @instance_id end |
#name ⇒ Object
Returns the value of attribute name.
60 61 62 |
# File 'lib/draw_cloud/elastic_ip.rb', line 60 def name @name end |
Instance Method Details
#association ⇒ Object
72 73 74 |
# File 'lib/draw_cloud/elastic_ip.rb', line 72 def association ElasticIpAssociation.new(self, instance_id, vpc) end |
#elastic_ip ⇒ Object
68 69 70 |
# File 'lib/draw_cloud/elastic_ip.rb', line 68 def elastic_ip self end |
#load_into_config(config) ⇒ Object
76 77 78 79 80 |
# File 'lib/draw_cloud/elastic_ip.rb', line 76 def load_into_config(config) config.cf_add_resource resource_name, self config.cf_add_resource(association.resource_name, association) if instance_id super(config) end |
#resource_name ⇒ Object
82 83 84 |
# File 'lib/draw_cloud/elastic_ip.rb', line 82 def resource_name resource_style(name) + "EIP" end |
#to_h ⇒ Object
86 87 88 89 90 91 92 93 94 |
# File 'lib/draw_cloud/elastic_ip.rb', line 86 def to_h h = { "Type" => "AWS::EC2::EIP", "Properties" => {} } h["Properties"]["Domain"] = domain unless domain.nil? h["Properties"]["Domain"] = "vpc" if (domain.nil? && vpc) add_standard_properties(h) end |