fog 1.31.0 → 1.32.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (176) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +53 -0
  3. data/Rakefile +5 -5
  4. data/fog.gemspec +6 -5
  5. data/lib/fog/cloudstack/models/compute/network.rb +1 -0
  6. data/lib/fog/openstack/compute.rb +41 -98
  7. data/lib/fog/openstack/core.rb +257 -118
  8. data/lib/fog/openstack/identity.rb +4 -0
  9. data/lib/fog/openstack/identity_v3.rb +10 -41
  10. data/lib/fog/openstack/models/baremetal/chassis_collection.rb +10 -4
  11. data/lib/fog/openstack/models/baremetal/drivers.rb +4 -2
  12. data/lib/fog/openstack/models/baremetal/nodes.rb +10 -4
  13. data/lib/fog/openstack/models/baremetal/ports.rb +10 -4
  14. data/lib/fog/openstack/models/compute/addresses.rb +4 -2
  15. data/lib/fog/openstack/models/compute/aggregate.rb +64 -0
  16. data/lib/fog/openstack/models/compute/aggregates.rb +28 -0
  17. data/lib/fog/openstack/models/compute/flavors.rb +5 -0
  18. data/lib/fog/openstack/models/compute/hosts.rb +4 -2
  19. data/lib/fog/openstack/models/compute/images.rb +2 -0
  20. data/lib/fog/openstack/models/compute/key_pairs.rb +4 -2
  21. data/lib/fog/openstack/models/compute/security_groups.rb +4 -2
  22. data/lib/fog/openstack/models/compute/servers.rb +2 -0
  23. data/lib/fog/openstack/models/compute/services.rb +7 -4
  24. data/lib/fog/openstack/models/compute/snapshots.rb +15 -2
  25. data/lib/fog/openstack/models/compute/volumes.rb +15 -2
  26. data/lib/fog/openstack/models/identity_v2/ec2_credentials.rb +6 -3
  27. data/lib/fog/openstack/models/identity_v2/roles.rb +5 -3
  28. data/lib/fog/openstack/models/identity_v2/tenants.rb +5 -3
  29. data/lib/fog/openstack/models/identity_v2/users.rb +7 -3
  30. data/lib/fog/openstack/models/identity_v3/domains.rb +7 -6
  31. data/lib/fog/openstack/models/identity_v3/endpoints.rb +5 -4
  32. data/lib/fog/openstack/models/identity_v3/groups.rb +5 -3
  33. data/lib/fog/openstack/models/identity_v3/os_credentials.rb +5 -3
  34. data/lib/fog/openstack/models/identity_v3/policies.rb +5 -3
  35. data/lib/fog/openstack/models/identity_v3/project.rb +1 -0
  36. data/lib/fog/openstack/models/identity_v3/projects.rb +7 -5
  37. data/lib/fog/openstack/models/identity_v3/role_assignments.rb +10 -5
  38. data/lib/fog/openstack/models/identity_v3/roles.rb +11 -5
  39. data/lib/fog/openstack/models/identity_v3/services.rb +5 -3
  40. data/lib/fog/openstack/models/identity_v3/users.rb +4 -2
  41. data/lib/fog/openstack/models/image/images.rb +10 -4
  42. data/lib/fog/openstack/models/network/floating_ips.rb +2 -0
  43. data/lib/fog/openstack/models/network/lb_health_monitors.rb +2 -0
  44. data/lib/fog/openstack/models/network/lb_members.rb +2 -0
  45. data/lib/fog/openstack/models/network/lb_pools.rb +2 -0
  46. data/lib/fog/openstack/models/network/lb_vips.rb +2 -0
  47. data/lib/fog/openstack/models/network/networks.rb +2 -0
  48. data/lib/fog/openstack/models/network/port.rb +1 -0
  49. data/lib/fog/openstack/models/network/ports.rb +2 -0
  50. data/lib/fog/openstack/models/network/routers.rb +2 -0
  51. data/lib/fog/openstack/models/network/security_group_rules.rb +2 -0
  52. data/lib/fog/openstack/models/network/security_groups.rb +2 -0
  53. data/lib/fog/openstack/models/network/subnets.rb +2 -0
  54. data/lib/fog/openstack/models/orchestration/events.rb +10 -6
  55. data/lib/fog/openstack/models/orchestration/resources.rb +4 -2
  56. data/lib/fog/openstack/models/orchestration/stack.rb +1 -1
  57. data/lib/fog/openstack/models/orchestration/stacks.rb +9 -1
  58. data/lib/fog/openstack/models/planning/plans.rb +4 -2
  59. data/lib/fog/openstack/models/planning/roles.rb +5 -2
  60. data/lib/fog/openstack/models/storage/directories.rb +4 -2
  61. data/lib/fog/openstack/models/storage/files.rb +2 -0
  62. data/lib/fog/openstack/models/volume/volume.rb +1 -0
  63. data/lib/fog/openstack/models/volume/volume_types.rb +2 -0
  64. data/lib/fog/openstack/models/volume/volumes.rb +13 -2
  65. data/lib/fog/openstack/network.rb +18 -97
  66. data/lib/fog/openstack/orchestration.rb +2 -0
  67. data/lib/fog/openstack/requests/baremetal/list_chassis.rb +2 -8
  68. data/lib/fog/openstack/requests/baremetal/list_chassis_detailed.rb +3 -9
  69. data/lib/fog/openstack/requests/baremetal/list_drivers.rb +4 -3
  70. data/lib/fog/openstack/requests/baremetal/list_nodes.rb +3 -9
  71. data/lib/fog/openstack/requests/baremetal/list_nodes_detailed.rb +3 -9
  72. data/lib/fog/openstack/requests/baremetal/list_ports.rb +3 -9
  73. data/lib/fog/openstack/requests/baremetal/list_ports_detailed.rb +3 -9
  74. data/lib/fog/openstack/requests/compute/add_aggregate_host.rb +30 -0
  75. data/lib/fog/openstack/requests/compute/create_aggregate.rb +42 -0
  76. data/lib/fog/openstack/requests/compute/delete_aggregate.rb +28 -0
  77. data/lib/fog/openstack/requests/compute/get_aggregate.rb +26 -0
  78. data/lib/fog/openstack/requests/compute/list_aggregates.rb +36 -0
  79. data/lib/fog/openstack/requests/compute/list_all_addresses.rb +4 -3
  80. data/lib/fog/openstack/requests/compute/list_flavors.rb +6 -5
  81. data/lib/fog/openstack/requests/compute/list_hosts.rb +4 -3
  82. data/lib/fog/openstack/requests/compute/list_key_pairs.rb +4 -3
  83. data/lib/fog/openstack/requests/compute/list_security_groups.rb +15 -2
  84. data/lib/fog/openstack/requests/compute/list_snapshots.rb +18 -4
  85. data/lib/fog/openstack/requests/compute/list_snapshots_detail.rb +27 -0
  86. data/lib/fog/openstack/requests/compute/list_volumes.rb +18 -4
  87. data/lib/fog/openstack/requests/compute/list_volumes_detail.rb +25 -0
  88. data/lib/fog/openstack/requests/compute/remove_aggregate_host.rb +30 -0
  89. data/lib/fog/openstack/requests/compute/update_aggregate.rb +37 -0
  90. data/lib/fog/openstack/requests/compute/update_aggregate_metadata.rb +30 -0
  91. data/lib/fog/openstack/requests/identity_v2/list_ec2_credentials.rb +23 -7
  92. data/lib/fog/openstack/requests/identity_v2/list_roles.rb +5 -4
  93. data/lib/fog/openstack/requests/identity_v2/list_tenants.rb +14 -8
  94. data/lib/fog/openstack/requests/identity_v2/list_users.rb +16 -4
  95. data/lib/fog/openstack/requests/identity_v3/auth_domains.rb +2 -7
  96. data/lib/fog/openstack/requests/identity_v3/auth_projects.rb +6 -11
  97. data/lib/fog/openstack/requests/identity_v3/list_domains.rb +7 -14
  98. data/lib/fog/openstack/requests/identity_v3/list_endpoints.rb +7 -14
  99. data/lib/fog/openstack/requests/identity_v3/list_group_users.rb +5 -13
  100. data/lib/fog/openstack/requests/identity_v3/list_groups.rb +14 -24
  101. data/lib/fog/openstack/requests/identity_v3/list_os_credentials.rb +7 -12
  102. data/lib/fog/openstack/requests/identity_v3/list_policies.rb +7 -11
  103. data/lib/fog/openstack/requests/identity_v3/list_projects.rb +14 -25
  104. data/lib/fog/openstack/requests/identity_v3/list_role_assignments.rb +21 -17
  105. data/lib/fog/openstack/requests/identity_v3/list_roles.rb +7 -25
  106. data/lib/fog/openstack/requests/identity_v3/list_services.rb +7 -13
  107. data/lib/fog/openstack/requests/identity_v3/list_users.rb +7 -15
  108. data/lib/fog/openstack/requests/image/list_public_images.rb +4 -3
  109. data/lib/fog/openstack/requests/image/list_public_images_detailed.rb +9 -6
  110. data/lib/fog/openstack/requests/network/create_port.rb +12 -11
  111. data/lib/fog/openstack/requests/network/create_subnet.rb +7 -7
  112. data/lib/fog/openstack/requests/network/get_port.rb +1 -0
  113. data/lib/fog/openstack/requests/network/update_port.rb +7 -6
  114. data/lib/fog/openstack/requests/orchestration/list_events.rb +46 -0
  115. data/lib/fog/openstack/requests/orchestration/list_resource_events.rb +7 -2
  116. data/lib/fog/openstack/requests/orchestration/list_resource_types.rb +3 -2
  117. data/lib/fog/openstack/requests/orchestration/list_resources.rb +27 -4
  118. data/lib/fog/openstack/requests/orchestration/list_stack_data.rb +2 -2
  119. data/lib/fog/openstack/requests/orchestration/list_stack_data_detailed.rb +49 -0
  120. data/lib/fog/openstack/requests/orchestration/list_stack_events.rb +6 -2
  121. data/lib/fog/openstack/requests/planning/list_plans.rb +4 -3
  122. data/lib/fog/openstack/requests/planning/list_roles.rb +3 -9
  123. data/lib/fog/openstack/requests/volume/create_volume.rb +2 -1
  124. data/lib/fog/openstack/requests/volume/list_snapshots.rb +16 -3
  125. data/lib/fog/openstack/requests/volume/list_snapshots_detailed.rb +27 -0
  126. data/lib/fog/openstack/requests/volume/list_volume_types.rb +6 -6
  127. data/lib/fog/openstack/requests/volume/list_volumes.rb +20 -7
  128. data/lib/fog/openstack/requests/volume/list_volumes_detailed.rb +49 -0
  129. data/lib/fog/openstack/volume.rb +1 -0
  130. data/lib/fog/ovirt/models/compute/server.rb +1 -0
  131. data/lib/fog/ovirt/models/compute/template.rb +1 -0
  132. data/lib/fog/rackspace/docs/queues.md +2 -2
  133. data/lib/fog/rackspace/models/block_storage/snapshot.rb +5 -1
  134. data/lib/fog/version.rb +1 -1
  135. data/lib/fog/vsphere/requests/compute/vm_clone.rb +1 -1
  136. data/lib/tasks/changelog_task.rb +1 -0
  137. data/spec/fog/openstack/identity_v3/authv3_a.yml +55 -35
  138. data/spec/fog/openstack/identity_v3/authv3_b.yml +55 -35
  139. data/spec/fog/openstack/identity_v3/authv3_c.yml +159 -33
  140. data/spec/fog/openstack/identity_v3/authv3_project.yml +79 -35
  141. data/spec/fog/openstack/identity_v3/authv3_token.yml +377 -76
  142. data/spec/fog/openstack/identity_v3/authv3_unscoped.yml +298 -155
  143. data/spec/fog/openstack/identity_v3/authv3_unscoped_reauth.yml +371 -0
  144. data/spec/fog/openstack/identity_v3/idv3.yml +456 -41
  145. data/spec/fog/openstack/identity_v3/idv3_credential.yml +36 -30
  146. data/spec/fog/openstack/identity_v3/idv3_credential_crud.yml +223 -190
  147. data/spec/fog/openstack/identity_v3/idv3_domain.yml +64 -58
  148. data/spec/fog/openstack/identity_v3/idv3_domain_crud.yml +176 -393
  149. data/spec/fog/openstack/identity_v3/idv3_domain_group_roles_mutation.yml +277 -379
  150. data/spec/fog/openstack/identity_v3/idv3_domain_roles_mutation.yml +177 -204
  151. data/spec/fog/openstack/identity_v3/idv3_endpoint.yml +492 -174
  152. data/spec/fog/openstack/identity_v3/idv3_endpoints_crud.yml +669 -435
  153. data/spec/fog/openstack/identity_v3/idv3_group_crud_mutation.yml +378 -298
  154. data/spec/fog/openstack/identity_v3/idv3_other_region.yml +187 -0
  155. data/spec/fog/openstack/identity_v3/idv3_policy.yml +54 -46
  156. data/spec/fog/openstack/identity_v3/idv3_policy_crud.yml +137 -117
  157. data/spec/fog/openstack/identity_v3/idv3_project.yml +116 -86
  158. data/spec/fog/openstack/identity_v3/idv3_project_crud.yml +179 -387
  159. data/spec/fog/openstack/identity_v3/idv3_project_group_user_roles_mutation.yml +415 -556
  160. data/spec/fog/openstack/identity_v3/idv3_role.yml +108 -74
  161. data/spec/fog/openstack/identity_v3/idv3_role_crud.yml +160 -368
  162. data/spec/fog/openstack/identity_v3/idv3_service.yml +156 -94
  163. data/spec/fog/openstack/identity_v3/idv3_services_crud.yml +250 -306
  164. data/spec/fog/openstack/identity_v3/idv3_token.yml +195 -101
  165. data/spec/fog/openstack/identity_v3/idv3_user_crud.yml +276 -193
  166. data/spec/fog/openstack/identity_v3/idv3_users.yml +149 -219
  167. data/spec/fog/openstack/identity_v3_spec.rb +502 -474
  168. data/spec/fog/openstack/volume/volume_common_setup.yml +76 -0
  169. data/spec/fog/openstack/volume/volume_crud.yml +561 -0
  170. data/spec/fog/openstack/volume/volume_type_read.yml +120 -0
  171. data/spec/fog/openstack/volume_spec.rb +165 -0
  172. data/tests/openstack/requests/compute/aggregate_tests.rb +59 -0
  173. data/tests/openstack/requests/network/port_tests.rb +12 -11
  174. data/tests/openstack/requests/orchestration/stack_tests.rb +25 -0
  175. metadata +56 -14
  176. data/spec/fog/openstack/identity_v3/idv2_unscoped_token_v3.yml +0 -467
