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,25 @@
1
+ require 'fog/openstack/models/collection'
2
+ require 'fog/key_manager/openstack/models/secret'
3
+
4
+ module Fog
5
+ module KeyManager
6
+ class OpenStack
7
+ class Secrets < Fog::OpenStack::Collection
8
+ model Fog::KeyManager::OpenStack::Secret
9
+
10
+ def all(options = {})
11
+ load_response(service.list_secrets(options), 'secrets')
12
+ end
13
+
14
+ def get(secret_ref)
15
+ if secret = service.get_secret(secret_ref).body
16
+ new(secret)
17
+ end
18
+ rescue Fog::Compute::OpenStack::NotFound
19
+ nil
20
+ end
21
+
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,19 @@
1
+ module Fog
2
+ module KeyManager
3
+ class OpenStack
4
+ class Real
5
+ def create_container(options)
6
+ request(
7
+ :body => Fog::JSON.encode(options),
8
+ :expects => [201],
9
+ :method => 'POST',
10
+ :path => 'containers'
11
+ )
12
+ end
13
+ end
14
+
15
+ class Mock
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,19 @@
1
+ module Fog
2
+ module KeyManager
3
+ class OpenStack
4
+ class Real
5
+ def create_secret(options)
6
+ request(
7
+ :body => Fog::JSON.encode(options),
8
+ :expects => [201],
9
+ :method => 'POST',
10
+ :path => 'secrets'
11
+ )
12
+ end
13
+ end
14
+
15
+ class Mock
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,18 @@
1
+ module Fog
2
+ module KeyManager
3
+ class OpenStack
4
+ class Real
5
+ def delete_container(id)
6
+ request(
7
+ :expects => [204],
8
+ :method => 'DELETE',
9
+ :path => "containers/#{id}"
10
+ )
11
+ end
12
+ end
13
+
14
+ class Mock
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,18 @@
1
+ module Fog
2
+ module KeyManager
3
+ class OpenStack
4
+ class Real
5
+ def delete_secret(id)
6
+ request(
7
+ :expects => [204],
8
+ :method => 'DELETE',
9
+ :path => "secrets/#{id}"
10
+ )
11
+ end
12
+ end
13
+
14
+ class Mock
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,18 @@
1
+ module Fog
2
+ module KeyManager
3
+ class OpenStack
4
+ class Real
5
+ def get_container(uuid)
6
+ request(
7
+ :expects => [200],
8
+ :method => 'GET',
9
+ :path => "containers/#{uuid}",
10
+ )
11
+ end
12
+ end
13
+
14
+ class Mock
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,18 @@
1
+ module Fog
2
+ module KeyManager
3
+ class OpenStack
4
+ class Real
5
+ def get_secret(uuid)
6
+ request(
7
+ :expects => [200],
8
+ :method => 'GET',
9
+ :path => "secrets/#{uuid}",
10
+ )
11
+ end
12
+ end
13
+
14
+ class Mock
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,18 @@
1
+ module Fog
2
+ module KeyManager
3
+ class OpenStack
4
+ class Real
5
+ def get_secret_metadata(uuid)
6
+ request(
7
+ :expects => [200],
8
+ :method => 'GET',
9
+ :path => "secrets/#{uuid}/metadata",
10
+ )
11
+ end
12
+ end
13
+
14
+ class Mock
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,21 @@
1
+ module Fog
2
+ module KeyManager
3
+ class OpenStack
4
+ class Real
5
+ def get_secret_payload(uuid)
6
+ request(
7
+ :expects => [200],
8
+ :method => 'GET',
9
+ :path => "secrets/#{uuid}/payload",
10
+ :headers => {
11
+ 'Accept' => '*/*'
12
+ }
13
+ )
14
+ end
15
+ end
16
+
17
+ class Mock
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,19 @@
1
+ module Fog
2
+ module KeyManager
3
+ class OpenStack
4
+ class Real
5
+ def list_containers(options = {})
6
+ request(
7
+ :expects => [200],
8
+ :method => 'GET',
9
+ :path => 'containers',
10
+ :query => options
11
+ )
12
+ end
13
+ end
14
+
15
+ class Mock
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,19 @@
1
+ module Fog
2
+ module KeyManager
3
+ class OpenStack
4
+ class Real
5
+ def list_secrets(options = {})
6
+ request(
7
+ :expects => [200],
8
+ :method => 'GET',
9
+ :path => 'secrets',
10
+ :query => options
11
+ )
12
+ end
13
+ end
14
+
15
+ class Mock
16
+ end
17
+ end
18
+ end
19
+ end
@@ -101,6 +101,10 @@ module Fog
101
101
  request :add_router_interface
