fog 1.28.0 → 1.29.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +111 -0
- data/CONTRIBUTING.md +255 -1
- data/Rakefile +1 -1
- data/fog.gemspec +41 -44
- data/lib/fog.rb +1 -0
- data/lib/fog/bin.rb +1 -0
- data/lib/fog/bin/openstack.rb +2 -0
- data/lib/fog/cloudsigma/mock_data.rb +37 -33
- data/lib/fog/dnsmadeeasy/models/dns/record.rb +1 -1
- data/lib/fog/fogdocker/requests/compute/api_version.rb +1 -1
- data/lib/fog/glesys/compute.rb +9 -1
- data/lib/fog/glesys/models/compute/server.rb +32 -21
- data/lib/fog/glesys/models/compute/ssh_key.rb +28 -0
- data/lib/fog/glesys/models/compute/ssh_keys.rb +21 -0
- data/lib/fog/glesys/requests/compute/edit.rb +11 -0
- data/lib/fog/glesys/requests/compute/ssh_key_add.rb +11 -0
- data/lib/fog/glesys/requests/compute/ssh_key_list.rb +11 -0
- data/lib/fog/glesys/requests/compute/ssh_key_remove.rb +11 -0
- data/lib/fog/google/compute.rb +2 -0
- data/lib/fog/google/models/compute/server.rb +14 -0
- data/lib/fog/google/requests/compute/start_server.rb +24 -0
- data/lib/fog/google/requests/compute/stop_server.rb +24 -0
- data/lib/fog/linode/compute.rb +7 -0
- data/lib/fog/linode/requests/compute/image_delete.rb +42 -0
- data/lib/fog/linode/requests/compute/image_list.rb +64 -0
- data/lib/fog/linode/requests/compute/linode_disk_createfromimage.rb +37 -0
- data/lib/fog/linode/requests/compute/linode_disk_duplicate.rb +33 -0
- data/lib/fog/linode/requests/compute/linode_disk_imagize.rb +37 -0
- data/lib/fog/linode/requests/compute/linode_disk_resize.rb +36 -0
- data/lib/fog/linode/requests/compute/linode_disk_update.rb +34 -0
- data/lib/fog/openstack.rb +1 -0
- data/lib/fog/openstack/compute.rb +12 -1
- data/lib/fog/openstack/core.rb +159 -5
- data/lib/fog/openstack/docs/planning.md +270 -0
- data/lib/fog/openstack/examples/planning/basics.rb +53 -0
- data/lib/fog/openstack/models/planning/plan.rb +81 -0
- data/lib/fog/openstack/models/planning/plans.rb +31 -0
- data/lib/fog/openstack/models/planning/role.rb +29 -0
- data/lib/fog/openstack/models/planning/roles.rb +16 -0
- data/lib/fog/openstack/planning.rb +235 -0
- data/lib/fog/openstack/requests/compute/get_hypervisor_statistics.rb +39 -0
- data/lib/fog/openstack/requests/identity/check_token.rb +4 -2
- data/lib/fog/openstack/requests/identity/validate_token.rb +4 -2
- data/lib/fog/openstack/requests/planning/add_role_to_plan.rb +40 -0
- data/lib/fog/openstack/requests/planning/create_plan.rb +33 -0
- data/lib/fog/openstack/requests/planning/delete_plan.rb +23 -0
- data/lib/fog/openstack/requests/planning/get_plan.rb +58 -0
- data/lib/fog/openstack/requests/planning/get_plan_templates.rb +28 -0
- data/lib/fog/openstack/requests/planning/list_plans.rb +60 -0
- data/lib/fog/openstack/requests/planning/list_roles.rb +38 -0
- data/lib/fog/openstack/requests/planning/patch_plan.rb +51 -0
- data/lib/fog/openstack/requests/planning/remove_role_from_plan.rb +32 -0
- data/lib/fog/ovirt/compute.rb +10 -0
- data/lib/fog/ovirt/models/compute/affinity_group.rb +25 -0
- data/lib/fog/ovirt/models/compute/affinity_groups.rb +20 -0
- data/lib/fog/ovirt/models/compute/server.rb +12 -0
- data/lib/fog/ovirt/models/compute/volume.rb +2 -0
- data/lib/fog/ovirt/requests/compute/add_to_affinity_group.rb +21 -0
- data/lib/fog/ovirt/requests/compute/create_affinity_group.rb +18 -0
- data/lib/fog/ovirt/requests/compute/destroy_affinity_group.rb +19 -0
- data/lib/fog/ovirt/requests/compute/get_affinity_group.rb +18 -0
- data/lib/fog/ovirt/requests/compute/list_affinity_group_vms.rb +22 -0
- data/lib/fog/ovirt/requests/compute/list_affinity_groups.rb +20 -0
- data/lib/fog/ovirt/requests/compute/mock_files/affinitygroup.xml +8 -0
- data/lib/fog/ovirt/requests/compute/mock_files/affinitygroup_vms.xml +9 -0
- data/lib/fog/ovirt/requests/compute/mock_files/affinitygroups.xml +17 -0
- data/lib/fog/ovirt/requests/compute/remove_from_affinity_group.rb +21 -0
- data/lib/fog/ovirt/requests/compute/update_interface.rb +18 -5
- data/lib/fog/rackspace/docs/block_storage.md +1 -1
- data/lib/fog/rackspace/docs/cdn_v2.md +1 -1
- data/lib/fog/rackspace/docs/compute_v2.md +1 -1
- data/lib/fog/rackspace/docs/getting_started.md +1 -1
- data/lib/fog/rackspace/docs/networking_v2.md +1 -1
- data/lib/fog/rackspace/docs/storage.md +1 -1
- data/lib/fog/rackspace/examples/README.md +1 -1
- data/lib/fog/rackspace/mock_data.rb +48 -48
- data/lib/fog/rackspace/models/networking_v2/security_group.rb +32 -0
- data/lib/fog/rackspace/models/networking_v2/security_group_rule.rb +38 -0
- data/lib/fog/rackspace/models/networking_v2/security_group_rules.rb +23 -0
- data/lib/fog/rackspace/models/networking_v2/security_groups.rb +23 -0
- data/lib/fog/rackspace/networking_v2.rb +24 -7
- data/lib/fog/rackspace/requests/networking_v2/create_security_group.rb +12 -0
- data/lib/fog/rackspace/requests/networking_v2/create_security_group_rule.rb +12 -0
- data/lib/fog/rackspace/requests/networking_v2/delete_security_group.rb +5 -0
- data/lib/fog/rackspace/requests/networking_v2/delete_security_group_rule.rb +5 -0
- data/lib/fog/rackspace/requests/networking_v2/list_security_group_rules.rb +5 -0
- data/lib/fog/rackspace/requests/networking_v2/list_security_groups.rb +5 -0
- data/lib/fog/rackspace/requests/networking_v2/show_security_group.rb +5 -0
- data/lib/fog/rackspace/requests/networking_v2/show_security_group_rule.rb +5 -0
- data/lib/fog/rackspace/requests/networking_v2/update_security_group.rb +12 -0
- data/lib/fog/rackspace/requests/storage/get_object_https_url.rb +1 -1
- data/lib/fog/version.rb +1 -1
- data/lib/fog/vsphere/requests/compute/cloudinit_to_customspec.rb +13 -4
- data/lib/fog/vsphere/requests/compute/vm_clone.rb +19 -6
- data/lib/fog/xenserver/requests/compute/create_vdi.rb +16 -6
- data/lib/tasks/changelog_task.rb +2 -1
- data/spec/fog/account_spec.rb +1 -2
- data/spec/fog/billing_spec.rb +1 -2
- data/spec/fog/bin/atmos_spec.rb +25 -2
- data/spec/fog/bin/aws_spec.rb +1 -2
- data/spec/fog/bin/baremetalcloud_spec.rb +25 -2
- data/spec/fog/bin/bluebox_spec.rb +47 -2
- data/spec/fog/bin/brightbox_spec.rb +1 -2
- data/spec/fog/bin/clodo_spec.rb +1 -2
- data/spec/fog/bin/cloudsigma_spec.rb +1 -2
- data/spec/fog/bin/cloudstack_spec.rb +1 -2
- data/spec/fog/bin/digitalocean_spec.rb +1 -2
- data/spec/fog/bin/dnsimple_spec.rb +1 -2
- data/spec/fog/bin/dnsmadeeasy_spec.rb +1 -2
- data/spec/fog/bin/dreamhost_spec.rb +1 -2
- data/spec/fog/bin/dynect_spec.rb +1 -2
- data/spec/fog/bin/powerdns_spec.rb +9 -0
- data/spec/fog/bin_spec.rb +4 -2
- data/spec/fog/cdn_spec.rb +1 -2
- data/spec/fog/compute_spec.rb +1 -2
- data/spec/fog/dns_spec.rb +1 -2
- data/spec/fog/identity_spec.rb +1 -2
- data/spec/fog/image_spec.rb +1 -2
- data/spec/fog/metering_spec.rb +1 -2
- data/spec/fog/monitoring_spec.rb +1 -2
- data/spec/fog/network_spec.rb +1 -2
- data/spec/fog/orchestration_spec.rb +1 -2
- data/spec/fog/storage_spec.rb +1 -2
- data/spec/fog/support_spec.rb +1 -2
- data/spec/fog/volume_spec.rb +1 -2
- data/spec/fog/vpn_spec.rb +1 -2
- data/spec/fog/xml/connection_spec.rb +1 -2
- data/spec/helpers/bin.rb +4 -0
- data/spec/spec_helper.rb +15 -0
- data/tests/compute/helper.rb +3 -0
- data/tests/glesys/requests/compute/helper.rb +66 -2
- data/tests/glesys/requests/compute/server_tests.rb +22 -6
- data/tests/glesys/requests/compute/ssh_key_tests.rb +47 -0
- data/tests/google/credentials_tests.rb +73 -0
- data/tests/helper.rb +5 -1
- data/tests/linode/requests/compute/linode_tests.rb +76 -3
- data/tests/openstack/authenticate_tests.rb +10 -0
- data/tests/openstack/models/planning/.gitkeep +0 -0
- data/tests/openstack/models/planning/plan_tests.rb +51 -0
- data/tests/openstack/models/planning/plans_tests.rb +18 -0
- data/tests/openstack/models/planning/role_tests.rb +14 -0
- data/tests/openstack/requests/planning/.gitkeep +0 -0
- data/tests/openstack/requests/planning/plan_tests.rb +65 -0
- data/tests/openstack/requests/planning/role_tests.rb +16 -0
- metadata +193 -75
- data/lib/fog/bin/atmos.rb +0 -29
- data/lib/fog/bin/local.rb +0 -29
- data/lib/fog/local.rb +0 -1
- data/lib/fog/local/core.rb +0 -9
- data/lib/fog/local/models/storage/directories.rb +0 -33
- data/lib/fog/local/models/storage/directory.rb +0 -53
- data/lib/fog/local/models/storage/file.rb +0 -132
- data/lib/fog/local/models/storage/files.rb +0 -84
- data/lib/fog/local/storage.rb +0 -96
- data/tests/local/models/directories_tests.rb +0 -17
- data/tests/local/models/directory_tests.rb +0 -16
- data/tests/local/models/file_tests.rb +0 -43
- data/tests/local/storage_tests.rb +0 -40
@@ -0,0 +1,8 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
2
|
+
<affinity_group href="/api/clusters/a240aac1-d03a-4c69-923e-a295200539fa/affinitygroups/9aaec56b-e24d-4fce-82a1-21a7b642ab0f" id="9aaec56b-e24d-4fce-82a1-21a7b642ab0f">
|
3
|
+
<name>test1_ag</name>
|
4
|
+
<link href="/api/clusters/a240aac1-d03a-4c69-923e-a295200539fa/affinitygroups/9aaec56b-e24d-4fce-82a1-21a7b642ab0f/vms" rel="vms"/>
|
5
|
+
<cluster href="/api/clusters/a240aac1-d03a-4c69-923e-a295200539fa" id="a240aac1-d03a-4c69-923e-a295200539fa"/>
|
6
|
+
<positive>true</positive>
|
7
|
+
<enforcing>false</enforcing>
|
8
|
+
</affinity_group>
|
@@ -0,0 +1,9 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
2
|
+
<vms>
|
3
|
+
<vm href="/api/vms/5ee86332-7b19-465b-8801-2a12ed0d6c1b" id="5ee86332-7b19-465b-8801-2a12ed0d6c1b">
|
4
|
+
<name>test-vm1</name>
|
5
|
+
</vm>
|
6
|
+
<vm href="/api/vms/349764bb-eba3-4466-abef-f18f4c40c9f1" id="349764bb-eba3-4466-abef-f18f4c40c9f1">
|
7
|
+
<name>fosdem</name>
|
8
|
+
</vm>
|
9
|
+
</vms>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
2
|
+
<affinity_groups>
|
3
|
+
<affinity_group href="/api/clusters/a240aac1-d03a-4c69-923e-a295200539fa/affinitygroups/ff73a83f-10b2-44ae-8c98-a29b13ae0c19" id="ff73a83f-10b2-44ae-8c98-a29b13ae0c19">
|
4
|
+
<name>test2_ag</name>
|
5
|
+
<link href="/api/clusters/a240aac1-d03a-4c69-923e-a295200539fa/affinitygroups/ff73a83f-10b2-44ae-8c98-a29b13ae0c19/vms" rel="vms"/>
|
6
|
+
<cluster href="/api/clusters/a240aac1-d03a-4c69-923e-a295200539fa" id="a240aac1-d03a-4c69-923e-a295200539fa"/>
|
7
|
+
<positive>true</positive>
|
8
|
+
<enforcing>true</enforcing>
|
9
|
+
</affinity_group>
|
10
|
+
<affinity_group href="/api/clusters/a240aac1-d03a-4c69-923e-a295200539fa/affinitygroups/9aaec56b-e24d-4fce-82a1-21a7b642ab0f" id="9aaec56b-e24d-4fce-82a1-21a7b642ab0f">
|
11
|
+
<name>test1_ag</name>
|
12
|
+
<link href="/api/clusters/a240aac1-d03a-4c69-923e-a295200539fa/affinitygroups/9aaec56b-e24d-4fce-82a1-21a7b642ab0f/vms" rel="vms"/>
|
13
|
+
<cluster href="/api/clusters/a240aac1-d03a-4c69-923e-a295200539fa" id="a240aac1-d03a-4c69-923e-a295200539fa"/>
|
14
|
+
<positive>true</positive>
|
15
|
+
<enforcing>false</enforcing>
|
16
|
+
</affinity_group>
|
17
|
+
</affinity_groups>
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class Ovirt
|
4
|
+
class Real
|
5
|
+
def remove_from_affinity_group(id, options = {})
|
6
|
+
raise ArgumentError, "instance id is a required parameter" unless id
|
7
|
+
raise ArgumentError, "affinity group id is a required parameter for remove-from-affinity-group" unless options.key? :id
|
8
|
+
client.delete_vm_from_affinity_group(options[:id], id)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
class Mock
|
13
|
+
def remove_from_affinity_group(id, options = {})
|
14
|
+
raise ArgumentError, "instance id is a required parameter" unless id
|
15
|
+
raise ArgumentError, "affinity group id is a required parameter for remove-from-affinity-group" unless options.key? :id
|
16
|
+
true
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -1,19 +1,32 @@
|
|
1
1
|
module Fog
|
2
2
|
module Compute
|
3
3
|
class Ovirt
|
4
|
-
|
5
|
-
|
4
|
+
|
5
|
+
module Shared
|
6
|
+
def check_arguments(id, options)
|
6
7
|
raise ArgumentError, "instance id is a required parameter" unless id
|
7
8
|
raise ArgumentError, "interface id is a required parameter for update-interface" unless options.key? :id
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
class Real
|
13
|
+
extend ::Fog::Compute::Ovirt::Shared
|
8
14
|
|
9
|
-
|
15
|
+
def update_interface(id, options)
|
16
|
+
check_arguments(id, options)
|
17
|
+
|
18
|
+
interface_id = options[:id]
|
19
|
+
options.delete(:id)
|
20
|
+
|
21
|
+
client.update_interface(id, interface_id, options)
|
10
22
|
end
|
11
23
|
end
|
12
24
|
|
13
25
|
class Mock
|
26
|
+
extend ::Fog::Compute::Ovirt::Shared
|
27
|
+
|
14
28
|
def update_interface(id, options)
|
15
|
-
|
16
|
-
raise ArgumentError, "interface id is a required parameter for update-interface" unless options.key? :id
|
29
|
+
check_arguments(id, options)
|
17
30
|
true
|
18
31
|
end
|
19
32
|
end
|
@@ -414,4 +414,4 @@ Example code using Cloud Block Storage can be found [here](https://github.com/fo
|
|
414
414
|
|
415
415
|
Your feedback is appreciated! If you have specific issues with the **fog** SDK, you should file an [issue via Github](https://github.com/fog/fog/issues).
|
416
416
|
|
417
|
-
For general feedback and support requests,
|
417
|
+
For general feedback and support requests, please visit: https://developer.rackspace.com/support.
|
@@ -348,4 +348,4 @@ This returns a JSON blob that describes the home document.
|
|
348
348
|
|
349
349
|
Your feedback is appreciated! If you have specific issues with the **fog** SDK, you should file an [issue via Github](https://github.com/fog/fog/issues).
|
350
350
|
|
351
|
-
For general feedback and support requests,
|
351
|
+
For general feedback and support requests, please visit: https://developer.rackspace.com/support.
|
@@ -715,5 +715,5 @@ Example code using Next Gen Cloud Servers can be found [here](https://github.com
|
|
715
715
|
|
716
716
|
Your feedback is appreciated! If you have specific issues with the **fog** SDK, you should file an [issue via Github](https://github.com/fog/fog/issues).
|
717
717
|
|
718
|
-
For general feedback and support requests,
|
718
|
+
For general feedback and support requests, please visit: https://developer.rackspace.com/support.
|
719
719
|
|
@@ -85,4 +85,4 @@ These services can be explored in further depth in the following documents:
|
|
85
85
|
## Support and Feedback
|
86
86
|
Your feedback is appreciated! If you have specific issues with the **fog** SDK, you should file an [issue via Github](https://github.com/fog/fog/issues).
|
87
87
|
|
88
|
-
For general feedback and support requests,
|
88
|
+
For general feedback and support requests, please visit: https://developer.rackspace.com/support.
|
@@ -419,4 +419,4 @@ Example code using Networking can be found [here](https://github.com/fog/fog/tre
|
|
419
419
|
|
420
420
|
Your feedback is appreciated! If you have specific issues with the **fog** SDK, you should file an [issue via Github](https://github.com/fog/fog/issues).
|
421
421
|
|
422
|
-
For general feedback and support requests,
|
422
|
+
For general feedback and support requests, please visit: https://developer.rackspace.com/support.
|
@@ -554,4 +554,4 @@ Example code using Cloud Files can be found [here](https://github.com/fog/fog/tr
|
|
554
554
|
|
555
555
|
Your feedback is appreciated! If you have specific issues with the **fog** SDK, you should file an [issue via Github](https://github.com/fog/fog/issues).
|
556
556
|
|
557
|
-
For general feedback and support requests,
|
557
|
+
For general feedback and support requests, please visit: https://developer.rackspace.com/support.
|
@@ -44,4 +44,4 @@ To execute scripts without `bundler`:
|
|
44
44
|
|
45
45
|
Your feedback is appreciated! If you have specific issues with the **fog** SDK, developers should file an [issue via Github](https://github.com/fog/fog/issues).
|
46
46
|
|
47
|
-
For general feedback and support requests,
|
47
|
+
For general feedback and support requests, please visit: https://developer.rackspace.com/support.
|
@@ -12,7 +12,7 @@ module Fog
|
|
12
12
|
image_id = Fog.credentials[:rackspace_image_id] ||= Fog::Rackspace::MockData.uuid
|
13
13
|
image_name = Fog::Mock.random_letters(6)
|
14
14
|
network_id = Fog::Rackspace::MockData.uuid
|
15
|
-
user_id =
|
15
|
+
user_id = Fog::Mock.random_numbers(6).to_s
|
16
16
|
|
17
17
|
flavor = {
|
18
18
|
"OS-FLV-EXT-DATA:ephemeral" => 4,
|
@@ -28,11 +28,11 @@ module Fog
|
|
28
28
|
"rel" => "bookmark"
|
29
29
|
}
|
30
30
|
],
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
31
|
+
"name" => "512MB Standard Instance",
|
32
|
+
"ram" => 512,
|
33
|
+
"rxtx_factor" => 2.0,
|
34
|
+
"swap" => 512,
|
35
|
+
"vcpus" => 1
|
36
36
|
}
|
37
37
|
|
38
38
|
image = {
|
@@ -55,7 +55,7 @@ module Fog
|
|
55
55
|
"type" => "application/vnd.openstack.image"
|
56
56
|
}
|
57
57
|
],
|
58
|
-
|
58
|
+
"metadata" => {
|
59
59
|
"arch" => "x86-64",
|
60
60
|
"auto_disk_config" => "True",
|
61
61
|
"com.rackspace__1__build_core" => "1",
|
@@ -89,11 +89,11 @@ module Fog
|
|
89
89
|
}
|
90
90
|
|
91
91
|
key_pair = {
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
92
|
+
'public_key' => "ssh-rsa ".concat(Fog::Mock.random_letters(372)).concat(" Generated by Nova\n"),
|
93
|
+
'private_key' => "-----BEGIN RSA PRIVATE KEY-----\n".concat(Fog::Mock.random_letters(1635)).concat("\n-----END RSA PRIVATE KEY-----\n"),
|
94
|
+
'user_id' => user_id,
|
95
|
+
'name' => Fog::Mock.random_letters(32),
|
96
|
+
'fingerprint' => "00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00"
|
97
97
|
}
|
98
98
|
|
99
99
|
#Block Storage
|
@@ -103,51 +103,51 @@ module Fog
|
|
103
103
|
volume_type1 = {
|
104
104
|
"id" => volume_type1_id,
|
105
105
|
"name" => "SATA",
|
106
|
-
"extra_specs" => {}
|
106
|
+
"extra_specs" => {}
|
107
107
|
}
|
108
108
|
|
109
109
|
volume_type2 = {
|
110
110
|
"id" => volume_type2_id,
|
111
111
|
"name" => "SSD",
|
112
|
-
"extra_specs" => {}
|
112
|
+
"extra_specs" => {}
|
113
113
|
}
|
114
114
|
|
115
115
|
#AutoScale
|
116
116
|
launch_config = {
|
117
117
|
"args" => {
|
118
|
-
|
118
|
+
"loadBalancers" => [
|
119
|
+
{
|
120
|
+
"port" => 8080,
|
121
|
+
"loadBalancerId" => 9099
|
122
|
+
}
|
123
|
+
],
|
124
|
+
"server" => {
|
125
|
+
"name" => "autoscale_server",
|
126
|
+
"imageRef" => "0d589460-f177-4b0f-81c1-8ab8903ac7d8",
|
127
|
+
"flavorRef" => "2",
|
128
|
+
"OS-DCF =>diskConfig" => "AUTO",
|
129
|
+
"metadata" => {
|
130
|
+
"build_config" => "core",
|
131
|
+
"meta_key_1" => "meta_value_1",
|
132
|
+
"meta_key_2" => "meta_value_2"
|
133
|
+
},
|
134
|
+
"networks" => [
|
135
|
+
{
|
136
|
+
"uuid" => "11111111-1111-1111-1111-111111111111"
|
137
|
+
},
|
119
138
|
{
|
120
|
-
"
|
121
|
-
"loadBalancerId" => 9099
|
139
|
+
"uuid" => "00000000-0000-0000-0000-000000000000"
|
122
140
|
}
|
123
141
|
],
|
124
|
-
"
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
},
|
134
|
-
"networks" => [
|
135
|
-
{
|
136
|
-
"uuid" => "11111111-1111-1111-1111-111111111111"
|
137
|
-
},
|
138
|
-
{
|
139
|
-
"uuid" => "00000000-0000-0000-0000-000000000000"
|
140
|
-
}
|
141
|
-
],
|
142
|
-
"personality" => [
|
143
|
-
{
|
144
|
-
"path" => "/root/.csivh",
|
145
|
-
"contents" => "VGhpcyBpcyBhIHRlc3QgZmlsZS4="
|
146
|
-
}
|
147
|
-
]
|
148
|
-
}
|
149
|
-
},
|
150
|
-
"type" => "launch_server"
|
142
|
+
"personality" => [
|
143
|
+
{
|
144
|
+
"path" => "/root/.csivh",
|
145
|
+
"contents" => "VGhpcyBpcyBhIHRlc3QgZmlsZS4="
|
146
|
+
}
|
147
|
+
]
|
148
|
+
}
|
149
|
+
},
|
150
|
+
"type" => "launch_server"
|
151
151
|
}
|
152
152
|
|
153
153
|
group_config = {
|
@@ -204,11 +204,11 @@ module Fog
|
|
204
204
|
end
|
205
205
|
|
206
206
|
def self.uuid
|
207
|
-
[8,4,4,4,12].map{|i| Fog::Mock.random_hex(i)}.join("-")
|
207
|
+
[8,4,4,4,12].map { |i| Fog::Mock.random_hex(i) }.join("-")
|
208
208
|
end
|
209
209
|
|
210
210
|
def self.ipv4_address
|
211
|
-
4.times.map{ Fog::Mock.random_numbers(3) }.join(".")
|
211
|
+
4.times.map { Fog::Mock.random_numbers(3) }.join(".")
|
212
212
|
end
|
213
213
|
|
214
214
|
def self.ipv6_address
|
@@ -217,13 +217,13 @@ module Fog
|
|
217
217
|
|
218
218
|
def self.keep(hash, *keys)
|
219
219
|
{}.tap do |kept|
|
220
|
-
keys.each{|k| kept[k]= hash[k] if hash.key?(k)}
|
220
|
+
keys.each { |k| kept[k] = hash[k] if hash.key?(k) }
|
221
221
|
end
|
222
222
|
end
|
223
223
|
|
224
224
|
def self.slice(hash, *keys)
|
225
225
|
hash.dup.tap do |sliced|
|
226
|
-
keys.each{|k| sliced.delete(k)}
|
226
|
+
keys.each { |k| sliced.delete(k) }
|
227
227
|
end
|
228
228
|
end
|
229
229
|
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module Fog
|
2
|
+
module Rackspace
|
3
|
+
class NetworkingV2
|
4
|
+
class SecurityGroup < Fog::Model
|
5
|
+
|
6
|
+
identity :id
|
7
|
+
|
8
|
+
attribute :name
|
9
|
+
attribute :description
|
10
|
+
attribute :tenant_id
|
11
|
+
|
12
|
+
def save
|
13
|
+
data = unless self.id.nil?
|
14
|
+
service.update_security_group(self)
|
15
|
+
else
|
16
|
+
service.create_security_group(self)
|
17
|
+
end
|
18
|
+
|
19
|
+
merge_attributes(data.body['security_group'])
|
20
|
+
true
|
21
|
+
end
|
22
|
+
|
23
|
+
def destroy
|
24
|
+
requires :identity
|
25
|
+
|
26
|
+
service.delete_security_group(identity)
|
27
|
+
true
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module Fog
|
2
|
+
module Rackspace
|
3
|
+
class NetworkingV2
|
4
|
+
class SecurityGroupRule < Fog::Model
|
5
|
+
|
6
|
+
identity :id
|
7
|
+
|
8
|
+
attribute :direction
|
9
|
+
attribute :ethertype
|
10
|
+
attribute :port_range_max
|
11
|
+
attribute :port_range_min
|
12
|
+
attribute :protocol
|
13
|
+
attribute :remote_group_id
|
14
|
+
attribute :remote_ip_prefix
|
15
|
+
attribute :security_group_id
|
16
|
+
attribute :tenant_id
|
17
|
+
|
18
|
+
def save
|
19
|
+
data = unless self.id.nil?
|
20
|
+
service.update_security_group_rule(self)
|
21
|
+
else
|
22
|
+
service.create_security_group_rule(self)
|
23
|
+
end
|
24
|
+
|
25
|
+
merge_attributes(data.body['security_group_rule'])
|
26
|
+
true
|
27
|
+
end
|
28
|
+
|
29
|
+
def destroy
|
30
|
+
requires :identity
|
31
|
+
|
32
|
+
service.delete_security_group_rule(identity)
|
33
|
+
true
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'fog/rackspace/models/networking_v2/security_group_rule'
|
2
|
+
|
3
|
+
module Fog
|
4
|
+
module Rackspace
|
5
|
+
class NetworkingV2
|
6
|
+
class SecurityGroupRules < Fog::Collection
|
7
|
+
model Fog::Rackspace::NetworkingV2::SecurityGroupRule
|
8
|
+
|
9
|
+
def all
|
10
|
+
data = service.list_security_group_rules.body['security_group_rules']
|
11
|
+
load(data)
|
12
|
+
end
|
13
|
+
|
14
|
+
def get(id)
|
15
|
+
data = service.show_security_group_rule(id).body['security_group_rule']
|
16
|
+
new(data)
|
17
|
+
rescue Fog::Rackspace::NetworkingV2::NotFound
|
18
|
+
nil
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'fog/rackspace/models/networking_v2/security_group'
|
2
|
+
|
3
|
+
module Fog
|
4
|
+
module Rackspace
|
5
|
+
class NetworkingV2
|
6
|
+
class SecurityGroups < Fog::Collection
|
7
|
+
model Fog::Rackspace::NetworkingV2::SecurityGroup
|
8
|
+
|
9
|
+
def all
|
10
|
+
data = service.list_security_groups.body['security_groups']
|
11
|
+
load(data)
|
12
|
+
end
|
13
|
+
|
14
|
+
def get(id)
|
15
|
+
data = service.show_security_group(id).body['security_group']
|
16
|
+
new(data)
|
17
|
+
rescue Fog::Rackspace::NetworkingV2::NotFound
|
18
|
+
nil
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -31,9 +31,9 @@ module Fog
|
|
31
31
|
end
|
32
32
|
|
33
33
|
class InvalidImageStateException < InvalidStateException
|
34
|
-
|
35
|
-
|
36
|
-
|
34
|
+
def to_s
|
35
|
+
"Image should have transitioned to '#{desired_state}' not '#{current_state}'"
|
36
|
+
end
|
37
37
|
end
|
38
38
|
|
39
39
|
requires :rackspace_username, :rackspace_api_key
|
@@ -54,6 +54,12 @@ module Fog
|
|
54
54
|
model :port
|
55
55
|
collection :ports
|
56
56
|
|
57
|
+
model :security_group
|
58
|
+
collection :security_groups
|
59
|
+
|
60
|
+
model :security_group_rule
|
61
|
+
collection :security_group_rules
|
62
|
+
|
57
63
|
request_path 'fog/rackspace/requests/networking_v2'
|
58
64
|
request :list_networks
|
59
65
|
request :create_network
|
@@ -73,6 +79,17 @@ module Fog
|
|
73
79
|
request :update_port
|
74
80
|
request :delete_port
|
75
81
|
|
82
|
+
request :list_security_groups
|
83
|
+
request :create_security_group
|
84
|
+
request :show_security_group
|
85
|
+
request :update_security_group
|
86
|
+
request :delete_security_group
|
87
|
+
|
88
|
+
request :list_security_group_rules
|
89
|
+
request :create_security_group_rule
|
90
|
+
request :show_security_group_rule
|
91
|
+
request :delete_security_group_rule
|
92
|
+
|
76
93
|
class Mock < Fog::Rackspace::Service
|
77
94
|
include Fog::Rackspace::MockData
|
78
95
|
|
@@ -128,10 +145,10 @@ module Fog
|
|
128
145
|
|
129
146
|
def authenticate(options={})
|
130
147
|
super({
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
148
|
+
:rackspace_api_key => @rackspace_api_key,
|
149
|
+
:rackspace_username => @rackspace_username,
|
150
|
+
:rackspace_auth_url => @rackspace_auth_url,
|
151
|
+
:connection_options => @connection_options
|
135
152
|
})
|
136
153
|
end
|
137
154
|
|