fog-openstack 0.1.17 → 0.1.18

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/examples/container_infra/basics.rb +61 -0
  4. data/examples/identity/basics_v3.rb +83 -0
  5. data/lib/fog/container_infra/openstack.rb +163 -0
  6. data/lib/fog/container_infra/openstack/models/base.rb +19 -0
  7. data/lib/fog/container_infra/openstack/models/bay.rb +56 -0
  8. data/lib/fog/container_infra/openstack/models/bay_model.rb +62 -0
  9. data/lib/fog/container_infra/openstack/models/bay_models.rb +23 -0
  10. data/lib/fog/container_infra/openstack/models/bays.rb +23 -0
  11. data/lib/fog/container_infra/openstack/models/certificate.rb +20 -0
  12. data/lib/fog/container_infra/openstack/models/certificates.rb +25 -0
  13. data/lib/fog/container_infra/openstack/models/cluster.rb +56 -0
  14. data/lib/fog/container_infra/openstack/models/cluster_template.rb +61 -0
  15. data/lib/fog/container_infra/openstack/models/cluster_templates.rb +24 -0
  16. data/lib/fog/container_infra/openstack/models/clusters.rb +24 -0
  17. data/lib/fog/container_infra/openstack/requests/create_bay.rb +27 -0
  18. data/lib/fog/container_infra/openstack/requests/create_bay_model.rb +56 -0
  19. data/lib/fog/container_infra/openstack/requests/create_certificate.rb +29 -0
  20. data/lib/fog/container_infra/openstack/requests/create_cluster.rb +27 -0
  21. data/lib/fog/container_infra/openstack/requests/create_cluster_template.rb +56 -0
  22. data/lib/fog/container_infra/openstack/requests/delete_bay.rb +24 -0
  23. data/lib/fog/container_infra/openstack/requests/delete_bay_model.rb +24 -0
  24. data/lib/fog/container_infra/openstack/requests/delete_cluster.rb +24 -0
  25. data/lib/fog/container_infra/openstack/requests/delete_cluster_template.rb +24 -0
  26. data/lib/fog/container_infra/openstack/requests/get_bay.rb +51 -0
  27. data/lib/fog/container_infra/openstack/requests/get_bay_model.rb +55 -0
  28. data/lib/fog/container_infra/openstack/requests/get_certificate.rb +27 -0
  29. data/lib/fog/container_infra/openstack/requests/get_cluster.rb +41 -0
  30. data/lib/fog/container_infra/openstack/requests/get_cluster_template.rb +55 -0
  31. data/lib/fog/container_infra/openstack/requests/list_bay_models.rb +69 -0
  32. data/lib/fog/container_infra/openstack/requests/list_bays.rb +55 -0
  33. data/lib/fog/container_infra/openstack/requests/list_cluster_templates.rb +59 -0
  34. data/lib/fog/container_infra/openstack/requests/list_clusters.rb +37 -0
  35. data/lib/fog/container_infra/openstack/requests/update_bay.rb +27 -0
  36. data/lib/fog/container_infra/openstack/requests/update_bay_model.rb +56 -0
  37. data/lib/fog/container_infra/openstack/requests/update_cluster.rb +27 -0
  38. data/lib/fog/container_infra/openstack/requests/update_cluster_template.rb +56 -0
  39. data/lib/fog/key_manager/openstack.rb +103 -0
  40. data/lib/fog/key_manager/openstack/models/container.rb +44 -0
  41. data/lib/fog/key_manager/openstack/models/containers.rb +25 -0
  42. data/lib/fog/key_manager/openstack/models/secret.rb +53 -0
  43. data/lib/fog/key_manager/openstack/models/secrets.rb +25 -0
  44. data/lib/fog/key_manager/openstack/requests/create_container.rb +19 -0
  45. data/lib/fog/key_manager/openstack/requests/create_secret.rb +19 -0
  46. data/lib/fog/key_manager/openstack/requests/delete_container.rb +18 -0
  47. data/lib/fog/key_manager/openstack/requests/delete_secret.rb +18 -0
  48. data/lib/fog/key_manager/openstack/requests/get_container.rb +18 -0
  49. data/lib/fog/key_manager/openstack/requests/get_secret.rb +18 -0
  50. data/lib/fog/key_manager/openstack/requests/get_secret_metadata.rb +18 -0
  51. data/lib/fog/key_manager/openstack/requests/get_secret_payload.rb +21 -0
  52. data/lib/fog/key_manager/openstack/requests/list_containers.rb +19 -0
  53. data/lib/fog/key_manager/openstack/requests/list_secrets.rb +19 -0
  54. data/lib/fog/network/openstack.rb +50 -1
  55. data/lib/fog/network/openstack/requests/create_lbaas_healthmonitor.rb +57 -0
  56. data/lib/fog/network/openstack/requests/create_lbaas_listener.rb +55 -0
  57. data/lib/fog/network/openstack/requests/create_lbaas_loadbalancer.rb +52 -0
  58. data/lib/fog/network/openstack/requests/create_lbaas_pool.rb +53 -0
  59. data/lib/fog/network/openstack/requests/create_lbaas_pool_member.rb +49 -0
  60. data/lib/fog/network/openstack/requests/delete_lbaas_healthmonitor.rb +28 -0
  61. data/lib/fog/network/openstack/requests/delete_lbaas_listener.rb +28 -0
  62. data/lib/fog/network/openstack/requests/delete_lbaas_loadbalancer.rb +28 -0
  63. data/lib/fog/network/openstack/requests/delete_lbaas_pool.rb +28 -0
  64. data/lib/fog/network/openstack/requests/delete_lbaas_pool_member.rb +28 -0
  65. data/lib/fog/network/openstack/requests/get_lbaas_healthmonitor.rb +28 -0
  66. data/lib/fog/network/openstack/requests/get_lbaas_listener.rb +28 -0
  67. data/lib/fog/network/openstack/requests/get_lbaas_loadbalancer.rb +28 -0
  68. data/lib/fog/network/openstack/requests/get_lbaas_pool.rb +28 -0
  69. data/lib/fog/network/openstack/requests/get_lbaas_pool_member.rb +28 -0
  70. data/lib/fog/network/openstack/requests/list_lbaas_healthmonitors.rb +25 -0
  71. data/lib/fog/network/openstack/requests/list_lbaas_listeners.rb +25 -0
  72. data/lib/fog/network/openstack/requests/list_lbaas_loadbalancers.rb +25 -0
  73. data/lib/fog/network/openstack/requests/list_lbaas_pool_members.rb +25 -0
  74. data/lib/fog/network/openstack/requests/list_lbaas_pools.rb +25 -0
  75. data/lib/fog/network/openstack/requests/update_lbaas_healthmonitor.rb +43 -0
  76. data/lib/fog/network/openstack/requests/update_lbaas_listener.rb +45 -0
  77. data/lib/fog/network/openstack/requests/update_lbaas_loadbalancer.rb +41 -0
  78. data/lib/fog/network/openstack/requests/update_lbaas_pool.rb +40 -0
  79. data/lib/fog/network/openstack/requests/update_lbaas_pool_member.rb +39 -0
  80. data/lib/fog/openstack.rb +10 -0
  81. data/lib/fog/openstack/version.rb +7 -1
  82. metadata +78 -2