102
102
  request :remove_router_interface
103
103
 
104
+ #
105
+ # LBaaS V1
106
+ #
107
+
104
108
  # LBaaS Pool CRUD
105
109
  request :list_lb_pools
106
110
  request :create_lb_pool
@@ -132,6 +136,46 @@ module Fog
132
136
  request :get_lb_vip
133
137
  request :update_lb_vip
134
138
 
139
+ #
140
+ # LBaaS V2
141
+ #
142
+
143
+ # LBaaS V2 Loadbanacer
144
+ request :list_lbaas_loadbalancers
145
+ request :create_lbaas_loadbalancer
146
+ request :delete_lbaas_loadbalancer
147
+ request :get_lbaas_loadbalancer
148
+ request :update_lbaas_loadbalancer
149
+
150
+ # LBaaS V2 Listener
151
+ request :list_lbaas_listeners
152
+ request :create_lbaas_listener
153
+ request :delete_lbaas_listener
154
+ request :get_lbaas_listener
155
+ request :update_lbaas_listener
156
+
157
+ # LBaaS V2 Pool
158
+ request :list_lbaas_pools
159
+ request :create_lbaas_pool
160
+ request :delete_lbaas_pool
161
+ request :get_lbaas_pool
162
+ request :update_lbaas_pool
163
+
164
+ # LBaaS V2 Pool_Member
165
+ request :list_lbaas_pool_members
166
+ request :create_lbaas_pool_member
167
+ request :delete_lbaas_pool_member
168
+ request :get_lbaas_pool_member
169
+ request :update_lbaas_pool_member
170
+
171
+ # LBaaS V2 Healthmonitor
172
+ request :list_lbaas_healthmonitors
173
+ request :create_lbaas_healthmonitor
174
+ request :delete_lbaas_healthmonitor
175
+ request :get_lbaas_healthmonitor
176
+ request :update_lbaas_healthmonitor
177
+
178
+
135
179
  # VPNaaS VPN Service CRUD
136
180
  request :list_vpn_services
137
181
  request :create_vpn_service
@@ -209,7 +253,7 @@ module Fog
209
253
  }
210
254
  },
