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,30 @@
1
+ module Fog
2
+ module DNS
3
+ class OpenStack
4
+ class V2
5
+ class Real
6
+ def get_pool(id, options = {})
7
+ headers, _options = Fog::DNS::OpenStack::V2.setup_headers(options)
8
+ request(
9
+ :expects => 200,
10
+ :method => 'GET',
11
+ :path => "pools/#{id}",
12
+ :headers => headers
13
+ )
14
+ end
15
+ end
16
+
17
+ class Mock
18
+ def get_pool(id, _options = {})
19
+ response = Excon::Response.new
20
+ response.status = 200
21
+ pool = data[:pool_updated] || data[:pools]['pools'].first
22
+ pool['id'] = id
23
+ response.body = pool
24
+ response
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,28 @@
1
+ module Fog
2
+ module DNS
3
+ class OpenStack
4
+ class V2
5
+ class Real
6
+ def get_zone_transfer_accept(zone_transfer_accept_id)
7
+ request(
8
+ :expects => 200,
9
+ :method => 'GET',
10
+ :path => "zones/tasks/transfer_requests/#{zone_transfer_accept_id}"
11
+ )
12
+ end
13
+ end
14
+
15
+ class Mock
16
+ def get_zone_transfer_accept(zone_transfer_accept_id)
17
+ response = Excon::Response.new
18
+ response.status = 200
19
+ accept = data[:zone_transfer_accepts]["transfer_accepts"].first
20
+ accept["id"] = zone_transfer_accept_id
21
+ response.body = accept
22
+ response
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,29 @@
1
+
2
+ module Fog
3
+ module DNS
4
+ class OpenStack
5
+ class V2
6
+ class Real
7
+ def get_zone_transfer_request(zone_transfer_request_id)
8
+ request(
9
+ :expects => 200,
10
+ :method => 'GET',
11
+ :path => "zones/tasks/transfer_requests/#{zone_transfer_request_id}"
12
+ )
13
+ end
14
+ end
15
+
16
+ class Mock
17
+ def get_zone_transfer_request(zone_transfer_request_id)
18
+ response = Excon::Response.new
19
+ response.status = 200
20
+ request = data[:zone_transfer_requests]["transfer_requests"].first
21
+ request["id"] = zone_transfer_request_id
22
+ response.body = request
23
+ response
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,30 @@
1
+ module Fog
2
+ module DNS
3
+ class OpenStack
4
+ class V2
5
+ class Real
6
+ def list_pools(options = {})
7
+ headers, options = Fog::DNS::OpenStack::V2.setup_headers(options)
8
+
9
+ request(
10
+ :expects => 200,
11
+ :method => 'GET',
12
+ :path => 'pools',
13
+ :query => options,
14
+ :headers => headers
15
+ )
16
+ end
17
+ end
18
+
19
+ class Mock
20
+ def list_pools(_options = {})
21
+ response = Excon::Response.new
22
+ response.status = 200
23
+ response.body = data[:pools]
24
+ response
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,27 @@
1
+ module Fog
2
+ module DNS
3
+ class OpenStack
4
+ class V2
5
+ class Real
6
+ def list_zone_transfer_accepts(options={})
7
+ request(
8
+ :expects => 200,
9
+ :method => 'GET',
10
+ :path => "zones/tasks/transfer_accepts",
11
+ :query => options
12
+ )
13
+ end
14
+ end
15
+
16
+ class Mock
17
+ def list_zone_transfer_accepts(options={})
18
+ response = Excon::Response.new
19
+ response.status = 200
20
+ response.body = data[:zone_transfer_accepts]["transfer_accepts"]
21
+ response
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,27 @@
1
+ module Fog
2
+ module DNS
3
+ class OpenStack
4
+ class V2
5
+ class Real
6
+ def list_zone_transfer_requests(options={})
7
+ request(
8
+ :expects => 200,
9
+ :method => 'GET',
10
+ :path => "zones/tasks/transfer_requests",
11
+ :query => options
12
+ )
13
+ end
14
+ end
15
+
16
+ class Mock
17
+ def list_zone_transfer_requests(options={})
18
+ response = Excon::Response.new
19
+ response.status = 200
20
+ response.body = data[:zone_transfer_requests]["transfer_requests"]
21
+ response
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,36 @@
1
+ module Fog
2
+ module DNS
3
+ class OpenStack
4
+ class V2
5
+ class Real
6
+ def update_zone_transfer_request(zone_transfer_request_id,description,options={})
7
+ vanilla_options = [:target_project_id]
8
+ data = vanilla_options.inject({}) do |result,option|
9
+ result[option] = options[option] if options[option]
10
+ result
11
+ end
12
+
13
+ request(
14
+ :expects => 200,
15
+ :method => 'PATCH',
16
+ :path => "zones/tasks/transfer_requests/#{zone_transfer_request_id}",
17
+ :body => Fog::JSON.encode(data)
18
+ )
19
+ end
20
+ end
21
+
22
+ class Mock
23
+ def update_zone_transfer_request(zone_transfer_request_id,description,options={})
24
+ response = Excon::Response.new
25
+ response.status = 200
26
+ request = data[:zone_transfer_requests]["transfer_requests"]
27
+ request.id = zone_transfer_request_id
28
+ request.description =description
29
+ response.body = request
30
+ response
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
@@ -3,11 +3,12 @@ module Fog
3
3
  class OpenStack