@@ -0,0 +1,25 @@
1
+ module Fog
2
+ module Compute
3
+ class OpenStack
4
+ class Real
5
+ def list_volumes_detail(options = {})
6
+ request(
7
+ :expects => 200,
8
+ :method => 'GET',
9
+ :path => 'os-volumes/detail',
10
+ :query => options
11
+ )
12
+ end
13
+ end
14
+
15
+ class Mock
16
+ def list_volumes_detail(options = {})
17
+ Excon::Response.new(
18
+ :body => { 'volumes' => self.data[:volumes].values },
19
+ :status => 200
20
+ )
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,30 @@
1
+ module Fog
2
+ module Compute
3
+ class OpenStack
4
+ class Real
5
+ def remove_aggregate_host(uuid, host_uuid)
6
+ data = {'remove_host' => {'host' => host_uuid}}
7
+ request(
8
+ :body => Fog::JSON.encode(data),
9
+ :expects => [200],
10
+ :method => 'POST',
11
+ :path => "os-aggregates/#{uuid}/action"
12
+ )
13
+ end
14
+ end
15
+
16
+ class Mock
17
+ def remove_aggregate_host(uuid, host_uuid)
18
+ response = Excon::Response.new
19
+ response.status = 200
20
+ response.headers = {
21
+ "Content-Type" => "text/html; charset=UTF-8",
22
+ "Content-Length" => "0",
23
+ "Date" => Date.new
24
+ }
25
+ response
26
+ end
27
+ end # mock
28
+ end # openstack
29
+ end # compute
30
+ end # fog
@@ -0,0 +1,37 @@
1
+ module Fog
2
+ module Compute
3
+ class OpenStack
4
+ class Real
5
+ def update_aggregate(uuid, options = {})
6
+ vanilla_options = ['name', 'availability_zone']
7
+
8
+ data = {'aggregate' => {}}
9
+ vanilla_options.select{|o| options[o]}.each do |key|
10
+ data['aggregate'][key] = options[key]
11
+ end
12
+
13
+ request(
14
+ :body => Fog::JSON.encode(data),
15
+ :expects => [200],
16
+ :method => 'PUT',
17
+ :path => "os-aggregates/#{uuid}"
18
+ )
19
+ end
20
+ end
21
+
22
+ class Mock
23
+ def update_aggregate(uuid, options = {})
24
+ response = Excon::Response.new
25
+ response.status = 200
26
+ response.headers = {
27
+ "Content-Type" => "text/html; charset=UTF-8",
28
+ "Content-Length" => "0",
29
+ "Date" => Date.new
30
+ }
31
+ response.body = {'aggregate' => self.data[:aggregates].first}
32
+ response
33
+ end
34
+ end # mock
35
+ end # openstack
36
+ end # compute
37
+ end # fog
@@ -0,0 +1,30 @@
1
+ module Fog
2
+ module Compute
3
+ class OpenStack
4
+ class Real
5
+ def update_aggregate_metadata(uuid, metadata = {})
6
+ data = {'set_metadata' => {'metadata' => metadata}}
7
+ request(
8
+ :body => Fog::JSON.encode(data),
9
+ :expects => [200],
10
+ :method => 'POST',
11
+ :path => "os-aggregates/#{uuid}/action"
12
+ )
13
+ end
14
+ end
15
+
16
+ class Mock
17
+ def update_aggregate_metadata(uuid, metadata = {})
18
+ response = Excon::Response.new
19
+ response.status = 200
20
+ response.headers = {
21
+ "Content-Type" => "text/html; charset=UTF-8",
22
+ "Content-Length" => "0",
23
+ "Date" => Date.new
24
+ }
25
+ response
26
+ end
27
+ end # mock
28
+ end # openstack
29
+ end # compute
30
+ end # fog
@@ -7,8 +7,8 @@ module Fog
7
7
  # List EC2 credentials for a user. Requires administrator
