1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00
fog--fog/lib/fog/aws/requests/auto_scaling/describe_launch_configurations.rb
2011-06-12 21:07:42 +01:00

108 lines
4.6 KiB
Ruby

module Fog
module AWS
class AutoScaling
class Real
require 'fog/aws/parsers/auto_scaling/describe_launch_configurations'
# Returns a full description of the launch configurations given the
# specified names.
#
# If no names are specified, then the full details of all launch
# configurations are returned.
#
# ==== Parameters
# * options<~Hash>:
# * 'LaunchConfigurationNames'<~Array> - A list of launch
# configuration names.
# * 'MaxRecords'<~Integer> - The maximum number of launch
# configurations.
# * 'NextToken'<~String> - The token returned by a previous call to
# indicate that there is more data available.
#
# ==== Returns
# * response<~Excon::Response>:
# * body<~Hash>:
# * 'ResponseMetadata'<~Hash>:
# * 'RequestId'<~String> - Id of request
# * 'DescribeLaunchConfigurationsResponse'<~Hash>:
# * 'LaunchConfigurations'<~Array>:
# * launchconfiguration'<~Hash>:
# * 'BlockDeviceMappings'<~Array>:
# * blockdevicemapping<~Hash>:
# * 'DeviceName'<~String> - The name of the device within
# EC2.
# * 'Ebs'<~Hash>:
# * 'SnapshotId'<~String> - The snapshot ID
# * 'VolumeSize'<~Integer> - The volume size, in
# GigaBytes.
# * 'VirtualName'<~String> - The virtual name associated
# with the device.
# * 'CreatedTime'<~Time> - Provides the creation date and
# time for this launch configuration.
# * 'ImageId'<~String> - Provides the unique ID of the Amazon
# Machine Image (AMI) that was assigned during
# registration.
# * 'InstanceMonitoring'<~Hash>:
# * 'Enabled'<~Boolean> - If true, instance monitoring is
# enabled.
# * 'InstanceType'<~String> - Specifies the instance type of
# the EC2 instance.
# * 'KernelId'<~String> - Provides the ID of the kernel
# associated with the EC2 AMI.
# * 'KeyName'<~String> - Provides the name of the EC2 key
# pair.
# * 'LaunchConfigurationARN'<~String> - The launch
# configuration's Amazon Resource Name (ARN).
# * 'LaunchConfigurationName'<~String> - Specifies the name
# of the launch configuration.
# * 'RamdiskId'<~String> - Provides ID of the RAM disk
# associated with the EC2 AMI.
# * 'SecurityGroups'<~Array> - A description of the security
# groups to associate with the EC2 instances.
# * 'UserData'<~String> - The user data available to the
# launched EC2 instances.
# * 'NextToken'<~String> - Acts as a paging mechanism for large
# result sets. Set to a non-empty string if there are
# additional results waiting to be returned. Pass this in to
# subsequent calls to return additional results.
#
# ==== See Also
# http://docs.amazonwebservices.com/AutoScaling/latest/APIReference/API_DescribeLaunchConfigurations.html
#
def describe_launch_configurations(options = {})
if launch_configuration_names = options.delete('LaunchConfigurationNames')
options.merge!(AWS.indexed_param('LaunchConfigurationNames.member.%d', [*launch_configuration_names]))
end
request({
'Action' => 'DescribeLaunchConfigurations',
:parser => Fog::Parsers::AWS::AutoScaling::DescribeLaunchConfigurations.new
}.merge!(options))
end
end
class Mock
def describe_launch_configurations(options = {})
results = { 'LaunchConfigurations' => [] }
data[:launch_configurations].each do |lc_name, lc_data|
results['LaunchConfigurations'] << {
'LaunchConfigurationName' => lc_name
}.merge!(lc_data)
end
response = Excon::Response.new
response.status = 200
response.body = {
'DescribeLaunchConfigurationsResult' => results,
'ResponseMetadata' => { 'RequestId' => Fog::AWS::Mock.request_id }
}
response
end
end
end
end
end