1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

AmazonCase ec2

This commit is contained in:
Wesley Beary 2009-08-01 01:15:44 -07:00
parent a9991f62b3
commit e443caf24e
77 changed files with 669 additions and 866 deletions

View file

@ -7,10 +7,8 @@ module Fog
def end_element(name)
case name
when 'requestId'
@response[:request_id] = @value
when 'publicIp'
@response[:public_ip] = @value
when 'publicIp', 'requestId'
@response[name] = @value
end
end

View file

@ -8,17 +8,9 @@ module Fog
def end_element(name)
case name
when 'attachTime'
@response[:attach_time] = Time.parse(@value)
when 'device'
@response[:device] = @value
when 'instanceId'
@response[:instance_id] = @value
when 'requestId'
@response[:request_id] = @value
when 'status'
@response[:status] = @value
when 'volumeId'
@response[:volume_id] = @value
@response[name] = Time.parse(@value)
when 'device', 'instanceId', 'requestId', 'status', 'volumeId'
@response[name] = @value
end
end

View file

@ -8,12 +8,12 @@ module Fog
def end_element(name)
case name
when 'requestId'
@response[:request_id] = @value
@response[name] = @value
when 'return'
if @value == 'true'
@response[:return] = true
@response[name] = true
else
@response[:return] = false
@response[name] = false
end
end
end

View file

@ -7,14 +7,8 @@ module Fog
def end_element(name)
case name
when 'keyFingerprint'
@response[:key_fingerprint] = @value
when 'keyMaterial'
@response[:key_material] = @value
when 'keyName'
@response[:key_name] = @value
when 'requestId'
@response[:request_id] = @value
when 'keyFingerprint', 'keyMaterial', 'keyName', 'requestId'
@response[name] = @value
end
end

View file

@ -7,16 +7,10 @@ module Fog
def end_element(name)
case name
when 'progress'
@response[:progress] = @value
when 'snapshotId'
@response[:snapshot_id] = @value
when 'progress', 'snapshotId', 'status', 'volumeId'
@response[name] = @value
when 'startTime'
@response[:start_time] = Time.parse(@value)
when 'status'
@response[:status] = @value
when 'volumeId'
@response[:volume_id] = @value
@response[name] = Time.parse(@value)
end
end

View file

@ -7,20 +7,12 @@ module Fog
def end_element(name)
case name
when 'availabilityZone'
@response[:availability_zone] = @value
when 'availabilityZone', 'requestId', 'snapshotId', 'status', 'volumeId'
@response[name] = @value
when 'createTime'
@response[:create_time] = Time.parse(@value)
when 'requestId'
@response[:request_id] = @value
@response[name] = Time.parse(@value)
when 'size'
@response[:size] = @value.to_i
when 'snapshotId'
@response[:snapshot_id] = @value
when 'status'
@response[:status] = @value
when 'volumeId'
@response[:volume_id] = @value
@response[name] = @value.to_i
end
end

View file

@ -7,20 +7,18 @@ module Fog
def reset
@address = {}
@response = { :address_set => [] }
@response = { 'addressesSet' => [] }
end
def end_element(name)
case name
when 'instanceId'
@address[:instance_id] = @value
when 'instanceId', 'publicIp'
@address[name] = @value
when 'item'
@response[:address_set] << @address
@response['addressesSet'] << @address
@address = []
when 'publicIp'
@address[:public_ip] = @value
when 'requestId'
@response[:request_id] = @value
@response[name] = @value
end
end

View file

@ -6,23 +6,19 @@ module Fog
class DescribeAvailabilityZones < Fog::Parsers::Base
def reset
@zone = {}
@response = { :availability_zone_info => [] }
@availability_zone = {}
@response = { 'availabilityZoneInfo' => [] }
end
def end_element(name)
case name
when 'item'
@response[:availability_zone_info] << @zone
@zone = {}
when 'regionName'
@zone[:region_name] = @value
@response['availabilityZoneInfo'] << @availability_zone
@availability_zone = {}
when 'regionName', 'zoneName', 'zoneState'
@availability_zone[name] = @value
when 'requestId'
@response[:request_id] = @value
when 'zoneName'
@zone[:zone_name] = @value
when 'zoneState'
@zone[:zone_state] = @value
@response[name] = @value
end
end

View file

@ -6,8 +6,8 @@ module Fog
class DescribeImages < Fog::Parsers::Base
def reset
@image = { :product_codes => [] }
@response = { :image_set => [] }
@image = { 'productCodes' => [] }
@response = { 'imagesSet' => [] }
end
def start_element(name, attrs = [])
@ -19,41 +19,25 @@ module Fog
def end_element(name)
case name
when 'architecture'
@image[:architecture] = @value
when 'imageId'
@image[:image_id] = @value
when 'imageLocation'
@image[:image_location] = @value
when 'imageOwnerId'
@image[:image_owner_id] = @value
when 'imageState'
@image[:image_state] = @value
when 'imageType'
@image[:image_type] = @value
when 'architecture', 'imageId', 'imageLocation', 'imageOwnerId', 'imageState', 'imageType', 'kernelId', 'platform', 'ramdiskId'
@image[name] = @value
when 'isPublic'
if @value == 'true'
@image[:is_public] = true
@image[name] = true
else
@image[:is_public] = false
@image[name] = false
end
when 'item'
unless @in_product_codes
@response[:image_set] << @image
@image = { :product_codes => [] }
@response['imagesSet'] << @image
@image = { 'productCodes' => [] }
end
when 'kernelId'
@image[:kernel_id] = @value
when 'platform'
@image[:platform] = @value
when 'productCode'
@image[:product_codes] << @value
@image['productCodes'] << @value
when 'productCodes'
@in_product_codes = false
when 'ramdiskId'
@image[:ramdisk_id] = @value
when 'requestId'
@response[:request_id] = @value
@response[name] = @value
end
end

View file

@ -6,9 +6,9 @@ module Fog
class DescribeInstances < Fog::Parsers::Base
def reset
@instance = { :instance_state => {}, :monitoring => {}, :placement => [], :product_codes => [] }
@reservation = { :group_set => [], :instances_set => [] }
@response = { :reservation_set => [] }
@instance = { 'instanceState' => {}, 'monitoring' => {}, 'placement' => [], 'productCodes' => [] }
@reservation = { 'groupSet' => [], 'instancesSet' => [] }
@response = { 'reservationSet' => [] }
end
def start_element(name, attrs = [])
@ -23,64 +23,44 @@ module Fog
def end_element(name)
case name
when 'amiLaunchIndex'
@instance[:ami_launch_index] = @value.to_i
@instance[name] = @value.to_i
when 'availabilityZone'
@instance[:placement] << @value
@instance['placement'] << @value
when 'code'
@instance[:instance_state][:code] = @value
when 'dnsName'
@instance[:dns_name] = @value
@instance['instanceState'][name] = @value
when 'dnsName', 'imageId', 'instanceId', 'instanceType', 'kernelId', 'keyName', 'privateDnsName', 'ramdiskId', 'reason'
@instance[name] = @value
when 'groupId'
@reservation[:group_set] << @value
@reservation['groupSet'] << @value
when 'groupSet'
@in_subset = false
when 'imageId'
@instance[:image_id] = @value
when 'instanceId'
@instance[:instance_id] = @value
when 'instancesSet'
@in_instances_set = false
when 'instanceType'
@instance[:instance_type] = @value
when 'item'
if @in_instances_set
@reservation[:instances_set] << @instance
@instance = { :instance_state => {}, :monitoring => {}, :placement => [], :product_codes => [] }
@reservation['instancesSet'] << @instance
@instance = { 'instanceState' => {}, 'monitoring' => {}, 'placement' => [], 'productCodes' => [] }
elsif !@in_subset
@response[:reservation_set] << @reservation
@reservation = { :group_set => [], :instances_set => [] }
@response['reservationSet'] << @reservation
@reservation = { 'groupSet' => [], 'instancesSet' => [] }
end
when 'kernelId'
@instance[:kernel_id] = @value
when 'keyName'
@instance[:key_name] = @value
when 'launchTime'
@instance[:launch_time] = Time.parse(@value)
@instance[name] = Time.parse(@value)
when 'name'
@instance[:instance_state][:name] = @value
when 'ownerId'
@reservation[:owner_id] = @value
when 'ramdiskId'
@instance[:ramdisk_id] = @value
when 'reason'
@instance[:reason] = @value
@instance['instanceState'][name] = @value
when 'ownerId', 'reservationId'
@reservation[name] = @value
when 'requestId'
@response[:request_id] = @value
when 'reservationId'
@reservation[:reservation_id] = @value
when 'privateDnsName'
@instance[:private_dns_name] = @value
@response[name] = @value
when 'productCode'
@instance[:product_codes] << @value
@instance['productCodes'] << @value
when 'productCodes'
@in_subset = false
when 'ramdiskId'
@instance[:ramdisk_id] = @value
when 'state'
if @value == 'true'
@instance[:monitoring][:state] = true
@instance['monitoring'][name] = true
else
@instance[:monitoring][:state] = false
@instance['monitoring'][name] = false
end
end
end

View file

@ -7,20 +7,18 @@ module Fog
def reset
@key = {}
@response = { :key_set => [] }
@response = { 'keySet' => [] }
end
def end_element(name)
case name
when 'item'
@response[:key_set] << @key
@response['keySet'] << @key
@key = {}
when 'keyFingerprint'
@key[:key_fingerprint] = @value
when 'keyName'
@key[:key_name] = @value
when 'keyFingerprint', 'keyName'
@key[name] = @value
when 'requestId'
@response[:request_id] = @value
@response[name] = @value
end
end

View file

@ -7,20 +7,18 @@ module Fog
def reset
@region = {}
@response = { :region_info => [] }
@response = { 'regionInfo' => [] }
end
def end_element(name)
case name
when 'item'
@response[:region_info] << @region
@response['regionInfo'] << @region
@region = {}
when 'regionEndpoint'
@region[:region_endpoint] = @value
when 'regionName'
@region[:region_name] = @value
when 'regionEndpoint', 'regionName'
@region[name] = @value
when 'requestId'
@response[:request_id] = @value
@response[name] = @value
end
end

View file

@ -7,10 +7,10 @@ module Fog
def reset
@group = {}
@ip_permission = { :groups => [], :ip_ranges => []}
@ip_permission = { 'groups' => [], 'ipRanges' => []}
@ip_range = {}
@security_group = { :ip_permissions => [] }
@response = { :security_group_info => [] }
@security_group = { 'ipPermissions' => [] }
@response = { 'securityGroupInfo' => [] }
end
def start_element(name, attrs = [])
@ -27,47 +27,43 @@ module Fog
def end_element(name)
case name
when 'cidrIp'
@ip_range[:cidrIp] = @value
when 'fromPort'
@ip_permission[:from_port] = @value.to_i
@ip_range[name] = @value
when 'fromPort', 'toPort'
@ip_permission[name] = @value.to_i
when 'groups'
@in_groups = false
when 'groupDescription'
@security_group[:group_description] = @value
when 'groupDescription', 'ownerId'
@security_group[name] = @value
when 'groupName'
if @in_groups
@group[:group_name] = @value
@group[name] = @value
else
@security_group[:group_name] = @value
@security_group[name] = @value
end
when 'ipPermissions'
@in_ip_permissions = false
when 'ipProtocol'
@ip_permission[:ip_protocol] = @value
@ip_permission[name] = @value
when 'ipRanges'
@in_ip_ranges = false
when 'item'
if @in_groups
@ip_permission[:groups] << @group
@ip_permission['groups'] << @group
@group = {}
elsif @in_ip_permissions
@security_group[:ip_permissions] << @ip_permission
@ip_permission = { :groups => [], :ip_ranges => []}
@security_group['ipPermissions'] << @ip_permission
@ip_permission = { 'groups' => [], 'ipRanges' => []}
elsif @in_ip_ranges
@ip_permission[:ip_ranges] << @ip_range
@ip_permission['ipRanges'] << @ip_range
@ip_range = {}
else
@response[:security_group_info] << @security_group
@security_group = { :ip_permissions => [] }
@response['securityGroupInfo'] << @security_group
@security_group = { 'ipPermissions' => [] }
end
when 'ownerId'
@security_group[:owner_id] = @value
when 'requestId'
@response[:request_id] = @value
when 'toPort'
@ip_permission[:to_port] = @value.to_i
@response[name] = @value
when 'userId'
@group[:user_id] = @value
@group[name] = @value
end
end