8
8
  # credentials.
9
9
  #
10
- # ==== Parameters
11
- # * user_id<~String>: The id of the user to retrieve the credential
10
+ # ==== Parameters hash
11
+ # * :user_id<~String>: The id of the user to retrieve the credential
12
12
  # for
13
13
  #
14
14
  # ==== Returns
@@ -20,17 +20,33 @@ module Fog
20
20
  # * 'user_id'<~String>: The user id
21
21
  # * 'tenant_id'<~String>: The tenant id
22
22
 
23
- def list_ec2_credentials(user_id)
23
+ def list_ec2_credentials(options = {})
24
+ if options.is_a?(Hash)
25
+ user_id = options.delete(:user_id)
26
+ query = options
27
+ else
28
+ Fog::Logger.deprecation('Calling OpenStack[:identity].list_ec2_credentials(user_id) is deprecated, use .list_ec2_credentials(:user_id => value)')
29
+ user_id = options
30
+ query = {}
31
+ end
32
+
24
33
  request(
25
- :expects => [200, 202],
26
- :method => 'GET',
27
- :path => "users/#{user_id}/credentials/OS-EC2"
34
+ :expects => [200, 202],
35
+ :method => 'GET',
36
+ :path => "users/#{user_id}/credentials/OS-EC2",
37
+ :query => query
28
38
  )
