Class: AWS::AutoScaling::LaunchConfiguration

Inherits:
Core::Resource show all
Defined in:
lib/aws/auto_scaling/launch_configuration.rb

Instance Attribute Summary collapse

Attributes included from Core::Model

#config

Instance Method Summary collapse

Methods inherited from Core::Resource

attribute_providers, attribute_providers_for, attributes, #attributes_from_response, define_attribute_type, #eql?, #inspect, new_from

Methods included from Core::Cacheable

included, #retrieve_attribute

Methods included from Core::Model

#client, #config_prefix, #inspect

Constructor Details

#initialize(name, options = {}) ⇒ LaunchConfiguration

Returns a new instance of LaunchConfiguration.



44
45
46
# File 'lib/aws/auto_scaling/launch_configuration.rb', line 44

def initialize name, options = {}
  super(options.merge(:name => name))
end

Instance Attribute Details

#arnString (readonly)

Returns the current value of arn.

Returns:

  • (String)

    the current value of arn



41
42
43
# File 'lib/aws/auto_scaling/launch_configuration.rb', line 41

def arn
  @arn
end

#block_device_mappingsArray<Hash> (readonly)

Returns the current value of block_device_mappings.

Returns:

  • (Array<Hash>)

    the current value of block_device_mappings



41
42
43
# File 'lib/aws/auto_scaling/launch_configuration.rb', line 41

def block_device_mappings
  @block_device_mappings
end

#created_timeTime (readonly) Also known as: created_at

Returns the current value of created_time.

Returns:

  • (Time)

    the current value of created_time



41
42
43
# File 'lib/aws/auto_scaling/launch_configuration.rb', line 41

def created_time
  @created_time
end

#detailed_instance_monitoringBoolean (readonly) Also known as: detailed_instance_monitoring?

Returns the current value of detailed_instance_monitoring.

Returns:

  • (Boolean)

    the current value of detailed_instance_monitoring



41
42
43
# File 'lib/aws/auto_scaling/launch_configuration.rb', line 41

def detailed_instance_monitoring
  @detailed_instance_monitoring
end

#image_idString (readonly)

Returns the current value of image_id.

Returns:

  • (String)

    the current value of image_id



41
42
43
# File 'lib/aws/auto_scaling/launch_configuration.rb', line 41

def image_id
  @image_id
end

#instance_typeString (readonly)

Returns the current value of instance_type.

Returns:

  • (String)

    the current value of instance_type



41
42
43
# File 'lib/aws/auto_scaling/launch_configuration.rb', line 41

def instance_type
  @instance_type
end

#kernel_idString? (readonly)

Returns the current value of kernel_id.

Returns:

  • (String, nil)

    the current value of kernel_id



41
42
43
# File 'lib/aws/auto_scaling/launch_configuration.rb', line 41

def kernel_id
  @kernel_id
end

#key_nameString? (readonly)

Returns the current value of key_name.

Returns:

  • (String, nil)

    the current value of key_name



41
42
43
# File 'lib/aws/auto_scaling/launch_configuration.rb', line 41

def key_name
  @key_name
end

#nameString (readonly)

Returns the current value of name.

Returns:

  • (String)

    the current value of name



41
42
43
# File 'lib/aws/auto_scaling/launch_configuration.rb', line 41

def name
  @name
end

#ramdisk_idString? (readonly)

Returns the current value of ramdisk_id.

Returns:

  • (String, nil)

    the current value of ramdisk_id



41
42
43
# File 'lib/aws/auto_scaling/launch_configuration.rb', line 41

def ramdisk_id
  @ramdisk_id
end

#user_dataString? (readonly)

Returns the current value of user_data.

Returns:

  • (String, nil)

    the current value of user_data



41
42
43
# File 'lib/aws/auto_scaling/launch_configuration.rb', line 41

def user_data
  @user_data
end

Instance Method Details

#deletenil

Deletes the current launch configuration.

Returns:

  • (nil)


131
132
133
134
# File 'lib/aws/auto_scaling/launch_configuration.rb', line 131

def delete
  client.delete_launch_configuration(resource_options)
  nil
end

#exists?Boolean

Returns true if this launch configuration exists.

Returns:

  • (Boolean)

    Returns true if this launch configuration exists.



125
126
127
# File 'lib/aws/auto_scaling/launch_configuration.rb', line 125

def exists?
  !!get_resource.launch_configurations.first
end

#imageEC2::Image

Returns:



96
97
98
# File 'lib/aws/auto_scaling/launch_configuration.rb', line 96

def image
  EC2::Image.new(image_id, :config => config)
end

#key_pairKeyPair?

Returns:

  • (KeyPair, nil)


101
102
103
104
105
# File 'lib/aws/auto_scaling/launch_configuration.rb', line 101

def key_pair
  if key_name
    EC2::KeyPair.new(key_name, :config => config)
  end
end

#security_groupsArray<EC2::SecurityGroup>

Returns:



108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# File 'lib/aws/auto_scaling/launch_configuration.rb', line 108

def security_groups
  names_or_ids = security_group_details
  if names_or_ids.all?{|str| str.match(/^sg-[0-9a-f]{8}$/) }
    names_or_ids.collect do |security_group_id|
      EC2::SecurityGroup.new(security_group_id, :config => config)
    end
  else
    begin
      ec2 = EC2.new(:config => config)
      ec2.security_groups.filter('group-name', *names_or_ids).to_a
    rescue
      names_or_ids
    end
  end
end