211
255
  :networks => {
212
- network_id => {
256
+ network_id => {
213
257
  'id' => network_id,
214
258
  'name' => 'Public',
215
259
  'subnets' => [subnet_id],
@@ -258,6 +302,11 @@ module Fog
258
302
  :lb_members => {},
259
303
  :lb_health_monitors => {},
260
304
  :lb_vips => {},
305
+ :lbaas_loadbalancers => {},
306
+ :lbaas_listeners => {},
307
+ :lbaas_pools => {},
308
+ :lbaas_pool_members => {},
309
+ :lbaas_health_monitorss => {},
261
310
  :vpn_services => {},
262
311
  :ike_policies => {},
263
312
  :ipsec_policies => {},
@@ -0,0 +1,57 @@
1
+ module Fog
2
+ module Network
3
+ class OpenStack
4
+ class Real
5
+ def create_lbaas_healthmonitor(pool_id, type, delay, timeout, max_retries, options = {})
6
+ data = {
7
+ 'healthmonitor' => {
8
+ 'pool_id' => pool_id,
9
+ 'type' => type,
10
+ 'delay' => delay,
11
+ 'timeout' => timeout,
12
+ 'max_retries' => max_retries
13
+ }
14
+ }
15
+
16
+ vanilla_options = [:http_method, :url_path, :expected_codes, :admin_state_up, :tenant_id]
17
+ vanilla_options.reject { |o| options[o].nil? }.each do |key|
18
+ data['healthmonitor'][key] = options[key]
19
+ end
20
+
21
+ request(
22
+ :body => Fog::JSON.encode(data),
23
+ :expects => [201],
24
+ :method => 'POST',
25
+ :path => 'lbaas/healthmonitors'
26
+ )
27
+ end
28
+ end
29
+
30
+ class Mock
31
+ def create_lbaas_healthmonitor(type, delay, timeout, max_retries, options = {})
32
+ response = Excon::Response.new
33
+ response.status = 201
34
+ data = {
35
+ 'id' => Fog::Mock.random_numbers(6).to_s,
36
+ 'type' => type,
37
+ 'delay' => delay,
38
+ 'timeout' => timeout,
39
+ 'max_retries' => max_retries,
40
+ 'http_method' => options[:http_method],
41
+ 'url_path' => options[:url_path],
42
+ 'expected_codes' => options[:expected_codes],
43
+ 'status' => 'ACTIVE',
44
+ 'admin_state_up' => options[:admin_state_up],
45
+ 'tenant_id' => options[:tenant_id],
46
+ 'name' => options[:name],
47
+ 'pools' => [{ 'id'=> Fog::Mock.random_numbers(6).to_s}]
48
+ }
49
+
50
+ self.data[:lbaas_healthmonitors][data['id']] = data
51
+ response.body = {'healthmonitor' => data}
52
+ response
53
+ end
54
+ end
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,55 @@
1
+ module Fog
2
+ module Network
3
+ class OpenStack
4
+ class Real
5
+ def create_lbaas_listener(loadbalancer_id, protocol, protocol_port, options = {})
6
+ data = {
7
+ 'listener' => {
8
+ 'loadbalancer_id' => loadbalancer_id,
9
+ 'protocol' => protocol,
10
+ 'protocol_port' => protocol_port
11
+ }
12
+ }
13
+
14
+ vanilla_options = [:name, :description, :default_pool_id, :connection_limit, :default_tls_container_ref, :sni_container_refs,
15
+ :admin_state_up, :tenant_id]
16
+ vanilla_options.reject { |o| options[o].nil? }.each do |key|
17
+ data['listener'][key] = options[key]
18
+ end
19
+
20
+ request(
21
+ :body => Fog::JSON.encode(data),
22
+ :expects => [201],
23
+ :method => 'POST',
24
+ :path => 'lbaas/listeners'
25
+ )
26
+ end
27
+ end
28
+
29
+ class Mock
30
+ def create_lbaas_listener(loadbalancer_id, protocol, protocol_port, options = {})
31
+ response = Excon::Response.new
32
+ response.status = 201
33
+ data = {
34
+ 'id' => Fog::Mock.random_numbers(6).to_s,
35
+ 'loadbalancers' => [{'id' => loadbalancer_id }],
36
+ 'protocol' => protocol,
37
+ 'protocol_port' => protocol_port,
38
+ 'name' => options[:name],
39
+ 'description' => options[:description],
40
+ 'default_pool_id' => options[:default_pool_id],
41
+ 'connection_limit' => options[:connection_limit],
42
+ 'default_tls_container_ref' => options[:default_tls_container_ref],
43
+ 'sni_container_refs' => options[:sni_container_refs],
44
+ 'admin_state_up' => options[:admin_state_up],
45
+ 'tenant_id' => options[:tenant_id]
46
+ }
47
+
48
+ self.data[:lbaas_listener][data['id']] = data
49
+ response.body = {'listener' => data}
50
+ response
51
+ end
52
+ end
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,52 @@
1
+ module Fog
2
+ module Network
3
+ class OpenStack
4
+ class Real
5
+ def create_lbaas_loadbalancer(vip_subnet_id, options = {})
6
+ data = {
7
+ 'loadbalancer' => {
8
+ 'vip_subnet_id' => vip_subnet_id
9
+ }
10
+ }
11
+ vanilla_options = [:name, :description, :vip_address, :provider, :flavor, :admin_state_up, :tenant_id]
12
+ vanilla_options.reject { |o| options[o].nil? }.each do |key|
13
+ data['loadbalancer'][key] = options[key]
14
+ end
15
+
16
+ request(
17
+ :body => Fog::JSON.encode(data),
18
+ :expects => [201],
19
+ :method => 'POST',
20
+ :path => 'lbaas/loadbalancers'
21
+ )
22
+ end
23
+ end
24
+
25
+ class Mock
26
+ def create_lbaas_loadbalancer(vip_subnet_id, options = {})
27
+ response = Excon::Response.new
28
+ response.status = 201
29
+ data = {
30
+ 'id' => Fog::Mock.random_numbers(6).to_s,
31
+ 'subnet_id' => vip_subnet_id,
32
+ 'name' => options[:name],
33
+ 'description' => options[:description],
34
+ 'vip_address' => options[:vip_address],
35
+ 'vip_port_id'=> Fog::Mock.random_numbers(6).to_s,
36
+ 'vip_subnet_id'=> vip_subnet_id,
37
+ 'flavor' => options[:flavor],
38
+ 'admin_state_up' => options[:admin_state_up],
39
+ 'tenant_id' => options[:tenant_id],
40
+ 'listeners'=> [{ 'id'=> Fog::Mock.random_numbers(6).to_s}],
41
+ 'operating_status'=> 'ONLINE',
42
+ 'provider'=> 'lbprovider',
43
+ 'provisioning_status'=> 'ACTIVE'
44
+ }
45
+ self.data[:lbaas_loadbalancer][data['id']] = data
46
+ response.body = {'loadbalancer' => data}
47
+ response
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end