View file

@ -6,25 +6,19 @@ module Fog
class DescribeSnapshots < Fog::Parsers::Base
def reset
@response = { :snapshot_set => [] }
@response = { 'snapshotSet' => [] }
@snapshot = {}
end
def end_element(name)
case name
when 'item'
@response[:snapshot_set] << @snapshot
@response['snapshotSet'] << @snapshot
@snapshot = {}
when 'progress'
@snapshot[:progress] = @value
when 'snapshotId'
@snapshot[:snapshot_id] = @value
when 'progress', 'snapshotId', 'status', 'volumeId'
@snapshot[name] = @value
when 'startTime'
@snapshot[:start_time] = Time.parse(@value)
when 'status'
@snapshot[:status] = @value
when 'volumeId'
@snapshot[:volume_id] = @value
@snapshot[name] = Time.parse(@value)
end
end

View file

@ -8,8 +8,8 @@ module Fog
def reset
@attachment = {}
@in_attachment_set = false
@response = { :volume_set => [] }
@volume = { :attachment_set => [] }
@response = { 'volumeSet' => [] }
@volume = { 'attachmentSet' => [] }
end
def start_element(name, attrs = [])
@ -25,38 +25,26 @@ module Fog
when 'attachmentSet'
@in_attachment_set = false
when 'attachTime'
@attachment[:attach_time] = Time.parse(@value)
when 'device'
@attachment[:device] = @value
when 'instanceId'
@attachment[:instance_id] = @value
@attachment[name] = Time.parse(@value)
when 'device', 'instanceId', 'status', 'volumeId'
@attachment[name] = @value
when 'item'
@volume[:attachment_set] << @attachment
@volume['attachmentSet'] << @attachment
@attachment = {}
when 'status'
@attachment[:status] = @value
when 'volumeId'
@attachment[:volume_id] = @value
end
else
case name
when 'availabilityZone'
@volume[:availability_zone] = @value
when 'availabilityZone', 'snapshotId', 'status', 'volumeId'
@volume[name] = @value
when 'createTime'
@volume[:create_time] = Time.parse(@value)
@volume[name] = Time.parse(@value)
when 'item'
@response[:volume_set] << @volume
@volume = { :attachment_set => [] }
@response['volumeSet'] << @volume
@volume = { 'attachmentSet' => [] }
when 'requestId'
@response[:request_id] = @value
@response[name] = @value
when 'size'
@volume[:size] = @value.to_i
when 'snapshotId'
@volume[:snapshot_id] = @value
when 'status'
@volume[:status] = @value
when 'volumeId'
@volume[:volume_id] = @value
@volume[name] = @value.to_i
end
end
end

View file

@ -8,17 +8,9 @@ module Fog
def end_element(name)
case name
when 'attachTime'
@response[:attach_time] = Time.parse(@value)
when 'device'
@response[:device] = @value
when 'instanceId'
@response[:instance_id] = @value
when 'requestId'
@response[:request_id] = @value
when 'status'
@response[:status] = @value
when 'volumeId'
@response[:volume_id] = @value
@response[name] = Time.parse(@value)
when 'device', 'instanceId', 'requestId', 'status', 'volumeId'
@response[name] = @value
end
end

View file

@ -11,14 +11,12 @@ module Fog
def end_element(name)
case name
when 'instanceId'
@response[:instance_id] = @value
when 'instanceId', 'requestId'
@response[name] = @value
when 'output'
@response[:output] = Base64.decode64(@value)
when 'requestId'
@response[:request_id] = @value
@response[name] = Base64.decode64(@value)
when 'timestamp'
@response[:timestamp] = Time.parse(@value)
@response[name] = Time.parse(@value)
end
end

View file

@ -6,8 +6,8 @@ module Fog
class RunInstances < Fog::Parsers::Base
def reset
@instance = { :instance_state => {}, :monitoring => {}, :placement => {}, :product_codes => [] }
@response = { :group_set => [], :instances_set => [] }
@instance = { 'instanceState' => {}, 'monitoring' => {}, 'placement' => {}, 'productCodes' => [] }
@response = { 'groupSet' => [], 'instancesSet' => [] }
end
def start_element(name, attrs = [])
@ -22,63 +22,37 @@ module Fog
def end_element(name)
case name
when 'amiLaunchIndex'
@instance[:ami_launch_index] = @value.to_i
@instance[name] = @value.to_i
when 'availabilityZone'
@instance[:placement][:availability_zone] = @value
@instance['placement'][name] = @value
when 'code'
@instance[:instance_state][:code] = @value.to_i
when 'dnsName'
@instance[:dns_name] = @value
@instance['instanceState'][name] = @value.to_i
when 'dnsName', 'kernelId', 'keyName', 'imageId', 'instanceId', 'instanceType', 'platform', 'privateDnsName', 'ramdiskId', 'reason', 'requestorId'
@instance[name] = @value
when 'groupId'
@response[:group_set] << @value
@response['groupSet'] << @value
when 'groupSet'
@in_group_set = false
when 'kernelId'
@instance[:kernel_id] = @value
when 'keyName'
@instance[:key_name] = @value
when 'imageId'
@instance[:image_id] = @value
when 'instanceId'
@instance[:instance_id] = @value
when 'instanceType'
@instance[:instance_type] = @value
when 'item'
unless @in_group_set || @in_product_codes
@response[:instances_set] << @instance
@instance = { :instance_state => {}, :monitoring => {}, :placement => {}, :product_codes => [] }
@response['instancesSet'] << @instance
@instance = { 'instanceState' => {}, 'monitoring' => {}, 'placement' => {}, 'productCodes' => [] }
end
when 'kernelId'
@instance[:kernel_id] = @value
when 'launchTime'
@instance[:launch_time] = Time.parse(@value)
@instance[name] = Time.parse(@value)
when 'name'
@instance[:instance_state][:name] = @value
when 'ownerId'
@response[:owner_id] = @value
when 'platform'
@instance[:platform] = @value
when 'privateDnsName'
@instance[:private_dns_name] = @value
@instance['instanceState'][name] = @value
when 'ownerId', 'requestId', 'reservationId'
@response[name] = @value
when 'product_code'
@instance[:product_codes] << @value
@instance['productCodes'] << @value
when 'productCodes'
@in_product_codes = false
when 'ramdiskId'
@instance[:ramdisk_id] = @value
when 'reason'
@instance[:reason] = @value
when 'requestId'
@response[:request_id] = @value
when 'requestorId'
@instance[:requestor_id] = @value
when 'reservationId'
@response[:reservation_id] = @value
when 'state'
if @value == 'true'
@instance[:monitoring][:state] = true
@instance['monitoring'][name] = true
else
@instance[:monitoring][:state] = false
@instance['monitoring'][name] = false
end
end
end

View file

@ -6,8 +6,8 @@ module Fog
class TerminateInstances < Fog::Parsers::Base
def reset
@instance = { :previous_state => {}, :shutdown_state => {} }
@response = { :instances_set => [] }
@instance = { 'previousState' => {}, 'shutdownState' => {} }
@response = { 'instancesSet' => [] }
end
def start_element(name, attrs = [])
@ -22,26 +22,26 @@ module Fog
def end_element(name)
case name
when 'instanceId'
@instance[:instance_id] = @value
@instance[name] = @value
when 'item'
@response[:instances_set] << @instance
@instance = { :previous_state => {}, :shutdown_state => {} }
@response['instancesSet'] << @instance
@instance = { 'previousState' => {}, 'shutdownState' => {} }
when 'code'
if @in_previous_state
@instance[:previous_state][:code] = @value.to_i
@instance['previousState'][name] = @value.to_i
elsif @in_shutdown_state
@instance[:shutdown_state][:code] = @value.to_i
@instance['shutdownState'][name] = @value.to_i
end
when 'name'
if @in_previous_state
@instance[:previous_state][:name] = @value
@instance['previousState'][name] = @value
elsif @in_shutdown_state
@instance[:shutdown_state][:name] = @value
@instance['shutdownState'][name] = @value
end
when 'previousState'
@in_previous_state = false
when 'requestId'
@response[:request_id] = @value
@response[name] = @value
when 'shutdownState'
@in_shutdown_state = false
end

View file

