fog-openstack 0.1.20 → 0.1.21

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/lib/fog/dns/openstack/v2.rb +137 -1
  4. data/lib/fog/dns/openstack/v2/models/pool.rb +21 -0
  5. data/lib/fog/dns/openstack/v2/models/pools.rb +25 -0
  6. data/lib/fog/dns/openstack/v2/models/zone_transfer_accept.rb +29 -0
  7. data/lib/fog/dns/openstack/v2/models/zone_transfer_accepts.rb +25 -0
  8. data/lib/fog/dns/openstack/v2/models/zone_transfer_request.rb +50 -0
  9. data/lib/fog/dns/openstack/v2/models/zone_transfer_requests.rb +30 -0
  10. data/lib/fog/dns/openstack/v2/requests/create_zone_transfer_accept.rb +32 -0
  11. data/lib/fog/dns/openstack/v2/requests/create_zone_transfer_request.rb +34 -0
  12. data/lib/fog/dns/openstack/v2/requests/delete_zone_transfer_request.rb +26 -0
  13. data/lib/fog/dns/openstack/v2/requests/get_pool.rb +30 -0
  14. data/lib/fog/dns/openstack/v2/requests/get_zone_transfer_accept.rb +28 -0
  15. data/lib/fog/dns/openstack/v2/requests/get_zone_transfer_request.rb +29 -0
  16. data/lib/fog/dns/openstack/v2/requests/list_pools.rb +30 -0
  17. data/lib/fog/dns/openstack/v2/requests/list_zone_transfer_accepts.rb +27 -0
  18. data/lib/fog/dns/openstack/v2/requests/list_zone_transfer_requests.rb +27 -0
  19. data/lib/fog/dns/openstack/v2/requests/update_zone_transfer_request.rb +36 -0
  20. data/lib/fog/identity/openstack/v3/requests/list_user_projects.rb +3 -2
  21. data/lib/fog/key_manager/openstack.rb +48 -0
  22. data/lib/fog/key_manager/openstack/models/acl.rb +23 -0
  23. data/lib/fog/key_manager/openstack/requests/delete_container_acl.rb +24 -0
  24. data/lib/fog/key_manager/openstack/requests/delete_secret_acl.rb +24 -0
  25. data/lib/fog/key_manager/openstack/requests/get_container_acl.rb +31 -0
  26. data/lib/fog/key_manager/openstack/requests/get_secret_acl.rb +31 -0
  27. data/lib/fog/key_manager/openstack/requests/replace_container_acl.rb +27 -0
  28. data/lib/fog/key_manager/openstack/requests/replace_secret_acl.rb +27 -0
  29. data/lib/fog/key_manager/openstack/requests/update_container_acl.rb +26 -0
  30. data/lib/fog/key_manager/openstack/requests/update_secret_acl.rb +26 -0
  31. data/lib/fog/metric/openstack/requests/list_resources.rb +3 -3
  32. data/lib/fog/network/openstack.rb +77 -2
  33. data/lib/fog/network/openstack/models/network_ip_availabilities.rb +24 -0
  34. data/lib/fog/network/openstack/models/network_ip_availability.rb +17 -0
  35. data/lib/fog/network/openstack/requests/create_lbaas_l7policy.rb +50 -0
  36. data/lib/fog/network/openstack/requests/create_lbaas_l7rule.rb +50 -0
  37. data/lib/fog/network/openstack/requests/delete_lbaas_l7policy.rb +28 -0
  38. data/lib/fog/network/openstack/requests/delete_lbaas_l7rule.rb +28 -0
  39. data/lib/fog/network/openstack/requests/get_lbaas_l7policy.rb +28 -0
  40. data/lib/fog/network/openstack/requests/get_lbaas_l7rule.rb +28 -0
  41. data/lib/fog/network/openstack/requests/get_network_ip_availability.rb +28 -0
  42. data/lib/fog/network/openstack/requests/list_lbaas_l7policies.rb +25 -0
  43. data/lib/fog/network/openstack/requests/list_lbaas_l7rules.rb +25 -0
  44. data/lib/fog/network/openstack/requests/list_network_ip_availabilities.rb +28 -0
  45. data/lib/fog/network/openstack/requests/update_lbaas_l7policy.rb +43 -0
  46. data/lib/fog/network/openstack/requests/update_lbaas_l7rule.rb +42 -0
  47. data/lib/fog/network/openstack/requests/update_lbaas_listener.rb +3 -4
  48. data/lib/fog/openstack/version.rb +1 -1
  49. data/lib/fog/shared_file_system/openstack.rb +20 -0
  50. data/lib/fog/shared_file_system/openstack/models/share.rb +4 -0
  51. data/lib/fog/shared_file_system/openstack/models/share_export_location.rb +16 -0
  52. data/lib/fog/shared_file_system/openstack/models/share_export_locations.rb +31 -0
  53. data/lib/fog/shared_file_system/openstack/requests/get_share_export_location.rb +29 -0
  54. data/lib/fog/shared_file_system/openstack/requests/list_share_export_locations.rb +27 -0
  55. data/lib/fog/shared_file_system/openstack/requests/list_share_networks.rb +1 -1
  56. data/lib/fog/volume/openstack/requests/update_metadata.rb +1 -1
  57. metadata +81 -38
