fog 0.0.29 → 0.0.30

Sign up to get free protection for your applications and to get access to all the features.
Files changed (181) hide show
  1. data/Rakefile +1 -0
  2. data/VERSION +1 -1
  3. data/bin/fog +18 -11
  4. data/fog.gemspec +43 -14
  5. data/lib/fog.rb +7 -1
  6. data/lib/fog/aws/ec2.rb +0 -7
  7. data/lib/fog/aws/models/ec2/address.rb +22 -26
  8. data/lib/fog/aws/models/ec2/addresses.rb +7 -22
  9. data/lib/fog/aws/models/ec2/instance.rb +2 -15
  10. data/lib/fog/aws/models/ec2/instances.rb +6 -23
  11. data/lib/fog/aws/models/ec2/key_pair.rb +2 -17
  12. data/lib/fog/aws/models/ec2/key_pairs.rb +6 -23
  13. data/lib/fog/aws/models/ec2/security_group.rb +18 -22
  14. data/lib/fog/aws/models/ec2/security_groups.rb +6 -23
  15. data/lib/fog/aws/models/ec2/snapshot.rb +2 -15
  16. data/lib/fog/aws/models/ec2/snapshots.rb +7 -20
  17. data/lib/fog/aws/models/ec2/volume.rb +23 -22
  18. data/lib/fog/aws/models/ec2/volumes.rb +8 -22
  19. data/lib/fog/aws/models/s3/bucket.rb +1 -1
  20. data/lib/fog/aws/models/s3/buckets.rb +3 -20
  21. data/lib/fog/aws/models/s3/objects.rb +11 -22
  22. data/lib/fog/aws/requests/ec2/allocate_address.rb +1 -1
  23. data/lib/fog/aws/requests/ec2/associate_address.rb +2 -2
  24. data/lib/fog/aws/requests/ec2/attach_volume.rb +2 -2
  25. data/lib/fog/aws/requests/ec2/authorize_security_group_ingress.rb +1 -1
  26. data/lib/fog/aws/requests/ec2/create_key_pair.rb +2 -2
  27. data/lib/fog/aws/requests/ec2/create_security_group.rb +2 -2
  28. data/lib/fog/aws/requests/ec2/create_snapshot.rb +2 -2
  29. data/lib/fog/aws/requests/ec2/create_volume.rb +3 -3
  30. data/lib/fog/aws/requests/ec2/delete_key_pair.rb +1 -1
  31. data/lib/fog/aws/requests/ec2/delete_security_group.rb +2 -2
  32. data/lib/fog/aws/requests/ec2/delete_snapshot.rb +2 -2
  33. data/lib/fog/aws/requests/ec2/delete_volume.rb +2 -2
  34. data/lib/fog/aws/requests/ec2/describe_addresses.rb +2 -2
  35. data/lib/fog/aws/requests/ec2/describe_availability_zones.rb +1 -1
  36. data/lib/fog/aws/requests/ec2/describe_images.rb +1 -1
  37. data/lib/fog/aws/requests/ec2/describe_instances.rb +2 -2
  38. data/lib/fog/aws/requests/ec2/describe_key_pairs.rb +2 -2
  39. data/lib/fog/aws/requests/ec2/describe_regions.rb +1 -1
  40. data/lib/fog/aws/requests/ec2/describe_security_groups.rb +2 -2
  41. data/lib/fog/aws/requests/ec2/describe_snapshots.rb +2 -2
  42. data/lib/fog/aws/requests/ec2/describe_volumes.rb +2 -2
  43. data/lib/fog/aws/requests/ec2/detach_volume.rb +2 -2
  44. data/lib/fog/aws/requests/ec2/disassociate_address.rb +2 -2
  45. data/lib/fog/aws/requests/ec2/get_console_output.rb +2 -2
  46. data/lib/fog/aws/requests/ec2/reboot_instances.rb +2 -2
  47. data/lib/fog/aws/requests/ec2/release_address.rb +2 -2
  48. data/lib/fog/aws/requests/ec2/revoke_security_group_ingress.rb +1 -1
  49. data/lib/fog/aws/requests/ec2/run_instances.rb +2 -2
  50. data/lib/fog/aws/requests/ec2/terminate_instances.rb +2 -2
  51. data/lib/fog/aws/requests/s3/copy_object.rb +2 -2
  52. data/lib/fog/aws/requests/s3/delete_bucket.rb +3 -3
  53. data/lib/fog/aws/requests/s3/delete_object.rb +2 -2
  54. data/lib/fog/aws/requests/s3/get_bucket.rb +2 -2
  55. data/lib/fog/aws/requests/s3/get_bucket_location.rb +2 -2
  56. data/lib/fog/aws/requests/s3/get_object.rb +2 -2
  57. data/lib/fog/aws/requests/s3/get_request_payment.rb +2 -2
  58. data/lib/fog/aws/requests/s3/get_service.rb +1 -1
  59. data/lib/fog/aws/requests/s3/head_object.rb +1 -1
  60. data/lib/fog/aws/requests/s3/put_bucket.rb +1 -1
  61. data/lib/fog/aws/requests/s3/put_object.rb +2 -2
  62. data/lib/fog/aws/requests/s3/put_request_payment.rb +1 -1
  63. data/lib/fog/aws/requests/simpledb/batch_put_attributes.rb +2 -2
  64. data/lib/fog/aws/requests/simpledb/create_domain.rb +1 -1
  65. data/lib/fog/aws/requests/simpledb/delete_attributes.rb +2 -2
  66. data/lib/fog/aws/requests/simpledb/delete_domain.rb +1 -1
  67. data/lib/fog/aws/requests/simpledb/domain_metadata.rb +2 -2
  68. data/lib/fog/aws/requests/simpledb/get_attributes.rb +2 -2
  69. data/lib/fog/aws/requests/simpledb/list_domains.rb +1 -1
  70. data/lib/fog/aws/requests/simpledb/put_attributes.rb +1 -1
  71. data/lib/fog/aws/requests/simpledb/select.rb +1 -1
  72. data/lib/fog/aws/s3.rb +0 -7
  73. data/lib/fog/aws/simpledb.rb +0 -4
  74. data/lib/fog/collection.rb +35 -7
  75. data/lib/fog/connection.rb +10 -130
  76. data/lib/fog/model.rb +18 -13
  77. data/lib/fog/parser.rb +0 -5
  78. data/lib/fog/rackspace.rb +35 -15
  79. data/lib/fog/rackspace/files.rb +36 -6
  80. data/lib/fog/rackspace/models/servers/server.rb +2 -16
  81. data/lib/fog/rackspace/models/servers/servers.rb +6 -21
  82. data/lib/fog/rackspace/requests/files/delete_container.rb +38 -0
  83. data/lib/fog/rackspace/requests/files/delete_object.rb +39 -0
  84. data/lib/fog/rackspace/requests/files/get_container.rb +61 -0
  85. data/lib/fog/rackspace/requests/files/get_containers.rb +5 -7
  86. data/lib/fog/rackspace/requests/files/head_container.rb +44 -0
  87. data/lib/fog/rackspace/requests/files/head_containers.rb +1 -1
  88. data/lib/fog/rackspace/requests/files/put_container.rb +38 -0
  89. data/lib/fog/rackspace/requests/files/put_object.rb +41 -0
  90. data/lib/fog/rackspace/requests/servers/create_image.rb +6 -0
  91. data/lib/fog/rackspace/requests/servers/create_server.rb +21 -2
  92. data/lib/fog/rackspace/requests/servers/delete_server.rb +18 -3
  93. data/lib/fog/rackspace/requests/servers/get_server_details.rb +17 -5
  94. data/lib/fog/rackspace/requests/servers/list_addresses.rb +52 -0
  95. data/lib/fog/rackspace/requests/servers/list_flavors.rb +2 -4
  96. data/lib/fog/rackspace/requests/servers/list_flavors_detail.rb +41 -0
  97. data/lib/fog/rackspace/requests/servers/list_images.rb +1 -1
  98. data/lib/fog/rackspace/requests/servers/list_images_detail.rb +1 -1
  99. data/lib/fog/rackspace/requests/servers/list_private_addresses.rb +50 -0
  100. data/lib/fog/rackspace/requests/servers/list_public_addresses.rb +50 -0
  101. data/lib/fog/rackspace/requests/servers/list_servers.rb +11 -2
  102. data/lib/fog/rackspace/requests/servers/list_servers_detail.rb +17 -2
  103. data/lib/fog/rackspace/requests/servers/reboot_server.rb +3 -6
  104. data/lib/fog/rackspace/requests/servers/update_server.rb +18 -5
  105. data/lib/fog/rackspace/servers.rb +20 -0
  106. data/spec/aws/models/ec2/address_spec.rb +4 -4
  107. data/spec/aws/models/ec2/instance_spec.rb +6 -6
  108. data/spec/aws/models/ec2/key_pair_spec.rb +5 -5
  109. data/spec/aws/models/ec2/security_group_spec.rb +5 -5
  110. data/spec/aws/models/ec2/snapshot_spec.rb +8 -8
  111. data/spec/aws/models/ec2/snapshots_spec.rb +6 -6
  112. data/spec/aws/models/ec2/volume_spec.rb +6 -5
  113. data/spec/aws/models/ec2/volumes_spec.rb +4 -4
  114. data/spec/aws/requests/ec2/associate_address_spec.rb +2 -2
  115. data/spec/aws/requests/ec2/attach_volume_spec.rb +2 -2
  116. data/spec/aws/requests/ec2/create_key_pair_spec.rb +1 -1
  117. data/spec/aws/requests/ec2/create_security_group_spec.rb +1 -1
  118. data/spec/aws/requests/ec2/create_snapshot_spec.rb +1 -1
  119. data/spec/aws/requests/ec2/delete_security_group_spec.rb +1 -1
  120. data/spec/aws/requests/ec2/delete_snapshot_spec.rb +1 -1
  121. data/spec/aws/requests/ec2/delete_volume_spec.rb +2 -2
  122. data/spec/aws/requests/ec2/describe_addresses_spec.rb +1 -1
  123. data/spec/aws/requests/ec2/describe_instances_spec.rb +1 -1
  124. data/spec/aws/requests/ec2/describe_key_pairs_spec.rb +1 -1
  125. data/spec/aws/requests/ec2/describe_security_groups_spec.rb +1 -1
  126. data/spec/aws/requests/ec2/describe_snapshots_spec.rb +1 -1
  127. data/spec/aws/requests/ec2/describe_volumes_spec.rb +1 -1
  128. data/spec/aws/requests/ec2/detach_volume_spec.rb +1 -1
  129. data/spec/aws/requests/ec2/disassociate_address_spec.rb +1 -1
  130. data/spec/aws/requests/ec2/get_console_output_spec.rb +1 -1
  131. data/spec/aws/requests/ec2/reboot_instances_spec.rb +1 -1
  132. data/spec/aws/requests/ec2/release_address_spec.rb +1 -1
  133. data/spec/aws/requests/ec2/terminate_instances_spec.rb +1 -1
  134. data/spec/aws/requests/s3/copy_object_spec.rb +4 -5
  135. data/spec/aws/requests/s3/delete_bucket_spec.rb +3 -4
  136. data/spec/aws/requests/s3/delete_object_spec.rb +2 -3
  137. data/spec/aws/requests/s3/get_bucket_location_spec.rb +1 -1
  138. data/spec/aws/requests/s3/get_bucket_spec.rb +4 -6
  139. data/spec/aws/requests/s3/get_object_spec.rb +6 -10
  140. data/spec/aws/requests/s3/get_request_payment_spec.rb +1 -1
  141. data/spec/aws/requests/s3/head_object_spec.rb +2 -4
  142. data/spec/aws/requests/s3/put_object_spec.rb +4 -7
  143. data/spec/aws/requests/s3/put_request_payment_spec.rb +1 -1
  144. data/spec/aws/requests/simpledb/batch_put_attributes_spec.rb +1 -1
  145. data/spec/aws/requests/simpledb/delete_attributes_spec.rb +1 -1
  146. data/spec/aws/requests/simpledb/domain_metadata_spec.rb +1 -1
  147. data/spec/aws/requests/simpledb/get_attributes_spec.rb +1 -1
  148. data/spec/aws/requests/simpledb/put_attributes_spec.rb +1 -1
  149. data/spec/rackspace/requests/files/delete_container_spec.rb +24 -0
  150. data/spec/rackspace/requests/files/delete_object_spec.rb +37 -0
  151. data/spec/rackspace/requests/files/get_container_spec.rb +33 -0
  152. data/spec/rackspace/requests/files/get_containers_spec.rb +12 -1
  153. data/spec/rackspace/requests/files/head_container_spec.rb +30 -0
  154. data/spec/rackspace/requests/files/head_containers_spec.rb +9 -1
  155. data/spec/rackspace/requests/files/put_container_spec.rb +15 -0
  156. data/spec/rackspace/requests/files/put_object_spec.rb +20 -0
  157. data/spec/rackspace/requests/servers/create_image_spec.rb +16 -2
  158. data/spec/rackspace/requests/servers/create_server_spec.rb +1 -1
  159. data/spec/rackspace/requests/servers/delete_image_spec.rb +32 -0
  160. data/spec/rackspace/requests/servers/delete_server_spec.rb +1 -1
  161. data/spec/rackspace/requests/servers/get_server_details_spec.rb +1 -1
  162. data/spec/rackspace/requests/servers/list_addresses_spec.rb +34 -0
  163. data/spec/rackspace/requests/servers/list_flavors_detail_spec.rb +17 -0
  164. data/spec/rackspace/requests/servers/list_flavors_spec.rb +6 -3
  165. data/spec/rackspace/requests/servers/list_images_detail_spec.rb +18 -0
  166. data/spec/rackspace/requests/servers/list_images_spec.rb +5 -2
  167. data/spec/rackspace/requests/servers/list_private_addresses_spec.rb +32 -0
  168. data/spec/rackspace/requests/servers/list_public_addresses_spec.rb +32 -0
  169. data/spec/rackspace/requests/servers/list_servers_detail_spec.rb +1 -1
  170. data/spec/rackspace/requests/servers/reboot_server_spec.rb +31 -0
  171. data/spec/rackspace/requests/servers/update_server_spec.rb +33 -0
  172. data/spec/spec_helper.rb +5 -1
  173. metadata +50 -14
  174. data/benchs/headers_split_vs_match.rb +0 -18
  175. data/benchs/stripping.rb +0 -26
  176. data/lib/fog/errors.rb +0 -145
  177. data/lib/fog/response.rb +0 -12
  178. data/spec/rackspace/requests/servers/delete_image.rb +0 -12
  179. data/spec/rackspace/requests/servers/list_images_detail.rb +0 -12
  180. data/spec/rackspace/requests/servers/reboot_server.rb +0 -12
  181. data/spec/rackspace/requests/servers/update_server.rb +0 -12
