fog 1.32.0 → 1.33.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (204) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +59 -0
  3. data/Gemfile +1 -0
  4. data/Rakefile +4 -4
  5. data/fog.gemspec +3 -2
  6. data/lib/fog/linode/requests/compute/avail_datacenters.rb +8 -7
  7. data/lib/fog/openstack.rb +1 -0
  8. data/lib/fog/openstack/compute.rb +7 -1
  9. data/lib/fog/openstack/core.rb +28 -54
  10. data/lib/fog/openstack/identity.rb +1 -0
  11. data/lib/fog/openstack/identity_v3.rb +10 -9
  12. data/lib/fog/openstack/models/baremetal/chassis.rb +3 -14
  13. data/lib/fog/openstack/models/baremetal/chassis_collection.rb +5 -5
  14. data/lib/fog/openstack/models/baremetal/driver.rb +2 -8
  15. data/lib/fog/openstack/models/baremetal/drivers.rb +3 -5
  16. data/lib/fog/openstack/models/baremetal/node.rb +3 -14
  17. data/lib/fog/openstack/models/baremetal/nodes.rb +4 -4
  18. data/lib/fog/openstack/models/baremetal/port.rb +3 -14
  19. data/lib/fog/openstack/models/baremetal/ports.rb +4 -4
  20. data/lib/fog/openstack/models/collection.rb +45 -0
  21. data/lib/fog/openstack/models/compute/address.rb +2 -2
  22. data/lib/fog/openstack/models/compute/addresses.rb +3 -5
  23. data/lib/fog/openstack/models/compute/aggregate.rb +2 -8
  24. data/lib/fog/openstack/models/compute/aggregates.rb +3 -5
  25. data/lib/fog/openstack/models/compute/availability_zone.rb +14 -0
  26. data/lib/fog/openstack/models/compute/availability_zones.rb +22 -0
  27. data/lib/fog/openstack/models/compute/flavor.rb +2 -8
  28. data/lib/fog/openstack/models/compute/flavors.rb +6 -6
  29. data/lib/fog/openstack/models/compute/host.rb +1 -1
  30. data/lib/fog/openstack/models/compute/hosts.rb +4 -6
  31. data/lib/fog/openstack/models/compute/image.rb +2 -8
  32. data/lib/fog/openstack/models/compute/images.rb +4 -6
  33. data/lib/fog/openstack/models/compute/key_pair.rb +2 -2
  34. data/lib/fog/openstack/models/compute/key_pairs.rb +3 -4
  35. data/lib/fog/openstack/models/compute/metadata.rb +3 -2
  36. data/lib/fog/openstack/models/compute/metadatum.rb +2 -2
  37. data/lib/fog/openstack/models/compute/network.rb +2 -2
  38. data/lib/fog/openstack/models/compute/networks.rb +3 -2
  39. data/lib/fog/openstack/models/compute/security_group.rb +2 -2
  40. data/lib/fog/openstack/models/compute/security_group_rule.rb +2 -2
  41. data/lib/fog/openstack/models/compute/security_group_rules.rb +2 -2
  42. data/lib/fog/openstack/models/compute/security_groups.rb +3 -5
  43. data/lib/fog/openstack/models/compute/server.rb +20 -1
  44. data/lib/fog/openstack/models/compute/servers.rb +9 -5
  45. data/lib/fog/openstack/models/compute/service.rb +2 -8
  46. data/lib/fog/openstack/models/compute/services.rb +4 -4
  47. data/lib/fog/openstack/models/compute/snapshot.rb +2 -8
  48. data/lib/fog/openstack/models/compute/snapshots.rb +5 -5
  49. data/lib/fog/openstack/models/compute/tenant.rb +2 -2
  50. data/lib/fog/openstack/models/compute/tenants.rb +3 -4
  51. data/lib/fog/openstack/models/compute/volume.rb +2 -8
  52. data/lib/fog/openstack/models/compute/volumes.rb +5 -5
  53. data/lib/fog/openstack/models/identity_v2/ec2_credential.rb +3 -9
  54. data/lib/fog/openstack/models/identity_v2/ec2_credentials.rb +3 -5
  55. data/lib/fog/openstack/models/identity_v2/role.rb +3 -3
  56. data/lib/fog/openstack/models/identity_v2/roles.rb +3 -5
  57. data/lib/fog/openstack/models/identity_v2/tenant.rb +5 -9
  58. data/lib/fog/openstack/models/identity_v2/tenants.rb +3 -5
  59. data/lib/fog/openstack/models/identity_v2/user.rb +2 -8
  60. data/lib/fog/openstack/models/identity_v2/users.rb +3 -5
  61. data/lib/fog/openstack/models/identity_v3/domain.rb +5 -9
  62. data/lib/fog/openstack/models/identity_v3/domains.rb +3 -5
  63. data/lib/fog/openstack/models/identity_v3/endpoint.rb +5 -9
  64. data/lib/fog/openstack/models/identity_v3/endpoints.rb +3 -5
  65. data/lib/fog/openstack/models/identity_v3/group.rb +5 -9
  66. data/lib/fog/openstack/models/identity_v3/groups.rb +3 -5
  67. data/lib/fog/openstack/models/identity_v3/os_credential.rb +3 -3
  68. data/lib/fog/openstack/models/identity_v3/os_credentials.rb +3 -5
  69. data/lib/fog/openstack/models/identity_v3/policies.rb +3 -5
  70. data/lib/fog/openstack/models/identity_v3/policy.rb +5 -9
  71. data/lib/fog/openstack/models/identity_v3/project.rb +5 -8
  72. data/lib/fog/openstack/models/identity_v3/projects.rb +21 -10
  73. data/lib/fog/openstack/models/identity_v3/role.rb +3 -8
  74. data/lib/fog/openstack/models/identity_v3/role_assignment.rb +3 -3
  75. data/lib/fog/openstack/models/identity_v3/role_assignments.rb +3 -5
  76. data/lib/fog/openstack/models/identity_v3/roles.rb +3 -5
  77. data/lib/fog/openstack/models/identity_v3/service.rb +3 -3
  78. data/lib/fog/openstack/models/identity_v3/services.rb +3 -5
  79. data/lib/fog/openstack/models/identity_v3/token.rb +3 -3
  80. data/lib/fog/openstack/models/identity_v3/tokens.rb +3 -3
  81. data/lib/fog/openstack/models/identity_v3/user.rb +3 -9
  82. data/lib/fog/openstack/models/identity_v3/users.rb +3 -5
  83. data/lib/fog/openstack/models/image/image.rb +2 -13
  84. data/lib/fog/openstack/models/image/images.rb +5 -5
  85. data/lib/fog/openstack/models/metering/resource.rb +2 -7
  86. data/lib/fog/openstack/models/metering/resources.rb +3 -3
  87. data/lib/fog/openstack/models/model.rb +44 -0
  88. data/lib/fog/openstack/models/network/floating_ip.rb +2 -7
  89. data/lib/fog/openstack/models/network/floating_ips.rb +3 -5
  90. data/lib/fog/openstack/models/network/lb_health_monitor.rb +2 -12
  91. data/lib/fog/openstack/models/network/lb_health_monitors.rb +3 -5
  92. data/lib/fog/openstack/models/network/lb_member.rb +2 -12
  93. data/lib/fog/openstack/models/network/lb_members.rb +3 -5
  94. data/lib/fog/openstack/models/network/lb_pool.rb +2 -12
  95. data/lib/fog/openstack/models/network/lb_pools.rb +3 -5
  96. data/lib/fog/openstack/models/network/lb_vip.rb +2 -12
  97. data/lib/fog/openstack/models/network/lb_vips.rb +3 -5
  98. data/lib/fog/openstack/models/network/network.rb +2 -12
  99. data/lib/fog/openstack/models/network/networks.rb +3 -5
  100. data/lib/fog/openstack/models/network/port.rb +2 -13
  101. data/lib/fog/openstack/models/network/ports.rb +3 -5
  102. data/lib/fog/openstack/models/network/router.rb +2 -13
  103. data/lib/fog/openstack/models/network/routers.rb +3 -5
  104. data/lib/fog/openstack/models/network/security_group.rb +2 -2
  105. data/lib/fog/openstack/models/network/security_group_rule.rb +2 -2
  106. data/lib/fog/openstack/models/network/security_group_rules.rb +3 -5
  107. data/lib/fog/openstack/models/network/security_groups.rb +3 -5
  108. data/lib/fog/openstack/models/network/subnet.rb +3 -14
  109. data/lib/fog/openstack/models/network/subnets.rb +3 -5
  110. data/lib/fog/openstack/models/orchestration/event.rb +2 -2
  111. data/lib/fog/openstack/models/orchestration/events.rb +5 -7
  112. data/lib/fog/openstack/models/orchestration/resource.rb +2 -2
  113. data/lib/fog/openstack/models/orchestration/resource_schemas.rb +2 -2
  114. data/lib/fog/openstack/models/orchestration/resources.rb +3 -5
  115. data/lib/fog/openstack/models/orchestration/stack.rb +3 -7
  116. data/lib/fog/openstack/models/orchestration/stacks.rb +5 -5
  117. data/lib/fog/openstack/models/orchestration/template.rb +2 -2
  118. data/lib/fog/openstack/models/orchestration/templates.rb +1 -1
  119. data/lib/fog/openstack/models/planning/plan.rb +2 -13
  120. data/lib/fog/openstack/models/planning/plans.rb +3 -5
  121. data/lib/fog/openstack/models/planning/role.rb +2 -8
  122. data/lib/fog/openstack/models/planning/roles.rb +3 -6
  123. data/lib/fog/openstack/models/storage/directories.rb +4 -6
  124. data/lib/fog/openstack/models/storage/directory.rb +2 -2
  125. data/lib/fog/openstack/models/storage/file.rb +15 -2
  126. data/lib/fog/openstack/models/storage/files.rb +7 -8
  127. data/lib/fog/openstack/models/volume/availability_zone.rb +13 -0
  128. data/lib/fog/openstack/models/volume/availability_zones.rb +17 -0
  129. data/lib/fog/openstack/models/volume/transfer.rb +36 -0
  130. data/lib/fog/openstack/models/volume/transfers.rb +38 -0
  131. data/lib/fog/openstack/models/volume/volume.rb +9 -8
  132. data/lib/fog/openstack/models/volume/volume_type.rb +2 -8
  133. data/lib/fog/openstack/models/volume/volume_types.rb +3 -6
  134. data/lib/fog/openstack/models/volume/volumes.rb +5 -6
  135. data/lib/fog/openstack/requests/compute/list_servers.rb +8 -5
  136. data/lib/fog/openstack/requests/compute/list_servers_detail.rb +9 -6
  137. data/lib/fog/openstack/requests/compute/list_zones.rb +6 -5
  138. data/lib/fog/openstack/requests/compute/list_zones_detailed.rb +55 -0
  139. data/lib/fog/openstack/requests/compute/shelve_offload_server.rb +24 -0
  140. data/lib/fog/openstack/requests/compute/shelve_server.rb +24 -0
  141. data/lib/fog/openstack/requests/compute/unshelve_server.rb +24 -0
  142. data/lib/fog/openstack/requests/identity_v3/get_project.rb +2 -2
  143. data/lib/fog/openstack/requests/network/create_subnet.rb +1 -1
  144. data/lib/fog/openstack/requests/network/update_subnet.rb +8 -7
  145. data/lib/fog/openstack/requests/volume/accept_transfer.rb +24 -0
  146. data/lib/fog/openstack/requests/volume/create_transfer.rb +27 -0
  147. data/lib/fog/openstack/requests/volume/delete_transfer.rb +17 -0
  148. data/lib/fog/openstack/requests/volume/extend_volume.rb +25 -0
  149. data/lib/fog/openstack/requests/volume/get_transfer_details.rb +17 -0
  150. data/lib/fog/openstack/requests/volume/list_transfers.rb +18 -0
  151. data/lib/fog/openstack/requests/volume/list_transfers_detailed.rb +18 -0
  152. data/lib/fog/openstack/requests/volume/list_zones.rb +32 -0
  153. data/lib/fog/openstack/storage.rb +3 -1
  154. data/lib/fog/openstack/volume.rb +16 -0
  155. data/lib/fog/rackspace/examples/compute_v2/create_network.rb +1 -1
  156. data/lib/fog/vcloud_director/generators/compute/edge_gateway_service_configuration.rb +31 -30
  157. data/lib/fog/vcloud_director/models/compute/task.rb +2 -2
  158. data/lib/fog/version.rb +1 -1
  159. data/lib/fog/vsphere/compute.rb +1 -0
  160. data/lib/fog/vsphere/requests/compute/get_resource_pool.rb +1 -1
  161. data/lib/fog/vsphere/requests/compute/get_virtual_machine.rb +4 -3
  162. data/lib/fog/vsphere/requests/compute/list_clusters.rb +1 -1
  163. data/lib/fog/vsphere/requests/compute/list_vm_interfaces.rb +2 -2
  164. data/lib/fog/vsphere/requests/compute/vm_clone.rb +101 -30
  165. data/lib/fog/vsphere/requests/compute/vm_execute.rb +47 -0
  166. data/lib/tasks/changelog_task.rb +1 -0
  167. data/spec/fog/openstack/identity_v3/{idv3.yml → common_setup.yml} +0 -0
  168. data/spec/fog/openstack/identity_v3/idv3_project_hier_crud_list.yml +1394 -0
  169. data/spec/fog/openstack/identity_v3_spec.rb +255 -196
  170. data/spec/fog/openstack/network/common_setup.yml +131 -0
  171. data/spec/fog/openstack/network/subnets_crud.yml +140 -0
  172. data/spec/fog/openstack/network_spec.rb +43 -0
  173. data/spec/fog/openstack/shared_context.rb +98 -0
  174. data/spec/fog/openstack/volume/{volume_common_setup.yml → common_setup.yml} +0 -0
  175. data/spec/fog/openstack/volume/volume_extend.yml +762 -0
  176. data/spec/fog/openstack/volume/volume_transfer_and_accept.yml +1078 -0
  177. data/spec/fog/openstack/volume/volume_transfer_and_delete.yml +695 -0
  178. data/spec/fog/openstack/volume_spec.rb +232 -67
  179. data/tests/openstack/models/storage/file_tests.rb +26 -0
  180. data/tests/openstack/requests/compute/availability_zone_tests.rb +18 -0
  181. data/tests/openstack/requests/compute/server_tests.rb +12 -0
  182. data/tests/openstack/requests/network/subnet_tests.rb +2 -2
  183. data/tests/openstack/requests/volume/availability_zone_tests.rb +13 -0
  184. data/tests/vcloud_director/requests/compute/edge_gateway_tests.rb +2 -2
  185. metadata +61 -26
  186. data/lib/fog/dynect.rb +0 -1
  187. data/lib/fog/dynect/core.rb +0 -26
  188. data/lib/fog/dynect/dns.rb +0 -157
  189. data/lib/fog/dynect/models/dns/record.rb +0 -67
  190. data/lib/fog/dynect/models/dns/records.rb +0 -48
  191. data/lib/fog/dynect/models/dns/zone.rb +0 -56
  192. data/lib/fog/dynect/models/dns/zones.rb +0 -25
  193. data/lib/fog/dynect/requests/dns/delete_record.rb +0 -55
  194. data/lib/fog/dynect/requests/dns/delete_zone.rb +0 -41
  195. data/lib/fog/dynect/requests/dns/get_all_records.rb +0 -56
  196. data/lib/fog/dynect/requests/dns/get_node_list.rb +0 -55
  197. data/lib/fog/dynect/requests/dns/get_record.rb +0 -83
  198. data/lib/fog/dynect/requests/dns/get_zone.rb +0 -57
  199. data/lib/fog/dynect/requests/dns/post_record.rb +0 -71
  200. data/lib/fog/dynect/requests/dns/post_session.rb +0 -43
  201. data/lib/fog/dynect/requests/dns/post_zone.rb +0 -70
  202. data/lib/fog/dynect/requests/dns/put_record.rb +0 -76
  203. data/lib/fog/dynect/requests/dns/put_zone.rb +0 -76
  204. data/tests/dynect/requests/dns/dns_tests.rb +0 -258