29
39
  end
30
40
  end
31
41
 
32
42
  class Mock
33
- def list_ec2_credentials(user_id)
43
+ def list_ec2_credentials(options = {})
44
+ if options.is_a?(Hash)
45
+ user_id = options.delete(:user_id)
46
+ else
47
+ user_id = options
48
+ end
49
+
34
50
  ec2_credentials = self.data[:ec2_credentials][user_id].values
35
51
 
36
52
  response = Excon::Response.new
@@ -3,17 +3,18 @@ module Fog
3
3
  class OpenStack
4
4
  class V2
5
5
  class Real
6
- def list_roles
6
+ def list_roles(options = {})
7
7
  request(
8
8
  :expects => 200,
9
- :method => 'GET',
10
- :path => '/OS-KSADM/roles'
9
+ :method => 'GET',
10
+ :path => '/OS-KSADM/roles',
11
+ :query => options
11
12
  )
12
13
  end
13
14
  end
14
15
 
15
16
  class Mock
16
- def list_roles
17
+ def list_roles(options = {})
17
18
  if self.data[:roles].empty?
18
19
  ['admin', 'Member'].each do |name|
19
20
  id = Fog::Mock.random_hex(32)
@@ -3,22 +3,28 @@ module Fog
3
3
  class OpenStack