@@ -0,0 +1,27 @@
1
+ module Fog
2
+ module KeyManager
3
+ class OpenStack
4
+ class Real
5
+ def replace_secret_acl(uuid, options)
6
+ request(
7
+ :body => Fog::JSON.encode(options),
8
+ :expects => [200],
9
+ :method => 'PUT',
10
+ :path => "secrets/#{uuid}/acl"
11
+ )
12
+ end
13
+ end
14
+
15
+ class Mock
16
+ def replace_secret_acl(_uuid, _options)
17
+ response = Excon::Response.new
18
+ response.status = 200
19
+ response.body = {
20
+ "acl_ref" => "https://10.0.2.15:9311/v1/secrets/17ca49d9-0804-4ba7-b931-d34cabaa1f04/acl"
21
+ }
22
+ response
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,26 @@
1
+ module Fog
2
+ module KeyManager
3
+ class OpenStack
4
+ class Real
5
+ def update_container_acl(uuid, options)
6
+ request(
7
+ :body => Fog::JSON.encode(options),
8
+ :expects => [200],
9
+ :method => 'PATCH',
10
+ :path => "containers/#{uuid}/acl"
11
+ )
12
+ end
13
+ end
14
+ class Mock
15
+ def update_container_acl(_uuid, _options)
16
+ response = Excon::Response.new
17
+ response.status = 200
18
+ response.body = {
19
+ "acl_ref" => "https://10.0.2.15:9311/v1/containers/4ab86cb0-a736-48df-ae97-b10d3e5bc60a/acl"
20
+ }
21
+ response
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,26 @@
1
+ module Fog
2
+ module KeyManager
3
+ class OpenStack
4
+ class Real
5
+ def update_secret_acl(uuid, options)
6
+ request(
7
+ :body => Fog::JSON.encode(options),
8
+ :expects => [200],
9
+ :method => 'PATCH',
10
+ :path => "secrets/#{uuid}/acl"
11
+ )
12
+ end
13
+ end
14
+ class Mock
15
+ def update_secret_acl(_uuid, _options)
16
+ response = Excon::Response.new
17
+ response.status = 200
18
+ response.body = {
19
+ "acl_ref" => "https://10.0.2.15:9311/v1/secrets/17ca49d9-0804-4ba7-b931-d34cabaa1f04/acl"
20
+ }
21
+ response
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -2,18 +2,18 @@ module Fog
2
2
  module Metric
3
3
  class OpenStack
4
4
  class Real
5
- def list_resources(options = {})
5
+ def list_resources(type = "generic", options = {})
6
6
  request(
7
7
  :expects => 200,
8
8
  :method => 'GET',
9
- :path => 'resource/generic',
9
+ :path => "resource/#{Fog::OpenStack.escape(type)}",
10
10
  :query => options
11
11
  )