@@ -1,21 +1,15 @@
1
- require 'fog/core/model'
1
+ require 'fog/openstack/models/model'
2
2
 
3
3
  module Fog
4
4
  module Openstack
5
5
  class Planning
6
- class Role < Fog::Model
6
+ class Role < Fog::OpenStack::Model
7
7
  identity :uuid
8
8
 
9
9
  attribute :description
10
10
  attribute :name
11
11
  attribute :uuid
12
12
 
13
- def initialize(attributes)
14
- # Old 'connection' is renamed as service and should be used instead
15
- prepare_service_value(attributes)
16
- super
17
- end
18
-
19
13
  def add_to_plan(plan_uuid)
20
14
  service.add_role_to_plan(plan_uuid, uuid)
21
15
  end
@@ -1,18 +1,15 @@
1
- require 'fog/core/collection'
1
+ require 'fog/openstack/models/collection'
2
2
  require 'fog/openstack/models/planning/role'
3
3
 
4
4
  module Fog
5
5
  module Openstack
6
6
  class Planning
7
- class Roles < Fog::Collection
7
+ class Roles < Fog::OpenStack::Collection
8
8
  model Fog::Openstack::Planning::Role
9
9
 
10
10
  def all(options = {})
11
- load(service.list_roles(options).body)
11
+ load_response(service.list_roles(options))
12
12
  end
