fog 1.4.0 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.document +1 -1
- data/.irbrc +5 -10
- data/{README.rdoc → README.md} +66 -61
- data/Rakefile +4 -6
- data/changelog.txt +491 -0
- data/docs/about/users.markdown +1 -0
- data/fog.gemspec +4 -4
- data/lib/fog.rb +1 -1
- data/lib/fog/aws.rb +4 -0
- data/lib/fog/aws/auto_scaling.rb +3 -0
- data/lib/fog/aws/cloud_watch.rb +28 -0
- data/lib/fog/aws/compute.rb +7 -1
- data/lib/fog/aws/elasticache.rb +64 -6
- data/lib/fog/aws/models/auto_scaling/configuration.rb +3 -1
- data/lib/fog/aws/models/auto_scaling/group.rb +10 -9
- data/lib/fog/aws/models/auto_scaling/policies.rb +33 -0
- data/lib/fog/aws/models/auto_scaling/policy.rb +46 -0
- data/lib/fog/aws/models/cloud_watch/alarm.rb +50 -2
- data/lib/fog/aws/models/cloud_watch/alarms.rb +18 -1
- data/lib/fog/aws/models/compute/address.rb +2 -2
- data/lib/fog/aws/models/dns/records.rb +5 -0
- data/lib/fog/aws/models/elasticache/cluster.rb +1 -1
- data/lib/fog/aws/models/iam/users.rb +26 -4
- data/lib/fog/aws/parsers/auto_scaling/describe_policies.rb +7 -5
- data/lib/fog/aws/parsers/elb/describe_load_balancers.rb +1 -1
- data/lib/fog/aws/rds.rb +1 -1
- data/lib/fog/aws/requests/auto_scaling/create_auto_scaling_group.rb +8 -0
- data/lib/fog/aws/requests/auto_scaling/create_launch_configuration.rb +1 -2
- data/lib/fog/aws/requests/auto_scaling/delete_auto_scaling_group.rb +10 -2
- data/lib/fog/aws/requests/auto_scaling/delete_launch_configuration.rb +1 -1
- data/lib/fog/aws/requests/auto_scaling/delete_policy.rb +10 -1
- data/lib/fog/aws/requests/auto_scaling/describe_auto_scaling_instances.rb +0 -1
- data/lib/fog/aws/requests/auto_scaling/describe_policies.rb +13 -1
- data/lib/fog/aws/requests/auto_scaling/put_scaling_policy.rb +20 -1
- data/lib/fog/aws/requests/auto_scaling/update_auto_scaling_group.rb +1 -1
- data/lib/fog/aws/requests/cloud_watch/delete_alarms.rb +19 -1
- data/lib/fog/aws/requests/cloud_watch/describe_alarms.rb +20 -2
- data/lib/fog/aws/requests/cloud_watch/put_metric_alarm.rb +9 -0
- data/lib/fog/aws/requests/compute/allocate_address.rb +4 -5
- data/lib/fog/aws/requests/compute/create_dhcp_options.rb +6 -5
- data/lib/fog/aws/requests/compute/create_internet_gateway.rb +7 -6
- data/lib/fog/aws/requests/compute/create_subnet.rb +11 -10
- data/lib/fog/aws/requests/compute/create_vpc.rb +8 -7
- data/lib/fog/aws/requests/compute/delete_dhcp_options.rb +1 -0
- data/lib/fog/aws/requests/compute/delete_internet_gateway.rb +1 -0
- data/lib/fog/aws/requests/compute/delete_subnet.rb +1 -0
- data/lib/fog/aws/requests/compute/delete_vpc.rb +2 -1
- data/lib/fog/aws/requests/compute/describe_availability_zones.rb +1 -0
- data/lib/fog/aws/requests/compute/describe_dhcp_options.rb +1 -8
- data/lib/fog/aws/requests/compute/describe_instances.rb +3 -1
- data/lib/fog/aws/requests/compute/describe_internet_gateways.rb +1 -8
- data/lib/fog/aws/requests/compute/describe_subnets.rb +1 -9
- data/lib/fog/aws/requests/compute/describe_vpcs.rb +1 -8
- data/lib/fog/aws/requests/compute/release_address.rb +12 -4
- data/lib/fog/aws/requests/compute/start_instances.rb +1 -0
- data/lib/fog/aws/requests/compute/stop_instances.rb +1 -0
- data/lib/fog/aws/requests/elasticache/create_cache_cluster.rb +26 -2
- data/lib/fog/aws/requests/elasticache/delete_cache_cluster.rb +10 -1
- data/lib/fog/aws/requests/elasticache/describe_cache_clusters.rb +16 -1
- data/lib/fog/aws/requests/elasticache/modify_cache_cluster.rb +35 -3
- data/lib/fog/aws/requests/elasticache/reboot_cache_cluster.rb +10 -2
- data/lib/fog/aws/requests/elb/create_load_balancer.rb +1 -1
- data/lib/fog/aws/requests/rds/describe_db_instances.rb +3 -3
- data/lib/fog/aws/sqs.rb +1 -1
- data/lib/fog/aws/storage.rb +1 -1
- data/lib/fog/bin/rackspace.rb +4 -0
- data/lib/fog/cloudstack/compute.rb +25 -18
- data/lib/fog/cloudstack/models/compute/image.rb +34 -34
- data/lib/fog/cloudstack/models/compute/job.rb +14 -1
- data/lib/fog/cloudstack/models/compute/jobs.rb +1 -1
- data/lib/fog/cloudstack/models/compute/security_group.rb +50 -0
- data/lib/fog/cloudstack/models/compute/security_group_rule.rb +62 -0
- data/lib/fog/cloudstack/models/compute/security_group_rules.rb +37 -0
- data/lib/fog/cloudstack/models/compute/security_groups.rb +27 -0
- data/lib/fog/cloudstack/models/compute/server.rb +63 -39
- data/lib/fog/cloudstack/models/compute/volume.rb +3 -7
- data/lib/fog/cloudstack/models/compute/zone.rb +1 -2
- data/lib/fog/cloudstack/requests/compute/assign_virtual_machine.rb +18 -0
- data/lib/fog/cloudstack/requests/compute/authorize_security_group_egress.rb +68 -0
- data/lib/fog/cloudstack/requests/compute/authorize_security_group_ingress.rb +55 -4
- data/lib/fog/cloudstack/requests/compute/create_security_group.rb +12 -4
- data/lib/fog/cloudstack/requests/compute/create_zone.rb +20 -0
- data/lib/fog/cloudstack/requests/compute/delete_security_group.rb +17 -0
- data/lib/fog/cloudstack/requests/compute/destroy_virtual_machine.rb +23 -1
- data/lib/fog/cloudstack/requests/compute/list_firewall_rules.rb +15 -0
- data/lib/fog/cloudstack/requests/compute/list_security_groups.rb +22 -4
- data/lib/fog/cloudstack/requests/compute/query_async_job_result.rb +15 -3
- data/lib/fog/cloudstack/requests/compute/revoke_security_group_egress.rb +42 -0
- data/lib/fog/cloudstack/requests/compute/revoke_security_group_ingress.rb +29 -3
- data/lib/fog/core.rb +1 -0
- data/lib/fog/core/attributes.rb +1 -1
- data/lib/fog/core/current_machine.rb +2 -2
- data/lib/fog/core/scp.rb +8 -0
- data/lib/fog/core/ssh.rb +8 -0
- data/lib/fog/dynect/dns.rb +14 -5
- data/lib/fog/ibm/requests/compute/create_instance.rb +1 -1
- data/lib/fog/libvirt/requests/compute/create_volume.rb +1 -1
- data/lib/fog/libvirt/requests/compute/list_volumes.rb +1 -1
- data/lib/fog/local/models/storage/file.rb +12 -1
- data/lib/fog/local/storage.rb +25 -1
- data/lib/fog/ninefold/compute.rb +1 -0
- data/lib/fog/openstack.rb +3 -1
- data/lib/fog/openstack/compute.rb +13 -2
- data/lib/fog/openstack/models/compute/servers.rb +10 -2
- data/lib/fog/openstack/requests/compute/create_flavor.rb +2 -2
- data/lib/fog/openstack/requests/compute/create_security_group.rb +1 -1
- data/lib/fog/openstack/requests/compute/create_server.rb +1 -1
- data/lib/fog/openstack/requests/compute/create_volume.rb +1 -1
- data/lib/fog/openstack/requests/compute/get_flavor_details.rb +7 -7
- data/lib/fog/openstack/requests/compute/get_quota.rb +1 -12
- data/lib/fog/openstack/requests/compute/get_quota_defaults.rb +1 -12
- data/lib/fog/openstack/requests/compute/get_volume_details.rb +1 -1
- data/lib/fog/openstack/requests/compute/list_flavors.rb +7 -7
- data/lib/fog/openstack/requests/compute/list_flavors_detail.rb +7 -7
- data/lib/fog/openstack/requests/compute/list_security_groups.rb +7 -7
- data/lib/fog/openstack/requests/compute/list_servers_detail.rb +4 -3
- data/lib/fog/openstack/requests/compute/list_volumes.rb +6 -8
- data/lib/fog/openstack/requests/compute/update_quota.rb +2 -15
- data/lib/fog/openstack/requests/identity/delete_role.rb +1 -1
- data/lib/fog/openstack/requests/identity/list_roles.rb +1 -1
- data/lib/fog/openstack/requests/image/create_image.rb +3 -1
- data/lib/fog/openstack/requests/image/list_public_images.rb +19 -1
- data/lib/fog/openstack/requests/image/list_public_images_detailed.rb +20 -2
- data/lib/fog/openstack/requests/image/update_image.rb +1 -1
- data/lib/fog/rackspace.rb +2 -0
- data/lib/fog/rackspace/databases.rb +121 -0
- data/lib/fog/rackspace/identity.rb +83 -0
- data/lib/fog/rackspace/load_balancers.rb +3 -0
- data/lib/fog/rackspace/models/databases/database.rb +32 -0
- data/lib/fog/rackspace/models/databases/databases.rb +31 -0
- data/lib/fog/rackspace/models/databases/flavor.rb +15 -0
- data/lib/fog/rackspace/models/databases/flavors.rb +25 -0
- data/lib/fog/rackspace/models/databases/instance.rb +104 -0
- data/lib/fog/rackspace/models/databases/instances.rb +25 -0
- data/lib/fog/rackspace/models/databases/user.rb +32 -0
- data/lib/fog/rackspace/models/databases/users.rb +31 -0
- data/lib/fog/rackspace/models/identity/credential.rb +13 -0
- data/lib/fog/rackspace/models/identity/credentials.rb +32 -0
- data/lib/fog/rackspace/models/identity/role.rb +14 -0
- data/lib/fog/rackspace/models/identity/roles.rb +32 -0
- data/lib/fog/rackspace/models/identity/tenant.rb +15 -0
- data/lib/fog/rackspace/models/identity/tenants.rb +28 -0
- data/lib/fog/rackspace/models/identity/user.rb +53 -0
- data/lib/fog/rackspace/models/identity/users.rb +36 -0
- data/lib/fog/rackspace/models/load_balancers/load_balancer.rb +17 -0
- data/lib/fog/rackspace/requests/databases/check_root_user.rb +15 -0
- data/lib/fog/rackspace/requests/databases/create_database.rb +24 -0
- data/lib/fog/rackspace/requests/databases/create_instance.rb +26 -0
- data/lib/fog/rackspace/requests/databases/create_user.rb +24 -0
- data/lib/fog/rackspace/requests/databases/delete_database.rb +15 -0
- data/lib/fog/rackspace/requests/databases/delete_instance.rb +15 -0
- data/lib/fog/rackspace/requests/databases/delete_user.rb +15 -0
- data/lib/fog/rackspace/requests/databases/enable_root_user.rb +15 -0
- data/lib/fog/rackspace/requests/databases/get_flavor.rb +15 -0
- data/lib/fog/rackspace/requests/databases/get_instance.rb +15 -0
- data/lib/fog/rackspace/requests/databases/list_databases.rb +15 -0
- data/lib/fog/rackspace/requests/databases/list_flavors.rb +15 -0
- data/lib/fog/rackspace/requests/databases/list_instances.rb +15 -0
- data/lib/fog/rackspace/requests/databases/list_users.rb +15 -0
- data/lib/fog/rackspace/requests/databases/resize_instance.rb +22 -0
- data/lib/fog/rackspace/requests/databases/resize_instance_volume.rb +24 -0
- data/lib/fog/rackspace/requests/databases/restart_instance.rb +20 -0
- data/lib/fog/rackspace/requests/identity/create_token.rb +25 -0
- data/lib/fog/rackspace/requests/identity/create_user.rb +25 -0
- data/lib/fog/rackspace/requests/identity/delete_user.rb +15 -0
- data/lib/fog/rackspace/requests/identity/get_credentials.rb +15 -0
- data/lib/fog/rackspace/requests/identity/get_user_by_id.rb +15 -0
- data/lib/fog/rackspace/requests/identity/get_user_by_name.rb +15 -0
- data/lib/fog/rackspace/requests/identity/list_credentials.rb +22 -0
- data/lib/fog/rackspace/requests/identity/list_tenants.rb +22 -0
- data/lib/fog/rackspace/requests/identity/list_user_roles.rb +22 -0
- data/lib/fog/rackspace/requests/identity/list_users.rb +22 -0
- data/lib/fog/rackspace/requests/identity/update_user.rb +24 -0
- data/lib/fog/rackspace/requests/load_balancers/get_ssl_termination.rb +15 -0
- data/lib/fog/rackspace/requests/load_balancers/remove_ssl_termination.rb +15 -0
- data/lib/fog/rackspace/requests/load_balancers/set_ssl_termination.rb +31 -0
- data/lib/fog/rackspace/storage.rb +1 -1
- data/lib/fog/vsphere/models/compute/server.rb +1 -0
- data/lib/fog/vsphere/requests/compute/vm_clone.rb +2 -2
- data/tests/aws/models/compute/address_tests.rb +2 -1
- data/tests/aws/models/compute/volume_tests.rb +1 -1
- data/tests/aws/models/dns/records_tests.rb +19 -1
- data/tests/aws/models/storage/directory_tests.rb +1 -1
- data/tests/aws/models/storage/url_tests.rb +7 -1
- data/tests/aws/requests/auto_scaling/auto_scaling_tests.rb +4 -2
- data/tests/aws/requests/compute/address_tests.rb +19 -1
- data/tests/aws/requests/elasticache/cache_cluster_tests.rb +4 -4
- data/tests/aws/requests/elb/helper.rb +13 -2
- data/tests/aws/requests/iam/access_key_tests.rb +1 -3
- data/tests/cloudstack/compute/models/security_group_rule_tests.rb +29 -0
- data/tests/cloudstack/compute/models/security_group_tests.rb +16 -0
- data/tests/cloudstack/compute/models/security_groups_tests.rb +19 -0
- data/tests/cloudstack/compute/models/server_tests.rb +18 -0
- data/tests/cloudstack/compute/models/volume_tests.rb +34 -0
- data/tests/cloudstack/compute/models/volumes_tests.rb +17 -0
- data/tests/compute/helper.rb +10 -3
- data/tests/core/current_machine_tests.rb +32 -0
- data/tests/helper.rb +1 -1
- data/tests/helpers/mock_helper.rb +3 -0
- data/tests/hp/requests/compute/address_tests.rb +2 -1
- data/tests/joyent/requests/compute/datasets_tests.rb +12 -3
- data/tests/local/models/file_tests.rb +43 -0
- data/tests/local/storage_tests.rb +40 -0
- data/tests/openstack/requests/compute/flavor_tests.rb +1 -1
- data/tests/openstack/requests/compute/server_tests.rb +3 -3
- data/tests/openstack/requests/compute/volume_tests.rb +1 -1
- data/tests/openstack/requests/identity/role_tests.rb +1 -1
- data/tests/rackspace/databases_tests.rb +26 -0
- data/tests/rackspace/models/databases/database_tests.rb +17 -0
- data/tests/rackspace/models/databases/databases_tests.rb +17 -0
- data/tests/rackspace/models/databases/flavors_tests.rb +20 -0
- data/tests/rackspace/models/databases/instance_tests.rb +43 -0
- data/tests/rackspace/models/databases/instances_tests.rb +14 -0
- data/tests/rackspace/models/databases/user_tests.rb +21 -0
- data/tests/rackspace/models/databases/users_tests.rb +21 -0
- data/tests/rackspace/models/identity/credentials_tests.rb +16 -0
- data/tests/rackspace/models/identity/roles_tests.rb +16 -0
- data/tests/rackspace/models/identity/tenants_tests.rb +21 -0
- data/tests/rackspace/models/identity/user_tests.rb +17 -0
- data/tests/rackspace/models/identity/users_tests.rb +17 -0
- data/tests/rackspace/models/load_balancers/load_balancer_tests.rb +20 -0
- data/tests/rackspace/requests/databases/database_tests.rb +36 -0
- data/tests/rackspace/requests/databases/flavor_tests.rb +16 -0
- data/tests/rackspace/requests/databases/helper.rb +84 -0
- data/tests/rackspace/requests/databases/instance_tests.rb +77 -0
- data/tests/rackspace/requests/databases/user_tests.rb +37 -0
- data/tests/rackspace/requests/identity/tenants_tests.rb +21 -0
- data/tests/rackspace/requests/identity/token_tests.rb +63 -0
- data/tests/rackspace/requests/identity/user_tests.rb +107 -0
- data/tests/rackspace/requests/load_balancers/helper.rb +70 -1
- data/tests/rackspace/requests/load_balancers/ssl_termination_tests.rb +38 -0
- data/tests/storage/models/file_tests.rb +1 -1
- metadata +129 -13
- data/spec/core/current_machine_spec.rb +0 -32
- data/spec/lib/fog/aws/parsers/sqs/receive_message_spec.rb +0 -58
- data/spec/spec_helper.rb +0 -8
|
@@ -86,16 +86,14 @@ module Fog
|
|
|
86
86
|
end
|
|
87
87
|
|
|
88
88
|
options = {
|
|
89
|
-
'id'
|
|
89
|
+
'id' => id,
|
|
90
90
|
'virtualmachineid' => instance_id,
|
|
91
91
|
}
|
|
92
92
|
options.merge!('deviceid' => mountpoint) if mountpoint
|
|
93
93
|
|
|
94
94
|
data = connection.attach_volume(options)
|
|
95
95
|
|
|
96
|
-
|
|
97
|
-
job.connection= self.connection
|
|
98
|
-
end
|
|
96
|
+
connection.jobs.new(data["attachvolumeresponse"])
|
|
99
97
|
end
|
|
100
98
|
|
|
101
99
|
def detach
|
|
@@ -103,9 +101,7 @@ module Fog
|
|
|
103
101
|
|
|
104
102
|
data = connection.detach_volume('id' => id)
|
|
105
103
|
|
|
106
|
-
|
|
107
|
-
job.connection= self.connection
|
|
108
|
-
end
|
|
104
|
+
connection.jobs.new(data["detachvolumeresponse"])
|
|
109
105
|
end
|
|
110
106
|
|
|
111
107
|
def destroy
|
|
@@ -26,12 +26,11 @@ module Fog
|
|
|
26
26
|
'domainid' => domain_id,
|
|
27
27
|
'guestcidraddress' => guest_cidr_address,
|
|
28
28
|
'internaldns2' => internaldns2,
|
|
29
|
-
'securitygroupenabled' =>
|
|
29
|
+
'securitygroupenabled' => security_groups_enabled,
|
|
30
30
|
}
|
|
31
31
|
data = connection.create_zone(options)
|
|
32
32
|
merge_attributes(data['createzoneresponse'])
|
|
33
33
|
end
|
|
34
|
-
|
|
35
34
|
end # Zone
|
|
36
35
|
end # Cloudstack
|
|
37
36
|
end # Compute
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
module Fog
|
|
2
|
+
module Compute
|
|
3
|
+
class Cloudstack
|
|
4
|
+
class Real
|
|
5
|
+
def assign_virtual_machine(options={})
|
|
6
|
+
options.merge!('command' => 'assignVirtualMachine')
|
|
7
|
+
|
|
8
|
+
request(options)
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
class Mock
|
|
12
|
+
# Fog::Compute::Cloudstack::Error: Failed to move vm VM is Running, unable to move the vm VM[User|e845934a-e44f-43da-aabf-05c90c651756]
|
|
13
|
+
#def assign_virtual_machine(options={})
|
|
14
|
+
#end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
module Fog
|
|
2
|
+
module Compute
|
|
3
|
+
class Cloudstack
|
|
4
|
+
class Real
|
|
5
|
+
def authorize_security_group_egress(options={})
|
|
6
|
+
options.merge!(
|
|
7
|
+
'command' => 'authorizeSecurityGroupEgress'
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
request(options)
|
|
11
|
+
end
|
|
12
|
+
end # Real
|
|
13
|
+
class Mock
|
|
14
|
+
def authorize_security_group_egress(options={})
|
|
15
|
+
security_group_id = options['securitygroupid']
|
|
16
|
+
security_group_rule_id = Fog::Cloudstack.uuid
|
|
17
|
+
|
|
18
|
+
unless cidr = options['cidrlist']
|
|
19
|
+
raise Fog::Compute::Cloudstack::BadRequest.new('Unable to execute API command missing parameter cidr')
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
unless start_port = options['startport']
|
|
23
|
+
raise Fog::Compute::Cloudstack::BadRequest.new('Unable to execute API command missing parameter start_port')
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
unless end_port = options['endport']
|
|
27
|
+
raise Fog::Compute::Cloudstack::BadRequest.new('Unable to execute API command missing parameter end_port')
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
unless protocol = options['protocol']
|
|
31
|
+
raise Fog::Compute::Cloudstack::BadRequest.new('Unable to execute API command missing parameter protocol')
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
rule = {
|
|
35
|
+
"ruleid" => security_group_rule_id,
|
|
36
|
+
"cidr" => cidr,
|
|
37
|
+
"startport" => start_port,
|
|
38
|
+
"endport" => end_port,
|
|
39
|
+
"protocol" => protocol
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
unless security_group = self.data[:security_groups][security_group_id]
|
|
43
|
+
raise Fog::Compute::Cloudstack::BadRequest.new("Security group id #{security_group_id} does not exist")
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
security_group["egressrule"] ||= []
|
|
47
|
+
security_group["egressrule"] << rule
|
|
48
|
+
|
|
49
|
+
job_id = Fog::Cloudstack.uuid
|
|
50
|
+
job = {
|
|
51
|
+
"cmd" => "com.cloud.api.commands.authorizeSecurityGroupEgress",
|
|
52
|
+
"created" => Time.now.iso8601,
|
|
53
|
+
"jobid" => job_id,
|
|
54
|
+
"jobstatus" => 1,
|
|
55
|
+
"jobprocstatus" => 0,
|
|
56
|
+
"jobresultcode" => 0,
|
|
57
|
+
"jobresulttype" => "object",
|
|
58
|
+
"jobresult" => { "securitygroup" => security_group }
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
self.data[:jobs][job_id]= job
|
|
62
|
+
|
|
63
|
+
{ "authorizesecuritygroupegressresponse" => { "jobid" => job_id } }
|
|
64
|
+
end
|
|
65
|
+
end # Mock
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
end
|
|
@@ -3,9 +3,6 @@ module Fog
|
|
|
3
3
|
class Cloudstack
|
|
4
4
|
class Real
|
|
5
5
|
|
|
6
|
-
# Creates an account.
|
|
7
|
-
#
|
|
8
|
-
# {CloudStack API Reference}[http://download.cloud.com/releases/2.2.0/api_2.2.4/global_admin/authorizeSecurityGroupIngress.html]
|
|
9
6
|
def authorize_security_group_ingress(options={})
|
|
10
7
|
options.merge!(
|
|
11
8
|
'command' => 'authorizeSecurityGroupIngress'
|
|
@@ -14,7 +11,61 @@ module Fog
|
|
|
14
11
|
request(options)
|
|
15
12
|
end
|
|
16
13
|
|
|
17
|
-
end
|
|
14
|
+
end # Real
|
|
15
|
+
|
|
16
|
+
class Mock
|
|
17
|
+
def authorize_security_group_ingress(options={})
|
|
18
|
+
security_group_id = options['securitygroupid']
|
|
19
|
+
security_group_rule_id = Fog::Cloudstack.uuid
|
|
20
|
+
|
|
21
|
+
unless cidr = options['cidrlist']
|
|
22
|
+
raise Fog::Compute::Cloudstack::BadRequest.new('Unable to execute API command missing parameter cidr')
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
unless start_port = options['startport']
|
|
26
|
+
raise Fog::Compute::Cloudstack::BadRequest.new('Unable to execute API command missing parameter start_port')
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
unless end_port = options['endport']
|
|
30
|
+
raise Fog::Compute::Cloudstack::BadRequest.new('Unable to execute API command missing parameter end_port')
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
unless protocol = options['protocol']
|
|
34
|
+
raise Fog::Compute::Cloudstack::BadRequest.new('Unable to execute API command missing parameter protocol')
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
rule = {
|
|
38
|
+
"ruleid" => security_group_rule_id,
|
|
39
|
+
"cidr" => cidr,
|
|
40
|
+
"startport" => start_port,
|
|
41
|
+
"endport" => end_port,
|
|
42
|
+
"protocol" => protocol
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
unless security_group = self.data[:security_groups][security_group_id]
|
|
46
|
+
raise Fog::Compute::Cloudstack::BadRequest.new("Security group id #{security_group_id} does not exist")
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
security_group["ingressrule"] ||= []
|
|
50
|
+
security_group["ingressrule"] << rule
|
|
51
|
+
|
|
52
|
+
job_id = Fog::Cloudstack.uuid
|
|
53
|
+
job = {
|
|
54
|
+
"cmd" => "com.cloud.api.commands.authorizeSecurityGroupIngress",
|
|
55
|
+
"created" => Time.now.iso8601,
|
|
56
|
+
"jobid" => job_id,
|
|
57
|
+
"jobstatus" => 1,
|
|
58
|
+
"jobprocstatus" => 0,
|
|
59
|
+
"jobresultcode" => 0,
|
|
60
|
+
"jobresulttype" => "object",
|
|
61
|
+
"jobresult" => { "securitygroup" => security_group }
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
self.data[:jobs][job_id]= job
|
|
65
|
+
|
|
66
|
+
{ "authorizesecuritygroupingressresponse" => { "jobid" => job_id } }
|
|
67
|
+
end
|
|
68
|
+
end # Mock
|
|
18
69
|
end
|
|
19
70
|
end
|
|
20
71
|
end
|
|
@@ -2,10 +2,6 @@ module Fog
|
|
|
2
2
|
module Compute
|
|
3
3
|
class Cloudstack
|
|
4
4
|
class Real
|
|
5
|
-
|
|
6
|
-
# Creates an account.
|
|
7
|
-
#
|
|
8
|
-
# {CloudStack API Reference}[http://download.cloud.com/releases/2.2.0/api_2.2.4/global_admin/createSecurityGroup.html]
|
|
9
5
|
def create_security_group(options={})
|
|
10
6
|
options.merge!(
|
|
11
7
|
'command' => 'createSecurityGroup'
|
|
@@ -13,7 +9,19 @@ module Fog
|
|
|
13
9
|
|
|
14
10
|
request(options)
|
|
15
11
|
end
|
|
12
|
+
end # Real
|
|
13
|
+
|
|
14
|
+
class Mock
|
|
15
|
+
def create_security_group(options={})
|
|
16
|
+
security_group_id = Fog::Cloudstack.uuid
|
|
16
17
|
|
|
18
|
+
security_group = {
|
|
19
|
+
"id" => security_group_id,
|
|
20
|
+
}.merge(options)
|
|
21
|
+
|
|
22
|
+
self.data[:security_groups][security_group_id]= security_group
|
|
23
|
+
{"createsecuritygroupresponse" => { "securitygroup" => security_group}}
|
|
24
|
+
end
|
|
17
25
|
end
|
|
18
26
|
end
|
|
19
27
|
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
module Fog
|
|
2
|
+
module Compute
|
|
3
|
+
class Cloudstack
|
|
4
|
+
class Real
|
|
5
|
+
|
|
6
|
+
# Lists zones.
|
|
7
|
+
#
|
|
8
|
+
# {CloudStack API Reference}[http://download.cloud.com/releases/2.2.0/api_2.2.4/global_admin/listZones.html]
|
|
9
|
+
def create_zone(options={})
|
|
10
|
+
options.merge!(
|
|
11
|
+
'command' => 'createZone'
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
request(options)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
end # Real
|
|
18
|
+
end # Cloudstack
|
|
19
|
+
end # Compute
|
|
20
|
+
end # Fog
|
|
@@ -14,7 +14,24 @@ module Fog
|
|
|
14
14
|
request(options)
|
|
15
15
|
end
|
|
16
16
|
|
|
17
|
+
end # Real
|
|
18
|
+
|
|
19
|
+
class Mock
|
|
20
|
+
def delete_security_group(options={})
|
|
21
|
+
security_group_id = options['id']
|
|
22
|
+
if self.data[:security_groups][security_group_id]
|
|
23
|
+
self.data[:security_groups].delete(security_group_id)
|
|
24
|
+
{
|
|
25
|
+
"deletesecuritygroupresponse" => {
|
|
26
|
+
"success" => "true"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
else
|
|
30
|
+
raise Fog::Compute::Cloudstack::BadRequest.new('No security_group found')
|
|
31
|
+
end
|
|
32
|
+
end
|
|
17
33
|
end
|
|
34
|
+
|
|
18
35
|
end
|
|
19
36
|
end
|
|
20
37
|
end
|
|
@@ -19,9 +19,31 @@ module Fog
|
|
|
19
19
|
class Mock
|
|
20
20
|
|
|
21
21
|
def destroy_virtual_machine(options={})
|
|
22
|
-
identity = options[
|
|
22
|
+
identity = options["id"]
|
|
23
23
|
|
|
24
|
+
server = self.data[:servers][identity]
|
|
25
|
+
unless server
|
|
26
|
+
raise Fog::Compute::Cloudstack::BadRequest.new("Unable to execute API command attachserver due to invalid value. Object servers(uuid: #{identity}) does not exist.")
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
job_id = Fog::Cloudstack.uuid
|
|
30
|
+
|
|
31
|
+
job = {
|
|
32
|
+
"cmd" => "com.cloud.api.commands.DestroyVirtualMachineCmd",
|
|
33
|
+
"created" => Time.now.iso8601,
|
|
34
|
+
"jobid" => job_id,
|
|
35
|
+
"jobstatus" => 1,
|
|
36
|
+
"jobprocstatus" => 0,
|
|
37
|
+
"jobresultcode" => 0,
|
|
38
|
+
"jobresulttype" => "object",
|
|
39
|
+
"jobresult" =>
|
|
40
|
+
{"virtualmachine" => server}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
self.data[:jobs][job_id]= job
|
|
24
44
|
self.data[:servers].delete(identity)
|
|
45
|
+
|
|
46
|
+
{"destroyvirtualmachineresponse" => {"jobid" => job_id}}
|
|
25
47
|
end
|
|
26
48
|
end
|
|
27
49
|
end # Cloudstack
|
|
@@ -3,17 +3,35 @@ module Fog
|
|
|
3
3
|
class Cloudstack
|
|
4
4
|
class Real
|
|
5
5
|
|
|
6
|
-
# Lists security groups.
|
|
7
|
-
#
|
|
8
|
-
# {CloudStack API Reference}[http://download.cloud.com/releases/2.2.0/api_2.2.4/global_admin/listSecurityGroups.html]
|
|
9
6
|
def list_security_groups(options={})
|
|
10
7
|
options.merge!(
|
|
11
8
|
'command' => 'listSecurityGroups'
|
|
12
9
|
)
|
|
13
|
-
|
|
10
|
+
|
|
14
11
|
request(options)
|
|
15
12
|
end
|
|
16
13
|
|
|
14
|
+
end # Real
|
|
15
|
+
|
|
16
|
+
class Mock
|
|
17
|
+
def list_security_groups(options={})
|
|
18
|
+
security_groups = []
|
|
19
|
+
if security_group_id = options['id']
|
|
20
|
+
security_group = self.data[:security_groups][security_group_id]
|
|
21
|
+
raise Fog::Compute::Cloudstack::BadRequest unless security_group
|
|
22
|
+
security_groups = [security_group]
|
|
23
|
+
else
|
|
24
|
+
security_groups = self.data[:security_groups].values
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
{
|
|
28
|
+
"listsecuritygroupsresponse" =>
|
|
29
|
+
{
|
|
30
|
+
"count" => security_groups.size,
|
|
31
|
+
"securitygroup" => security_groups
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
end
|
|
17
35
|
end
|
|
18
36
|
end
|
|
19
37
|
end
|
|
@@ -3,9 +3,6 @@ module Fog
|
|
|
3
3
|
class Cloudstack
|
|
4
4
|
class Real
|
|
5
5
|
|
|
6
|
-
# Creates a domain.
|
|
7
|
-
#
|
|
8
|
-
# {CloudStack API Reference}[http://download.cloud.com/releases/2.2.0/api_2.2.4/global_admin/queryAsyncJobResult.html]
|
|
9
6
|
def query_async_job_result(options={})
|
|
10
7
|
options.merge!(
|
|
11
8
|
'command' => 'queryAsyncJobResult'
|
|
@@ -14,7 +11,22 @@ module Fog
|
|
|
14
11
|
request(options)
|
|
15
12
|
end
|
|
16
13
|
|
|
14
|
+
end # Real
|
|
15
|
+
|
|
16
|
+
class Mock
|
|
17
|
+
def query_async_job_result(options={})
|
|
18
|
+
unless job_id = options['jobid']
|
|
19
|
+
raise Fog::Compute::Cloudstack::BadRequest.new("Missing required parameter jobid")
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
unless job = self.data[:jobs][job_id]
|
|
23
|
+
raise Fog::Compute::Cloudstack::BadRequest.new("Unknown job id #{job_id}")
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
{'queryasyncjobresultresponse' => job }
|
|
27
|
+
end
|
|
17
28
|
end
|
|
29
|
+
|
|
18
30
|
end
|
|
19
31
|
end
|
|
20
32
|
end
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
module Fog
|
|
2
|
+
module Compute
|
|
3
|
+
class Cloudstack
|
|
4
|
+
class Real
|
|
5
|
+
def revoke_security_group_egress(options={})
|
|
6
|
+
options.merge!(
|
|
7
|
+
'command' => 'revokeSecurityGroupEgress'
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
request(options)
|
|
11
|
+
end
|
|
12
|
+
end # Real
|
|
13
|
+
class Mock
|
|
14
|
+
def revoke_security_group_egress(options={})
|
|
15
|
+
unless security_group_rule_id = options['id']
|
|
16
|
+
raise Fog::Compute::Cloudstack::BadRequest.new('Unable to execute API command missing parameter id')
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
security_group = self.data[:security_groups].values.find do |group|
|
|
20
|
+
(rule = (group['egressrule'] || []).find{|r| r['ruleid'] == security_group_rule_id}) && group['egressrule'].delete(rule)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
job_id = Fog::Cloudstack.uuid
|
|
24
|
+
job = {
|
|
25
|
+
"cmd" => "com.cloud.api.commands.revokeSecurityGroupEgress",
|
|
26
|
+
"created" => Time.now.iso8601,
|
|
27
|
+
"jobid" => job_id,
|
|
28
|
+
"jobstatus" => 1,
|
|
29
|
+
"jobprocstatus" => 0,
|
|
30
|
+
"jobresultcode" => 0,
|
|
31
|
+
"jobresulttype" => "object",
|
|
32
|
+
"jobresult" => { "securitygroup" => security_group }
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
self.data[:jobs][job_id]= job
|
|
36
|
+
|
|
37
|
+
{"revokesecuritygroupegress" => { "jobid" => job_id }}
|
|
38
|
+
end
|
|
39
|
+
end # Mock
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|