12
12
  end
13
13
  end
14
14
 
15
15
  class Mock
16
- def list_resources(_options = {})
16
+ def list_resources(_type = "generic", _options = {})
17
17
  response = Excon::Response.new
18
18
  response.status = 200
19
19
  response.body = [
@@ -56,6 +56,8 @@ module Fog
56
56
  collection :security_groups
57
57
  model :security_group_rule
58
58
  collection :security_group_rules
59
+ model :network_ip_availability
60
+ collection :network_ip_availabilities
59
61
 
60
62
  ## REQUESTS
61
63
  #
@@ -65,6 +67,10 @@ module Fog
65
67
  request :list_extensions
66
68
  request :get_extension
67
69
 
70
+ # IP Availability
71
+ request :get_network_ip_availability
72
+ request :list_network_ip_availabilities
73
+
68
74
  # Network CRUD
69
75
  request :list_networks
70
76
  request :create_network
@@ -184,6 +190,19 @@ module Fog
184
190
  request :get_lbaas_healthmonitor
185
191
  request :update_lbaas_healthmonitor
186
192
 
193
+ # LBaaS V2 L7Policy
194
+ request :list_lbaas_l7policies
195
+ request :create_lbaas_l7policy
196
+ request :delete_lbaas_l7policy
197
+ request :get_lbaas_l7policy
198
+ request :update_lbaas_l7policy
199
+
200
+ # LBaaS V2 L7Rule
201
+ request :list_lbaas_l7rules
202
+ request :create_lbaas_l7rule
203
+ request :delete_lbaas_l7rule
204
+ request :get_lbaas_l7rule
205
+ request :update_lbaas_l7rule
187
206
 
188
207
  # VPNaaS VPN Service CRUD
189
208
  request :list_vpn_services
@@ -317,6 +336,8 @@ module Fog
317
336
  :lbaas_pools => {},
318
337
  :lbaas_pool_members => {},
319
338
  :lbaas_health_monitorss => {},
339
+ :lbaas_l7policies => {},
340
+ :lbaas_l7rules => {},
320
341
  :vpn_services => {},
321
342
  :ike_policies => {},
322
343
  :ipsec_policies => {},
@@ -339,8 +360,62 @@ module Fog
339
360
  "port" => 30
340
361
  }
341
362
  ],
342
- :security_groups => {},
343
- :security_group_rules => {},
363
+ :security_groups => {},
364
+ :security_group_rules => {},
365
+ :network_ip_availabilities => [
366
+ {
367
+ "network_id" => "4cf895c9-c3d1-489e-b02e-59b5c8976809",
368
+ "network_name" => "public",
369
+ "subnet_ip_availability" => [
370
+ {
371
+ "cidr" => "2001:db8::/64",
372
+ "ip_version" => 6,
373
+ "subnet_id" => "ca3f46c4-c6ff-4272-9be4-0466f84c6077",
374
+ "subnet_name" => "ipv6-public-subnet",
375
+ "total_ips" => 18446744073709552000,
376
+ "used_ips" => 1
377
+ },
378
+ {
379
+ "cidr" => "172.24.4.0/24",
380
+ "ip_version" => 4,
381
+ "subnet_id" => "cc02efc1-9d47-46bd-bab6-760919c836b5",
382
+ "subnet_name" => "public-subnet",
383
+ "total_ips" => 253,
384
+ "used_ips" => 1
385
+ }
386
+ ],
387
+ "project_id" => "1a02cc95f1734fcc9d3c753818f03002",
388
+ "tenant_id" => "1a02cc95f1734fcc9d3c753818f03002",
389
+ "total_ips" => 253,
390
+ "used_ips" => 2
391
+ },
392
+ {
393
+ "network_id" => "6801d9c8-20e6-4b27-945d-62499f00002e",
394
+ "network_name" => "private",
395
+ "subnet_ip_availability" => [
396
+ {
397
+ "cidr" => "10.0.0.0/24",
398
+ "ip_version" => 4,
399
+ "subnet_id" => "44e70d00-80a2-4fb1-ab59-6190595ceb61",
400
+ "subnet_name" => "private-subnet",
401
+ "total_ips" => 253,
402
+ "used_ips" => 2
403
+ },
404
+ {
405
+ "ip_version" => 6,
406
+ "cidr" => "fdbf:ac66:9be8::/64",
407
+ "subnet_id" => "a90623df-00e1-4902-a675-40674385d74c",
408
+ "subnet_name" => "ipv6-private-subnet",
409
+ "total_ips" => 18446744073709552000,
410
+ "used_ips" => 2
411
+ }
412
+ ],
413
+ "project_id" => "d56d3b8dd6894a508cf41b96b522328c",
414
+ "tenant_id" => "d56d3b8dd6894a508cf41b96b522328c",
415
+ "total_ips" => 18446744073709552000,
416
+ "used_ips" => 4
417
+ }
418
+ ]
344
419
  }