13
-
14
- alias_method :summary, :all
15
-
16
13
  end
17
14
  end
18
15
  end
@@ -1,19 +1,17 @@
1
- require 'fog/core/collection'
1
+ require 'fog/openstack/models/collection'
2
2
  require 'fog/openstack/models/storage/directory'
3
3
 
4
4
  module Fog
5
5
  module Storage
6
6
  class OpenStack
7
- class Directories < Fog::Collection
7
+ class Directories < Fog::OpenStack::Collection
8
8
  model Fog::Storage::OpenStack::Directory
9
9
 
10
10
  def all(options = {})
11
- data = service.get_containers(options).body
12
- load(data)
11
+ data = service.get_containers(options)
12
+ load_response(data)
13
13
  end
14
14
 
15
- alias_method :summary, :all
16
-
17
15
  def get(key, options = {})
18
16
  data = service.get_container(key, options)
19
17
  directory = new(:key => key)
@@ -1,10 +1,10 @@
1
- require 'fog/core/model'
1
+ require 'fog/openstack/models/model'
2
2
  require 'fog/openstack/models/storage/files'
3
3
 
4
4
  module Fog
5
5
  module Storage
6
6
  class OpenStack
7
- class Directory < Fog::Model
7
+ class Directory < Fog::OpenStack::Model
8
8
  identity :key, :aliases => 'name'