@@ -4,8 +4,9 @@ module Fog
4
4
 
5
5
  class Server < Fog::Model
6
6
 
7
+ identity :id
8
+
7
9
  attribute :admin_pass, 'adminPass'
8
- attribute :id
9
10
  attribute :name
10
11
  attribute :image_id, 'imageId'
11
12
  attribute :flavor_id, 'flavorId'
@@ -21,11 +22,6 @@ module Fog
21
22
  true
22
23
  end
23
24
 
24
- def reload
25
- new_attributes = servers.get(@id).body['server']
26
- merge_attributes(new_attributes)
27
- end
28
-
29
25
  def save
30
26
  options = { 'metadata' => @metadata, 'name' => @name, 'personality' => @personality }
31
27
  options = options.reject {|key, value| value.nil?}
@@ -34,16 +30,6 @@ module Fog
34
30
  true
35
31
  end
36
32
 
37
- def servers
38
- @servers
39
- end
40
-
41
- private
42
-
43
- def servers=(new_servers)
44
- @servers = new_servers
45
- end
46
-
47
33
  end
48
34
 
49
35
  end
@@ -8,43 +8,28 @@ module Fog
8
8
 
9
9
  class Servers < Fog::Collection
10
10
 
11
+ model Fog::Rackspace::Servers::Server
12
+
11
13
  def all