@@ -0,0 +1,53 @@
1
+ module Fog
2
+ module Network
3
+ class OpenStack
4
+ class Real
5
+ def create_lbaas_pool(listener_id, protocol, lb_algorithm, options = {})
6
+ data = {
7
+ 'pool' => {
8
+ 'listener_id' => listener_id,
9
+ 'protocol' => protocol,
10
+ 'lb_algorithm' => lb_algorithm
11
+ }
12
+ }
13
+
14
+ vanilla_options = [:name, :description, :admin_state_up, :session_persistence, :tenant_id]
15
+ vanilla_options.reject { |o| options[o].nil? }.each do |key|
16
+ data['pool'][key] = options[key]
17
+ end
18
+
19
+ request(
20
+ :body => Fog::JSON.encode(data),
21
+ :expects => [201],
22
+ :method => 'POST',
23
+ :path => 'lbaas/pools'
24
+ )
25
+ end
26
+ end
27
+
28
+ class Mock
29
+ def create_lbaas_pool(listener_id, protocol, lb_algorithm, options = {})
30
+ response = Excon::Response.new
31
+ response.status = 201
32
+ data = {
33
+ 'id' => Fog::Mock.random_numbers(6).to_s,
34
+ 'protocol' => protocol,
35
+ 'lb_algorithm' => lb_algorithm,
36
+ 'name' => options[:name],
37
+ 'description' => options[:description],
38
+ 'healthmonitor_id' => Fog::Mock.random_numbers(6).to_s,
39
+ 'members' => [Fog::Mock.random_numbers(6).to_s],
40
+ 'status' => 'ACTIVE',
41
+ 'admin_state_up' => options[:admin_state_up],
42
+ 'tenant_id' => options[:tenant_id],
43
+ 'listeners' => [ 'id' => listener_id ],
44
+ 'session_persistence' => {}
45
+ }
46
+ self.data[:lbaas_pools][data['id']] = data
47
+ response.body = {'pool' => data}
48
+ response
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,49 @@
1
+ module Fog
2
+ module Network
3
+ class OpenStack
4
+ class Real
5
+ def create_lbaas_pool_member(pool_id, address, protocol_port, options = {})
6
+ data = {
7
+ 'member' => {
8
+ 'address' => address,
9
+ 'protocol_port' => protocol_port
10
+ }
11
+ }
12
+
13
+ vanilla_options = [:admin_state_up, :tenant_id, :weight, :subnet_id]
14
+ vanilla_options.reject { |o| options[o].nil? }.each do |key|
15
+ data['member'][key] = options[key]
16
+ end
17
+
18
+ request(
19
+ :body => Fog::JSON.encode(data),
20
+ :expects => [201],
21
+ :method => 'POST',
22
+ :path => "lbaas/pools/#{pool_id}/members"
23
+ )
24
+ end
25
+ end
26
+
27
+ class Mock
28
+ def create_lbaas_pool_member(pool_id, address, protocol_port, options = {})
29
+ response = Excon::Response.new
30
+ response.status = 201
31
+ data = {
32
+ 'id' => Fog::Mock.random_numbers(6).to_s,
33
+ 'pool_id' => pool_id,
34
+ 'address' => address,
35
+ 'protocol_port' => protocol_port,
36
+ 'weight' => options[:weight],
37
+ 'status' => 'ACTIVE',
38
+ 'admin_state_up' => options[:admin_state_up],
39
+ 'tenant_id' => options[:tenant_id],
40
+ 'subnet_id' => ptions[:subnet_id]
41
+ }
42
+ self.data[:lb_members][data['id']] = data
43
+ response.body = {'member' => data}
44
+ response
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,28 @@
1
+ module Fog
2
+ module Network
3
+ class OpenStack
4
+ class Real
5
+ def delete_lbaas_healthmonitor(healthmonitor_id)
6
+ request(
7
+ :expects => 204,
8
+ :method => 'DELETE',
9
+ :path => "lbaas/healthmonitors/#{healthmonitor_id}"
10
+ )
11
+ end
12
+ end
13
+
14
+ class Mock
15
+ def delete_lbaas_healthmonitor(healthmonitor_id)
16
+ response = Excon::Response.new
17
+ if list_lbaas_healthmonitors.body['healthmonitors'].map { |r| r['id'] }.include? healthmonitor_id
18
+ data[:lbaas_healthmonitors].delete(healthmonitor_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_listener(listener_id)
6
+ request(
7
+ :expects => 204,
8
+ :method => 'DELETE',
9
+ :path => "lbaas/listeners/#{listener_id}"
10
+ )
11
+ end
12
+ end
13
+
14
+ class Mock
15
+ def delete_lbaas_listener(listener_id)
16
+ response = Excon::Response.new
17
+ if list_lbaas_listeners.body['listsners'].map { |r| r['id'] }.include? listener_id
18
+ data[:lbaas_listeners].delete(listener_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_loadbalancer(loadbalancer_id)
6
+ request(
7
+ :expects => 204,
8
+ :method => 'DELETE',
9
+ :path => "lbaas/loadbalancers/#{loadbalancer_id}"
10
+ )
11
+ end
12
+ end
13
+
14
+ class Mock
15
+ def delete_lbaas_loadbalancer(loadbalancer_id)
16
+ response = Excon::Response.new
17
+ if list_lbaas_loadbalancers.body['loadbalancers'].map { |r| r['id'] }.include? loadbalancer_id
18
+ data[:lbaas_loadbalancers].delete(loadbalancer_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_pool(pool_id)
6
+ request(
7
+ :expects => 204,
8
+ :method => 'DELETE',
9
+ :path => "lbaas/pools/#{pool_id}"
10
+ )
11
+ end
12
+ end
13
+
14
+ class Mock
15
+ def delete_lbaas_pool(pool_id)
16
+ response = Excon::Response.new
17
+ if list_lb_pools.body['pools'].map { |r| r['id'] }.include? pool_id
18
+ data[:lb_pools].delete(pool_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_pool_member(pool_id, member_id)
6
+ request(
7
+ :expects => 204,
8
+ :method => 'DELETE',
9
+ :path => "lbaas/pools/#{pool_id}/members/#{member_id}"
10
+ )
11
+ end
12
+ end
13
+
14
+ class Mock
15
+ def delete_lbaas_pool_member(pool_id, member_id)
16
+ response = Excon::Response.new
17
+ if list_lbaas_pool_members(pool_id).body['members'].map { |r| r['id'] }.include? member_id
18
+ data[:members].delete(member_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_healthmonitor(healthmonitor_id)
6
+ request(
7
+ :expects => [200],
8
+ :method => 'GET',
9
+ :path => "lbaas/healthmonitors/#{healthmonitor_id}"
10
+ )
11
+ end
12
+ end
13
+
14
+ class Mock
15
+ def get_lbaas_healthmonitor(healthmonitor_id)
16
+ response = Excon::Response.new
17
+ if data = self.data[:lbaas_healthmonitors][healthmonitor_id]
18
+ response.status = 200
19
+ response.body = {'healthmonitor' => data}
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_listener(listener_id)
6
+ request(
7
+ :expects => [200],
8
+ :method => 'GET',
9
+ :path => "lbaas/listeners/#{listener_id}"
10
+ )
11
+ end
12
+ end
13
+
14
+ class Mock
15
+ def get_lbaas_listener(listener_id)
16
+ response = Excon::Response.new
17
+ if data = self.data[:lbaas_listeners][listener_id]
18
+ response.status = 200
19
+ response.body = {'listener' => data}
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_loadbalancer(loadbalancer_id)
6
+ request(
7
+ :expects => [200],
8
+ :method => 'GET',
9
+ :path => "lbaas/loadbalancers/#{loadbalancer_id}"
10
+ )
11
+ end
12
+ end
13
+
14
+ class Mock
15
+ def get_lbaas_loadbalancer(loadbalancer_id)
16
+ response = Excon::Response.new
17
+ if data = self.data[:lbaas_loadbalancer][loadbalancer_id]
18
+ response.status = 200
19
+ response.body = {'loadbalancer' => data[:lbaas_loadbalancer]}
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_pool(pool_id)
6
+ request(
7
+ :expects => [200],
8
+ :method => 'GET',
9
+ :path => "lbaas/pools/#{pool_id}"
10
+ )
11
+ end
12
+ end
13
+
14
+ class Mock
15
+ def get_lbaas_pool(pool_id)
16
+ response = Excon::Response.new
17
+ if data = self.data[:lbaas_pools][pool_id]
18
+ response.status = 200
19
+ response.body = {'pool' => data}
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_pool_member(pool_id, member_id)
6
+ request(
7
+ :expects => [200],
8
+ :method => 'GET',
9
+ :path => "lbaas/pools/#{pool_id}/members/#{member_id}"
10
+ )
11
+ end
12
+ end
13
+
14
+ class Mock
15
+ def get_lbaas_pool_member(pool_id, member_id)
16
+ response = Excon::Response.new
17
+ if data = self.data[:lbaas_pool_members][member_id]
18
+ response.status = 200
19
+ response.body = {'member' => data}
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,25 @@
1
+ module Fog
2
+ module Network
3
+ class OpenStack
4
+ class Real
5
+ def list_lbaas_healthmonitors(filters = {})
6
+ request(
7
+ :expects => 200,
8
+ :method => 'GET',
9
+ :path => 'lbaas/healthmonitors',
10
+ :query => filters
11
+ )
12
+ end
13
+ end
14
+
15
+ class Mock
16
+ def list_lbaas_healthmonitors(_filters = {})
17
+ Excon::Response.new(
18
+ :body => {'healthmonitors' => data[:lbaas_healthmonitors].values},
19
+ :status => 200
20
+ )
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,25 @@
1
+ module Fog
2
+ module Network
3
+ class OpenStack
4
+ class Real
5
+ def list_lbaas_listeners(filters = {})
6
+ request(
7
+ :expects => 200,
8
+ :method => 'GET',
9
+ :path => 'lbaas/listeners',
10
+ :query => filters
11
+ )
12
+ end
13
+ end
14
+
15
+ class Mock
16
+ def list_lbaas_listeners(_filters = {})
17
+ Excon::Response.new(
18
+ :body => {'listeners' => data[:lbaas_listeners].values},
19
+ :status => 200
20
+ )
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end