345
420
  end
346
421
  end
@@ -0,0 +1,24 @@
1
+ require 'fog/openstack/models/collection'
2
+ require 'fog/network/openstack/models/network_ip_availability'
3
+
4
+ module Fog
5
+ module Network
6
+ class OpenStack
7
+ class NetworkIpAvailabilities < Fog::OpenStack::Collection
8
+ model Fog::Network::OpenStack::NetworkIpAvailability
9
+
10
+ def all
11
+ load_response(service.list_network_ip_availabilities, 'network_ip_availabilities')
12
+ end
13
+
14
+ def get(network_id)
15
+ if network_ip_availability = service.get_network_ip_availability(network_id).body['network_ip_availability']
16
+ new(network_ip_availability)
17
+ end
18
+ rescue Fog::Network::OpenStack::NotFound
19
+ nil
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,17 @@
1
+ require 'fog/openstack/models/model'
2
+
3
+ module Fog
4
+ module Network
5
+ class OpenStack
6
+ class NetworkIpAvailability < Fog::OpenStack::Model
7
+ attribute :used_ips
8
+ attribute :subnet_ip_availability
9
+ attribute :network_id
10
+ attribute :project_id
11
+ attribute :tenant_id
12
+ attribute :total_ips
13
+ attribute :network_name
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,50 @@
1
+ module Fog
2
+ module Network
3
+ class OpenStack
4
+ class Real
5
+ def create_lbaas_l7policy(listener_id, action, options = {})
6
+ data = {
7
+ 'l7policy' => {
8
+ 'listener_id' => listener_id,
9
+ 'action' => action
10
+ }
11
+ }
12
+
13
+ vanilla_options = [:tenant_id, :name, :description, :redirect_pool_id, :redirect_url, :position]
14
+ vanilla_options.reject { |o| options[o].nil? }.each do |key|
15
+ data['l7policy'][key] = options[key]
16
+ end
17
+
18
+ request(
19
+ :body => Fog::JSON.encode(data),
20
+ :expects => [201],
21
+ :method => 'POST',
22
+ :path => 'lbaas/l7policies'
23
+ )
24
+ end
25
+ end
26
+
27
+ class Mock
28
+ def create_lbaas_l7policy(listener_id, action, options = {})
29
+ response = Excon::Response.new
30
+ response.status = 201
31
+ data = {
32
+ 'id' => Fog::Mock.random_numbers(6).to_s,
33
+ 'listener_id' => listener_id,
34
+ 'action' => action,
35
+ 'position' => options[:position],
36
+ 'tenant_id' => options[:tenant_id],
37
+ 'name' => options[:name],
38
+ 'description' => options[:description],
39
+ 'redirect_pool_id' => options[:redirect_pool_id],
40
+ 'redirect_url' => options[:redirect_url]
41
+ }
42
+
43
+ self.data[:lbaas_l7policies][data['id']] = data
44
+ response.body = {'l7policy' => data}
45
+ response
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,50 @@
1
+ module Fog
2
+ module Network
3
+ class OpenStack
4
+ class Real
5
+ def create_lbaas_l7rule(l7policy_id, type, compare_type, value, options = {})
6
+ data = {
7
+ 'rule' => {
8
+ 'type' => type,
9
+ 'compare_type' => compare_type,
10
+ 'value' => value
11
+ }
12
+ }
13
+
14
+ vanilla_options = [:tenant_id, :key, :invert]
15
+ vanilla_options.reject { |o| options[o].nil? }.each do |key|
16
+ data['rule'][key] = options[key]
17
+ end
18
+
19
+ request(
20
+ :body => Fog::JSON.encode(data),
21
+ :expects => [201],
22
+ :method => 'POST',
23
+ :path => "lbaas/l7policies/#{l7policy_id}/rules"
24
+ )
25
+ end
26
+ end
27
+
28
+ class Mock
29
+ def create_lbaas_l7rule(l7policy_id, type, compare_type, value, options = {})
30
+ response = Excon::Response.new
31
+ response.status = 201
32
+ data = {
33
+ 'id' => Fog::Mock.random_numbers(6).to_s,
34
+ 'type' => type,
35
+ 'compare_type' => compare_type,
36
+ 'value' => value,
37
+ 'tenant_id' => options[:tenant_id],
38
+ 'key' => options[:key],
39
+ 'invert' => options[:invert],
40
+ 'l7policy_id' => l7policy_id
41
+ }
42
+
43
+ self.data[:lbaas_l7rules][data['id']] = data
44
+ response.body = {'rule' => data}
45
+ response
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,28 @@
1
+ module Fog
2
+ module Network
3
+ class OpenStack
4
+ class Real
5
+ def delete_lbaas_l7policy(l7policy_id)
6
+ request(
7
+ :expects => 204,
8
+ :method => 'DELETE',
9
+ :path => "lbaas/l7policies/#{l7policy_id}"
10
+ )
11
+ end
12
+ end
13
+
14
+ class Mock
15
+ def delete_lbaas_l7policy(l7policy_id)
16
+ response = Excon::Response.new
17
+ if list_lbaas_l7policies.body['l7policies'].map { |r| r['id'] }.include? l7policy_id
18
+ data[:lbaas_l7policies].delete(l7policy_id)
19
+ response.status = 204
20
+ response
21
+ else
22
+ raise Fog::Network::OpenStack::NotFound
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,28 @@
1
+ module Fog
2
+ module Network
3
+ class OpenStack
4
+ class Real
5
+ def delete_lbaas_l7rule(l7policy_id, l7rule_id)
6
+ request(
7
+ :expects => 204,
8
+ :method => 'DELETE',
9
+ :path => "lbaas/l7policies/#{l7policy_id}/rules/#{l7rule_id}"
10
+ )
11
+ end
12
+ end
13
+
14
+ class Mock
15
+ def delete_lbaas_l7rule(l7policy_id, l7rule_id)
16
+ response = Excon::Response.new
17
+ if list_lbaas_l7rules.body['l7rules'].map { |r| r['id'] }.include? l7rule_id
18
+ data[:lbaas_l7rules].delete(l7rule_id)
19
+ response.status = 204
20
+ response
21
+ else
22
+ raise Fog::Network::OpenStack::NotFound
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,28 @@
1
+ module Fog
2
+ module Network
3
+ class OpenStack
4
+ class Real
5
+ def get_lbaas_l7policy(l7policy_id)
6
+ request(
7
+ :expects => [200],
8
+ :method => 'GET',
9
+ :path => "lbaas/l7policies/#{l7policy_id}"
10
+ )
11
+ end
12
+ end
13
+
14
+ class Mock
15
+ def get_lbaas_l7policy(l7policy_id)
16
+ response = Excon::Response.new
17
+ if data = self.data[:lbaas_l7policies][l7policy_id]
18
+ response.status = 200
19
+ response.body = {'l7policy' => data}
20
+ response
21
+ else
22
+ raise Fog::Network::OpenStack::NotFound
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end