12
- data = connection.list_servers_details.body
14
+ data = connection.list_servers_detail.body
13
15
  servers = Fog::Rackspace::Servers::Servers.new({
14
16
  :connection => connection
15
17
  })
16
18
  for server in data['servers']
17
19
  servers << Fog::Rackspace::Servers::Server.new({
18
- :connection => connection,
19
- :servers => servers
20
+ :collection => servers,
21
+ :connection => connection
20
22
  }.merge!(server))
21
23
  end
22
24
  servers
23
25
  end
24
26
 
25
- def create(attributes = {})
26
- server = new(attributes)
27
- server.save
28
- server
29
- end
30
-
31
27
  def get(id)
32
28
  connection.get_server_details(id)
33
- rescue Fog::Errors::NotFound
29
+ rescue Excon::Errors::NotFound
34
30
  nil
35
31
  end
36
32
 
37
- def new(attributes = {})
38
- Fog::Rackspace::Servers::Server.new({
39
- :connection => connection,
40
- :servers => self
41
- }.merge!(attributes))
42
- end
43
-
44
- def reload
45
- get(id)
46
- end
47
-
48
33
  end
49
34
 
50
35
  end
@@ -0,0 +1,38 @@
1
+ unless Fog.mocking?
2
+
3
+ module Fog
4
+ module Rackspace
5
+ class Files
6
+
7
+ # Delete an existing container
8
+ #
9
+ # ==== Parameters
10
+ # * name<~String> - Name of container to delete
11
+ #
12
+ def delete_container(name)
13
+ response = storage_request(
14
+ :expects => 204,
15
+ :method => 'DELETE',
16
+ :path => CGI.escape(name)
17
+ )
18
+ response
19
+ end
20
+
21
+ end
22
+ end
23
+ end
24
+
25
+ else
26
+
27
+ module Fog
28
+ module Rackspace
29
+ class Servers
30
+
31
+ def delete_container
32
+ end
33
+
34
+ end
35
+ end
36
+ end
37
+
38
+ end
@@ -0,0 +1,39 @@
1
+ unless Fog.mocking?
2
+
3
+ module Fog
4
+ module Rackspace
5
+ class Files
6
+
7
+ # Delete an existing container
8
+ #
9
+ # ==== Parameters
10
+ # * container<~String> - Name of container to delete
11
+ # * object<~String> - Name of object to delete
12
+ #
13
+ def delete_object(container, object)
14
+ response = storage_request(
15
+ :expects => 204,
16
+ :method => 'DELETE',
17
+ :path => "#{CGI.escape(container)}/#{CGI.escape(object)}"
18
+ )
19
+ response
20
+ end
21
+
22
+ end
23
+ end
24
+ end
25
+
26
+ else
27
+
28
+ module Fog
29
+ module Rackspace
30
+ class Servers
31
+
32
+ def delete_object
33
+ end
34
+
35
+ end
36
+ end
37
+ end
38
+
39
+ end
@@ -0,0 +1,61 @@
1
+ unless Fog.mocking?
2
+
3
+ module Fog
4
+ module Rackspace
5
+ class Files
6
+
7
+ # List number of containers and total bytes stored
8
+ #
9
+ # ==== Parameters
10
+ # * container<~String> - Name of container to retrieve info for
11
+ # * options<~String>:
12
+ # * 'limit'<~String> - Maximum number of objects to return
13
+ # * 'marker'<~String> - Only return objects whose name is greater than marker
14
+ # * 'prefix'<~String> - Limits results to those starting with prefix
15
+ # * 'path'<~String> - Return objects nested in the pseudo path
16
+ #
17
+ # ==== Returns
18
+ # * response<~Excon::Response>:
19
+ # * headers<~Hash>:
20
+ # * 'X-Account-Container-Count'<~String> - Count of containers
21
+ # * 'X-Account-Bytes-Used'<~String> - Bytes used
22
+ # * body<~Array>:
23
+ # * item<~Hash>:
24
+ # * 'bytes'<~String> - Size of object
25
+ # * 'content_type'<~String> Content-Type of object
26
+ # * 'hash'<~String> - Hash of object (etag?)
27
+ # * 'last_modified'<~String> - Last modified timestamp
28
+ # * 'name'<~String> - Name of object
29
+ def get_container(container, options = {})
30
+ query = ''
31
+ for key, value in options.merge!({ 'format' => 'json' })
32
+ query << "#{key}=#{value}&"
33
+ end
34
+ query.chop!
35
+ response = storage_request(
36
+ :expects => 200,
37
+ :method => 'GET',
38
+ :path => container,
39
+ :query => query
40
+ )
41
+ response
42
+ end
43
+
44
+ end
45
+ end
46
+ end
47
+
48
+ else
49
+
50
+ module Fog
51
+ module Rackspace
52
+ class Servers
53
+
54
+ def get_flavors
55
+ end
56
+
57
+ end
58
+ end
59
+ end
60
+
61
+ end
@@ -12,7 +12,7 @@ unless Fog.mocking?
12
12
  # * 'marker'<~String> - Only return objects with name greater than this value