9
9
 
10
10
  attribute :bytes, :aliases => 'X-Container-Bytes-Used'
@@ -1,9 +1,9 @@
1
- require 'fog/core/model'
1
+ require 'fog/openstack/models/model'
2
2
 
3
3
  module Fog
4
4
  module Storage
5
5
  class OpenStack
6
- class File < Fog::Model
6
+ class File < Fog::OpenStack::Model
7
7
  identity :key, :aliases => 'name'
8
8
 
9
9
  attribute :access_control_allow_origin, :aliases => ['Access-Control-Allow-Origin']
@@ -14,6 +14,17 @@ module Fog
14
14
  attribute :last_modified, :aliases => ['last_modified', 'Last-Modified'], :type => :time
15
15
  attribute :metadata
16
16
  attribute :origin, :aliases => ['Origin']
17
+ # @!attribute [rw] delete_at
18
+ # A Unix Epoch Timestamp, in integer form, representing the time when this object will be automatically deleted.
19
+ # @return [Integer] the unix epoch timestamp of when this object will be automatically deleted
20
+ # @see http://docs.openstack.org/developer/swift/overview_expiring_objects.html
21
+ attribute :delete_at, :aliases => ['X-Delete-At']
22
+
23
+ # @!attribute [rw] delete_after
24
+ # A number of seconds representing how long from now this object will be automatically deleted.
25
+ # @return [Integer] the number of seconds until this object will be automatically deleted
26
+ # @see http://docs.openstack.org/developer/swift/overview_expiring_objects.html
27
+ attribute :delete_after, :aliases => ['X-Delete-After']
17
28
 
