fog 1.1.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/Rakefile +3 -3
- data/changelog.txt +213 -0
- data/docs/compute/index.markdown +15 -1
- data/fog.gemspec +3 -3
- data/lib/fog.rb +1 -1
- data/lib/fog/aws.rb +9 -0
- data/lib/fog/aws/auto_scaling.rb +3 -1
- data/lib/fog/aws/cloud_formation.rb +2 -0
- data/lib/fog/aws/cloud_watch.rb +2 -0
- data/lib/fog/aws/compute.rb +9 -3
- data/lib/fog/aws/elasticache.rb +8 -1
- data/lib/fog/aws/elb.rb +2 -0
- data/lib/fog/aws/models/cloud_watch/metric_statistic.rb +1 -2
- data/lib/fog/aws/models/compute/security_group.rb +1 -1
- data/lib/fog/aws/models/compute/server.rb +3 -1
- data/lib/fog/aws/models/dns/records.rb +3 -3
- data/lib/fog/aws/models/elb/load_balancer.rb +6 -0
- data/lib/fog/aws/models/storage/file.rb +2 -2
- data/lib/fog/aws/models/storage/files.rb +4 -4
- data/lib/fog/aws/parsers/compute/describe_instance_status.rb +64 -0
- data/lib/fog/aws/parsers/compute/describe_security_groups.rb +1 -1
- data/lib/fog/aws/parsers/sqs/receive_message.rb +1 -1
- data/lib/fog/aws/parsers/sts/get_session_token.rb +31 -0
- data/lib/fog/aws/rds.rb +36 -1
- data/lib/fog/aws/requests/compute/describe_availability_zones.rb +3 -0
- data/lib/fog/aws/requests/compute/describe_instance_status.rb +36 -0
- data/lib/fog/aws/requests/compute/describe_security_groups.rb +2 -0
- data/lib/fog/aws/requests/elb/set_load_balancer_listener_ssl_certificate.rb +27 -0
- data/lib/fog/aws/requests/rds/create_db_instance.rb +64 -1
- data/lib/fog/aws/requests/rds/delete_db_instance.rb +19 -3
- data/lib/fog/aws/requests/rds/describe_db_instances.rb +40 -1
- data/lib/fog/aws/requests/rds/describe_db_reserved_instances.rb +1 -1
- data/lib/fog/aws/requests/rds/modify_db_instance.rb +24 -1
- data/lib/fog/aws/requests/rds/reboot_db_instance.rb +17 -1
- data/lib/fog/aws/requests/storage/{hash_to_acl.rb → acl_utils.rb} +8 -0
- data/lib/fog/aws/requests/storage/copy_object.rb +8 -0
- data/lib/fog/aws/requests/storage/get_bucket_acl.rb +7 -1
- data/lib/fog/aws/requests/storage/get_object_acl.rb +7 -1
- data/lib/fog/aws/requests/storage/get_object_http_url.rb +4 -3
- data/lib/fog/aws/requests/storage/get_object_https_url.rb +4 -3
- data/lib/fog/aws/requests/storage/put_bucket_acl.rb +2 -2
- data/lib/fog/aws/requests/storage/put_object_acl.rb +1 -1
- data/lib/fog/aws/requests/sts/get_federation_token.rb +20 -0
- data/lib/fog/aws/requests/sts/get_session_token.rb +18 -0
- data/lib/fog/aws/simpledb.rb +5 -1
- data/lib/fog/aws/sns.rb +2 -0
- data/lib/fog/aws/sqs.rb +5 -1
- data/lib/fog/aws/storage.rb +6 -0
- data/lib/fog/aws/sts.rb +137 -0
- data/lib/fog/bin.rb +1 -0
- data/lib/fog/bin/aws.rb +2 -0
- data/lib/fog/bin/clodo.rb +31 -0
- data/lib/fog/brightbox/compute.rb +7 -0
- data/lib/fog/brightbox/models/compute/cloud_ip.rb +10 -2
- data/lib/fog/brightbox/models/compute/firewall_policies.rb +29 -0
- data/lib/fog/brightbox/models/compute/firewall_policy.rb +65 -0
- data/lib/fog/brightbox/models/compute/firewall_rule.rb +54 -0
- data/lib/fog/brightbox/models/compute/firewall_rules.rb +24 -0
- data/lib/fog/brightbox/models/compute/image.rb +2 -0
- data/lib/fog/brightbox/models/compute/server.rb +41 -6
- data/lib/fog/brightbox/models/compute/server_group.rb +56 -17
- data/lib/fog/brightbox/requests/compute/remove_firewall_policy.rb +14 -0
- data/lib/fog/clodo.rb +34 -0
- data/lib/fog/clodo/compute.rb +152 -0
- data/lib/fog/clodo/models/compute/image.rb +31 -0
- data/lib/fog/clodo/models/compute/images.rb +28 -0
- data/lib/fog/clodo/models/compute/server.rb +163 -0
- data/lib/fog/clodo/models/compute/servers.rb +36 -0
- data/lib/fog/clodo/requests/compute/add_ip_address.rb +49 -0
- data/lib/fog/clodo/requests/compute/create_server.rb +112 -0
- data/lib/fog/clodo/requests/compute/delete_ip_address.rb +47 -0
- data/lib/fog/clodo/requests/compute/delete_server.rb +44 -0
- data/lib/fog/clodo/requests/compute/get_image_details.rb +20 -0
- data/lib/fog/clodo/requests/compute/get_server_details.rb +49 -0
- data/lib/fog/clodo/requests/compute/list_images.rb +48 -0
- data/lib/fog/clodo/requests/compute/list_images_detail.rb +61 -0
- data/lib/fog/clodo/requests/compute/list_servers.rb +50 -0
- data/lib/fog/clodo/requests/compute/list_servers_detail.rb +51 -0
- data/lib/fog/clodo/requests/compute/move_ip_address.rb +34 -0
- data/lib/fog/clodo/requests/compute/reboot_server.rb +19 -0
- data/lib/fog/clodo/requests/compute/rebuild_server.rb +21 -0
- data/lib/fog/clodo/requests/compute/server_action.rb +25 -0
- data/lib/fog/clodo/requests/compute/start_server.rb +19 -0
- data/lib/fog/clodo/requests/compute/stop_server.rb +19 -0
- data/lib/fog/compute.rb +3 -0
- data/lib/fog/core/credentials.rb +3 -3
- data/lib/fog/core/errors.rb +2 -0
- data/lib/fog/core/wait_for.rb +1 -1
- data/lib/fog/dnsmadeeasy/dns.rb +1 -1
- data/lib/fog/libvirt/compute.rb +2 -0
- data/lib/fog/libvirt/models/compute/nodes.rb +1 -3
- data/lib/fog/libvirt/models/compute/server.rb +8 -1
- data/lib/fog/providers.rb +1 -0
- data/lib/fog/rackspace/dns.rb +10 -2
- data/lib/fog/rackspace/load_balancers.rb +3 -0
- data/lib/fog/rackspace/models/compute/server.rb +2 -2
- data/lib/fog/rackspace/models/dns/callback.rb +3 -1
- data/lib/fog/rackspace/models/dns/record.rb +4 -0
- data/lib/fog/rackspace/models/load_balancers/load_balancer.rb +18 -8
- data/lib/fog/rackspace/requests/load_balancers/delete_nodes.rb +1 -2
- data/lib/fog/rackspace/requests/load_balancers/get_error_page.rb +15 -0
- data/lib/fog/rackspace/requests/load_balancers/list_load_balancers.rb +8 -2
- data/lib/fog/rackspace/requests/load_balancers/remove_error_page.rb +15 -0
- data/lib/fog/rackspace/requests/load_balancers/set_error_page.rb +21 -0
- data/lib/fog/vcloud/compute.rb +7 -1
- data/lib/fog/vcloud/models/compute/catalogs.rb +4 -5
- data/lib/fog/vcloud/models/compute/helpers/status.rb +37 -0
- data/lib/fog/vcloud/models/compute/network.rb +13 -49
- data/lib/fog/vcloud/models/compute/networks.rb +12 -3
- data/lib/fog/vcloud/models/compute/organization.rb +44 -0
- data/lib/fog/vcloud/models/compute/organizations.rb +29 -0
- data/lib/fog/vcloud/models/compute/server.rb +35 -56
- data/lib/fog/vcloud/models/compute/servers.rb +11 -13
- data/lib/fog/vcloud/models/compute/vapp.rb +41 -0
- data/lib/fog/vcloud/models/compute/vapps.rb +32 -0
- data/lib/fog/vcloud/models/compute/vdc.rb +11 -26
- data/lib/fog/vcloud/models/compute/vdcs.rb +6 -8
- data/lib/fog/vcloud/requests/compute/get_server.rb +10 -0
- data/lib/fog/vsphere/compute.rb +1 -0
- data/lib/fog/vsphere/models/compute/server.rb +18 -0
- data/lib/fog/vsphere/models/compute/servers.rb +8 -2
- data/lib/fog/vsphere/requests/compute/datacenters.rb +34 -0
- data/lib/fog/vsphere/requests/compute/list_virtual_machines.rb +132 -91
- data/lib/fog/vsphere/requests/compute/vm_clone.rb +76 -37
- data/spec/lib/fog/aws/parsers/sqs/receive_message_spec.rb +58 -0
- data/tests/aws/models/elb/model_tests.rb +5 -0
- data/tests/aws/requests/compute/instance_tests.rb +23 -0
- data/tests/aws/requests/compute/security_group_tests.rb +1 -0
- data/tests/aws/requests/elb/listener_tests.rb +4 -0
- data/tests/aws/requests/storage/{hash_to_acl_tests.rb → acl_utils_tests.rb} +38 -2
- data/tests/aws/requests/storage/bucket_tests.rb +0 -3
- data/tests/aws/requests/storage/object_tests.rb +2 -4
- data/tests/aws/requests/sts/get_federation_token_tests.rb +21 -0
- data/tests/aws/requests/sts/session_token_tests.rb +16 -0
- data/tests/brightbox/requests/compute/account_tests.rb +11 -6
- data/tests/brightbox/requests/compute/api_client_tests.rb +23 -12
- data/tests/brightbox/requests/compute/cloud_ip_tests.rb +32 -17
- data/tests/brightbox/requests/compute/helper.rb +29 -3
- data/tests/brightbox/requests/compute/image_tests.rb +17 -14
- data/tests/brightbox/requests/compute/interface_tests.rb +3 -2
- data/tests/brightbox/requests/compute/load_balancer_tests.rb +57 -11
- data/tests/brightbox/requests/compute/server_group_tests.rb +29 -22
- data/tests/brightbox/requests/compute/server_tests.rb +41 -22
- data/tests/brightbox/requests/compute/server_type_tests.rb +7 -6
- data/tests/brightbox/requests/compute/user_tests.rb +11 -16
- data/tests/brightbox/requests/compute/zone_tests.rb +7 -6
- data/tests/clodo/requests/compute/image_tests.rb +36 -0
- data/tests/clodo/requests/compute/server_tests.rb +152 -0
- data/tests/compute/helper.rb +1 -1
- data/tests/core/credential_tests.rb +2 -2
- data/tests/glesys/requests/compute/helper.rb +91 -66
- data/tests/glesys/requests/compute/ip_tests.rb +1 -1
- data/tests/glesys/requests/compute/server_tests.rb +5 -5
- data/tests/helpers/mock_helper.rb +2 -0
- data/tests/rackspace/models/dns/zone_tests.rb +14 -0
- data/tests/rackspace/models/{access_list_tests.rb → load_balancers/access_list_tests.rb} +0 -0
- data/tests/rackspace/models/{access_lists_tests.rb → load_balancers/access_lists_tests.rb} +0 -0
- data/tests/rackspace/models/{load_balancer_tests.rb → load_balancers/load_balancer_tests.rb} +25 -0
- data/tests/rackspace/models/{load_balancers_tests.rb → load_balancers/load_balancers_tests.rb} +0 -0
- data/tests/rackspace/models/{node_tests.rb → load_balancers/node_tests.rb} +0 -0
- data/tests/rackspace/models/{nodes_tests.rb → load_balancers/nodes_tests.rb} +0 -0
- data/tests/rackspace/models/{virtual_ip_tests.rb → load_balancers/virtual_ip_tests.rb} +0 -0
- data/tests/rackspace/models/{virtual_ips_tests.rb → load_balancers/virtual_ips_tests.rb} +0 -0
- data/tests/rackspace/requests/dns/dns_tests.rb +4 -2
- data/tests/rackspace/requests/load_balancers/error_page_tests.rb +31 -0
- data/tests/rackspace/requests/load_balancers/helper.rb +27 -11
- data/tests/rackspace/requests/load_balancers/load_balancer_tests.rb +4 -1
- data/tests/rackspace/requests/load_balancers/node_tests.rb +24 -25
- data/tests/slicehost/requests/compute/slice_tests.rb +2 -2
- data/tests/storm_on_demand/requests/compute/server_tests.rb +3 -3
- data/tests/vcloud/data/api_+_v1.0_+_admin_+_network_+_2 +110 -0
- data/tests/vcloud/data/api_+_v1.0_+_login +5 -0
- data/tests/vcloud/data/api_+_v1.0_+_network_+_1 +44 -0
- data/tests/vcloud/data/api_+_v1.0_+_network_+_2 +31 -0
- data/tests/vcloud/data/api_+_v1.0_+_org_+_1 +17 -0
- data/tests/vcloud/data/api_+_v1.0_+_vApp_+_vapp-1 +369 -0
- data/tests/vcloud/data/api_+_v1.0_+_vApp_+_vm-1 +139 -0
- data/tests/vcloud/data/api_+_v1.0_+_vApp_+_vm-2 +155 -0
- data/tests/vcloud/data/api_+_v1.0_+_vdc_+_1 +61 -0
- data/tests/vcloud/models/compute/conn_helper.rb +20 -0
- data/tests/vcloud/models/compute/network_tests.rb +65 -0
- data/tests/vcloud/models/compute/networks_tests.rb +42 -0
- data/tests/vcloud/models/compute/organization_tests.rb +13 -0
- data/tests/vcloud/models/compute/organizations_tests.rb +14 -0
- data/tests/vcloud/models/compute/server_tests.rb +136 -0
- data/tests/vcloud/models/compute/servers_tests.rb +10 -89
- data/tests/vcloud/models/compute/vapp_tests.rb +27 -0
- data/tests/vcloud/models/compute/vapps_tests.rb +17 -0
- data/tests/vcloud/models/compute/vdc_tests.rb +42 -0
- data/tests/vcloud/models/compute/vdcs_tests.rb +17 -0
- data/tests/vsphere/requests/compute/vm_clone_tests.rb +2 -6
- metadata +151 -55
@@ -6,14 +6,19 @@ module Fog
|
|
6
6
|
private
|
7
7
|
def vm_clone_check_options(options)
|
8
8
|
options = { 'force' => false }.merge(options)
|
9
|
-
required_options = %w{
|
9
|
+
required_options = %w{ path name }
|
10
10
|
required_options.each do |param|
|
11
11
|
raise ArgumentError, "#{required_options.join(', ')} are required" unless options.has_key? param
|
12
12
|
end
|
13
|
-
#
|
14
|
-
|
15
|
-
|
16
|
-
|
13
|
+
# The tap removes the leading empty string
|
14
|
+
path_elements = options['path'].split('/').tap { |o| o.shift }
|
15
|
+
first_folder = path_elements.shift
|
16
|
+
if first_folder != 'Datacenters' then
|
17
|
+
raise ArgumentError, "vm_clone path option must start with /Datacenters. Got: #{options['path']}"
|
18
|
+
end
|
19
|
+
dc_name = path_elements.shift
|
20
|
+
if not self.datacenters.include? dc_name then
|
21
|
+
raise ArgumentError, "Datacenter #{dc_name} does not exist, only datacenters #{self.dacenters.join(",")} are accessible."
|
17
22
|
end
|
18
23
|
options
|
19
24
|
end
|
@@ -25,23 +30,47 @@ module Fog
|
|
25
30
|
# Option handling
|
26
31
|
options = vm_clone_check_options(options)
|
27
32
|
|
28
|
-
notfound = lambda { raise Fog::Compute::Vsphere::NotFound, "
|
33
|
+
notfound = lambda { raise Fog::Compute::Vsphere::NotFound, "Could not find VM template" }
|
29
34
|
|
30
|
-
#
|
31
|
-
#
|
32
|
-
|
33
|
-
|
35
|
+
# Find the template in the folder. This is more efficient than
|
36
|
+
# searching ALL VM's looking for the template.
|
37
|
+
# Tap gets rid of the leading empty string and "Datacenters" element
|
38
|
+
# and returns the array.
|
39
|
+
path_elements = options['path'].split('/').tap { |ary| ary.shift 2 }
|
40
|
+
# The DC name itself.
|
41
|
+
template_dc = path_elements.shift
|
42
|
+
# If the first path element contains "vm" this denotes the vmFolder
|
43
|
+
# and needs to be shifted out
|
44
|
+
path_elements.shift if path_elements[0] = 'vm'
|
45
|
+
# The template name. The remaining elements are the folders in the
|
46
|
+
# datacenter.
|
47
|
+
template_name = path_elements.pop
|
48
|
+
# Make sure @datacenters is populated. We need the instances from the Hash keys.
|
49
|
+
self.datacenters
|
50
|
+
# Get the datacenter managed object from the hash
|
51
|
+
dc = @datacenters[template_dc]
|
52
|
+
# Get the VM Folder (Group) efficiently
|
53
|
+
vm_folder = dc.vmFolder
|
54
|
+
# Walk the tree resetting the folder pointer as we go
|
55
|
+
folder = path_elements.inject(vm_folder) do |current_folder, sub_folder_name|
|
56
|
+
# JJM VIM::Folder#find appears to be quite efficient as it uses the
|
57
|
+
# searchIndex It certainly appears to be faster than
|
58
|
+
# VIM::Folder#inventory since that returns _all_ managed objects of
|
59
|
+
# a certain type _and_ their properties.
|
60
|
+
sub_folder = current_folder.find(sub_folder_name, RbVmomi::VIM::Folder)
|
61
|
+
raise ArgumentError, "Could not descend into #{sub_folder_name}. Please check your path." unless sub_folder
|
62
|
+
sub_folder
|
34
63
|
end
|
35
64
|
|
36
|
-
#
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
65
|
+
# Now find the template itself using the efficient find method
|
66
|
+
vm_mob_ref = folder.find(template_name, RbVmomi::VIM::VirtualMachine)
|
67
|
+
|
68
|
+
# Now find _a_ resource pool of the template's host (REVISIT: We need
|
69
|
+
# to support cloning into a specific RP)
|
70
|
+
esx_host = vm_mob_ref.collect!('runtime.host')['runtime.host']
|
71
|
+
# The parent of the ESX host itself is a ComputeResource which has a resourcePool
|
72
|
+
resource_pool = esx_host.parent.resourcePool
|
73
|
+
|
45
74
|
# Next, create a Relocation Spec instance
|
46
75
|
relocation_spec = RbVmomi::VIM.VirtualMachineRelocateSpec(:pool => resource_pool,
|
47
76
|
:transform => options['transform'] || 'sparse')
|
@@ -50,27 +79,37 @@ module Fog
|
|
50
79
|
:powerOn => options['power_on'] || true,
|
51
80
|
:template => false)
|
52
81
|
task = vm_mob_ref.CloneVM_Task(:folder => vm_mob_ref.parent, :name => options['name'], :spec => clone_spec)
|
53
|
-
|
54
|
-
#
|
55
|
-
#
|
56
|
-
#
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
82
|
+
|
83
|
+
# Waiting for the VM to complete allows us to get the VirtulMachine
|
84
|
+
# object of the new machine when it's done. It is HIGHLY recommended
|
85
|
+
# to set 'wait' => true if your app wants to wait. Otherwise, you're
|
86
|
+
# going to have to reload the server model over and over which
|
87
|
+
# generates a lot of time consuming API calls to vmware.
|
88
|
+
if options['wait'] then
|
89
|
+
# REVISIT: It would be awesome to call a block passed to this
|
90
|
+
# request to notify the application how far along in the process we
|
91
|
+
# are. I'm thinking of updating a progress bar, etc...
|
92
|
+
new_vm = task.wait_for_completion
|
93
|
+
else
|
94
|
+
tries = 0
|
95
|
+
new_vm = begin
|
96
|
+
# Try and find the new VM (folder.find is quite efficient)
|
97
|
+
folder.find(options['name'], RbVmomi::VIM::VirtualMachine) or raise Fog::Vsphere::Errors::NotFound
|
98
|
+
rescue Fog::Vsphere::Errors::NotFound
|
99
|
+
tries += 1
|
100
|
+
if tries <= 10 then
|
101
|
+
sleep 15
|
102
|
+
retry
|
103
|
+
end
|
104
|
+
nil
|
67
105
|
end
|
68
|
-
nil
|
69
106
|
end
|
107
|
+
|
70
108
|
# Return hash
|
71
109
|
{
|
72
|
-
'vm_ref'
|
73
|
-
'
|
110
|
+
'vm_ref' => new_vm ? new_vm._ref : nil,
|
111
|
+
'vm_attributes' => new_vm ? convert_vm_mob_ref_to_attr_hash(new_vm) : {},
|
112
|
+
'task_ref' => task._ref
|
74
113
|
}
|
75
114
|
end
|
76
115
|
|
@@ -83,7 +122,7 @@ module Fog
|
|
83
122
|
options = vm_clone_check_options(options)
|
84
123
|
notfound = lambda { raise Fog::Compute::Vsphere::NotFound, "Cloud not find VM template" }
|
85
124
|
vm_mob_ref = list_virtual_machines['virtual_machines'].find(notfound) do |vm|
|
86
|
-
vm['
|
125
|
+
vm['name'] == options['path'].split("/")[-1]
|
87
126
|
end
|
88
127
|
{
|
89
128
|
'vm_ref' => 'vm-123',
|
@@ -0,0 +1,58 @@
|
|
1
|
+
require 'fog/core/parser'
|
2
|
+
require 'fog/aws/parsers/sqs/receive_message'
|
3
|
+
|
4
|
+
describe Fog::Parsers::AWS::SQS::ReceiveMessage do
|
5
|
+
let(:parser) { Fog::Parsers::AWS::SQS::ReceiveMessage.new }
|
6
|
+
|
7
|
+
let(:sent_timestamp) { 1322475007845 }
|
8
|
+
let(:approximate_first_receive_timestamp) { 1322494017370 }
|
9
|
+
|
10
|
+
let(:xml) do
|
11
|
+
<<-XML
|
12
|
+
<?xml version="1.0"?>
|
13
|
+
<ReceiveMessageResponse xmlns="http://queue.amazonaws.com/doc/2009-02-01/">
|
14
|
+
<ReceiveMessageResult>
|
15
|
+
<Message>
|
16
|
+
<MessageId>e4fbeece-7260-4106-807d-18255e43e687</MessageId>
|
17
|
+
<ReceiptHandle>gH2qdC6bjNtuE/U+iA5J/5HQK/lgvsTY0Vj+gFEXyRlsRL+EDf9tgjLxAW9cdutwjqgV22jyQyTgFsYV+G0oQc2posQntKVMZKqOLlrJqbKSOUnsBtkoWoD2MxyacbuDTG0q0a9yS3RpPSN4lV8RN0BrJjfoeQDRQOn/RIxtAH9H4C4NasSLODB1xJWcO/KsZYRch0IWL89a4YgP060XCxAyKYqY8O+GvNhX5d59JRAI6tO2sx9wLwytIHNlG97DDnUGb/6PNuYPmoZcvYOdfhMQgP28rdrUW3B7Pai+dqE=</ReceiptHandle>
|
18
|
+
<MD5OfBody>b425c09d8559b59dd989cf8c47caaf54</MD5OfBody>
|
19
|
+
<Body>testmessage</Body>
|
20
|
+
<Attribute><Name>SenderId</Name><Value>000000000000</Value></Attribute>
|
21
|
+
<Attribute><Name>SentTimestamp</Name><Value>#{sent_timestamp}</Value></Attribute>
|
22
|
+
<Attribute><Name>ApproximateReceiveCount</Name><Value>2</Value></Attribute>
|
23
|
+
<Attribute><Name>ApproximateFirstReceiveTimestamp</Name><Value>#{approximate_first_receive_timestamp}</Value></Attribute>
|
24
|
+
</Message>
|
25
|
+
</ReceiveMessageResult>
|
26
|
+
<ResponseMetadata><RequestId>72c77661-d4b5-45b9-8a82-a685c980e9dd</RequestId></ResponseMetadata>
|
27
|
+
</ReceiveMessageResponse>
|
28
|
+
XML
|
29
|
+
end
|
30
|
+
|
31
|
+
def timestamp(attribute)
|
32
|
+
body = Nokogiri::XML::SAX::PushParser.new(parser)
|
33
|
+
body << xml
|
34
|
+
body.finish
|
35
|
+
response_body = parser.response
|
36
|
+
response_body['Message'].first['Attributes'][attribute].utc
|
37
|
+
end
|
38
|
+
|
39
|
+
it "converts SentTimestamp to the same time as a Time-like object" do
|
40
|
+
stamp = timestamp 'SentTimestamp'
|
41
|
+
stamp.year.should == 2011
|
42
|
+
stamp.month.should == 11
|
43
|
+
stamp.day.should == 28
|
44
|
+
stamp.hour.should == 10
|
45
|
+
stamp.min.should == 10
|
46
|
+
stamp.sec.should == 7
|
47
|
+
end
|
48
|
+
|
49
|
+
it "converts ApproximateFirstReceiveTimestamp to the same time as a Time-like object" do
|
50
|
+
stamp = timestamp 'ApproximateFirstReceiveTimestamp'
|
51
|
+
stamp.year.should == 2011
|
52
|
+
stamp.month.should == 11
|
53
|
+
stamp.day.should == 28
|
54
|
+
stamp.hour.should == 15
|
55
|
+
stamp.min.should == 26
|
56
|
+
stamp.sec.should == 57
|
57
|
+
end
|
58
|
+
end
|
@@ -244,6 +244,11 @@ Shindo.tests('AWS::ELB | models', ['aws', 'elb']) do
|
|
244
244
|
end
|
245
245
|
end
|
246
246
|
|
247
|
+
tests('setting a new ssl certificate id') do
|
248
|
+
elb.listeners.create(:instance_port => 443, :lb_port => 443, :protocol => 'HTTPS', :ssl_id => @certificate['Arn'])
|
249
|
+
elb.set_listener_ssl_certificate(443, @certificate['Arn'])
|
250
|
+
end
|
251
|
+
|
247
252
|
tests('destroy') do
|
248
253
|
elb.destroy
|
249
254
|
end
|
@@ -122,6 +122,25 @@ Shindo.tests('Fog::Compute[:aws] | instance requests', ['aws']) do
|
|
122
122
|
'requestId' => String
|
123
123
|
}
|
124
124
|
|
125
|
+
@describe_instance_status_format = {
|
126
|
+
'requestId' => String,
|
127
|
+
'instanceStatusSet' => [{
|
128
|
+
'instanceId' => String,
|
129
|
+
'availabilityZone' => String,
|
130
|
+
'instanceState' => {
|
131
|
+
'code' => Integer,
|
132
|
+
'name' => String
|
133
|
+
},
|
134
|
+
'eventsSet' => [{
|
135
|
+
'code' => String,
|
136
|
+
'description' => String,
|
137
|
+
'notBefore' => Time,
|
138
|
+
'notAfter' => Time
|
139
|
+
}]
|
140
|
+
}]
|
141
|
+
|
142
|
+
}
|
143
|
+
|
125
144
|
tests('success') do
|
126
145
|
|
127
146
|
@instance_id = nil
|
@@ -214,6 +233,10 @@ Shindo.tests('Fog::Compute[:aws] | instance requests', ['aws']) do
|
|
214
233
|
@reserved_instances
|
215
234
|
end
|
216
235
|
|
236
|
+
tests('#describe_instance_status').formats(@describe_instance_status_format) do
|
237
|
+
Fog::Compute[:aws].describe_instance_status.body
|
238
|
+
end
|
239
|
+
|
217
240
|
if Fog.mocking?
|
218
241
|
@reserved_instance_offering_id = @reserved_instances["reservedInstancesOfferingsSet"].first["reservedInstancesOfferingId"]
|
219
242
|
tests("#purchase_reserved_instances_offering('#{@reserved_instance_offering_id}')").formats(@purchase_reserved_instances_offering_format) do
|
@@ -4,6 +4,7 @@ Shindo.tests('Fog::Compute[:aws] | security group requests', ['aws']) do
|
|
4
4
|
'requestId' => String,
|
5
5
|
'securityGroupInfo' => [{
|
6
6
|
'groupDescription' => String,
|
7
|
+
'groupId' => Fog::Nullable::String,
|
7
8
|
'groupName' => String,
|
8
9
|
'ipPermissions' => [{
|
9
10
|
'fromPort' => Integer,
|
@@ -44,6 +44,10 @@ Shindo.tests('AWS::ELB | listener_tests', ['aws', 'elb']) do
|
|
44
44
|
Fog::AWS[:elb].create_load_balancer_listeners(@load_balancer_id, listeners).body
|
45
45
|
end
|
46
46
|
|
47
|
+
tests("#set_load_balancer_listener_ssl_certificate").formats(AWS::ELB::Formats::BASIC) do
|
48
|
+
Fog::AWS[:elb].set_load_balancer_listener_ssl_certificate(@load_balancer_id, 443, @certificate['Arn']).body
|
49
|
+
end
|
50
|
+
|
47
51
|
Fog::AWS[:iam].delete_server_certificate(@key_name)
|
48
52
|
Fog::AWS[:elb].delete_load_balancer(@load_balancer_id)
|
49
53
|
end
|
@@ -1,6 +1,6 @@
|
|
1
|
-
require 'fog/aws/requests/storage/
|
1
|
+
require 'fog/aws/requests/storage/acl_utils'
|
2
2
|
|
3
|
-
Shindo.tests('Fog::Storage::AWS |
|
3
|
+
Shindo.tests('Fog::Storage::AWS | ACL utils', [:aws]) do
|
4
4
|
tests(".hash_to_acl") do
|
5
5
|
tests(".hash_to_acl({}) at xpath //AccessControlPolicy").returns("", "has an empty AccessControlPolicy") do
|
6
6
|
xml = Fog::Storage::AWS.hash_to_acl({})
|
@@ -170,4 +170,40 @@ Shindo.tests('Fog::Storage::AWS | converting a hash to an ACL', [:aws]) do
|
|
170
170
|
Nokogiri::XML(xml).xpath("//AccessControlPolicy/AccessControlList/Grant/Grantee/URI").first.content
|
171
171
|
end
|
172
172
|
end
|
173
|
+
|
174
|
+
tests(".acl_to_hash") do
|
175
|
+
acl_xml = <<-XML
|
176
|
+
<AccessControlPolicy>
|
177
|
+
<Owner>
|
178
|
+
<ID>2744ccd10c7533bd736ad890f9dd5cab2adb27b07d500b9493f29cdc420cb2e0</ID>
|
179
|
+
<DisplayName>me</DisplayName>
|
180
|
+
</Owner>
|
181
|
+
<AccessControlList>
|
182
|
+
<Grant>
|
183
|
+
<Grantee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="CanonicalUser">
|
184
|
+
<ID>2744ccd10c7533bd736ad890f9dd5cab2adb27b07d500b9493f29cdc420cb2e0</ID>
|
185
|
+
<DisplayName>me</DisplayName>
|
186
|
+
</Grantee>
|
187
|
+
<Permission>FULL_CONTROL</Permission>
|
188
|
+
</Grant>
|
189
|
+
</AccessControlList>
|
190
|
+
</AccessControlPolicy>
|
191
|
+
XML
|
192
|
+
|
193
|
+
tests(".acl_to_hash(#{acl_xml.inspect})").returns({
|
194
|
+
"Owner" => {
|
195
|
+
"DisplayName" => "me",
|
196
|
+
"ID" => "2744ccd10c7533bd736ad890f9dd5cab2adb27b07d500b9493f29cdc420cb2e0"
|
197
|
+
},
|
198
|
+
"AccessControlList" => [{
|
199
|
+
"Grantee" => {
|
200
|
+
"DisplayName" => "me",
|
201
|
+
"ID" => "2744ccd10c7533bd736ad890f9dd5cab2adb27b07d500b9493f29cdc420cb2e0"
|
202
|
+
},
|
203
|
+
"Permission" => "FULL_CONTROL"
|
204
|
+
}]
|
205
|
+
}, 'returns hash of ACL XML') do
|
206
|
+
Fog::Storage::AWS.acl_to_hash(acl_xml)
|
207
|
+
end
|
208
|
+
end
|
173
209
|
end
|
@@ -135,8 +135,6 @@ Shindo.tests('Fog::Storage[:aws] | bucket requests', [:aws]) do
|
|
135
135
|
]
|
136
136
|
}
|
137
137
|
tests("#put_bucket_acl('#{@aws_bucket_name}', hash with id)").returns(acl) do
|
138
|
-
pending if Fog.mocking?
|
139
|
-
|
140
138
|
Fog::Storage[:aws].put_bucket_acl(@aws_bucket_name, acl)
|
141
139
|
Fog::Storage[:aws].get_bucket_acl(@aws_bucket_name).body
|
142
140
|
end
|
@@ -173,7 +171,6 @@ Shindo.tests('Fog::Storage[:aws] | bucket requests', [:aws]) do
|
|
173
171
|
]
|
174
172
|
}
|
175
173
|
tests("#put_bucket_acl('#{@aws_bucket_name}', hash with uri)").returns(acl) do
|
176
|
-
pending if Fog.mocking?
|
177
174
|
Fog::Storage[:aws].put_bucket_acl(@aws_bucket_name, acl)
|
178
175
|
Fog::Storage[:aws].get_bucket_acl(@aws_bucket_name).body
|
179
176
|
end
|
@@ -37,13 +37,12 @@ Shindo.tests('AWS::Storage | object requests', ['aws']) do
|
|
37
37
|
acl = {
|
38
38
|
'Owner' => @aws_owner,
|
39
39
|
'AccessControlList' => [
|
40
|
-
{
|
40
|
+
{
|
41
41
|
'Grantee' => @aws_owner,
|
42
|
-
'Permission' => "FULL_CONTROL"
|
42
|
+
'Permission' => "FULL_CONTROL"
|
43
43
|
}
|
44
44
|
]}
|
45
45
|
tests("#put_object_acl('#{@directory.identity}', 'fog_object', hash with id)").returns(acl) do
|
46
|
-
pending if Fog.mocking?
|
47
46
|
Fog::Storage[:aws].put_object_acl(@directory.identity, 'fog_object', acl)
|
48
47
|
Fog::Storage[:aws].get_object_acl(@directory.identity, 'fog_object').body
|
49
48
|
end
|
@@ -77,7 +76,6 @@ Shindo.tests('AWS::Storage | object requests', ['aws']) do
|
|
77
76
|
}
|
78
77
|
]}
|
79
78
|
tests("#put_object_acl('#{@directory.identity}', 'fog_object', hash with uri)").returns(acl) do
|
80
|
-
pending if Fog.mocking?
|
81
79
|
Fog::Storage[:aws].put_object_acl(@directory.identity, 'fog_object', acl)
|
82
80
|
Fog::Storage[:aws].get_object_acl(@directory.identity, 'fog_object').body
|
83
81
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
Shindo.tests('AWS::STS | session tokens', ['aws']) do
|
2
|
+
|
3
|
+
@policy = {"Statement" => [{"Effect" => "Allow", "Action" => "*", "Resource" => "*"}]}
|
4
|
+
|
5
|
+
@federation_format = {
|
6
|
+
'SessionToken' => String,
|
7
|
+
'SecretAccessKey' => String,
|
8
|
+
'Expiration' => String,
|
9
|
+
'AccessKeyId' => String,
|
10
|
+
'Arn' => String,
|
11
|
+
'FederatedUserId' => String,
|
12
|
+
'PackedPolicySize' => String,
|
13
|
+
'RequestId' => String
|
14
|
+
}
|
15
|
+
|
16
|
+
tests("#get_federation_token('test@fog.io', #{@policy.inspect})").formats(@federation_format) do
|
17
|
+
pending if Fog.mocking?
|
18
|
+
Fog::AWS[:sts].get_federation_token("test@fog.io", @policy).body
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
Shindo.tests('AWS::STS | session tokens', ['aws']) do
|
2
|
+
|
3
|
+
@session_format = {
|
4
|
+
'SessionToken' => String,
|
5
|
+
'SecretAccessKey' => String,
|
6
|
+
'Expiration' => String,
|
7
|
+
'AccessKeyId' => String,
|
8
|
+
'RequestId' => String
|
9
|
+
}
|
10
|
+
|
11
|
+
tests("#get_session_token").formats(@session_format) do
|
12
|
+
pending if Fog.mocking?
|
13
|
+
Fog::AWS[:sts].get_session_token.body
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
@@ -2,20 +2,25 @@ Shindo.tests('Fog::Compute[:brightbox] | account requests', ['brightbox']) do
|
|
2
2
|
|
3
3
|
tests('success') do
|
4
4
|
|
5
|
-
tests("#get_account")
|
5
|
+
tests("#get_account") do
|
6
6
|
pending if Fog.mocking?
|
7
|
-
Fog::Compute[:brightbox].get_account
|
7
|
+
result = Fog::Compute[:brightbox].get_account
|
8
|
+
formats(Brightbox::Compute::Formats::Full::ACCOUNT) { result }
|
9
|
+
test("ftp password is blanked") { result["library_ftp_password"].nil? }
|
8
10
|
end
|
9
11
|
|
10
12
|
update_options = {:name => "Fog@#{Time.now.iso8601}"}
|
11
|
-
tests("#update_account(#{update_options.inspect})")
|
13
|
+
tests("#update_account(#{update_options.inspect})") do
|
12
14
|
pending if Fog.mocking?
|
13
|
-
Fog::Compute[:brightbox].update_account(update_options)
|
15
|
+
result = Fog::Compute[:brightbox].update_account(update_options)
|
16
|
+
formats(Brightbox::Compute::Formats::Full::ACCOUNT) { result }
|
14
17
|
end
|
15
18
|
|
16
|
-
tests("#reset_ftp_password_account")
|
19
|
+
tests("#reset_ftp_password_account") do
|
17
20
|
pending if Fog.mocking?
|
18
|
-
Fog::Compute[:brightbox].reset_ftp_password_account
|
21
|
+
result = Fog::Compute[:brightbox].reset_ftp_password_account
|
22
|
+
formats(Brightbox::Compute::Formats::Full::ACCOUNT) { result }
|
23
|
+
test("new ftp password is visible") { ! result["library_ftp_password"].nil? }
|
19
24
|
end
|
20
25
|
|
21
26
|
end
|
@@ -7,32 +7,43 @@ Shindo.tests('Fog::Compute[:brightbox] | api client requests', ['brightbox']) do
|
|
7
7
|
:description => "Description from Fog test"
|
8
8
|
}
|
9
9
|
|
10
|
-
tests("#create_api_client(#{create_options.inspect})")
|
10
|
+
tests("#create_api_client(#{create_options.inspect})") do
|
11
11
|
pending if Fog.mocking?
|
12
|
-
|
13
|
-
@api_client_id =
|
14
|
-
|
12
|
+
result = Fog::Compute[:brightbox].create_api_client(create_options)
|
13
|
+
@api_client_id = result["id"]
|
14
|
+
formats(Brightbox::Compute::Formats::Full::API_CLIENT) { result }
|
15
15
|
end
|
16
16
|
|
17
|
-
tests("#list_api_clients")
|
17
|
+
tests("#list_api_clients") do
|
18
18
|
pending if Fog.mocking?
|
19
|
-
Fog::Compute[:brightbox].list_api_clients
|
19
|
+
result = Fog::Compute[:brightbox].list_api_clients
|
20
|
+
formats(Brightbox::Compute::Formats::Collection::API_CLIENTS) { result }
|
20
21
|
end
|
21
22
|
|
22
|
-
tests("#get_api_client('#{@api_client_id}')")
|
23
|
+
tests("#get_api_client('#{@api_client_id}')") do
|
23
24
|
pending if Fog.mocking?
|
24
|
-
Fog::Compute[:brightbox].get_api_client(@api_client_id)
|
25
|
+
result = Fog::Compute[:brightbox].get_api_client(@api_client_id)
|
26
|
+
formats(Brightbox::Compute::Formats::Full::API_CLIENT) { result }
|
25
27
|
end
|
26
28
|
|
27
29
|
update_options = {:name => "Fog@#{Time.now.iso8601}"}
|
28
|
-
tests("#update_api_client('#{@api_client_id}')")
|
30
|
+
tests("#update_api_client('#{@api_client_id}', #{update_options.inspect})") do
|
29
31
|
pending if Fog.mocking?
|
30
|
-
Fog::Compute[:brightbox].update_api_client(@api_client_id, update_options)
|
32
|
+
result = Fog::Compute[:brightbox].update_api_client(@api_client_id, update_options)
|
33
|
+
formats(Brightbox::Compute::Formats::Full::API_CLIENT) { result }
|
31
34
|
end
|
32
35
|
|
33
|
-
tests("#
|
36
|
+
tests("#reset_secret_api_client('#{@api_client_id}')") do
|
34
37
|
pending if Fog.mocking?
|
35
|
-
Fog::Compute[:brightbox].
|
38
|
+
result = Fog::Compute[:brightbox].reset_secret_api_client(@api_client_id)
|
39
|
+
formats(Brightbox::Compute::Formats::Full::API_CLIENT) { result }
|
40
|
+
test("new secret is visible") { ! result["secret"].nil? }
|
41
|
+
end
|
42
|
+
|
43
|
+
tests("#destroy_api_client('#{@api_client_id}')") do
|
44
|
+
pending if Fog.mocking?
|
45
|
+
result = Fog::Compute[:brightbox].destroy_api_client(@api_client_id)
|
46
|
+
formats(Brightbox::Compute::Formats::Full::API_CLIENT) { result }
|
36
47
|
end
|
37
48
|
|
38
49
|
end
|