13
13
  #
14
14
  # ==== Returns
15
- # * response<~Fog::AWS::Response>:
15
+ # * response<~Excon::Response>:
16
16
  # * body<~Array>:
17
17
  # * container<~Hash>:
18
18
  # * 'bytes'<~Integer>: - Number of bytes used by container
@@ -20,19 +20,17 @@ unless Fog.mocking?
20
20
  # * 'name'<~String>: - Name of container
21
21
  def get_containers(options = {})
22
22
  options = { 'format' => 'json' }.merge!(options)
23
- query = []
23
+ query = ''
24
24
  for key, value in options
25
- query << "#{key}=#{CGI.escape(value)}"
25
+ query << "#{key}=#{CGI.escape(value)}&"
26
26
  end
27
+ query.chop!
27
28
  response = storage_request(
28
29
  :expects => [200, 204],
29
30
  :method => 'GET',
30
31
  :path => '',
31
- :query => query.join('&')
32
+ :query => query
32
33
  )
33
- if response.status == 204
34
- response.body = []
35
- end
36
34
  response
37
35
  end
38
36
 
@@ -0,0 +1,44 @@
1
+ unless Fog.mocking?
2
+
3
+ module Fog
4
+ module Rackspace
5
+ class Files
6
+
7
+ # List number of objects and total bytes stored
8
+ #
9
+ # ==== Parameters
10
+ # * container<~String> - Name of container to retrieve info for
11
+ #
12
+ # ==== Returns
13
+ # * response<~Excon::Response>:
14
+ # * headers<~Hash>:
15
+ # * 'X-Container-Object-Count'<~String> - Count of containers
16
+ # * 'X-Container-Bytes-Used'<~String> - Bytes used
17
+ def head_container(container)
18
+ response = storage_request(
19
+ :expects => 204,
20
+ :method => 'HEAD',
21
+ :path => container,
22
+ :query => 'format=json'
23
+ )
24
+ response
25
+ end
26
+
27
+ end
28
+ end
29
+ end
30
+
31
+ else
32
+
33
+ module Fog
34
+ module Rackspace
35
+ class Servers
36
+
37
+ def get_flavors
38
+ end
39
+
40
+ end
41
+ end
42
+ end
43
+
44
+ end
@@ -7,7 +7,7 @@ unless Fog.mocking?
7
7
  # List number of containers and total bytes stored