18
29
  def body
19
30
  attributes[:body] ||= if last_modified
@@ -88,6 +99,8 @@ module Fog
88
99
  options['Content-Disposition'] = content_disposition if content_disposition
89
100
  options['Access-Control-Allow-Origin'] = access_control_allow_origin if access_control_allow_origin
90
101
  options['Origin'] = origin if origin
102
+ options['X-Delete-At'] = delete_at if delete_at
103
+ options['X-Delete-After'] = delete_after if delete_after
91
104
  options.merge!(metadata_to_headers)
92
105
 
93
106
  data = service.put_object(directory.key, key, body, options)
@@ -1,10 +1,10 @@
1
- require 'fog/core/collection'
1
+ require 'fog/openstack/models/collection'
2
2
  require 'fog/openstack/models/storage/file'
3
3
 
4
4
  module Fog
5
5
  module Storage
6
6
  class OpenStack
7
- class Files < Fog::Collection
7
+ class Files < Fog::OpenStack::Collection
8
8
  attribute :directory
9
9
  attribute :limit
10
10
  attribute :marker
@@ -16,10 +16,10 @@ module Fog
16
16
  def all(options = {})
17
17
  requires :directory
18
18
  options = {
19
- 'limit' => limit,
20
- 'marker' => marker,
21
- 'path' => path,
22
- 'prefix' => prefix
19
+ 'limit' => limit,
20
+ 'marker' => marker,
21
+ 'path' => path,
22
+ 'prefix' => prefix
23
23
  }.merge!(options)