4
4
  class V2
5
5
  class Real
6
- def list_tenants(limit = nil, marker = nil)
7
- params = Hash.new
8
- params['limit'] = limit if limit
9
- params['marker'] = marker if marker
6
+ def list_tenants(options = nil, marker = nil)
7
+ if options.is_a?(Hash)
8
+ params = options
9
+ else
10
+ Fog::Logger.deprecation('Calling OpenStack[:identity].list_tenants(limit, marker) is deprecated, use'\
11
+ ' .list_ec2_credentials(:limit => value, :marker => value)')
12
+ params = {}
13
+ params['limit'] = options if options
14
+ params['marker'] = marker if marker
15
+ end
10
16
 
11
17
  request(
12
18
  :expects => [200, 204],
13
- :method => 'GET',
14
- :path => "tenants",
15
- :query => params
19
+ :method => 'GET',
20
+ :path => "tenants",
21
+ :query => params
16
22
  )
17
23
  end
18
24
  end # class Real
19
25
 
20
26
  class Mock
21
- def list_tenants
27
+ def list_tenants(options = nil, marker = nil)
22
28
  Excon::Response.new(
23
29
  :body => {
24
30
  'tenants_links' => [],
@@ -3,18 +3,30 @@ module Fog
3
3
  class OpenStack
4
4
  class V2
5
5
  class Real
6
- def list_users(tenant_id = nil)
6
+ def list_users(options = {})
7
+ if options.is_a?(Hash)
8
+ tenant_id = options.delete(:tenant_id)
9
+ query = options
10
+ else
11
+ Fog::Logger.deprecation('Calling OpenStack[:identity].list_users(tenant_id) is deprecated, use .list_users(:tenant_id => value)')
12
+ tenant_id = options
13
+ query = {}
14
+ end
15
+
7
16
  path = tenant_id ? "tenants/#{tenant_id}/users" : 'users'
8
17
  request(
9
18
  :expects => [200, 204],
10
- :method => 'GET',
11
- :path => path
19
+ :method => 'GET',
20
+ :path => path,
21
+ :query => query
12
22
  )
13
23
  end
14
24
  end # class Real
15
25
 
16
26
  class Mock
17
- def list_users(tenant_id = nil)
27
+ def list_users(options = {})
28
+ tenant_id = options[:tenant_id]
29
+
18
30
  users = self.data[:users].values
19
31
 
20
32
  if tenant_id
@@ -2,18 +2,13 @@ module Fog
2
2
  module Identity
3
3
  class OpenStack
4
4
  class V3
5
-
6
5
  class Real
7
6
  def auth_domains(options={})
8
- params = Hash.new
9
- params['page'] = options.fetch(:page, 1)
10
- params['per_page'] = options.fetch(:per_page, 30)
11
-
12
7
  request(
13
8
  :expects => [200],
14
9
  :method => 'GET',
15
10
  :path => "auth/domains",
16
- :query => params
11
+ :query => options
17
12
  )
18
13
  end
19
14
  end
@@ -26,4 +21,4 @@ module Fog
26
21
  end
27
22
  end
28
23
  end
29
- end
24
+ end
@@ -3,18 +3,13 @@ module Fog
3
3
  class OpenStack
4
4
  class V3
5
5
  class Real
6
- def auth_projects(options={})
7
- params = Hash.new
8
- params['page'] = options.fetch(:page, 1)
9
- params['per_page'] = options.fetch(:per_page, 30)
10
-
6
+ def auth_projects(options = {})
11
7
  request(
12
- :expects => [200],
13
- :method => 'GET',
14
- :path => "auth/projects",
15
- :query => params
8
+ :expects => [200],
9
+ :method => 'GET',
10
+ :path => "auth/projects",
11
+ :query => options
16
12
  )
17
-
18
13
  end
19
14
  end
20
15
 
@@ -26,4 +21,4 @@ module Fog
26
21
  end
27
22
  end
28
23
  end
29
- end
24
+ end
@@ -3,29 +3,22 @@ module Fog
3
3
  class OpenStack
4
4
  class V3
5
5
  class Real
6
- def list_domains(options={})
7
- params = Hash.new
8
- params['name'] = options[:name] if options[:name]
9
- params['enabled'] = options[:enabled] if options[:enabled]
10
-
11
- params['page'] = options.fetch(:page, 1)
12
- params['per_page'] = options.fetch(:per_page, 30)
13
-
6
+ def list_domains(options = {})
14
7
  request(
15
- :expects => [200],
16
- :method => 'GET',
17
- :path => "domains",
18
- :query => params
8
+ :expects => [200],
9
+ :method => 'GET',
10
+ :path => "domains",
11
+ :query => options
19
12
  )
20
13
  end
21
14
  end
22
15
 
23
16
  class Mock
24
- def list_domains
17
+ def list_domains(options = {})
25
18
 
26
19
  end
27
20
  end
28
21
  end
29
22
  end
30
23
  end
31
- end
24
+ end
@@ -3,29 +3,22 @@ module Fog
3
3
  class OpenStack
4
4
  class V3
5
5
  class Real
6
- def list_endpoints(options={})
7
- params = Hash.new
8
- params['service_id'] = options[:service_id] if options[:service_id]
9
- params['interface'] = options[:interface] if options[:interface]
10
-
11
- params['page'] = options.fetch(:page, 1)
12
- params['per_page'] = options.fetch(:per_page, 30)
13
-
6
+ def list_endpoints(options = {})
14
7
  request(
15
- :expects => [200],
16
- :method => 'GET',
17
- :path => "endpoints",
18
- :query => params
8
+ :expects => [200],
9
+ :method => 'GET',
10
+ :path => "endpoints",
11
+ :query => options
19
12
  )
20
13
  end
21
14
  end
22
15
 
23
16
  class Mock
24
- def list_endpoints
17
+ def list_endpoints(options={})
25
18
 
26
19
  end
27
20
  end
28
21
  end
29
22
  end
30
23
  end
31
- end
24
+ end
@@ -4,19 +4,11 @@ module Fog
4
4
  class V3
5
5
  class Real
6
6
  def list_group_users(id, options={})
7
- params = Hash.new
8
- params['name'] = options[:name] if options[:name]
9
- params['domain_id'] = options[:domain_id] if options[:domain_id]
10
- params['description'] = options[:description] if options[:description]
11
-
12
- params['page'] = options.fetch(:page, 1)
13
- params['per_page'] = options.fetch(:per_page, 30)
14
-
15
7
  request(
16
- :expects => [200],
17
- :method => 'GET',
18
- :path => "groups/#{id}/users",
19
- :query => params
8
+ :expects => [200],
9
+ :method => 'GET',
10
+ :path => "groups/#{id}/users",
11
+ :query => options
20
12
  )
21
13
  end
22
14
  end
@@ -29,4 +21,4 @@ module Fog
29
21
  end
30
22
  end
31
23
  end
32
- end
24
+ end
@@ -3,40 +3,30 @@ module Fog
3
3
  class OpenStack
4
4
  class V3
5
5
  class Real
6
- def list_groups(options={})
7
- params = Hash.new
8
- params['user_id'] = options[:user_id] if options[:user_id]
9
- params['domain_id'] = options[:domain_id] if options[:domain_id]
10
- params['name'] = options[:name] if options[:name]
11
- params['enabled'] = options[:enabled] if options[:enabled]
6
+ def list_groups(options = {})
7
+ user_id = options.delete('user_id') || options.delete(:user_id)
12
8
 
13
- params['page'] = options.fetch(:page, 1)
14
- params['per_page'] = options.fetch(:per_page, 30)
15
-
16
- if params['user_id'] then
17
- request(
18
- :expects => [200],
19
- :method => 'GET',
20
- :path => "users/#{params['user_id']}groups",
21
- :query => params
22
- )
9
+ if user_id
10
+ path = "users/#{user_id}groups"
23
11
  else
24
- request(
25
- :expects => [200],
26
- :method => 'GET',
27
- :path => "groups",
28
- :query => params
29
- )
12
+ path = "groups"
30
13
  end
14
+
15
+ request(
16
+ :expects => [200],
17
+ :method => 'GET',
18
+ :path => path,
19
+ :query => options
20
+ )
31
21
  end
32
22
  end
33
23
 
34
24
  class Mock
35
- def list_groups
25
+ def list_groups(options = {})
36
26
 
37
27
  end
38
28
  end
39
29
  end
40
30
  end
41
31
  end
42
- end
32
+ end