8
8
  #
9
9
  # ==== Returns
10
- # * response<~Fog::AWS::Response>:
10
+ # * response<~Excon::Response>:
11
11
  # * headers<~Hash>:
12
12
  # * 'X-Account-Container-Count'<~String> - Count of containers
13
13
  # * 'X-Account-Bytes-Used'<~String> - Bytes used
@@ -0,0 +1,38 @@
1
+ unless Fog.mocking?
2
+
3
+ module Fog
4
+ module Rackspace
5
+ class Files
6
+
7
+ # Create a new container
8
+ #
9
+ # ==== Parameters
10
+ # * name<~String> - Name for container, should be < 256 bytes and must not contain '/'
11
+ #
12
+ def put_container(name)
13
+ response = storage_request(
14
+ :expects => [201, 202],
15
+ :method => 'PUT',
16
+ :path => CGI.escape(name)
17
+ )
18
+ response
19
+ end
20
+
21
+ end
22
+ end
23
+ end
24
+
25
+ else
26
+
27
+ module Fog
28
+ module Rackspace
29
+ class Servers
30
+
31
+ def put_container
32
+ end
33
+
34
+ end
35
+ end
36
+ end
37
+
38
+ end
@@ -0,0 +1,41 @@
1
+ unless Fog.mocking?
2
+
3
+ module Fog
4
+ module Rackspace
5
+ class Files
6
+
7
+ # Create a new object
8
+ #
9
+ # ==== Parameters
10
+ # * container<~String> - Name for container, should be < 256 bytes and must not contain '/'
11
+ #
12
+ def put_object(container, object, data)
13
+ data = parse_data(data)
14
+ response = storage_request(
15
+ :body => data[:body],
16
+ :expects => 201,
17
+ :headers => data[:headers],
18
+ :method => 'PUT',
19
+ :path => "#{CGI.escape(container)}/#{CGI.escape(object)}"
20
+ )
21
+ response
22
+ end
23
+
24
+ end
25
+ end
26
+ end
27
+
28
+ else
29
+
30
+ module Fog
31
+ module Rackspace
32
+ class Servers
33
+
34
+ def put_container
35
+ end
36
+
37
+ end
38
+ end
39
+ end
40
+
41
+ end
@@ -10,6 +10,12 @@ unless Fog.mocking?
10
10
  # * server_id<~Integer> - Id of server to create image from