4
4
  class V3
5
5
  class Real
6
- def list_user_projects(user_id)
6
+ def list_user_projects(user_id, options = {})
7
7
  request(
8
8
  :expects => [200],
9
9
  :method => 'GET',
10
- :path => "users/#{user_id}/projects"
10
+ :path => "users/#{user_id}/projects",
11
+ :query => options
11
12
  )
12
13
  end
13
14
  end
@@ -23,6 +23,7 @@ module Fog
23
23
  collection :secrets
24
24
  model :container
25
25
  collection :containers
26
+ model :acl
26
27
 
27
28
  ## REQUESTS
28
29
 
@@ -41,6 +42,53 @@ module Fog
41
42
  request :list_containers
42
43
  request :delete_container
43
44
 
45
+ #ACL
46
+ request :get_secret_acl
47
+ request :update_secret_acl
48
+ request :replace_secret_acl
49
+ request :delete_secret_acl
50
+
51
+ request :get_container_acl
52
+ request :update_container_acl
53
+ request :replace_container_acl
54
+ request :delete_container_acl
55
+
56
+ class Mock
57
+ def initialize(options = {})
58
+ @openstack_username = options[:openstack_username]
59
+ @openstack_tenant = options[:openstack_tenant]
60
+ @openstack_auth_uri = URI.parse(options[:openstack_auth_url])
61
+
62
+ @auth_token = Fog::Mock.random_base64(64)
63
+ @auth_token_expiration = (Time.now.utc + 86400).iso8601
64
+
65
+ management_url = URI.parse(options[:openstack_auth_url])
66
+ management_url.port = 9311
67
+ management_url.path = '/v1'
68
+ @openstack_management_url = management_url.to_s
69
+
70
+ @data ||= {:users => {}}
71
+ unless @data[:users].detect { |u| u['name'] == options[:openstack_username] }
72
+ id = Fog::Mock.random_numbers(6).to_s
73
+ @data[:users][id] = {
74
+ 'id' => id,
75
+ 'name' => options[:openstack_username],
76
+ 'email' => "#{options[:openstack_username]}@mock.com",
77
+ 'tenantId' => Fog::Mock.random_numbers(6).to_s,
78
+ 'enabled' => true
79
+ }
80
+ end
81
+ end
82
+
83
+ def credentials
84
+ {:provider => 'openstack',
85
+ :openstack_auth_url => @openstack_auth_uri.to_s,
86
+ :openstack_auth_token => @auth_token,
87
+ :openstack_region => @openstack_region,
88
+ :openstack_management_url => @openstack_management_url}
89
+ end
90
+ end
91
+
44
92
  class Real
