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.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/examples/container_infra/basics.rb +61 -0
- data/examples/identity/basics_v3.rb +83 -0
- data/lib/fog/container_infra/openstack.rb +163 -0
- data/lib/fog/container_infra/openstack/models/base.rb +19 -0
- data/lib/fog/container_infra/openstack/models/bay.rb +56 -0
- data/lib/fog/container_infra/openstack/models/bay_model.rb +62 -0
- data/lib/fog/container_infra/openstack/models/bay_models.rb +23 -0
- data/lib/fog/container_infra/openstack/models/bays.rb +23 -0
- data/lib/fog/container_infra/openstack/models/certificate.rb +20 -0
- data/lib/fog/container_infra/openstack/models/certificates.rb +25 -0
- data/lib/fog/container_infra/openstack/models/cluster.rb +56 -0
- data/lib/fog/container_infra/openstack/models/cluster_template.rb +61 -0
- data/lib/fog/container_infra/openstack/models/cluster_templates.rb +24 -0
- data/lib/fog/container_infra/openstack/models/clusters.rb +24 -0
- data/lib/fog/container_infra/openstack/requests/create_bay.rb +27 -0
- data/lib/fog/container_infra/openstack/requests/create_bay_model.rb +56 -0
- data/lib/fog/container_infra/openstack/requests/create_certificate.rb +29 -0
- data/lib/fog/container_infra/openstack/requests/create_cluster.rb +27 -0
- data/lib/fog/container_infra/openstack/requests/create_cluster_template.rb +56 -0
- data/lib/fog/container_infra/openstack/requests/delete_bay.rb +24 -0
- data/lib/fog/container_infra/openstack/requests/delete_bay_model.rb +24 -0
- data/lib/fog/container_infra/openstack/requests/delete_cluster.rb +24 -0
- data/lib/fog/container_infra/openstack/requests/delete_cluster_template.rb +24 -0
- data/lib/fog/container_infra/openstack/requests/get_bay.rb +51 -0
- data/lib/fog/container_infra/openstack/requests/get_bay_model.rb +55 -0
- data/lib/fog/container_infra/openstack/requests/get_certificate.rb +27 -0
- data/lib/fog/container_infra/openstack/requests/get_cluster.rb +41 -0
- data/lib/fog/container_infra/openstack/requests/get_cluster_template.rb +55 -0
- data/lib/fog/container_infra/openstack/requests/list_bay_models.rb +69 -0
- data/lib/fog/container_infra/openstack/requests/list_bays.rb +55 -0
- data/lib/fog/container_infra/openstack/requests/list_cluster_templates.rb +59 -0
- data/lib/fog/container_infra/openstack/requests/list_clusters.rb +37 -0
- data/lib/fog/container_infra/openstack/requests/update_bay.rb +27 -0
- data/lib/fog/container_infra/openstack/requests/update_bay_model.rb +56 -0
- data/lib/fog/container_infra/openstack/requests/update_cluster.rb +27 -0
- data/lib/fog/container_infra/openstack/requests/update_cluster_template.rb +56 -0
- data/lib/fog/key_manager/openstack.rb +103 -0
- data/lib/fog/key_manager/openstack/models/container.rb +44 -0
- data/lib/fog/key_manager/openstack/models/containers.rb +25 -0
- data/lib/fog/key_manager/openstack/models/secret.rb +53 -0
- data/lib/fog/key_manager/openstack/models/secrets.rb +25 -0
- data/lib/fog/key_manager/openstack/requests/create_container.rb +19 -0
- data/lib/fog/key_manager/openstack/requests/create_secret.rb +19 -0
- data/lib/fog/key_manager/openstack/requests/delete_container.rb +18 -0
- data/lib/fog/key_manager/openstack/requests/delete_secret.rb +18 -0
- data/lib/fog/key_manager/openstack/requests/get_container.rb +18 -0
- data/lib/fog/key_manager/openstack/requests/get_secret.rb +18 -0
- data/lib/fog/key_manager/openstack/requests/get_secret_metadata.rb +18 -0
- data/lib/fog/key_manager/openstack/requests/get_secret_payload.rb +21 -0
- data/lib/fog/key_manager/openstack/requests/list_containers.rb +19 -0
- data/lib/fog/key_manager/openstack/requests/list_secrets.rb +19 -0
- data/lib/fog/network/openstack.rb +50 -1
- data/lib/fog/network/openstack/requests/create_lbaas_healthmonitor.rb +57 -0
- data/lib/fog/network/openstack/requests/create_lbaas_listener.rb +55 -0
- data/lib/fog/network/openstack/requests/create_lbaas_loadbalancer.rb +52 -0
- data/lib/fog/network/openstack/requests/create_lbaas_pool.rb +53 -0
- data/lib/fog/network/openstack/requests/create_lbaas_pool_member.rb +49 -0
- data/lib/fog/network/openstack/requests/delete_lbaas_healthmonitor.rb +28 -0
- data/lib/fog/network/openstack/requests/delete_lbaas_listener.rb +28 -0
- data/lib/fog/network/openstack/requests/delete_lbaas_loadbalancer.rb +28 -0
- data/lib/fog/network/openstack/requests/delete_lbaas_pool.rb +28 -0
- data/lib/fog/network/openstack/requests/delete_lbaas_pool_member.rb +28 -0
- data/lib/fog/network/openstack/requests/get_lbaas_healthmonitor.rb +28 -0
- data/lib/fog/network/openstack/requests/get_lbaas_listener.rb +28 -0
- data/lib/fog/network/openstack/requests/get_lbaas_loadbalancer.rb +28 -0
- data/lib/fog/network/openstack/requests/get_lbaas_pool.rb +28 -0
- data/lib/fog/network/openstack/requests/get_lbaas_pool_member.rb +28 -0
- data/lib/fog/network/openstack/requests/list_lbaas_healthmonitors.rb +25 -0
- data/lib/fog/network/openstack/requests/list_lbaas_listeners.rb +25 -0
- data/lib/fog/network/openstack/requests/list_lbaas_loadbalancers.rb +25 -0
- data/lib/fog/network/openstack/requests/list_lbaas_pool_members.rb +25 -0
- data/lib/fog/network/openstack/requests/list_lbaas_pools.rb +25 -0
- data/lib/fog/network/openstack/requests/update_lbaas_healthmonitor.rb +43 -0
- data/lib/fog/network/openstack/requests/update_lbaas_listener.rb +45 -0
- data/lib/fog/network/openstack/requests/update_lbaas_loadbalancer.rb +41 -0
- data/lib/fog/network/openstack/requests/update_lbaas_pool.rb +40 -0
- data/lib/fog/network/openstack/requests/update_lbaas_pool_member.rb +39 -0
- data/lib/fog/openstack.rb +10 -0
- data/lib/fog/openstack/version.rb +7 -1
- 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
|