11
11
  # * options<~Hash> - Name
12
12
  #
13
+ # ==== Returns
14
+ # * response<~Excon::Response>:
15
+ # * 'image'<~Hash>:
16
+ # * 'id'<~Integer> - Id of image
17
+ # * 'name'<~String> - Name of image
18
+ # * 'serverId'<~Integer> - Id of server
13
19
  def create_image(server_id, options = {})
14
20
  data = {
15
21
  'image' => {
@@ -19,7 +19,7 @@ unless Fog.mocking?
19
19
  # * 'path'<~String> - Path to file (255 bytes total of path strings)
20
20
  #
21
21
  # ==== Returns
22
- # * response<~Fog::AWS::Response>:
22
+ # * response<~Excon::Response>:
23
23
  # * body<~Hash>:
24
24
  # * 'server'<~Hash>:
25
25
  # * 'addresses'<~Hash>:
@@ -74,7 +74,26 @@ else
74
74
  module Rackspace
75
75
  class Servers
76
76
 
77
- def create_server
77
+ def create_server(flavor_id, image_id, options = {})
78
+ response = Fog::Response.new
79
+ response.status = 202
80
+
81
+ data = {
82
+ 'addresses' => { 'private' => ['0.0.0.0'], 'public' => ['0.0.0.0'] },
83
+ 'flavorId' => flavor_id,
84
+ 'id' => 123456,
85
+ 'imageId' => image_id,
86
+ 'hostId' => "123456789ABCDEF01234567890ABCDEF",
87
+ 'metadata' => options[:metadata] || {},
88
+ 'progress' => 0,
89
+ 'status' => 'BUILD'
90
+ }
91
+ data['name'] = "slice#{data[:id]}"
92
+ data['adminPass'] = "#{data['name']}password"
93
+ Fog::Rackspace::Servers.data[:last_modified][data['id']] = Time.now
94
+ Fog::Rackspace::Servers.data[:servers][data['id']] = data
95
+ response.body = { 'server' => data }
96
+ response
78
97
  end
79
98
 
80
99
  end