45
93
  include Fog::OpenStack::Core
46
94
 
@@ -0,0 +1,23 @@
1
+
2
+ require 'fog/openstack/models/model'
3
+
4
+ module Fog
5
+ module KeyManager
6
+ class OpenStack
7
+
8
+ class ACL < Fog::OpenStack::Model
9
+ identity :acl_ref
10
+
11
+ attribute :uuid
12
+ attribute :operation_type
13
+ attribute :users, type: Array
14
+ attribute :project_access
15
+ attribute :secret_type
16
+ attribute :created
17
+ attribute :creator_id
18
+ attribute :updated
19
+
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,24 @@
1
+ module Fog
2
+ module KeyManager
3
+ class OpenStack
4
+ class Real
5
+ def delete_container_acl(uuid)
6
+ request(
7
+ :expects => [200],
8
+ :method => 'DELETE',
9
+ :path => "containers/#{uuid}/acl"
10
+ )
11
+ end
12
+ end
13
+
14
+ class Mock
15
+ def delete_container_acl(_uuid)
16
+ response = Excon::Response.new
17
+ response.status = 200
18
+ response.body = "null"
19
+ response
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,24 @@
1
+ module Fog
2
+ module KeyManager
3
+ class OpenStack
4
+ class Real
5
+ def delete_secret_acl(uuid)
6
+ request(
7
+ :expects => [200],
8
+ :method => 'DELETE',
9
+ :path => "secrets/#{uuid}/acl"
10
+ )
11
+ end
12
+ end
13
+
14
+ class Mock
15
+ def delete_secret_acl(_uuid)
16
+ response = Excon::Response.new
17
+ response.status = 200
18
+ response.body = "null"
19
+ response
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,31 @@
1
+ module Fog
2
+ module KeyManager
3
+ class OpenStack
4
+ class Real
5
+ def get_container_acl(uuid)
6
+ request(
7
+ :expects => [200],
8
+ :method => 'GET',
9
+ :path => "containers/#{uuid}/acl"
10
+ )
11
+ end
12
+ end
13
+
14
+ class Mock
15
+ def get_container_acl(_uuid)
16
+ response = Excon::Response.new
17
+ response.status = 200
18
+ response.body = {
19
+ "read" => {
20
+ "project-access" => true,
21
+ "updated" => "2017-04-25T19:10:52",
22
+ "users" => ["45895d3a393f42b2a8760f5dafa9c6d8"],
23
+ "created" => "2017-04-25T19:10:52"
24
+ }
25
+ }
26
+ response
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,31 @@
1
+ module Fog
2
+ module KeyManager
3
+ class OpenStack
4
+ class Real
5
+ def get_secret_acl(uuid)
6
+ request(
7
+ :expects => [200],
8
+ :method => 'GET',
9
+ :path => "secrets/#{uuid}/acl"
10
+ )
11
+ end
12
+ end
13
+
14
+ class Mock
15
+ def get_secret_acl(_uuid)
16
+ response = Excon::Response.new
17
+ response.status = 200
18
+ response.body = {
19
+ "read" => {
20
+ "project-access" => false,
21
+ "updated" => "2017-04-25T19:10:52",
22
+ "users" => %w(45895d3a393f42b2a8760f5dafa9c6d8 dc2cb4f0d30044e2b0251409c94cc955),
23
+ "created" => "2017-04-25T19:10:52"
24
+ }
25
+ }
26
+ response
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,27 @@
1
+ module Fog
2
+ module KeyManager
3
+ class OpenStack
4
+ class Real
5
+ def replace_container_acl(uuid, options)
6
+ request(
7
+ :body => Fog::JSON.encode(options),
8
+ :expects => [200],
9
+ :method => 'PUT',
10
+ :path => "containers/#{uuid}/acl"
11
+ )
12
+ end
13
+ end
14
+
15
+ class Mock
16
+ def replace_container_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/containers/4ab86cb0-a736-48df-ae97-b10d3e5bc60a/acl"
21
+ }
22
+ response
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end