24
24
  merge_attributes(options)
25
25
  parent = directory.collection.get(
@@ -27,14 +27,13 @@ module Fog
27
27
  options
28
28
  )
29
29
  if parent
30
+ # TODO change to load_response?
30
31
  load(parent.files.map {|file| file.attributes})
31
32
  else
32
33
  nil
33
34
  end
34
35
  end
35
36
 
36
- alias_method :summary, :all
37
-
38
37
  alias_method :each_file_this_page, :each
39
38
  def each
40
39
  if !block_given?
@@ -0,0 +1,13 @@
1
+ require 'fog/openstack/models/model'
2
+
3
+ module Fog
4
+ module Volume
5
+ class OpenStack
6
+ class AvailabilityZone < Fog::OpenStack::Model
7
+ identity :zoneName
8
+
9
+ attribute :zoneState
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,17 @@
1
+ require 'fog/openstack/models/collection'
2
+ require 'fog/openstack/models/volume/availability_zone'
3
+
4
+ module Fog
5
+ module Volume
6
+ class OpenStack
7
+ class AvailabilityZones < Fog::OpenStack::Collection
8
+ model Fog::Volume::OpenStack::AvailabilityZone
9
+
10
+ def all(options = {})
11
+ data = service.list_zones(options)
12
+ load_response(data, 'availabilityZoneInfo')
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,36 @@
1
+ require 'fog/openstack/models/model'
2
+
3
+ module Fog
4
+ module Volume
5
+ class OpenStack
6
+ class Transfer < Fog::OpenStack::Model
7
+ identity :id
8
+
9
+ attribute :auth_key, :aliases => 'authKey'
10
+ attribute :created_at, :aliases => 'createdAt'
11
+ attribute :name
12
+ attribute :volume_id, :aliases => 'volumeId'
13
+
14
+ def save
15
+ requires :name, :volume_id
16
+ data = service.create_transfer(volume_id, :name => name)
17
+ merge_attributes(data.body['transfer'])
18
+ true
19
+ end
20
+
21
+ def destroy
22
+ requires :id
23
+ service.delete_transfer(id)
24
+ true
25
+ end
26
+
27
+ def initialize(attributes)
28
+ # Old 'connection' is renamed as service and should be used instead
29
+ prepare_service_value(attributes)
30
+ super
31
+ end
32
+
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,38 @@
1
+ require 'fog/openstack/models/collection'
2
+ require 'fog/openstack/models/volume/transfer'
3
+
4
+ module Fog
5
+ module Volume
6
+ class OpenStack
7
+ class Transfers < Fog::OpenStack::Collection
8
+ model Fog::Volume::OpenStack::Transfer
9
+
10
+ def all(options = {})
11
+ load_response(service.list_transfers_detailed(options), 'transfers')
12
+ end
13
+
14
+ def summary(options = {})
15
+ load_response(service.list_transfers(options), 'transfers')
16
+ end
17
+
18
+ def get(transfer_id)
19
+ if transfer = service.get_transfer_details(transfer_id).body['transfer']
20
+ new(transfer)
21
+ end
22
+ rescue Fog::Volume::OpenStack::NotFound
23
+ nil
24
+ end
25
+
26
+ def accept(transfer_id, auth_key)
27
+ # NOTE: This is NOT a method on the Transfer object, since the
28
+ # receiver cannot see the transfer object in the get_transfer_details
29
+ # or list_transfers(_detailed) requests.
30
+ if transfer = service.accept_transfer(transfer_id, auth_key).body['transfer']
31
+ new(transfer)
32
+ end
33
+ end
34
+
35
+ end
36
+ end
37
+ end
38
+ end
@@ -1,9 +1,9 @@
1
- require 'fog/core/model'
1
+ require 'fog/openstack/models/model'
2
2
 
