fog-maestrodev 1.18.0.20131121075022 → 1.18.0.20131122203507
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/fog.gemspec +2 -2
- data/lib/fog/aws/models/auto_scaling/configuration.rb +1 -0
- data/lib/fog/aws/models/compute/flavors.rb +10 -0
- data/lib/fog/aws/models/glacier/vault.rb +1 -1
- data/lib/fog/aws/parsers/auto_scaling/describe_launch_configurations.rb +3 -0
- data/lib/fog/aws/requests/auto_scaling/create_launch_configuration.rb +1 -0
- data/lib/fog/aws/requests/dns/get_change.rb +1 -1
- data/lib/fog/aws/storage.rb +2 -1
- data/lib/fog/core/errors.rb +3 -3
- data/lib/fog/dreamhost/dns.rb +2 -4
- data/lib/fog/google/compute.rb +72 -62
- data/lib/fog/google/models/compute/zones.rb +1 -1
- data/lib/fog/google/requests/compute/delete_disk.rb +19 -2
- data/lib/fog/google/requests/compute/delete_server.rb +3 -3
- data/lib/fog/google/requests/compute/get_disk.rb +26 -2
- data/lib/fog/google/requests/compute/get_image.rb +3 -3
- data/lib/fog/google/requests/compute/get_server.rb +1 -0
- data/lib/fog/google/requests/compute/insert_disk.rb +37 -2
- data/lib/fog/google/requests/compute/insert_firewall.rb +2 -1
- data/lib/fog/google/requests/compute/insert_image.rb +1 -1
- data/lib/fog/google/requests/compute/insert_server.rb +31 -22
- data/lib/fog/google/requests/compute/list_disks.rb +8 -2
- data/lib/fog/google/requests/compute/list_images.rb +2 -2
- data/lib/fog/google/requests/compute/list_machine_types.rb +2 -2
- data/lib/fog/google/requests/compute/list_servers.rb +2 -2
- data/lib/fog/google/requests/compute/list_zone_operations.rb +1 -1
- data/lib/fog/google/requests/compute/list_zones.rb +1 -1
- data/lib/fog/hp.rb +1 -1
- data/lib/fog/hp/README.md +57 -0
- data/lib/fog/hp/articles/auth_caching.md +23 -0
- data/lib/fog/hp/docs/connect.md +152 -0
- data/lib/fog/hp/docs/install.md +133 -0
- data/lib/fog/hp/examples/block_storage.md +296 -0
- data/lib/fog/hp/examples/block_storage_v2.md +446 -0
- data/lib/fog/hp/examples/cdn.md +54 -0
- data/lib/fog/hp/examples/compute.md +794 -0
- data/lib/fog/hp/examples/compute_v2.md +848 -0
- data/lib/fog/hp/examples/getting_started_examples.md +30 -0
- data/lib/fog/hp/examples/networking.md +472 -0
- data/lib/fog/hp/examples/object_storage.md +387 -0
- data/lib/fog/json.rb +6 -3
- data/lib/fog/openstack/identity.rb +2 -3
- data/lib/fog/openstack/image.rb +1 -4
- data/lib/fog/openstack/metering.rb +1 -4
- data/lib/fog/openstack/network.rb +1 -3
- data/lib/fog/openstack/requests/compute/add_flavor_access.rb +1 -1
- data/lib/fog/openstack/requests/compute/allocate_address.rb +1 -1
- data/lib/fog/openstack/requests/compute/attach_volume.rb +1 -1
- data/lib/fog/openstack/requests/compute/boot_from_snapshot.rb +1 -1
- data/lib/fog/openstack/requests/compute/create_flavor.rb +1 -1
- data/lib/fog/openstack/requests/compute/create_key_pair.rb +1 -1
- data/lib/fog/openstack/requests/compute/create_security_group.rb +1 -1
- data/lib/fog/openstack/requests/compute/create_security_group_rule.rb +1 -1
- data/lib/fog/openstack/requests/compute/create_volume.rb +1 -1
- data/lib/fog/openstack/requests/compute/create_volume_snapshot.rb +1 -1
- data/lib/fog/openstack/requests/compute/list_tenants.rb +1 -1
- data/lib/fog/openstack/requests/compute/remove_flavor_access.rb +1 -1
- data/lib/fog/openstack/requests/compute/update_quota.rb +1 -1
- data/lib/fog/openstack/requests/identity/create_ec2_credential.rb +1 -1
- data/lib/fog/openstack/requests/identity/create_role.rb +1 -1
- data/lib/fog/openstack/requests/identity/create_user.rb +1 -1
- data/lib/fog/openstack/requests/identity/update_user.rb +1 -1
- data/lib/fog/openstack/requests/image/update_image_members.rb +1 -1
- data/lib/fog/openstack/requests/orchestration/create_stack.rb +2 -2
- data/lib/fog/openstack/requests/orchestration/update_stack.rb +1 -1
- data/lib/fog/openstack/requests/volume/create_volume.rb +1 -1
- data/lib/fog/openstack/requests/volume/create_volume_snapshot.rb +1 -1
- data/lib/fog/openstack/volume.rb +1 -4
- data/lib/fog/rackspace/compute_v2.rb +1 -0
- data/lib/fog/rackspace/examples/queues/claim_messages.rb +60 -0
- data/lib/fog/rackspace/examples/queues/create_queue.rb +45 -0
- data/lib/fog/rackspace/examples/queues/delete_message.rb +72 -0
- data/lib/fog/rackspace/examples/queues/delete_queue.rb +53 -0
- data/lib/fog/rackspace/examples/queues/list_messages.rb +64 -0
- data/lib/fog/rackspace/examples/queues/post_message.rb +59 -0
- data/lib/fog/rackspace/models/queues/claim.rb +2 -0
- data/lib/fog/rackspace/models/queues/message.rb +5 -5
- data/lib/fog/rackspace/models/queues/queue.rb +1 -1
- data/lib/fog/rackspace/service.rb +1 -1
- data/lib/fog/riakcs.rb +2 -2
- data/lib/fog/riakcs/provisioning.rb +1 -3
- data/lib/fog/riakcs/requests/provisioning/create_user.rb +2 -2
- data/lib/fog/riakcs/requests/provisioning/get_user.rb +1 -1
- data/lib/fog/riakcs/requests/provisioning/list_users.rb +1 -1
- data/lib/fog/riakcs/requests/usage/get_usage.rb +1 -1
- data/lib/fog/riakcs/usage.rb +0 -2
- data/lib/fog/vsphere/compute.rb +1 -0
- data/lib/fog/vsphere/models/compute/datastore.rb +1 -0
- data/lib/fog/vsphere/requests/compute/list_datastores.rb +9 -8
- data/lib/fog/vsphere/requests/compute/set_vm_customvalue.rb +19 -0
- data/lib/tasks/changelog_task.rb +0 -1
- data/tests/google/models/compute/disk_tests.rb +5 -0
- data/tests/google/models/compute/disks_tests.rb +5 -0
- data/tests/google/models/compute/server_tests.rb +3 -0
- data/tests/google/models/compute/servers_tests.rb +5 -0
- data/tests/google/requests/compute/disk_tests.rb +2 -1
- data/tests/google/requests/compute/firewall_tests.rb +1 -0
- data/tests/google/requests/compute/image_tests.rb +3 -0
- data/tests/google/requests/compute/network_tests.rb +1 -0
- data/tests/google/requests/compute/operation_tests.rb +1 -0
- data/tests/google/requests/compute/server_tests.rb +2 -3
- data/tests/google/requests/compute/zone_tests.rb +1 -6
- data/tests/helpers/mock_helper.rb +3 -4
- data/tests/rackspace/models/queues/message_tests.rb +16 -0
- data/tests/vsphere/requests/compute/set_vm_customvalue_tests.rb +21 -0
- metadata +29 -3
- data/lib/fog/hp/README_HP.rdoc +0 -61
@@ -4,8 +4,25 @@ module Fog
|
|
4
4
|
|
5
5
|
class Mock
|
6
6
|
|
7
|
-
def delete_disk(disk_name)
|
8
|
-
|
7
|
+
def delete_disk(disk_name, zone_name)
|
8
|
+
get_disk(disk_name, zone_name)
|
9
|
+
self.data[:disks].delete disk_name
|
10
|
+
|
11
|
+
build_response(:body => {
|
12
|
+
"kind" => "compute#operation",
|
13
|
+
"id" => "7145812689701515415",
|
14
|
+
"name" => "operation-1385125998242-4ebc3c7173e70-11e1ad0b",
|
15
|
+
"zone" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/zones/#{zone_name}",
|
16
|
+
"operationType" => "delete",
|
17
|
+
"targetLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/zones/#{zone_name}/disks/#{disk_name}",
|
18
|
+
"targetId" => "6817095360746367667",
|
19
|
+
"status" => "PENDING",
|
20
|
+
"user" => "123456789012-qwertyuiopasdfghjkl1234567890qwe@developer.gserviceaccount.com",
|
21
|
+
"progress" => 0,
|
22
|
+
"insertTime" => Time.now.iso8601,
|
23
|
+
"startTime" => Time.now.iso8601,
|
24
|
+
"selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/zones/#{zone_name}/operations/operation-1385125998242-4ebc3c7173e70-11e1ad0b"
|
25
|
+
})
|
9
26
|
end
|
10
27
|
|
11
28
|
end
|
@@ -32,16 +32,16 @@ module Fog
|
|
32
32
|
"kind" => "compute#operation",
|
33
33
|
"id" => "10035781241131638365",
|
34
34
|
"name" => "operation-1380213292196-4e74bf2fbc3c1-ae707d47",
|
35
|
-
"zone" => "https://www.googleapis.com/compute/
|
35
|
+
"zone" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/zones/#{zone_name}",
|
36
36
|
"operationType" => "delete",
|
37
|
-
"targetLink" => "https://www.googleapis.com/compute/
|
37
|
+
"targetLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/zones/#{zone_name}/instances/#{server_name}",
|
38
38
|
"targetId" => "14544909043643897380",
|
39
39
|
"status" => "PENDING",
|
40
40
|
"user" => "123456789012-qwertyuiopasdfghjkl1234567890qwe@developer.gserviceaccount.com",
|
41
41
|
"progress" => 0,
|
42
42
|
"insertTime" => Time.now.iso8601,
|
43
43
|
"startTime" => Time.now.iso8601,
|
44
|
-
"selfLink" => "https://www.googleapis.com/compute/
|
44
|
+
"selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/zones/#{zone_name}/operations/operation-1380213292196-4e74bf2fbc3c1-ae707d47"
|
45
45
|
})
|
46
46
|
end
|
47
47
|
|
@@ -4,8 +4,32 @@ module Fog
|
|
4
4
|
|
5
5
|
class Mock
|
6
6
|
|
7
|
-
def get_disk(disk_name)
|
8
|
-
|
7
|
+
def get_disk(disk_name, zone_name)
|
8
|
+
disk = self.data[:disks][disk_name]
|
9
|
+
if zone_name.start_with? 'http'
|
10
|
+
zone_name = zone_name.split('/')[-1]
|
11
|
+
end
|
12
|
+
get_zone(zone_name)
|
13
|
+
zone = self.data[:zones][zone_name]
|
14
|
+
if disk.nil? or disk["zone"] != zone["selfLink"]
|
15
|
+
return build_response(:body => {
|
16
|
+
"error" => {
|
17
|
+
"errors" => [
|
18
|
+
{
|
19
|
+
"domain" => "global",
|
20
|
+
"reason" => "notFound",
|
21
|
+
"message" => "The resource 'projects/#{@project}/zones/#{zone_name}/disks/#{disk_name}' was not found"
|
22
|
+
}
|
23
|
+
],
|
24
|
+
"code" => 404,
|
25
|
+
"message" => "The resource 'projects/#{@project}/zones/#{zone_name}/disks/#{disk_name}' was not found"
|
26
|
+
}
|
27
|
+
})
|
28
|
+
end
|
29
|
+
|
30
|
+
# TODO transition the disk through the states
|
31
|
+
|
32
|
+
build_response(:body => disk)
|
9
33
|
end
|
10
34
|
|
11
35
|
end
|
@@ -5,17 +5,17 @@ module Fog
|
|
5
5
|
class Mock
|
6
6
|
|
7
7
|
def get_image(image_name, project=@project)
|
8
|
-
image =
|
8
|
+
image = data(project)[:images][image_name] || {
|
9
9
|
"error" => {
|
10
10
|
"errors" => [
|
11
11
|
{
|
12
12
|
"domain" => "global",
|
13
13
|
"reason" => "invalid",
|
14
|
-
"message" => "Invalid value for field 'resource.images': 'https://www.googleapis.com/compute/
|
14
|
+
"message" => "Invalid value for field 'resource.images': 'https://www.googleapis.com/compute/#{api_version}/projects/#{project}/global/images/#{image_name}'. Resource was not found."
|
15
15
|
}
|
16
16
|
],
|
17
17
|
"code" => 400,
|
18
|
-
"message" => "Invalid value for field 'resource.images': 'https://www.googleapis.com/compute/
|
18
|
+
"message" => "Invalid value for field 'resource.images': 'https://www.googleapis.com/compute/#{api_version}/projects/#{project}/global/images/#{image_name}'. Resource was not found."
|
19
19
|
}
|
20
20
|
}
|
21
21
|
build_response(:body => image)
|
@@ -4,8 +4,43 @@ module Fog
|
|
4
4
|
|
5
5
|
class Mock
|
6
6
|
|
7
|
-
def insert_disk(disk_name)
|
8
|
-
|
7
|
+
def insert_disk(disk_name, zone_name, image_name=nil, options={})
|
8
|
+
# check that image and zone exist
|
9
|
+
image_project = nil
|
10
|
+
unless image_name.nil?
|
11
|
+
([ @project ] + Fog::Compute::Google::Images::GLOBAL_PROJECTS).each do |project|
|
12
|
+
image_project = project
|
13
|
+
break if data(project)[:images][options['image']]
|
14
|
+
end
|
15
|
+
get_image(image_name, image_project) # ok if image exists, will fail otherwise
|
16
|
+
end
|
17
|
+
get_zone(zone_name)
|
18
|
+
|
19
|
+
self.data[:disks][disk_name] = {
|
20
|
+
"kind" => "compute#disk",
|
21
|
+
"id" => Fog::Mock.random_numbers(19),
|
22
|
+
"creationTimestamp" => Time.now.iso8601,
|
23
|
+
"zone" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/zones/#{zone_name}",
|
24
|
+
"status" => "READY",
|
25
|
+
"name" => disk_name,
|
26
|
+
"sizeGb" => options['sizeGb'] || "10",
|
27
|
+
"selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/zones/#{zone_name}/disks/#{disk_name}"
|
28
|
+
}
|
29
|
+
|
30
|
+
build_response(:body => {
|
31
|
+
"kind" => "compute#operation",
|
32
|
+
"id" => "12498846269172327286",
|
33
|
+
"name" => "operation-1385124218076-4ebc35cfbe9f1-476486c5",
|
34
|
+
"zone" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/zones/#{zone_name}",
|
35
|
+
"operationType" => "insert",
|
36
|
+
"targetLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/zones/#{zone_name}/disks/#{disk_name}",
|
37
|
+
"status" => "PENDING",
|
38
|
+
"user" => "123456789012-qwertyuiopasdfghjkl1234567890qwe@developer.gserviceaccount.com",
|
39
|
+
"progress" => 0,
|
40
|
+
"insertTime" => Time.now.iso8601,
|
41
|
+
"startTime" => Time.now.iso8601,
|
42
|
+
"selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/zones/#{zone_name}/operations/operation-1385124218076-4ebc35cfbe9f1-476486c5"
|
43
|
+
})
|
9
44
|
end
|
10
45
|
|
11
46
|
end
|
@@ -2,7 +2,25 @@ module Fog
|
|
2
2
|
module Compute
|
3
3
|
class Google
|
4
4
|
|
5
|
+
module Shared
|
6
|
+
private
|
7
|
+
|
8
|
+
def handle_disks(options)
|
9
|
+
disks = []
|
10
|
+
options.delete('disks').each do |disk|
|
11
|
+
if disk.is_a? Disk
|
12
|
+
disks << disk.get_object
|
13
|
+
else
|
14
|
+
disks << disk
|
15
|
+
end
|
16
|
+
end
|
17
|
+
disks
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
5
21
|
class Mock
|
22
|
+
include Shared
|
23
|
+
|
6
24
|
def insert_server(server_name, zone_name, options={}, *deprecated_args)
|
7
25
|
|
8
26
|
# check that image and zone exist
|
@@ -10,7 +28,7 @@ module Fog
|
|
10
28
|
if options.has_key? 'image'
|
11
29
|
([ @project ] + Fog::Compute::Google::Images::GLOBAL_PROJECTS).each do |project|
|
12
30
|
image_project = project
|
13
|
-
break if
|
31
|
+
break if data(project)[:images][options['image']]
|
14
32
|
end
|
15
33
|
get_image(options['image'], image_project) # ok if image exists, will fail otherwise
|
16
34
|
end
|
@@ -20,17 +38,17 @@ module Fog
|
|
20
38
|
"kind" => "compute#instance",
|
21
39
|
"id" => Fog::Mock.random_numbers(19),
|
22
40
|
"creationTimestamp" => Time.now.iso8601,
|
23
|
-
"zone" => "https://www.googleapis.com/compute/
|
41
|
+
"zone" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/zones/#{zone_name}",
|
24
42
|
"status" => "PROVISIONING",
|
25
43
|
"name" => server_name,
|
26
44
|
"tags" => { "fingerprint" => "42WmSpB8rSM=" },
|
27
|
-
"machineType" => "https://www.googleapis.com/compute/
|
28
|
-
"image" => "https://www.googleapis.com/compute/
|
29
|
-
"kernel" => "https://www.googleapis.com/compute/
|
45
|
+
"machineType" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/zones/#{zone_name}/machineTypes/#{options['machineType']}",
|
46
|
+
"image" => "https://www.googleapis.com/compute/#{api_version}/projects/centos-cloud/global/images/#{options['image']}",
|
47
|
+
"kernel" => "https://www.googleapis.com/compute/#{api_version}/projects/google/global/kernels/gce-v20130813",
|
30
48
|
"canIpForward" => false,
|
31
49
|
"networkInterfaces" => [
|
32
50
|
{
|
33
|
-
"network" => "https://www.googleapis.com/compute/
|
51
|
+
"network" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/global/networks/default",
|
34
52
|
"networkIP" => Fog::Mock.random_ip,
|
35
53
|
"name" => "nic0",
|
36
54
|
"accessConfigs" => [
|
@@ -43,7 +61,7 @@ module Fog
|
|
43
61
|
]
|
44
62
|
}
|
45
63
|
],
|
46
|
-
"disks" => [
|
64
|
+
"disks" => options['disks'] ? handle_disks(options) : [
|
47
65
|
{
|
48
66
|
"kind" => "compute#attachedDisk",
|
49
67
|
"index" => 0,
|
@@ -61,28 +79,29 @@ module Fog
|
|
61
79
|
}
|
62
80
|
]
|
63
81
|
},
|
64
|
-
"selfLink" => "https://www.googleapis.com/compute/
|
82
|
+
"selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/zones/#{zone_name}/instances/#{server_name}"
|
65
83
|
}
|
66
84
|
|
67
85
|
build_response(:body => {
|
68
86
|
"kind" => "compute#operation",
|
69
87
|
"id" => "4639689000254420481",
|
70
88
|
"name" => "operation-1380213292196-4e74bf2fbc3c1-ae707d47",
|
71
|
-
"zone" => "https://www.googleapis.com/compute/
|
89
|
+
"zone" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/zones/#{zone_name}",
|
72
90
|
"operationType" => "insert",
|
73
|
-
"targetLink" => "https://www.googleapis.com/compute/
|
91
|
+
"targetLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/zones/#{zone_name}/instances/#{server_name}",
|
74
92
|
"status" => "PENDING",
|
75
93
|
"user" => "123456789012-qwertyuiopasdfghjkl1234567890qwe@developer.gserviceaccount.com",
|
76
94
|
"progress" => 0,
|
77
95
|
"insertTime" => Time.now.iso8601,
|
78
96
|
"startTime" => Time.now.iso8601,
|
79
|
-
"selfLink" => "https://www.googleapis.com/compute/
|
97
|
+
"selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/zones/#{zone_name}/operations/operation-1380213292196-4e74bf2fbc3c1-ae707d47"
|
80
98
|
})
|
81
99
|
end
|
82
100
|
|
83
101
|
end
|
84
102
|
|
85
103
|
class Real
|
104
|
+
include Shared
|
86
105
|
|
87
106
|
def format_metadata(metadata)
|
88
107
|
{ "items" => metadata.map {|k,v| {"key" => k, "value" => v}} }
|
@@ -131,17 +150,7 @@ module Fog
|
|
131
150
|
# TODO: add other networks
|
132
151
|
body_object['networkInterfaces'] = networkInterfaces
|
133
152
|
|
134
|
-
if options['disks']
|
135
|
-
disks = []
|
136
|
-
options.delete('disks').each do |disk|
|
137
|
-
if disk.is_a? Disk
|
138
|
-
disks << disk.get_object
|
139
|
-
else
|
140
|
-
disks << disk
|
141
|
-
end
|
142
|
-
end
|
143
|
-
body_object['disks'] = disks
|
144
|
-
end
|
153
|
+
body_object['disks'] = handle_disks(options) if options['disks']
|
145
154
|
|
146
155
|
options['metadata'] = format_metadata options['metadata'] if options['metadata']
|
147
156
|
|
@@ -4,8 +4,14 @@ module Fog
|
|
4
4
|
|
5
5
|
class Mock
|
6
6
|
|
7
|
-
def list_disks
|
8
|
-
|
7
|
+
def list_disks(zone_name)
|
8
|
+
disks = self.data[:disks].values.select{|d| d["zone"].split("/")[-1] == zone_name}
|
9
|
+
build_response(:body => {
|
10
|
+
"kind" => "compute#diskList",
|
11
|
+
"selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/zones/#{zone_name}/disks",
|
12
|
+
"id" => "projects/#{@project}/zones/#{zone_name}/disks",
|
13
|
+
"items" => disks
|
14
|
+
})
|
9
15
|
end
|
10
16
|
|
11
17
|
end
|
@@ -5,10 +5,10 @@ module Fog
|
|
5
5
|
class Mock
|
6
6
|
|
7
7
|
def list_images(project=@project)
|
8
|
-
images =
|
8
|
+
images = data(project)[:images].values
|
9
9
|
build_response(:body => {
|
10
10
|
"kind" => "compute#imageList",
|
11
|
-
"selfLink" => "https://www.googleapis.com/compute/
|
11
|
+
"selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{project}/global/images",
|
12
12
|
"id" => "projects/#{project}/global/images",
|
13
13
|
"items" => images
|
14
14
|
})
|
@@ -6,10 +6,10 @@ module Fog
|
|
6
6
|
|
7
7
|
def list_machine_types(zone_name)
|
8
8
|
get_zone(zone_name)
|
9
|
-
machine_types =
|
9
|
+
machine_types = data[:machine_types][zone_name].values
|
10
10
|
build_response(:body => {
|
11
11
|
"kind" => "compute#machineTypeList",
|
12
|
-
"selfLink" => "https://www.googleapis.com/compute/
|
12
|
+
"selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/zones/#{zone_name}/machineTypes",
|
13
13
|
"id" => "projects/high-cistern-340/zones/us-central1-a/machineTypes",
|
14
14
|
"items" => machine_types
|
15
15
|
})
|
@@ -5,12 +5,12 @@ module Fog
|
|
5
5
|
class Mock
|
6
6
|
|
7
7
|
def list_servers(zone_name)
|
8
|
+
get_zone(zone_name)
|
8
9
|
zone = self.data[:zones][zone_name]
|
9
|
-
raise Fog::Errors::Error.new("Invalid value for field 'zone': '#{zone_name}'. Unknown zone.") if zone.nil?
|
10
10
|
servers = self.data[:servers].values.select{|s| s["zone"] == zone["selfLink"]}
|
11
11
|
build_response(:body => {
|
12
12
|
"kind" => "compute#instanceList",
|
13
|
-
"selfLink" => "https://www.googleapis.com/compute/
|
13
|
+
"selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/zones/#{zone_name}/instances",
|
14
14
|
"id" => "projects/#{@project}/zones/#{zone_name}/instances",
|
15
15
|
"items" => servers
|
16
16
|
})
|
@@ -8,7 +8,7 @@ module Fog
|
|
8
8
|
zones = self.data[:zones].values
|
9
9
|
build_response(:body => {
|
10
10
|
"kind" => "compute#zoneList",
|
11
|
-
"selfLink" => "https://www.googleapis.com/compute/
|
11
|
+
"selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/zones",
|
12
12
|
"id" => "projects/#{@project}/zones",
|
13
13
|
"items" => zones
|
14
14
|
})
|
data/lib/fog/hp.rb
CHANGED
@@ -26,7 +26,7 @@ module Fog
|
|
26
26
|
if message.nil? and !data.values.first.nil?
|
27
27
|
message = data.values.first['message']
|
28
28
|
end
|
29
|
-
rescue
|
29
|
+
rescue Fog::JSON::DecodeError
|
30
30
|
message = error.response.body #### body is not in JSON format, so just return as is
|
31
31
|
end
|
32
32
|
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# Getting Started with HP Cloud Extensions to Ruby Fog Bindings
|
2
|
+
|
3
|
+
[HP Cloud](http://www.hpcloud.com) has been creating and contributing bindings so
|
4
|
+
that developers can work with Ruby Fog and the HP Cloud services based on
|
5
|
+
[OpenStack](http://www.openstack.org/). By using the HP Cloud Extensions to Fog,
|
6
|
+
developers can write applications using Ruby that interacts with the
|
7
|
+
HP Cloud Services without having to deal with the underlying REST API or
|
8
|
+
JSON/XML document formats. We have officially turned these bindings over to the
|
9
|
+
Ruby Fog community where you can contribute and develop additional functionality
|
10
|
+
around these bindings.
|
11
|
+
|
12
|
+
This section of documentation provides information, examples and articles for working with the different HP Cloud services such as Compute, Object Storage and others.
|
13
|
+
|
14
|
+
Please note that HP Cloud recently released version 13.5 which updates and adds functionality provided by OpenStack Havana. Some of our HP Ruby Fog examples are developed to work with earlier versions so please take note which HP Cloud version you are working with.
|
15
|
+
|
16
|
+
**Note:** The Networking service examples only work with version 13.5.
|
17
|
+
|
18
|
+
## Installation
|
19
|
+
|
20
|
+
To install and use HP Cloud Ruby bindings for Fog, please install the [latest release](http://fog.io/) of Fog.
|
21
|
+
|
22
|
+
Then follow the installation instructions for the operating system you are using and connect to the service:
|
23
|
+
|
24
|
+
* [Installation Instructions](https://github.com/fog/fog/blob/master/lib/fog/hp/docs/install.md)
|
25
|
+
* [Connecting to the Service](https://github.com/fog/fog/blob/master/lib/fog/hp/docs/connect.md)
|
26
|
+
|
27
|
+
## Requirements
|
28
|
+
|
29
|
+
For working with the HP Cloud Extension to Fog, the following pre-requisites are needed:
|
30
|
+
|
31
|
+
* HP Cloud Services account. If you have not already signed up, please [sign up for your free trial](http://www.hpcloud.com/free-trial).
|
32
|
+
* Ruby version 1.8.x or 1.9.x
|
33
|
+
* `fog` gem
|
34
|
+
|
35
|
+
|
36
|
+
## Examples
|
37
|
+
|
38
|
+
Apart from the overall [Fog documentation](http://fog.io), we have HP Cloud specific examples that will help you in using the Ruby Fog bindings with HP Cloud services.
|
39
|
+
|
40
|
+
[Examples for using Fog with HP Cloud Services](https://github.com/fog/fog/blob/master/lib/fog/hp/examples/getting_started_examples.md)
|
41
|
+
|
42
|
+
## Articles
|
43
|
+
|
44
|
+
In addition to the examples we have provided, for Compute, Object Storage, and other HP Cloud services, we wanted to give you a few additional tips and "how-tos' to make using your Ruby Fog bindings even easier. Take a look at the articles listed below to find out more!
|
45
|
+
|
46
|
+
* [Using authentication caching](https://github.com/fog/fog/blob/master/lib/fog/hp/articles/auth_caching.md)
|
47
|
+
|
48
|
+
## Additional Resources
|
49
|
+
* [Fog cloud library](http://fog.io)
|
50
|
+
* [Fog documentation](http://rubydoc.info/gems/fog)
|
51
|
+
* [Fog Github repo](https://github.com/fog/fog)
|
52
|
+
* [Fog Release Notes](https://github.com/fog/fog/blob/master/changelog.txt)
|
53
|
+
|
54
|
+
## Support and Feedback
|
55
|
+
|
56
|
+
Your feedback is essential to the maturity of the bindings and is highly appreciated! If you have specific issues with the HP Cloud Extensions to Fog bindings, please file an [issue via Github](https://github.com/fog/fog/issues).
|
57
|
+
|