@ -7,7 +7,8 @@ module Fog
# ==== Returns
# * response<~Fog::AWS::Response>:
# * body<~Hash>:
# * :public_ip<~String> - The acquired address
# * 'publicIp'<~String> - The acquired address
# * 'requestId'<~String> - Id of the request
def allocate_address
request({
'Action' => 'AllocateAddress'

View file

@ -11,8 +11,8 @@ module Fog
# ==== Returns
# * response<~Fog::AWS::Response>:
# * body<~Hash>:
# * :request_id<~String> - Id of request
# * :return<~Boolean> - success?
# * 'requestId'<~String> - Id of request
# * 'return'<~Boolean> - success?
def associate_address(instance_id, public_ip)
request({
'Action' => 'AssociateAddress',

View file

@ -12,12 +12,12 @@ module Fog
# ==== Returns
# * response<~Fog::AWS::Response>:
# * body<~Hash>:
# * :attach_time<~Time> - Time of attachment was initiated at
# * :device<~String> - Device as it is exposed to the instance
# * :instance_id<~String> - Id of instance for volume
# * :request_id<~String> - Id of request
# * :status<~String> - Status of volume
# * :volume_id<~String> - Reference to volume
# * 'attachTime'<~Time> - Time of attachment was initiated at
# * 'device'<~String> - Device as it is exposed to the instance
# * 'instanceId'<~String> - Id of instance for volume
# * 'requestId'<~String> - Id of request
# * 'status'<~String> - Status of volume
# * 'volumeId'<~String> - Reference to volume
def attach_volume(volume_id, instance_id, device)
request({
'Action' => 'AttachVolume',

View file

@ -6,32 +6,25 @@ module Fog
#
# ==== Parameters
# * options<~Hash>:
# * :group_name<~String> - Name of group
# * :source_security_group_name<~String> - Name of security group to authorize
# * :source_security_group_owner_id<~String> - Name of owner to authorize
# * 'GroupName'<~String> - Name of group
# * 'SourceSecurityGroupName'<~String> - Name of security group to authorize
# * 'SourceSecurityGroupOwnerId'<~String> - Name of owner to authorize
# or
# * :cidr_ip - CIDR range
# * :from_port - Start of port range (or -1 for ICMP wildcard)
# * :group_name - Name of group to modify
# * :ip_protocol - Ip protocol, must be in ['tcp', 'udp', 'icmp']
# * :to_port - End of port range (or -1 for ICMP wildcard)
# * 'CidrIp' - CIDR range
# * 'FromPort' - Start of port range (or -1 for ICMP wildcard)
# * 'GroupName' - Name of group to modify
# * 'IpProtocol' - Ip protocol, must be in ['tcp', 'udp', 'icmp']
# * 'ToPort' - End of port range (or -1 for ICMP wildcard)
#
# === Returns
# * response<~Fog::AWS::Response>:
# * body<~Hash>:
# * :request_id<~String> - Id of request
# * :return<~Boolean> - success?
# * 'requestId'<~String> - Id of request
# * 'return'<~Boolean> - success?
def authorize_security_group_ingress(options = {})
request({
'Action' => 'AuthorizeSecurityGroupIngress',
'CidrIp' => options[:cidr_ip],
'FromPort' => options[:from_port],
'GroupName' => options[:group_name],
'IpProtocol' => options[:ip_protocol],
'SourceSecurityGroupName' => options[:source_security_group_name],
'SourceSecurityGroupOwnerId' => options[:source_security_group_owner_id],
'ToPort' => options[:to_port]
}, Fog::Parsers::AWS::EC2::Basic.new)
'Action' => 'AuthorizeSecurityGroupIngress'
}.merge!(options), Fog::Parsers::AWS::EC2::Basic.new)
end
end

View file

@ -10,10 +10,10 @@ module Fog
# ==== Returns
# * response<~Fog::AWS::Response>:
# * body<~Hash>:
# * :key_name<~String> - Name of key
# * :key_fingerprint<~String> - SHA-1 digest of DER encoded private key
# * :key_material<~String> - Unencrypted encoded PEM private key
# * :request_id<~String> - Id of request
# * 'keyName'<~String> - Name of key
# * 'keyFingerprint'<~String> - SHA-1 digest of DER encoded private key
# * 'keyMaterial'<~String> - Unencrypted encoded PEM private key
# * 'requestId'<~String> - Id of request
def create_key_pair(key_name)
request({
'Action' => 'CreateKeyPair',

View file

@ -11,8 +11,8 @@ module Fog
# ==== Returns
# * response<~Fog::AWS::Response>:
# * body<~Hash>:
# * :request_id<~String> - Id of request
# * :return<~Boolean> - success?
# * 'requestId'<~String> - Id of request
# * 'return'<~Boolean> - success?
def create_security_group(name, description)
request({
'Action' => 'CreateSecurityGroup',

View file

@ -10,12 +10,12 @@ module Fog
# ==== Returns
# * response<~Fog::AWS::Response>:
# * body<~Hash>:
# * :progress<~String> - The percentage progress of the snapshot
# * :request_id<~String> - id of request
# * :snapshot_id<~String> - id of snapshot
# * :start_time<~Time> - timestamp when snapshot was initiated
# * :status<~String> - state of snapshot
# * :volume_id<~String> - id of volume snapshot targets
# * 'progress'<~String> - The percentage progress of the snapshot
# * 'requestId'<~String> - id of request
# * 'snapshotId'<~String> - id of snapshot
# * 'startTime'<~Time> - timestamp when snapshot was initiated
# * 'status'<~String> - state of snapshot
# * 'volumeId'<~String> - id of volume snapshot targets
def create_snapshot(volume_id)
request({
'Action' => 'CreateSnapshot',

View file

@ -12,12 +12,12 @@ module Fog
# ==== Returns
# * response<~Fog::AWS::Response>:
# * body<~Hash>:
# * :volume_id<~String> - Reference to volume
# * :size<~Integer> - Size in GiBs for volume
# * :status<~String> - State of volume
# * :create_time<~Time> - Timestamp for creation
# * :availability_zone<~String> - Availability zone for volume
# * :snapshot_id<~String> - Snapshot volume was created from, if any
# * 'volumeId'<~String> - Reference to volume
# * 'size'<~Integer> - Size in GiBs for volume
# * 'status's<~String> - State of volume
# * 'createTime'<~Time> - Timestamp for creation
# * 'availabilityZone'<~String> - Availability zone for volume
# * 'snapshotId'<~String> - Snapshot volume was created from, if any
def create_volume(availability_zone, size, snapshot_id = nil)
request({
'Action' => 'CreateVolume',

View file

@ -10,8 +10,8 @@ module Fog
# ==== Returns
# * response<~Fog::AWS::Response>:
# * body<~Hash>:
# * :request_id<~String> id of request
# * :return<~Boolean> - success?
# * 'requestId'<~String> id of request
# * 'return'<~Boolean> - success?
def delete_key_pair(key_name)
request({
'Action' => 'DeleteKeyPair',

View file

@ -10,8 +10,8 @@ module Fog
# ==== Returns
# * response<~Fog::AWS::Response>:
# * body<~Hash>:
# * :request_id<~String> - Id of request
# * :return<~Boolean> - success?
# * 'requestId'<~String> - Id of request
# * 'return'<~Boolean> - success?
def delete_security_group(name)
request({
'Action' => 'DeleteSecurityGroup',

View file

@ -10,8 +10,8 @@ module Fog
# ==== Returns
# * response<~Fog::AWS::Response>:
# * body<~Hash>:
# * :request_id<~String> - Id of request
# * :return<~Boolean> - success?
# * 'requestId'<~String> - Id of request
# * 'return'<~Boolean> - success?
def delete_snapshot(snapshot_id)
request({
'Action' => 'DeleteSnapshot',

View file

@ -10,8 +10,8 @@ module Fog
# ==== Returns
# * response<~Fog::AWS::Response>:
# * body<~Hash>:
# * :request_id<~String> - Id of request
# * :return<~Boolean> - success?
# * 'requestId'<~String> - Id of request
# * 'return'<~Boolean> - success?
def delete_volume(volume_id)
request({
'Action' => 'DeleteVolume',

View file

@ -10,10 +10,10 @@ module Fog
# ==== Returns
# * response<~Fog::AWS::Response>:
# * body<~Hash>:
# * :request_id<~String> - Id of request
# * :address_set<~Array>:
# * :instance_id<~String> - instance for ip address
# * :public_ip<~String> - ip address for instance
# * 'requestId'<~String> - Id of request
# * 'addressesSet'<~Array>:
# * 'instanceId'<~String> - instance for ip address
# * 'publicIp'<~String> - ip address for instance
def describe_addresses(public_ip = [])
params = indexed_params('PublicIp', public_ip)
request({

View file

@ -10,11 +10,11 @@ module Fog
# ==== Returns
# * response<~Fog::AWS::Response>:
# * body<~Hash>:
# * :request_id<~String> - Id of request
# * :availability_zone_info<~Array>:
# * :region_name<~String> - Name of region
# * :zone_name<~String> - Name of zone
# * :zone_state<~String> - State of zone
# * 'requestId'<~String> - Id of request
# * 'availabilityZoneInfo'<~Array>:
# * 'regionName'<~String> - Name of region
# * 'zoneName'<~String> - Name of zone
# * 'zoneState'<~String> - State of zone
def describe_availability_zones(zone_name = [])
params = indexed_params('ZoneName', zone_name)
request({

View file

@ -6,37 +6,34 @@ module Fog
#
# ==== Params
# * options<~Hash> - Optional params
# * :executable_by<~String> - Only return images that the executable_by
# * 'ExecutableBy'<~String> - Only return images that the executable_by
# user has explicit permission to launch
# * :image_id<~Array> - Ids of images to describe
# * :owner<~String> - Only return images belonging to owner.
# * 'ImageId'<~Array> - Ids of images to describe
# * 'Owner'<~String> - Only return images belonging to owner.
#
# ==== Returns
# * response<~Fog::AWS::Response>:
# * body<~Hash>:
# * :request_id<~String> - Id of request
# * :image_set<~Array>:
# * :architecture<~String> - Architecture of the image
# * :image_id<~String> - Id of the image
# * :image_location<~String> - Location of the image
# * :image_owner_id<~String> - Id of the owner of the image
# * :image_state<~String> - State of the image
# * :image_type<~String> - Type of the image
# * :is_public<~Boolean> - Whether or not the image is public
# * :kernel_id<~String> - Kernel id associated with image, if any
# * :platform<~String> - Operating platform of the image
# * :productCodes<~Array> - Product codes for the image
# * :ramdisk_id<~String> - Ramdisk id associated with image, if any
# * 'requestId'<~String> - Id of request
# * 'imagesSet'<~Array>:
# * 'architecture'<~String> - Architecture of the image
# * 'imageId'<~String> - Id of the image
# * 'imageLocation'<~String> - Location of the image
# * 'imageOwnerId'<~String> - Id of the owner of the image
# * 'imageState'<~String> - State of the image
# * 'imageType'<~String> - Type of the image
# * 'isPublic'<~Boolean> - Whether or not the image is public
# * 'kernelId'<~String> - Kernel id associated with image, if any
# * 'platform'<~String> - Operating platform of the image
# * 'productCodes'<~Array> - Product codes for the image
# * 'ramdiskId'<~String> - Ramdisk id associated with image, if any
def describe_images(options = {})
params = {}
if options[:image_id]
params = indexed_params('ImageId', options[:image_id])
if image_id = options.delete('ImageId')
options.merge!(indexed_params('ImageId', image_id))
end
request({
'Action' => 'DescribeImages',
'ExecutableBy' => options[:executable_by],
'Owner' => options[:owner]
}.merge!(params), Fog::Parsers::AWS::EC2::DescribeImages.new)
'Action' => 'DescribeImages'
}.merge!(options), Fog::Parsers::AWS::EC2::DescribeImages.new)
end
end

View file

@ -10,36 +10,36 @@ module Fog
# ==== Returns
# * response<~Fog::AWS::Response>:
# * body<~Hash>:
# * :request_id<~String> - Id of request
# * :reservation_set<~Array>:
# * :group_set<~Array> - Group names for reservation
# * :owner_id<~String> - AWS Access Key ID of reservation owner
# * :reservation_id<~String> - Id of the reservation
# * :instances_set<~Array>:
# * 'requestId'<~String> - Id of request
# * 'reservationSet'<~Array>:
# * 'groupSet'<~Array> - Group names for reservation
# * 'ownerId'<~String> - AWS Access Key ID of reservation owner
# * 'reservationId'<~String> - Id of the reservation
# * 'instancesSet'<~Array>:
# * instance<~Hash>:
# * :ami_launch_index<~Integer> - reference to instance in launch group
# * :dns_name<~String> - public dns name, blank until instance is running
# * :image_id<~String> - image id of ami used to launch instance
# * :instance_id<~String> - id of the instance
# * :instance_state<~Hash>:
# * :code<~Integer> - current status code
# * :name<~String> - current status name
# * :instance_type<~String> - type of instance
# * :kernel_id<~String> - Id of kernel used to launch instance
# * :key_name<~String> - name of key used launch instances or blank
# * :launch_time<~Time> - time instance was launched
# * :monitoring<~Hash>:
# * :state<~Boolean - state of monitoring
# * :placement<~Hash>:
# * :availability_zone<~String> - Availability zone of the instance
# * :product_codes<~Array> - Product codes for the instance
# * :private_dns_name<~String> - private dns name, blank until instance is running
# * :ramdisk_id<~String> - Id of ramdisk used to launch instance
# * :reason<~String> - reason for most recent state transition, or blank
# * 'amiLaunchIndex'<~Integer> - reference to instance in launch group
# * 'dnsName'<~String> - public dns name, blank until instance is running
# * 'imageId'<~String> - image id of ami used to launch instance
# * 'instanceId'<~String> - id of the instance
# * 'instanceState'<~Hash>:
# * 'code'<~Integer> - current status code
# * 'name'<~String> - current status name
# * 'instanceType'<~String> - type of instance
# * 'kernelId'<~String> - Id of kernel used to launch instance
# * 'keyName'<~String> - name of key used launch instances or blank
# * 'launchTime'<~Time> - time instance was launched
# * 'monitoring'<~Hash>:
# * 'state'<~Boolean - state of monitoring
# * 'placement'<~Hash>:
# * 'availabilityZone'<~String> - Availability zone of the instance
# * 'productCodes'<~Array> - Product codes for the instance
# * 'privateDnsName'<~String> - private dns name, blank until instance is running
# * 'ramdiskId'<~String> - Id of ramdisk used to launch instance
# * 'reason'<~String> - reason for most recent state transition, or blank
def describe_instances(instance_id = [])
params = indexed_params('InstanceId', instance_id)
request({
'Action' => 'DescribeInstances',
'Action' => 'DescribeInstances'
}.merge!(params), Fog::Parsers::AWS::EC2::DescribeInstances.new)
end

View file

@ -10,14 +10,14 @@ module Fog
# ==== Returns
# * response<~Fog::AWS::Response>:
# * body<~Hash>:
# * :request_id<~String> - Id of request
# * :key_set<~Array>:
# * :key_name<~String> - Name of key
# * :key_fingerprint<~String> - Fingerprint of key
# * 'requestId'<~String> - Id of request
# * 'keySet'<~Array>:
# * 'keyName'<~String> - Name of key
# * 'keyFingerprint'<~String> - Fingerprint of key
def describe_key_pairs(key_name = [])
params = indexed_params('KeyName', key_name)
request({
'Action' => 'DescribeKeyPairs',
'Action' => 'DescribeKeyPairs'
}.merge!(params), Fog::Parsers::AWS::EC2::DescribeKeyPairs.new)
end

View file

@ -10,10 +10,10 @@ module Fog
# ==== Returns
# * response<~Fog::AWS::Response>:
# * body<~Hash>:
# * :request_id<~String> - Id of request
# * :region_info<~Array>:
# * :region_name<~String> - Name of region
# * :region_endpoint<~String> - Service endpoint for region
# * 'requestId'<~String> - Id of request
# * 'regionInfo'<~Array>:
# * 'regionName'<~String> - Name of region
# * 'regionEndpoint'<~String> - Service endpoint for region
def describe_regions(region_name = [])
params = indexed_params('RegionName', region_name)
request({

View file

@ -10,20 +10,20 @@ module Fog
# === Returns
# * response<~Fog::AWS::Response>:
# * body<~Hash>:
# * :request_id<~String> - Id of request
# * :security_group_info<~Array>:
# * :group_description<~String> - Description of security group
# * :group_name<~String> - Name of security group
# * :ip_permissions<~Array>:
# * :from_port<~Integer> - Start of port range (or -1 for ICMP wildcard)
# * :groups<~Array>:
# * :group_name<~String> - Name of security group
# * :user_id<~String> - AWS User Id of account
# * :ip_protocol<~String> - Ip protocol, must be in ['tcp', 'udp', 'icmp']
# * :ip_ranges<~Array>:
# * :cidr_ip<~String> - CIDR range
# * :to_port<~Integer> - End of port range (or -1 for ICMP wildcard)
# * :owner_id<~String> - AWS Access Key Id of the owner of the security group
# * 'requestId'<~String> - Id of request
# * 'securityGroupInfo'<~Array>:
# * 'groupDescription'<~String> - Description of security group
# * 'groupName'<~String> - Name of security group
# * 'ipPermissions'<~Array>:
# * 'fromPort'<~Integer> - Start of port range (or -1 for ICMP wildcard)
# * 'groups'<~Array>:
# * 'groupName'<~String> - Name of security group
# * 'userId'<~String> - AWS User Id of account
# * 'ipProtocol'<~String> - Ip protocol, must be in ['tcp', 'udp', 'icmp']
# * 'ipRanges'<~Array>:
# * 'cidrIp'<~String> - CIDR range
# * 'toPort'<~Integer> - End of port range (or -1 for ICMP wildcard)
# * 'ownerId'<~String> - AWS Access Key Id of the owner of the security group
def describe_security_groups(group_name = [])
params = indexed_params('GroupName', group_name)
request({

View file

@ -10,13 +10,13 @@ module Fog
# ==== Returns
# * response<~Fog::AWS::Response>:
# * body<~Hash>:
# * :request_id<~String> - Id of request
# * :snapshot_set<~Array>:
# * :progress<~String>: The percentage progress of the snapshot
# * :snapshot_id<~String>: Id of the snapshot
# * :start_time<~Time>: Timestamp of when snapshot was initiated
# * :status<~String>: Snapshot state, in ['pending', 'completed']
# * :volume_id<~String>: Id of volume that snapshot contains
# * 'requestId'<~String> - Id of request
# * 'snapshotSet'<~Array>:
# * 'progress'<~String>: The percentage progress of the snapshot
# * 'snapshotId'<~String>: Id of the snapshot
# * 'startTime'<~Time>: Timestamp of when snapshot was initiated
# * 'status'<~String>: Snapshot state, in ['pending', 'completed']
# * 'volumeId'<~String>: Id of volume that snapshot contains
def describe_snapshots(snapshot_id = [])
params = indexed_params('SnapshotId', snapshot_id)
request({

View file

@ -10,19 +10,19 @@ module Fog
# ==== Returns
# * response<~Fog::AWS::Response>:
# * body<~Hash>:
# * :volume_set<~Array>:
# * :volume_id<~String> - Reference to volume
# * :size<~Integer> - Size in GiBs for volume
# * :status<~String> - State of volume
# * :create_time<~Time> - Timestamp for creation
# * :availability_zone<~String> - Availability zone for volume
# * :snapshot_id<~String> - Snapshot volume was created from, if any
# * :attachment_set<~Array>:
# * :attachment_time<~Time> - Timestamp for attachment
# * :device<~String> - How value is exposed to instance
# * :instance_id<~String> - Reference to attached instance
# * :status<~String> - Attachment state
# * :volume_id<~String> - Reference to volume
# * 'volumeSet'<~Array>:
# * 'volumeId'<~String> - Reference to volume
# * 'size'<~Integer> - Size in GiBs for volume
# * 'status'<~String> - State of volume
# * 'createTime'<~Time> - Timestamp for creation
# * 'availabilityZone'<~String> - Availability zone for volume
# * 'snapshotId'<~String> - Snapshot volume was created from, if any
# * 'attachmentSet'<~Array>:
# * 'attachmentTime'<~Time> - Timestamp for attachment
# * 'device'<~String> - How value is exposed to instance
# * 'instanceId'<~String> - Reference to attached instance
# * 'status'<~String> - Attachment state
# * 'volumeId'<~String> - Reference to volume
def describe_volumes(volume_ids = [])
params = indexed_params('VolumeId', volume_ids)
request({

View file

@ -7,27 +7,24 @@ module Fog
# ==== Parameters
# * volume_id<~String> - Id of amazon EBS volume to associate with instance
# * options<~Hash>:
# * device<~String> - Specifies how the device is exposed to the instance (e.g. "/dev/sdh")
# * force<~Boolean> - If true forces detach, can cause data loss/corruption
# * instance_id<~String> - Id of instance to associate volume with
# * 'Device'<~String> - Specifies how the device is exposed to the instance (e.g. "/dev/sdh")
# * 'Force'<~Boolean> - If true forces detach, can cause data loss/corruption
# * 'InstanceId'<~String> - Id of instance to associate volume with
#
# ==== Returns
# * response<~Fog::AWS::Response>:
# * body<~Hash>:
# * :attach_time<~Time> - Time of attachment was initiated at
# * :device<~String> - Device as it is exposed to the instance
# * :instance_id<~String> - Id of instance for volume
# * :request_id<~String> - Id of request
# * :status<~String> - Status of volume
# * :volume_id<~String> - Reference to volume
# * 'attachTime'<~Time> - Time of attachment was initiated at
# * 'device'<~String> - Device as it is exposed to the instance
# * 'instanceId'<~String> - Id of instance for volume
# * 'requestId'<~String> - Id of request
# * 'status'<~String> - Status of volume
# * 'volumeId'<~String> - Reference to volume
def detach_volume(volume_id, options = {})
request({
'Action' => 'DetachVolume',
'VolumeId' => volume_id,
'Force' => options[:force].nil? ? nil : options[:force].to_s,
'InstanceId' => options[:instance_id],
'Device' => options[:device]
}, Fog::Parsers::AWS::EC2::DetachVolume.new)
'VolumeId' => volume_id
}.merge!(options), Fog::Parsers::AWS::EC2::DetachVolume.new)
end
end

View file

@ -10,8 +10,8 @@ module Fog
# ==== Returns
# * response<~Fog::AWS::Response>:
# * body<~Hash>:
# * :request_id<~String> - Id of request
# * :return<~Boolean> - success?
# * 'requestId'<~String> - Id of request
# * 'return'<~Boolean> - success?
def disassociate_address(public_ip)
request({
'Action' => 'DisassociateAddress',

View file

@ -10,10 +10,10 @@ module Fog
# ==== Returns
# # * response<~Fog::AWS::Response>:
# * body<~Hash>:
# * :instance_id<~String> - Id of instance
# * :output<~String> - Console output
# * :request_id<~String> - Id of request
# * :timestamp<~Time> - Timestamp of last update to output
# * 'instanceId'<~String> - Id of instance
# * 'output'<~String> - Console output
# * 'requestId'<~String> - Id of request
# * 'timestamp'<~Time> - Timestamp of last update to output
def get_console_output(instance_id)
request({
'Action' => 'GetConsoleOutput',

View file

@ -10,8 +10,8 @@ module Fog
# ==== Returns
# # * response<~Fog::AWS::Response>:
# * body<~Hash>:
# * :request_id<~String> - Id of request
# * :return<~Boolean> - success?
# * 'requestId'<~String> - Id of request
# * 'return'<~Boolean> - success?
def reboot_instances(instance_id = [])
params = indexed_params('InstanceId', instance_id)
request({

View file

@ -7,8 +7,8 @@ module Fog
# ==== Returns
# * response<~Fog::AWS::Response>:
# * body<~Hash>:
# * :request_id<~String> - Id of request
# * :return<~Boolean> - success?
# * 'requestId'<~String> - Id of request
# * 'return'<~Boolean> - success?
def release_address(public_ip)
request({
'Action' => 'ReleaseAddress',

View file

@ -6,32 +6,25 @@ module Fog
#
# ==== Parameters
# * options<~Hash>:
# * :group_name<~String> - Name of group
# * :source_security_group_name<~String> - Name of security group to authorize
# * :source_security_group_owner_id<~String> - Name of owner to authorize
# * 'GroupName'<~String> - Name of group
# * 'SourceSecurityGroupName'<~String> - Name of security group to authorize
# * 'SourceSecurityGroupOwnerId'<~String> - Name of owner to authorize
# or
# * :cidr_ip - CIDR range
# * :from_port - Start of port range (or -1 for ICMP wildcard)
# * :group_name - Name of group to modify
# * :ip_protocol - Ip protocol, must be in ['tcp', 'udp', 'icmp']
# * :to_port - End of port range (or -1 for ICMP wildcard)
# * 'CidrIp' - CIDR range
# * 'FromPort' - Start of port range (or -1 for ICMP wildcard)
# * 'GroupName' - Name of group to modify
# * 'IpProtocol' - Ip protocol, must be in ['tcp', 'udp', 'icmp']
# * 'ToPort' - End of port range (or -1 for ICMP wildcard)
#
# === Returns
# * response<~Fog::AWS::Response>:
# * body<~Hash>:
# * :request_id<~String> - Id of request
# * :return<~Boolean> - success?
# * 'requestId'<~String> - Id of request
# * 'return'<~Boolean> - success?
def revoke_security_group_ingress(options = {})
request({
'Action' => 'RevokeSecurityGroupIngress',
'CidrIp' => options[:cidr_ip],
'FromPort' => options[:from_port],
'GroupName' => options[:group_name],
'IpProtocol' => options[:ip_protocol],
'SourceSecurityGroupName' => options[:source_security_group_name],
'SourceSecurityGroupOwnerId' => options[:source_security_group_owner_id],
'ToPort' => options[:to_port]
}, Fog::Parsers::AWS::EC2::Basic.new)
'Action' => 'RevokeSecurityGroupIngress'
}.merge!(options), Fog::Parsers::AWS::EC2::Basic.new)
end
end

View file

@ -16,69 +16,57 @@ module Fog
# be between 1 and maximum allowed for you account
# (by default the maximum for an account is 20)
# * options<~Hash>:
# * :availability_zone<~String> - Placement constraint for instances
# * :data<~String> - Additional data to provide to booting instances
# * :device_name<~String> - ?
# * :encoding<~String> - ?
# * :group_id<~String> - Name of security group for instances
# * :instance_type<~String> - Type of instance to boot. Valid options
# * 'Placement.AvailabilityZone'<~String> - Placement constraint for instances
# * 'DeviceName'<~String> - ?
# * 'Encoding'<~String> - ?
# * 'GroupId'<~String> - Name of security group for instances
# * 'InstanceType'<~String> - Type of instance to boot. Valid options
# in ['m1.small', 'm1.large', 'm1.xlarge', 'c1.medium', 'c1.xlarge']
# default is 'm1.small'
# * :kernel_id<~String> - Id of kernel with which to launch
# * :key_name<~String> - Name of a keypair to add to booting instances
# * :monitoring_enabled<~Boolean> - Enables monitoring, defaults to
# * 'KernelId'<~String> - Id of kernel with which to launch
# * 'KeyName'<~String> - Name of a keypair to add to booting instances
# * 'Monitoring.Enabled'<~Boolean> - Enables monitoring, defaults to
# disabled
# * :ramdisk_id<~String> - Id of ramdisk with which to launch
# * :version<~String> - ?
# * :virtual_name<~String> - ?
# * 'RamdiskId'<~String> - Id of ramdisk with which to launch
# * 'UserData'<~String> - Additional data to provide to booting instances
# * 'Version'<~String> - ?
# * 'VirtualName'<~String> - ?
#
# ==== Returns
# * response<~Fog::AWS::Response>:
# * body<~Hash>:
# * :group_set<~Array>: groups the instances are members in
# * group_name<~String> - Name of group
# * :instances_set<~Array>: returned instances
# * 'groupSet'<~Array>: groups the instances are members in
# * 'groupName'<~String> - Name of group
# * 'instancesSet'<~Array>: returned instances
# * instance<~Hash>:
# * :ami_launch_index<~Integer> - reference to instance in launch group
# * :dns_name<~String> - public dns name, blank until instance is running
# * :image_id<~String> - image id of ami used to launch instance
# * :instance_id<~String> - id of the instance
# * :instance_state<~Hash>:
# * :code<~Integer> - current status code
# * :name<~String> - current status name
# * :instance_type<~String> - type of instance
# * :kernel_id<~String> - Id of kernel used to launch instance
# * :key_name<~String> - name of key used launch instances or blank
# * :launch_time<~Time> - time instance was launched
# * :monitoring<~Hash>:
# * :state<~Boolean - state of monitoring
# * :placement<~Hash>:
# * :availability_zone<~String> - Availability zone of the instance
# * :private_dns_name<~String> - private dns name, blank until instance is running
# * :product_codes<~Array> - Product codes for the instance
# * :ramdisk_id<~String> - Id of ramdisk used to launch instance
# * :reason<~String> - reason for most recent state transition, or blank
# * :owner_id<~String> - Id of owner
# * :request_id<~String> - Id of request
# * 'amiLaunchIndex'<~Integer> - reference to instance in launch group
# * 'dnsName'<~String> - public dns name, blank until instance is running
# * 'imageId'<~String> - image id of ami used to launch instance
# * 'instanceId'<~String> - id of the instance
# * 'instanceState'<~Hash>:
# * 'code'<~Integer> - current status code
# * 'name'<~String> - current status name
# * 'instanceType'<~String> - type of instance
# * 'kernelId'<~String> - Id of kernel used to launch instance
# * 'keyName'<~String> - name of key used launch instances or blank
# * 'launchTime'<~Time> - time instance was launched
# * 'monitoring'<~Hash>:
# * 'state'<~Boolean - state of monitoring
# * 'placement'<~Hash>:
# * 'availabilityZone'<~String> - Availability zone of the instance
# * 'privateDnsName'<~String> - private dns name, blank until instance is running
# * 'productCodes'<~Array> - Product codes for the instance
# * 'ramdiskId'<~String> - Id of ramdisk used to launch instance
# * 'reason'<~String> - reason for most recent state transition, or blank
# * 'ownerId'<~String> - Id of owner
# * 'requestId'<~String> - Id of request
def run_instances(image_id, min_count, max_count, options = {})
request({
'Action' => 'RunInstances',
'ImageId' => image_id,
'MinCount' => min_count,
'MaxCount' => max_count,
'Placement.AvailabilityZone' => options[:availability_zone],
'Data' => options[:data],
'DeviceName' => options[:device_name],
'Encoding' => options[:encoding],
'GroupId' => options[:group_id],
'InstanceType' => options[:instance_type],
'KernelId' => options[:kernel_id],
'KeyName' => options[:key_name],
'Monitoring.Enabled' => options[:monitoring_enabled].nil? ? nil : "#{options[:monitoring_enabled]}",
'RamdiskId' => options[:ramdisk_id],
'Version' => options[:version],
'VirtualName' => options[:virtual_name]
}, Fog::Parsers::AWS::EC2::RunInstances.new)
'MaxCount' => max_count
}.merge!(options), Fog::Parsers::AWS::EC2::RunInstances.new)
end
end

View file

@ -10,15 +10,15 @@ module Fog
# ==== Returns
# # * response<~Fog::AWS::Response>:
# * body<~Hash>:
# * :request_id<~String> - Id of request
# * :instances_set<~Array>:
# * :instance_id<~String> - id of the terminated instance
# * :previous_state<~Hash>: previous state of instance
# * :code<~Integer> - previous status code
# * :name<~String> - name of previous state
# * :shutdown_state<~Hash>: shutdown state of instance
# * :code<~Integer> - current status code
# * :name<~String> - name of current state
# * 'requestId'<~String> - Id of request
# * 'instancesSet'<~Array>:
# * 'instanceId'<~String> - id of the terminated instance
# * 'previousState'<~Hash>: previous state of instance
# * 'code'<~Integer> - previous status code
# * 'name'<~String> - name of previous state
# * 'shutdownState'<~Hash>: shutdown state of instance
# * 'code'<~Integer> - current status code
# * 'name'<~String> - name of current state
def terminate_instances(instance_id)
params = indexed_params('InstanceId', instance_id)
request({

View file

@ -8,9 +8,9 @@ describe 'EC2.allocate_address' do
it "should return proper attributes" do
actual = ec2.allocate_address
actual.body[:request_id].should be_a(String)
@public_ip = actual.body[:public_ip]
@public_ip.should be_a(String)
actual.body['requestId'].should be_a(String)
@public_ip = actual.body['publicIp']
actual.body['publicIp'].should be_a(String)
end
end

View file

@ -3,8 +3,8 @@ require File.dirname(__FILE__) + '/../../spec_helper'
describe 'EC2.associate_address' do
before(:all) do
@instance_id = ec2.run_instances('ami-5ee70037', 1, 1).body[:instances_set].first[:instance_id]
@public_ip = ec2.allocate_address.body[:public_ip]
@instance_id = ec2.run_instances('ami-5ee70037', 1, 1).body['instancesSet'].first['instanceId']
@public_ip = ec2.allocate_address.body['publicIp']
end
after(:all) do
@ -14,8 +14,8 @@ describe 'EC2.associate_address' do
it "should return proper attributes" do
actual = ec2.associate_address(@instance_id, @public_ip)
actual.body[:request_id].should be_a(String)
[false, true].should include(actual.body[:return])
actual.body['requestId'].should be_a(String)
[false, true].should include(actual.body['return'])
end
end

View file

@ -3,8 +3,8 @@ require File.dirname(__FILE__) + '/../../spec_helper'
describe 'EC2.attach_volume' do
before(:all) do
@instance_id = ec2.run_instances('ami-5ee70037', 1, 1, {:availability_zone => 'us-east-1a'}).body[:instances_set].first[:instance_id]
@volume_id = ec2.create_volume('us-east-1a', 1).body[:volume_id]
@instance_id = ec2.run_instances('ami-5ee70037', 1, 1, {'Placement.AvailabilityZone' => 'us-east-1a'}).body['instancesSet'].first['instanceId']
@volume_id = ec2.create_volume('us-east-1a', 1).body['volumeId']
end
after(:all) do
@ -20,12 +20,12 @@ describe 'EC2.attach_volume' do
it "should return proper attributes" do
eventually(128) do
actual = ec2.attach_volume(@volume_id, @instance_id, '/dev/sdh')
actual.body[:attach_time].should be_a(Time)
actual.body[:device].should be_a(String)
actual.body[:instance_id].should be_a(String)
actual.body[:request_id].should be_a(String)
actual.body[:status].should be_a(String)
actual.body[:volume_id].should be_a(String)
actual.body['attachTime'].should be_a(Time)
actual.body['device'].should be_a(String)
actual.body['instanceId'].should be_a(String)
actual.body['requestId'].should be_a(String)
actual.body['status'].should be_a(String)
actual.body['volumeId'].should be_a(String)
end
end

View file

@ -12,14 +12,13 @@ describe 'EC2.authorize_security_group_ingress' do
it "should return proper attributes" do
actual = ec2.authorize_security_group_ingress({
:cidr_id => '127.0.0.1',
:from_port => 80,
:group_name => 'fog_security_group',
:ip_protocol => 'tcp',
:to_port => 80,
'FromPort' => 80,
'GroupName' => 'fog_security_group',
'IpProtocol' => 'tcp',
'ToPort' => 80,
})
actual.body[:request_id].should be_a(String)
[false, true].should include(actual.body[:return])
actual.body['requestId'].should be_a(String)
[false, true].should include(actual.body['return'])
end
end

View file

@ -8,10 +8,10 @@ describe 'EC2.create_key_pair' do
it "should return proper attributes" do
actual = ec2.create_key_pair('fog_key_pair')
actual.body[:key_fingerprint].should be_a(String)
actual.body[:key_material].should be_a(String)
actual.body[:key_name].should be_a(String)
actual.body[:request_id].should be_a(String)
actual.body['keyFingerprint'].should be_a(String)
actual.body['keyMaterial'].should be_a(String)
actual.body['keyName'].should be_a(String)
actual.body['requestId'].should be_a(String)
end
end

View file

@ -8,8 +8,8 @@ describe 'EC2.create_security_group' do
it "should return proper attributes" do
actual = ec2.create_security_group('fog_security_group', 'a security group for testing fog')
actual.body[:request_id].should be_a(String)
[false, true].should include(actual.body[:return])
actual.body['requestId'].should be_a(String)
[false, true].should include(actual.body['return'])
end
end

View file

@ -3,7 +3,7 @@ require File.dirname(__FILE__) + '/../../spec_helper'
describe 'EC2.create_snapshot' do
before(:all) do
@volume_id = ec2.create_volume('us-east-1a', 1).body[:volume_id]
@volume_id = ec2.create_volume('us-east-1a', 1).body['volumeId']
end
after(:all) do
@ -15,12 +15,12 @@ describe 'EC2.create_snapshot' do
it "should return proper attributes" do
actual = ec2.create_snapshot(@volume_id)
actual.body[:progress].should be_a(String)
@snapshot_id = actual.body[:snapshot_id]
actual.body[:snapshot_id].should be_a(String)
actual.body[:start_time].should be_a(Time)
actual.body[:status].should be_a(String)
actual.body[:volume_id].should be_a(String)
actual.body['progress'].should be_a(String)
@snapshot_id = actual.body['snapshotId']
actual.body['snapshotId'].should be_a(String)
actual.body['startTime'].should be_a(Time)
actual.body['status'].should be_a(String)
actual.body['volumeId'].should be_a(String)
end
end

View file

@ -8,14 +8,14 @@ describe 'EC2.create_volume' do
it "should return proper attributes" do
actual = ec2.create_volume('us-east-1a', 1)
actual.body[:availability_zone].should be_a(String)
actual.body[:create_time].should be_a(Time)
actual.body[:request_id].should be_a(String)
actual.body[:size].should == 1
actual.body[:snapshot_id].should == ''
actual.body[:status].should be_a(String)
actual.body[:volume_id].should be_a(String)
@volume_id = actual.body[:volume_id]
actual.body['availabilityZone'].should be_a(String)
actual.body['createTime'].should be_a(Time)
actual.body['requestId'].should be_a(String)
actual.body['size'].should == 1
actual.body['snapshotId'].should == ''
actual.body['status'].should be_a(String)
actual.body['volumeId'].should be_a(String)
@volume_id = actual.body['volumeId']
end
end

View file

@ -8,8 +8,8 @@ describe 'EC2.delete_key_pair' do
it "should return proper attributes" do
actual = ec2.delete_key_pair('fog_key_pair')
actual.body[:request_id].should be_a(String)
[false, true].should include(actual.body[:return])
actual.body['requestId'].should be_a(String)
[false, true].should include(actual.body['return'])
end
end

View file

@ -8,8 +8,8 @@ describe 'EC2.delete_security_group' do
it "should return proper attributes" do
actual = ec2.delete_security_group('fog_security_group')
actual.body[:request_id].should be_a(String)
[false, true].should include(actual.body[:return])
actual.body['requestId'].should be_a(String)
[false, true].should include(actual.body['return'])
end
end

View file

@ -3,8 +3,8 @@ require File.dirname(__FILE__) + '/../../spec_helper'
describe 'EC2.delete_snapshot' do
before(:all) do
@volume_id = ec2.create_volume('us-east-1a', 1).body[:volume_id]
@snapshot_id = ec2.create_snapshot(@volume_id).body[:snapshot_id]
@volume_id = ec2.create_volume('us-east-1a', 1).body['volumeId']
@snapshot_id = ec2.create_snapshot(@volume_id).body['snapshotId']
end
after(:all) do
@ -15,8 +15,8 @@ describe 'EC2.delete_snapshot' do
eventually do
actual = ec2.delete_snapshot(@snapshot_id)
unless actual.body.empty?
actual.body[:request_id].should be_a(String)
[false, true].should include(actual.body[:return])
actual.body['requestId'].should be_a(String)
[false, true].should include(actual.body['return'])
end
end
end

View file

@ -3,13 +3,13 @@ require File.dirname(__FILE__) + '/../../spec_helper'
describe 'EC2.create_volume' do
before(:all) do
@volume_id = ec2.create_volume('us-east-1a', 1).body[:volume_id]
@volume_id = ec2.create_volume('us-east-1a', 1).body['volumeId']
end
it "should return proper attributes" do
actual = ec2.delete_volume(@volume_id)
actual.body[:request_id].should be_a(String)
actual.body[:return].should == true
actual.body['requestId'].should be_a(String)
actual.body['return'].should == true
end
end

View file

@ -3,7 +3,7 @@ require File.dirname(__FILE__) + '/../../spec_helper'
describe 'EC2.describe_addresses' do
before(:all) do
@public_ip = ec2.allocate_address.body[:public_ip]
@public_ip = ec2.allocate_address.body['publicIp']
end
after(:all) do
@ -12,15 +12,15 @@ describe 'EC2.describe_addresses' do
it "should return proper attributes with no params" do
actual = ec2.describe_addresses
actual.body[:request_id].should be_a(String)
item = actual.body[:address_set].select {|address| address[:public_ip] == @public_ip}
actual.body['requestId'].should be_a(String)
item = actual.body['addressesSet'].select {|address| address['publicIp'] == @public_ip}
item.should_not be_nil
end
it "should return proper attributes for specific ip" do
actual = ec2.describe_addresses(@public_ip)
actual.body[:request_id].should be_a(String)
item = actual.body[:address_set].select {|address| address[:public_ip] == @public_ip}
actual.body['requestId'].should be_a(String)
item = actual.body['addressesSet'].select {|address| address['publicIp'] == @public_ip}
item.should_not be_nil
end

View file

@ -4,18 +4,18 @@ describe 'EC2.describe_availability_zones' do
it "should return proper attributes with no params" do
actual = ec2.describe_availability_zones
zone = actual.body[:availability_zone_info].first
zone[:region_name].should be_a(String)
zone[:zone_name].should be_a(String)
zone[:zone_state].should be_a(String)
zone = actual.body['availabilityZoneInfo'].first
zone['regionName'].should be_a(String)
zone['zoneName'].should be_a(String)
zone['zoneState'].should be_a(String)
end
it "should return proper attribute with params" do
actual = ec2.describe_availability_zones(['us-east-1a'])
zone = actual.body[:availability_zone_info].first
zone[:region_name].should be_a(String)
zone[:zone_name].should be_a(String)
zone[:zone_state].should be_a(String)
zone = actual.body['availabilityZoneInfo'].first
zone['regionName'].should be_a(String)
zone['zoneName'].should be_a(String)
zone['zoneState'].should be_a(String)
end
end

View file

@ -4,34 +4,34 @@ describe 'EC2.describe_images' do
it "should return proper attributes with no params" do
actual = ec2.describe_images
actual.body[:request_id].should be_a(String)
image = actual.body[:image_set].first
image[:architecture].should be_a(String)
image[:image_id].should be_a(String)
image[:image_location].should be_a(String)
image[:image_owner_id].should be_a(String)
image[:image_state].should be_a(String)
image[:image_type].should be_a(String)
[false, true].should include(image[:is_public])
# image[:kernel_id].should be_a(String)
# image[:platform].should be_a(String)
# image[:ramdisk_id].should be_a(String)
actual.body['requestId'].should be_a(String)
image = actual.body['imagesSet'].first
image['architecture'].should be_a(String)
image['imageId'].should be_a(String)
image['imageLocation'].should be_a(String)
image['imageOwnerId'].should be_a(String)
image['imageState'].should be_a(String)
image['imageType'].should be_a(String)
[false, true].should include(image['isPublic'])
image['kernelId'].should be_a(String) if image['kernelId']
image['platform'].should be_a(String) if image['platform']
image['ramdiskId'].should be_a(String) if image['ramdiskId']
end
it "should return proper attributes with params" do
actual = ec2.describe_images(:image_id => 'ami-5ee70037')
actual.body[:request_id].should be_a(String)
image = actual.body[:image_set].first
image[:architecture].should be_a(String)
image[:image_id].should be_a(String)
image[:image_location].should be_a(String)
image[:image_owner_id].should be_a(String)
image[:image_state].should be_a(String)
image[:image_type].should be_a(String)
[false, true].should include(image[:is_public])
# image[:kernel_id].should be_a(String)
# image[:platform].should be_a(String)
# image[:ramdisk_id].should be_a(String)
actual = ec2.describe_images('ImageId' => 'ami-5ee70037')
actual.body['requestId'].should be_a(String)
image = actual.body['imagesSet'].first
image['architecture'].should be_a(String)
image['imageId'].should be_a(String)
image['imageLocation'].should be_a(String)
image['imageOwnerId'].should be_a(String)
image['imageState'].should be_a(String)
image['imageType'].should be_a(String)
[false, true].should include(image['isPublic'])
image['kernelId'].should be_a(String) if image['kernelId']
image['platform'].should be_a(String) if image['platform']
image['ramdiskId'].should be_a(String) if image['ramdiskId']
end
end

View file

@ -4,8 +4,8 @@ describe 'EC2.describe_instances' do
before(:all) do
run_instances = ec2.run_instances('ami-5ee70037', 1, 1).body
@instance_id = run_instances[:instances_set].first[:instance_id]
@reservation_id = run_instances[:reservation_id]
@instance_id = run_instances['instancesSet'].first['instanceId']
@reservation_id = run_instances['reservationId']
end
after(:all) do
@ -14,64 +14,62 @@ describe 'EC2.describe_instances' do
it "should return proper attributes with no params" do
actual = ec2.describe_instances
reservation = actual.body[:reservation_set].select {|reservation| reservation[:reservation_id] == @reservation_id}.first
reservation[:group_set].should be_an(Array)
reservation[:group_set].first.should be_a(String)
reservation[:owner_id].should be_a(String)
reservation[:reservation_id].should be_a(String)
instance = reservation[:instances_set].select {|instance| instance[:instance_id] == @instance_id}.first
instance[:ami_launch_index].should be_an(Integer)
instance[:dns_name].should be_a(String)
instance[:image_id].should be_a(String)
instance[:instance_id].should be_a(String)
instance[:instance_state].should be_a(Hash)
state = instance[:instance_state]
state[:code].should be_a(String)
state[:name].should be_a(String)
instance[:instance_type].should be_a(String)
instance[:kernel_id].should be_a(String)
# instance[:key_name].should be_a(String)
instance[:launch_time].should be_a(Time)
instance[:monitoring].should be_a(Hash)
[true, false].should include(instance[:monitoring][:state])
instance[:placement].should be_an(Array)
instance[:placement].first.should be_a(String)
instance[:private_dns_name].should be_a(String)
instance[:product_codes].should be_an(Array)
# instance[:product_codes].first.should be_a(String)
instance[:ramdisk_id].should be_a(String)
instance[:reason].should be_a(String)
reservation = actual.body['reservationSet'].select {|reservation| reservation['reservationId'] == @reservation_id}.first
reservation['groupSet'].should be_an(Array)
reservation['groupSet'].first.should be_a(String)
reservation['ownerId'].should be_a(String)
reservation['reservationId'].should be_a(String)
instance = reservation['instancesSet'].select {|instance| instance['instanceId'] == @instance_id}.first
instance['amiLaunchIndex'].should be_an(Integer)
instance['dnsName'].should be_a(String)
instance['imageId'].should be_a(String)
instance['instanceId'].should be_a(String)
instance['instanceState'].should be_a(Hash)
instance['instanceState']['code'].should be_a(String)
instance['instanceState']['name'].should be_a(String)
instance['instanceType'].should be_a(String)
instance['kernelId'].should be_a(String)
instance['keyName'].should be_a(String) if instance['keyName']
instance['launchTime'].should be_a(Time)
instance['monitoring'].should be_a(Hash)
[true, false].should include(instance['monitoring']['state'])
instance['placement'].should be_an(Array)
instance['placement'].first.should be_a(String)
instance['privateDnsName'].should be_a(String)
instance['productCodes'].should be_an(Array)
instance['productCodes'].first.should be_a(String) if instance['productCodes'].first
instance['ramdiskId'].should be_a(String)
instance['reason'].should be_a(String)
end
it "should return proper attributes with params" do
actual = ec2.describe_instances(@instance_id)
reservation = actual.body[:reservation_set].select {|reservation| reservation[:reservation_id] == @reservation_id}.first
reservation[:group_set].should be_an(Array)
reservation[:group_set].first.should be_a(String)
reservation[:owner_id].should be_a(String)
reservation[:reservation_id].should be_a(String)
instance = reservation[:instances_set].select {|instance| instance[:instance_id] == @instance_id}.first
instance[:ami_launch_index].should be_an(Integer)
instance[:dns_name].should be_a(String)
instance[:image_id].should be_a(String)
instance[:instance_id].should be_a(String)
instance[:instance_state].should be_a(Hash)
state = instance[:instance_state]
state[:code].should be_a(String)
state[:name].should be_a(String)
instance[:instance_type].should be_a(String)
instance[:kernel_id].should be_a(String)
# instance[:key_name].should be_a(String)
instance[:launch_time].should be_a(Time)
instance[:monitoring].should be_a(Hash)
[true, false].should include(instance[:monitoring][:state])
instance[:placement].should be_an(Array)
instance[:placement].first.should be_a(String)
instance[:private_dns_name].should be_a(String)
instance[:product_codes].should be_an(Array)
# instance[:product_codes].first.should be_a(String)
instance[:ramdisk_id].should be_a(String)
instance[:reason].should be_a(String)
reservation = actual.body['reservationSet'].select {|reservation| reservation['reservationId'] == @reservation_id}.first
reservation['groupSet'].should be_an(Array)
reservation['groupSet'].first.should be_a(String)
reservation['ownerId'].should be_a(String)
reservation['reservationId'].should be_a(String)
instance = reservation['instancesSet'].select {|instance| instance['instanceId'] == @instance_id}.first
instance['amiLaunchIndex'].should be_an(Integer)
instance['dnsName'].should be_a(String)
instance['imageId'].should be_a(String)
instance['instanceId'].should be_a(String)
instance['instanceState'].should be_a(Hash)
instance['instanceState']['code'].should be_a(String)
instance['instanceState']['name'].should be_a(String)
instance['instanceType'].should be_a(String)
instance['kernelId'].should be_a(String)
instance['keyName'].should be_a(String) if instance['keyName']
instance['launchTime'].should be_a(Time)
instance['monitoring'].should be_a(Hash)
[true, false].should include(instance['monitoring']['state'])
instance['placement'].should be_an(Array)
instance['placement'].first.should be_a(String)
instance['privateDnsName'].should be_a(String)
instance['productCodes'].should be_an(Array)
instance['productCodes'].first.should be_a(String) if instance['productCodes'].first
instance['ramdiskId'].should be_a(String)
instance['reason'].should be_a(String)
end
end

View file

@ -12,20 +12,20 @@ describe 'EC2.describe_key_pairs' do
it "should return proper attributes with no params" do
actual = ec2.describe_key_pairs
actual.body[:key_set].should be_an(Array)
actual.body[:request_id].should be_a(String)
key_pair = actual.body[:key_set].select {|key| key[:key_name] == 'key_name' }.first
key_pair[:key_fingerprint].should be_a(String)
key_pair[:key_name].should be_a(String)
actual.body['keySet'].should be_an(Array)
actual.body['requestId'].should be_a(String)
key_pair = actual.body['keySet'].select {|key| key['keyName'] == 'key_name' }.first
key_pair['keyFingerprint'].should be_a(String)
key_pair['keyName'].should be_a(String)
end
it "should return proper attributes with params" do
actual = ec2.describe_key_pairs(['key_name'])
actual.body[:key_set].should be_an(Array)
actual.body[:request_id].should be_a(String)
key_pair = actual.body[:key_set].select {|key| key[:key_name] == 'key_name' }.first
key_pair[:key_fingerprint].should be_a(String)
key_pair[:key_name].should be_a(String)
actual.body['keySet'].should be_an(Array)
actual.body['requestId'].should be_a(String)
key_pair = actual.body['keySet'].select {|key| key['keyName'] == 'key_name' }.first
key_pair['keyFingerprint'].should be_a(String)
key_pair['keyName'].should be_a(String)
end
end

View file

@ -4,16 +4,16 @@ describe 'EC2.describe_availability_zones' do
it "should return proper attributes with no params" do
actual = ec2.describe_regions
zone = actual.body[:region_info].first
zone[:region_endpoint].should be_a(String)
zone[:region_name].should be_a(String)
zone = actual.body['regionInfo'].first
zone['regionEndpoint'].should be_a(String)
zone['regionName'].should be_a(String)
end
it "should return proper attribute with params" do
actual = ec2.describe_regions(['us-east-1'])
zone = actual.body[:region_info].first
zone[:region_endpoint].should be_a(String)
zone[:region_name].should be_a(String)
zone = actual.body['regionInfo'].first
zone['regionEndpoint'].should be_a(String)
zone['regionName'].should be_a(String)
end
end

View file

@ -4,46 +4,46 @@ describe 'EC2.describe_security_groups' do
it "should return proper attributes with no params" do
actual = ec2.describe_security_groups
actual.body[:request_id].should be_a(String)
actual.body[:security_group_info].should be_an(Array)
security_group = actual.body[:security_group_info].select do |security_group|
security_group[:group_name] == 'default'
actual.body['requestId'].should be_a(String)
actual.body['securityGroupInfo'].should be_an(Array)
security_group = actual.body['securityGroupInfo'].select do |security_group|
security_group['groupName'] == 'default'
end.first
security_group[:group_description].should be_a(String)
security_group[:group_name].should be_a(String)
security_group[:owner_id].should be_a(String)
security_group[:ip_permissions].should be_an(Array)
ip_permission = security_group[:ip_permissions].first
ip_permission[:groups].should be_an(Array)
group = ip_permission[:groups].first
group[:group_name].should be_a(String)
group[:user_id].should be_a(String)
ip_permission[:from_port].should be_an(Integer)
ip_permission[:ip_protocol].should be_a(String)
ip_permission[:ip_ranges].should be_an(Array)
ip_permission[:to_port].should be_an(Integer)
security_group['groupDescription'].should be_a(String)
security_group['groupName'].should be_a(String)
security_group['ownerId'].should be_a(String)
security_group['ipPermissions'].should be_an(Array)
ip_permission = security_group['ipPermissions'].first
ip_permission['groups'].should be_an(Array)
group = ip_permission['groups'].first
group['groupName'].should be_a(String)
group['userId'].should be_a(String)
ip_permission['fromPort'].should be_an(Integer)
ip_permission['ipProtocol'].should be_a(String)
ip_permission['ipRanges'].should be_an(Array)
ip_permission['toPort'].should be_an(Integer)
end
it "should return proper attributes with params" do
actual = ec2.describe_security_groups('default')
actual.body[:request_id].should be_a(String)
actual.body[:security_group_info].should be_an(Array)
security_group = actual.body[:security_group_info].select do |security_group|
security_group[:group_name] == 'default'
actual.body['requestId'].should be_a(String)
actual.body['securityGroupInfo'].should be_an(Array)
security_group = actual.body['securityGroupInfo'].select do |security_group|
security_group['groupName'] == 'default'
end.first
security_group[:group_name].should be_a(String)
security_group[:group_description].should be_a(String)
security_group[:owner_id].should be_a(String)
security_group[:ip_permissions].should be_an(Array)
ip_permission = security_group[:ip_permissions].first
ip_permission[:groups].should be_an(Array)
group = ip_permission[:groups].first
group[:group_name].should be_a(String)
group[:user_id].should be_a(String)
ip_permission[:from_port].should be_an(Integer)
ip_permission[:ip_protocol].should be_a(String)
ip_permission[:ip_ranges].should be_an(Array)
ip_permission[:to_port].should be_an(Integer)
security_group['groupDescription'].should be_a(String)
security_group['groupName'].should be_a(String)
security_group['ownerId'].should be_a(String)
security_group['ipPermissions'].should be_an(Array)
ip_permission = security_group['ipPermissions'].first
ip_permission['groups'].should be_an(Array)
group = ip_permission['groups'].first
group['groupName'].should be_a(String)
group['userId'].should be_a(String)
ip_permission['fromPort'].should be_an(Integer)
ip_permission['ipProtocol'].should be_a(String)
ip_permission['ipRanges'].should be_an(Array)
ip_permission['toPort'].should be_an(Integer)
end
end

View file

@ -3,8 +3,8 @@ require File.dirname(__FILE__) + '/../../spec_helper'
describe 'EC2.describe_snapshots' do
before(:all) do
@volume_id = ec2.create_volume('us-east-1a', 1).body[:volume_id]
@snapshot_id = ec2.create_snapshot(@volume_id).body[:snapshot_id]
@volume_id = ec2.create_volume('us-east-1a', 1).body['volumeId']
@snapshot_id = ec2.create_snapshot(@volume_id).body['snapshotId']
end
after(:all) do
@ -17,26 +17,26 @@ describe 'EC2.describe_snapshots' do
it "should return proper attributes with no params" do
eventually do
actual = ec2.describe_snapshots
actual.body[:snapshot_set].should be_an(Array)
snapshot = actual.body[:snapshot_set].select {|snapshot| snapshot[:snapshot_id] == @snapshot_id}.first
snapshot[:progress].should be_a(String)
snapshot[:snapshot_id].should be_a(String)
snapshot[:start_time].should be_a(Time)
snapshot[:status].should be_a(String)
snapshot[:volume_id].should be_a(String)
actual.body['snapshotSet'].should be_an(Array)
snapshot = actual.body['snapshotSet'].select {|snapshot| snapshot['snapshotId'] == @snapshot_id}.first
snapshot['progress'].should be_a(String)
snapshot['snapshotId'].should be_a(String)
snapshot['startTime'].should be_a(Time)
snapshot['status'].should be_a(String)
snapshot['volumeId'].should be_a(String)
end
end
it "should return proper attributes with params" do
eventually do
actual = ec2.describe_snapshots([@snapshot_id])
actual.body[:snapshot_set].should be_an(Array)
snapshot = actual.body[:snapshot_set].select {|snapshot| snapshot[:snapshot_id] == @snapshot_id}.first
snapshot[:progress].should be_a(String)
snapshot[:snapshot_id].should be_a(String)
snapshot[:start_time].should be_a(Time)
snapshot[:status].should be_a(String)
snapshot[:volume_id].should be_a(String)
actual.body['snapshotSet'].should be_an(Array)
snapshot = actual.body['snapshotSet'].select {|snapshot| snapshot['snapshotId'] == @snapshot_id}.first
snapshot['progress'].should be_a(String)
snapshot['snapshotId'].should be_a(String)
snapshot['startTime'].should be_a(Time)
snapshot['status'].should be_a(String)
snapshot['volumeId'].should be_a(String)
end
end

View file

@ -3,7 +3,7 @@ require File.dirname(__FILE__) + '/../../spec_helper'
describe 'EC2.describe_volumes' do
before(:all) do
@volume_id = ec2.create_volume('us-east-1a', 1).body[:volume_id]
@volume_id = ec2.create_volume('us-east-1a', 1).body['volumeId']
end
after(:all) do
@ -12,28 +12,28 @@ describe 'EC2.describe_volumes' do
it "should return proper attributes with no params" do
actual = ec2.describe_volumes
actual.body[:request_id].should be_a(String)
volume = actual.body[:volume_set].select {|volume| volume[:volume_id] == @volume_id}.first
volume[:availability_zone].should be_a(String)
volume[:create_time].should be_a(Time)
volume[:size].should == 1
volume[:snapshot_id].should == ''
volume[:status].should be_a(String)
volume[:volume_id].should == @volume_id
volume[:attachment_set].should == []
actual.body['requestId'].should be_a(String)
volume = actual.body['volumeSet'].select {|volume| volume['volumeId'] == @volume_id}.first
volume['availabilityZone'].should be_a(String)
volume['createTime'].should be_a(Time)
volume['size'].should == 1
volume['snapshotId'].should == ''
volume['status'].should be_a(String)
volume['volumeId'].should == @volume_id
volume['attachmentSet'].should == []
end
it "should return proper attributes for specific volume" do
actual = ec2.describe_volumes(@volume_id)
actual.body[:request_id].should be_a(String)
volume = actual.body[:volume_set].select {|volume| volume[:volume_id] == @volume_id}.first
volume[:availability_zone].should be_a(String)
volume[:create_time].should be_a(Time)
volume[:size].should == 1
volume[:snapshot_id].should == ''
volume[:status].should be_a(String)
volume[:volume_id].should == @volume_id
volume[:attachment_set].should == []
actual.body['requestId'].should be_a(String)
volume = actual.body['volumeSet'].select {|volume| volume['volumeId'] == @volume_id}.first
volume['availabilityZone'].should be_a(String)
volume['createTime'].should be_a(Time)
volume['size'].should == 1
volume['snapshotId'].should == ''
volume['status'].should be_a(String)
volume['volumeId'].should == @volume_id
volume['attachmentSet'].should == []
end
end

View file

@ -3,8 +3,8 @@ require File.dirname(__FILE__) + '/../../spec_helper'
describe 'EC2.detach_volume' do
before(:all) do
@instance_id = ec2.run_instances('ami-5ee70037', 1, 1, {:availability_zone => 'us-east-1a'}).body[:instances_set].first[:instance_id]
@volume_id = ec2.create_volume('us-east-1a', 1).body[:volume_id]
@instance_id = ec2.run_instances('ami-5ee70037', 1, 1, {'Placement.AvailabilityZone' => 'us-east-1a'}).body['instancesSet'].first['instanceId']
@volume_id = ec2.create_volume('us-east-1a', 1).body['volumeId']
eventually(128) do
ec2.attach_volume(@volume_id, @instance_id, '/dev/sdh')
end
@ -20,12 +20,12 @@ describe 'EC2.detach_volume' do
it "should return proper attributes" do
eventually do
actual = ec2.detach_volume(@volume_id)
actual.body[:attach_time].should be_a(Time)
actual.body[:device].should be_a(String)
actual.body[:instance_id].should be_a(String)
actual.body[:request_id].should be_a(String)
actual.body[:status].should be_a(String)
actual.body[:volume_id].should be_a(String)
actual.body['attachTime'].should be_a(Time)
actual.body['device'].should be_a(String)
actual.body['instanceId'].should be_a(String)
actual.body['requestId'].should be_a(String)
actual.body['status'].should be_a(String)
actual.body['volumeId'].should be_a(String)
end
end

View file

@ -3,8 +3,8 @@ require File.dirname(__FILE__) + '/../../spec_helper'
describe 'EC2.disassociate_address' do
before(:all) do
@instance_id = ec2.run_instances('ami-5ee70037', 1, 1).body[:instances_set].first[:instance_id]
@public_ip = ec2.allocate_address.body[:public_ip]
@instance_id = ec2.run_instances('ami-5ee70037', 1, 1).body['instancesSet'].first['instanceId']
@public_ip = ec2.allocate_address.body['publicIp']
ec2.associate_address(@instance_id, @public_ip)
end
@ -15,8 +15,8 @@ describe 'EC2.disassociate_address' do
it "should return proper attributes" do
actual = ec2.disassociate_address(@public_ip)
actual.body[:request_id].should be_a(String)
[false, true].should include(actual.body[:return])
actual.body['requestId'].should be_a(String)
[false, true].should include(actual.body['return'])
end
end

View file

@ -3,7 +3,7 @@ require File.dirname(__FILE__) + '/../../spec_helper'
describe 'EC2.get_console_output' do
before(:all) do
@instance_id = ec2.run_instances('ami-5ee70037', 1, 1).body[:instances_set].first[:instance_id]
@instance_id = ec2.run_instances('ami-5ee70037', 1, 1).body['instancesSet'].first['instanceId']
end
after(:all) do
@ -12,11 +12,10 @@ describe 'EC2.get_console_output' do
it "should return proper attributes" do
actual = ec2.get_console_output(@instance_id)
p actual
# actual.body[:instance_id].should be_a(String)
# actual.body[:output].should be_a(String)
# actual.body[:request_id].should be_a(String)
# actual.body[:timestamp].should be_a(Time)
actual.body['instanceId'].should be_a(String)
actual.body['output'].should be_a(String)
actual.body['requestId'].should be_a(String)
actual.body['timestamp'].should be_a(Time)
end
end

View file

@ -3,7 +3,7 @@ require File.dirname(__FILE__) + '/../../spec_helper'
describe 'EC2.reboot_instances' do
before(:all) do
@instance_id = ec2.run_instances('ami-5ee70037', 1, 1).body[:instances_set].first[:instance_id]
@instance_id = ec2.run_instances('ami-5ee70037', 1, 1).body['instancesSet'].first['instanceId']
end
after(:all) do
@ -12,8 +12,8 @@ describe 'EC2.reboot_instances' do
it "should return proper attributes" do
actual = ec2.reboot_instances([@instance_id])
actual.body[:request_id].should be_a(String)
[false, true].should include(actual.body[:return])
actual.body['requestId'].should be_a(String)
[false, true].should include(actual.body['return'])
end
end

View file

@ -1,15 +1,15 @@
require File.dirname(__FILE__) + '/../../spec_helper'
describe 'EC2.release' do
describe 'EC2.release_address' do
before(:all) do
@public_ip = ec2.allocate_address.body[:public_ip]
@public_ip = ec2.allocate_address.body['publicIp']
end
it "should return proper attributes" do
actual = ec2.release_address(@public_ip)
actual.body[:request_id].should be_a(String)
actual.body[:return].should == true
actual.body['requestId'].should be_a(String)
actual.body['return'].should == true
end
end

View file

@ -5,11 +5,10 @@ describe 'EC2.revoke_security_group_ingress' do
before(:all) do
ec2.create_security_group('fog_security_group', 'a security group for testing fog')
ec2.authorize_security_group_ingress({
:cidr_id => '127.0.0.1',
:from_port => 80,
:group_name => 'fog_security_group',
:ip_protocol => 'tcp',
:to_port => 80,
'FromPort' => 80,
'GroupName' => 'fog_security_group',
'IpProtocol' => 'tcp',
'ToPort' => 80
})
end
@ -19,40 +18,13 @@ describe 'EC2.revoke_security_group_ingress' do
it "should return proper attributes" do
actual = ec2.revoke_security_group_ingress({
:cidr_id => '127.0.0.1',
:from_port => 80,
:group_name => 'fog_security_group',
:ip_protocol => 'tcp',
:to_port => 80,
'FromPort' => 80,
'GroupName' => 'fog_security_group',
'IpProtocol' => 'tcp',
'ToPort' => 80
})
actual.body[:request_id].should be_a(String)
[false, true].should include(actual.body[:return])
end
end
require File.dirname(__FILE__) + '/../../spec_helper'
describe 'EC2.authorize_security_group_ingress' do
before(:all) do
ec2.create_security_group('fog_security_group', 'a security group for testing fog')
end
after(:all) do
ec2.delete_security_group('fog_security_group')
end
it "should return proper attributes" do
actual = ec2.authorize_security_group_ingress({
:cidr_id => '127.0.0.1',
:from_port => 80,
:group_name => 'fog_security_group',
:ip_protocol => 'tcp',
:to_port => 80,
})
actual.body[:request_id].should be_a(String)
[false, true].should include(actual.body[:return])
actual.body['requestId'].should be_a(String)
[false, true].should include(actual.body['return'])
end
end

View file

@ -8,32 +8,32 @@ describe 'EC2.run_instances' do
it "should return proper attributes" do
actual = ec2.run_instances('ami-5ee70037', 1, 1)
@instance_id = actual.body[:instances_set].first[:instance_id]
actual.body[:group_set].should be_an(Array)
actual.body[:group_set].first.should be_a(String)
actual.body[:instances_set].should be_an(Array)
instance = actual.body[:instances_set].first
instance[:ami_launch_index].should be_a(Integer)
instance[:dns_name].should be_a(String)
instance[:image_id].should be_a(String)
instance[:instance_id].should be_a(String)
instance[:instance_state].should be_an(Hash)
instance[:instance_state][:code].should be_an(Integer)
instance[:instance_state][:name].should be_an(String)
instance[:instance_type].should be_a(String)
instance[:kernel_id].should be_a(String)
# instance[:key_name].should be_a(String)
instance[:launch_time].should be_a(Time)
instance[:monitoring].should be_a(Hash)
[false, true].should include(instance[:monitoring][:state])
instance[:placement].should be_a(Hash)
instance[:placement][:availability_zone].should be_a(String)
instance[:private_dns_name].should be_a(String)
instance[:ramdisk_id].should be_a(String)
instance[:reason].should be_a(String)
actual.body[:owner_id].should be_a(String)
actual.body[:request_id].should be_a(String)
actual.body[:reservation_id].should be_a(String)
@instance_id = actual.body['instancesSet'].first['instanceId']
actual.body['groupSet'].should be_an(Array)
actual.body['groupSet'].first.should be_a(String)
actual.body['instancesSet'].should be_an(Array)
instance = actual.body['instancesSet'].first
instance['amiLaunchIndex'].should be_a(Integer)
instance['dnsName'].should be_a(String)
instance['imageId'].should be_a(String)
instance['instanceId'].should be_a(String)
instance['instanceState'].should be_an(Hash)
instance['instanceState']['code'].should be_an(Integer)
instance['instanceState']['name'].should be_an(String)
instance['instanceType'].should be_a(String)
instance['kernelId'].should be_a(String)
instance['keyName'].should be_a(String) if instance['keyName']
instance['launchTime'].should be_a(Time)
instance['monitoring'].should be_a(Hash)
[false, true].should include(instance['monitoring']['state'])
instance['placement'].should be_a(Hash)
instance['placement']['availabilityZone'].should be_a(String)
instance['privateDnsName'].should be_a(String)
instance['ramdiskId'].should be_a(String)
instance['reason'].should be_a(String)
actual.body['ownerId'].should be_a(String)
actual.body['requestId'].should be_a(String)
actual.body['reservationId'].should be_a(String)
end
end

View file

@ -3,22 +3,22 @@ require File.dirname(__FILE__) + '/../../spec_helper'
describe 'EC2.terminate_instances' do
before(:all) do
@instance_id = ec2.run_instances('ami-5ee70037', 1, 1).body[:instances_set].first[:instance_id]
@instance_id = ec2.run_instances('ami-5ee70037', 1, 1).body['instancesSet'].first['instanceId']
end
it "should return proper attributes" do
actual = ec2.terminate_instances([@instance_id])
actual.body[:request_id].should be_a(String)
actual.body[:instances_set].should be_an(Array)
instance = actual.body[:instances_set].select {|instance| instance[:instance_id] == @instance_id}.first
instance[:previous_state].should be_a(Hash)
previous_state = instance[:previous_state]
previous_state[:code].should be_a(Integer)
previous_state[:name].should be_a(String)
instance[:shutdown_state].should be_a(Hash)
shutdown_state = instance[:shutdown_state]
shutdown_state[:code].should be_a(Integer)
shutdown_state[:name].should be_a(String)
actual.body['requestId'].should be_a(String)
actual.body['instancesSet'].should be_an(Array)
instance = actual.body['instancesSet'].select {|instance| instance['instanceId'] == @instance_id}.first
instance['previousState'].should be_a(Hash)
previous_state = instance['previousState']
previous_state['code'].should be_a(Integer)
previous_state['name'].should be_a(String)
instance['shutdownState'].should be_a(Hash)
shutdown_state = instance['shutdownState']
shutdown_state['code'].should be_a(Integer)
shutdown_state['name'].should be_a(String)
end
end