3
3
  module Fog
4
4
  module Volume
5
5
  class OpenStack
6
- class Volume < Fog::Model
6
+ class Volume < Fog::OpenStack::Model
7
7
  identity :id
8
8
 
9
9
  attribute :display_name, :aliases => 'displayName'
@@ -18,12 +18,7 @@ module Fog
18
18
  attribute :created_at, :aliases => 'createdAt'
19
19
  attribute :attachments
20
20
  attribute :source_volid
21
-
22
- def initialize(attributes)
23
- # Old 'connection' is renamed as service and should be used instead
24
- prepare_service_value(attributes)
25
- super
26
- end
21
+ attribute :tenant_id, :aliases => 'os-vol-tenant-attr:tenant_id'
27
22
 
28
23
  def save
29
24
  requires :display_name, :size
@@ -38,6 +33,12 @@ module Fog
38
33
  true
39
34
  end
40
35
 
36
+ def extend(size)
37
+ requires :id
38
+ service.extend_volume(id, size)
39
+ true
40
+ end
41
+
41
42
  def ready?
42
43
  status == 'available'
43
44
  end
@@ -1,19 +1,13 @@
1
- require 'fog/core/model'
1
+ require 'fog/openstack/models/model'
2
2
 
3
3
  module Fog
4
4
  module Volume
5
5
  class OpenStack
6
- class VolumeType < Fog::Model
6
+ class VolumeType < Fog::OpenStack::Model
7
7
  identity :id
8
8
 
9
9
  attribute :name
10
10
  attribute :volume_backend_name
11
-
12
- def initialize(attributes)
13
- # Old 'connection' is renamed as service and should be used instead
14
- prepare_service_value(attributes)
15
- super
16
- end
17
11
  end
18
12
  end
19
13
  end
@@ -1,19 +1,17 @@
1
- require 'fog/core/collection'
1
+ require 'fog/openstack/models/collection'
2
2
  require 'fog/openstack/models/volume/volume_type'
3
3
 
4
4
  module Fog
5
5
  module Volume
6
6
  class OpenStack
7
- class VolumeTypes < Fog::Collection
7
+ class VolumeTypes < Fog::OpenStack::Collection
8
8
  model Fog::Volume::OpenStack::VolumeType
