Class: CfFactory::CfAsLaunchConfig

Inherits:
Object
  • Object
show all
Includes:
CfBase
Defined in:
lib/cf_factory/as/cf_as_launch_config.rb

Instance Method Summary collapse

Methods included from CfBase

#generate, #generate_ref, #get_deletion_policy, #get_name, #get_update_policy, #hash_to_string, #retrieve_attribute, #set_meta_data, #set_quotes, #set_tags

Constructor Details

#initialize(name, image_id, instance_type, options) ⇒ CfAsLaunchConfig

Returns a new instance of CfAsLaunchConfig.



8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/cf_factory/as/cf_as_launch_config.rb', line 8

def initialize(name, image_id, instance_type, options)
  @name = name
  @image_id = image_id
  @instance_type = instance_type
  
  @user_data = options[:user_data]
  @key_name = options[:key_name]
  @security_groups = options[:security_groups]
  @spot_price = options[:spot_price]
  #TODO: a couple of properties missing
  validate()
end

Instance Method Details

#add_egress_rule(egress_rule) ⇒ Object



44
45
46
# File 'lib/cf_factory/as/cf_as_launch_config.rb', line 44

def add_egress_rule(egress_rule)
  @egress_rules << egress_rule
end

#add_ingress_rule(ingress_rule) ⇒ Object



40
41
42
# File 'lib/cf_factory/as/cf_as_launch_config.rb', line 40

def add_ingress_rule(ingress_rule)
  @ingress_rules << ingress_rule
end

#get_cf_attributesObject



25
26
27
# File 'lib/cf_factory/as/cf_as_launch_config.rb', line 25

def get_cf_attributes
  super
end

#get_cf_propertiesObject



29
30
31
32
33
34
35
36
37
38
# File 'lib/cf_factory/as/cf_as_launch_config.rb', line 29

def get_cf_properties
  result = {"ImageId" => @image_id,
    "InstanceType" => @instance_type
  }
  result["UserData"] = CfHelper.base64(@user_data) unless @user_data.nil?
  result["KeyName"] = @key_name unless @key_name.nil?
  result["SecurityGroups"] = CfHelper.generate_ref_array(@security_groups) unless @security_groups.nil?
  result["SpotPrice"] = @spot_price unless @spot_price.nil?
  result
end

#get_cf_typeObject



21
22
23
# File 'lib/cf_factory/as/cf_as_launch_config.rb', line 21

def get_cf_type
  "AWS::AutoScaling::LaunchConfiguration"
end