9
9
 
10
10
  def all(options = {})
11
11
  response = service.list_volume_types(options)
12
- load(response.body['volume_types'])
12
+ load_response(response, 'volume_types')
13
13
  end
14
14
 
15
- alias_method :summary, :all
16
-
17
15
  def get(volume_type_id)
18
16
  if volume_type = service.get_volume_type_details(volume_type_id).body['volume_type']
19
17
  new(volume_type)
@@ -21,7 +19,6 @@ module Fog
21
19
  rescue Fog::Volume::OpenStack::NotFound
22
20
  nil
23
21
  end
24
- alias_method :find_by_id, :get
25
22
  end
26
23
  end
27
24
  end
@@ -1,10 +1,10 @@
1
- require 'fog/core/collection'
1
+ require 'fog/openstack/models/collection'
2
2
  require 'fog/openstack/models/volume/volume'
3
3
 
4
4
  module Fog
5
5
  module Volume
6
6
  class OpenStack
7
- class Volumes < Fog::Collection
7
+ class Volumes < Fog::OpenStack::Collection
8
8
  model Fog::Volume::OpenStack::Volume
9
9
 
10
10
  def all(options = {})
@@ -13,16 +13,16 @@ module Fog
13
13
  detailed = options.is_a?(Hash) ? options.delete(:detailed) : options
14
14
  if detailed.nil? || detailed
15
15
  # This method gives details by default, unless false or {:detailed => false} is passed
16
- load(service.list_volumes_detailed(options).body['volumes'])
16
+ load_response(service.list_volumes_detailed(options), 'volumes')
17
17
  else
18
18
  Fog::Logger.deprecation('Calling OpenStack[:volume].volumes.all(false) or volumes.all(:detailed => false) '\
19
19
  ' is deprecated, call .volumes.summary instead')
20
- load(service.list_volumes(options).body['volumes'])
20
+ load_response(service.list_volumes(options), 'volumes')
21
21
  end
22
22
  end
23
23
 
24
24
  def summary(options = {})
25
- load(service.list_volumes(options).body['volumes'])
25
+ load_response(service.list_volumes(options), 'volumes')
26
26
  end
27
27
 
28
28
  def get(volume_id)
@@ -32,7 +32,6 @@ module Fog
32
32
  rescue Fog::Volume::OpenStack::NotFound
33
33
  nil
34
34
  end
35
- alias_method :find_by_id, :get
36
35
  end
37
36
  end
38
37
  end
@@ -3,13 +3,16 @@ module Fog
3
3
  class OpenStack
4
4
  class Real
5
5
  def list_servers(options = {})
6
- params = Hash.new
7
- params['all_tenants'] = 'True' if options[:all_tenants]
6
+ params = options.dup
7
+ if params[:all_tenants]
8
+ params['all_tenants'] = 'True'
9
+ params.delete(:all_tenants)
10
+ end
8
11
 
9
12
  request(
10
- :expects => [200, 203],
11
- :method => 'GET',
12
- :path => 'servers.json',
13
+ :expects => [200, 203],
14
+ :method => 'GET',
15
+ :path => 'servers.json',
13
16
  :query => params
14
17
  )
15
18
  end
@@ -3,14 +3,17 @@ module Fog
3
3
  class OpenStack
4
4
  class Real
5
5
  # Available filters: name, status, image, flavor, changes_since, reservation_id
6
- def list_servers_detail(filters = {})
7
- params = Hash.new
8
- filters[:all_tenants] ? params['all_tenants'] = 'True' : params = filters
6
+ def list_servers_detail(options = {})
7
+ params = options.dup
8
+ if params[:all_tenants]
9
+ params['all_tenants'] = 'True'
10
+ params.delete(:all_tenants)
11
+ end
9
12
 
10
13
  request(
11
- :expects => [200, 203],
12
- :method => 'GET',
13
- :path => 'servers/detail.json',
14
+ :expects => [200, 203],
15
+ :method => 'GET',
16
+ :path => 'servers/detail.json',
14
17
  :query => params
15
18
  )
16
19
  end