fog-openstack 0.1.17 → 0.1.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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,23 @@
1
+ require 'fog/openstack/models/collection'
2
+ require 'fog/container_infra/openstack/models/bay_model'
3
+
4
+ module Fog
5
+ module ContainerInfra
6
+ class OpenStack
7
+ class BayModels < Fog::OpenStack::Collection
8
+ model Fog::ContainerInfra::OpenStack::BayModel
9
+
10
+ def all
11
+ load_response(service.list_bay_models, 'baymodels')
12
+ end
13
+
14
+ def get(bay_model_uuid_or_name)
15
+ resource = service.get_bay_model(bay_model_uuid_or_name).body
16
+ new(resource)
17
+ rescue Fog::ContainerInfra::OpenStack::NotFound
18
+ nil
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,23 @@
1
+ require 'fog/openstack/models/collection'
2
+ require 'fog/container_infra/openstack/models/bay'
3
+
4
+ module Fog
5
+ module ContainerInfra
6
+ class OpenStack
7
+ class Bays < Fog::OpenStack::Collection
8
+ model Fog::ContainerInfra::OpenStack::Bay
9
+
10
+ def all
11
+ load_response(service.list_bays, "bays")
12
+ end
13
+
14
+ def get(bay_uuid_or_name)
15
+ resource = service.get_bay(bay_uuid_or_name).body
16
+ new(resource)
17
+ rescue Fog::ContainerInfra::OpenStack::NotFound
18
+ nil
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,20 @@
1
+ require_relative 'base'
2
+
3
+ module Fog
4
+ module ContainerInfra
5
+ class OpenStack
6
+ class Certificate < Fog::ContainerInfra::OpenStack::Base
7
+ identity :bay_uuid
8
+
9
+ attribute :pem
10
+ attribute :csr
11
+
12
+ def create
13
+ requires :csr, :bay_uuid
14
+ merge_attributes(service.create_certificate(attributes).body)
15
+ self
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,25 @@
1
+ require 'fog/openstack/models/collection'
2
+ require 'fog/container_infra/openstack/models/certificate'
3
+
4
+ module Fog
5
+ module ContainerInfra
6
+ class OpenStack
7
+ class Certificates < Fog::OpenStack::Collection
8
+
9
+ model Fog::ContainerInfra::OpenStack::Certificate
10
+
11
+ def create(bay_uuid)
12
+ resource = service.create_certificate(bay_uuid).body
13
+ new(resource)
14
+ end
15
+
16
+ def get(bay_uuid)
17
+ resource = service.get_certificate(bay_uuid).body
18
+ new(resource)
19
+ rescue Fog::ContainerInfra::OpenStack::NotFound
20
+ nil
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,56 @@
1
+ require_relative 'base'
2
+
3
+ module Fog
4
+ module ContainerInfra
5
+ class OpenStack
6
+ class Cluster < Fog::ContainerInfra::OpenStack::Base
7
+ identity :uuid
8
+
9
+ attribute :api_address
10
+ attribute :coe_version
11
+ attribute :cluster_template_id
12
+ attribute :create_timeout
13
+ attribute :created_at
14
+ attribute :discovery_url
15
+ attribute :master_addresses
16
+ attribute :master_count
17
+ attribute :name
18
+ attribute :node_addresses
19
+ attribute :node_count
20
+ attribute :stack_id
21
+ attribute :status
22
+ attribute :status_reason
23
+ attribute :updated_at
24
+
25
+ def create
26
+ requires :name, :cluster_template_id
27
+ merge_attributes(service.create_cluster(attributes).body)
28
+ self
29
+ end
30
+
31
+ def update
32
+ requires :uuid, :name, :cluster_template_id
33
+ attrs = attributes.select{|k,_| allowed_update_attributes.include? k}
34
+ attrs = convert_update_params(attrs)
35
+ merge_attributes(service.update_cluster(uuid, attrs).body)
36
+ self
37
+ end
38
+
39
+ def destroy
40
+ requires :uuid
41
+ service.delete_cluster(uuid)
42
+ true
43
+ end
44
+
45
+ private
46
+
47
+ def allowed_update_attributes
48
+ [
49
+ :node_count
50
+ ]
51
+ end
52
+
53
+ end
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,61 @@
1
+ require_relative 'base'
2
+
3
+ module Fog
4
+ module ContainerInfra
5
+ class OpenStack
6
+ class ClusterTemplate < Fog::ContainerInfra::OpenStack::Base
7
+ identity :uuid
8
+
9
+ attribute :apiserver_port
10
+ attribute :cluster_distro
11
+ attribute :coe
12
+ attribute :created_at
13
+ attribute :dns_nameserver
14
+ attribute :docker_storage_driver
15
+ attribute :docker_volume_size
16
+ attribute :external_network_id
17
+ attribute :fixed_network
18
+ attribute :fixed_subnet
19
+ attribute :flavor_id
20
+ attribute :floating_ip_enabled
21
+ attribute :http_proxy
22
+ attribute :image_id
23
+ attribute :insecure_registry
24
+ attribute :keypair_id
25
+ attribute :labels
26
+ attribute :master_flavor_id
27
+ attribute :master_lb_enabled
28
+ attribute :name
29
+ attribute :network_driver
30
+ attribute :no_proxy
31
+ attribute :public
32
+ attribute :registry_enabled
33
+ attribute :server_type
34
+ attribute :tls_disabled
35
+ attribute :updated_at
36
+ attribute :volume_driver
37
+
38
+ def create
39
+ requires :name, :keypair_id, :flavor_id, :image_id,
40
+ :external_network_id, :coe
41
+ merge_attributes(service.create_cluster_template(attributes).body)
42
+ self
43
+ end
44
+
45
+ def update
46
+ requires :uuid, :name, :keypair_id, :flavor_id, :image_id,
47
+ :external_network_id, :coe
48
+ attrs = convert_update_params(attributes)
49
+ merge_attributes(service.update_cluster_template(uuid, attrs).body)
50
+ self
51
+ end
52
+
53
+ def destroy
54
+ requires :uuid
55
+ service.delete_cluster_template(uuid)
56
+ true
57
+ end
58
+ end
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,24 @@
1
+ require 'fog/openstack/models/collection'
2
+ require 'fog/container_infra/openstack/models/cluster_template'
3
+
4
+ module Fog
5
+ module ContainerInfra
6
+ class OpenStack
7
+ class ClusterTemplates < Fog::OpenStack::Collection
8
+
9
+ model Fog::ContainerInfra::OpenStack::ClusterTemplate
10
+
11
+ def all
12
+ load_response(service.list_cluster_templates, 'clustertemplates')
13
+ end
14
+
15
+ def get(cluster_template_uuid_or_name)
16
+ resource = service.get_cluster_template(cluster_template_uuid_or_name).body
17
+ new(resource)
18
+ rescue Fog::ContainerInfra::OpenStack::NotFound
19
+ nil
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,24 @@
1
+ require 'fog/openstack/models/collection'
2
+ require 'fog/container_infra/openstack/models/cluster'
3
+
4
+ module Fog
5
+ module ContainerInfra
6
+ class OpenStack
7
+ class Clusters < Fog::OpenStack::Collection
8
+
9
+ model Fog::ContainerInfra::OpenStack::Cluster
10
+
11
+ def all
12
+ load_response(service.list_clusters, "clusters")
13
+ end
14
+
15
+ def get(cluster_uuid_or_name)
16
+ resource = service.get_cluster(cluster_uuid_or_name).body
17
+ new(resource)
18
+ rescue Fog::ContainerInfra::OpenStack::NotFound
19
+ nil
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,27 @@
1
+ module Fog
2
+ module ContainerInfra
3
+ class OpenStack
4
+ class Real
5
+ def create_bay(params)
6
+ request(
7
+ :expects => [202, 201, 200],
8
+ :method => 'POST',
9
+ :path => "bays",
10
+ :body => Fog::JSON.encode(params)
11
+ )
12
+ end
13
+ end
14
+
15
+ class Mock
16
+ def create_bay(_params)
17
+ response = Excon::Response.new
18
+ response.status = 202
19
+ response.body = {
20
+ "uuid" => "746e779a-751a-456b-a3e9-c883d734946f"
21
+ }
22
+ response
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,56 @@
1
+ module Fog
2
+ module ContainerInfra
3
+ class OpenStack
4
+ class Real
5
+ def create_bay_model(params)
6
+ request(
7
+ :expects => [201, 200],
8
+ :method => 'POST',
9
+ :path => "baymodels",
10
+ :body => Fog::JSON.encode(params)
11
+ )
12
+ end
13
+ end
14
+
15
+ class Mock
16
+ def create_bay_model(_params)
17
+ response = Excon::Response.new
18
+ response.status = 201
19
+ response.body = {
20
+ "insecure_registry" => nil,
21
+ "http_proxy" => "http://10.164.177.169:8080",
22
+ "updated_at" => nil,
23
+ "floating_ip_enabled" => true,
24
+ "fixed_subnet" => nil,
25
+ "master_flavor_id" => nil,
26
+ "uuid" => "085e1c4d-4f68-4bfd-8462-74b9e14e4f39",
27
+ "no_proxy" => "10.0.0.0/8,172.0.0.0/8,192.0.0.0/8,localhost",
28
+ "https_proxy" => "http://10.164.177.169:8080",
29
+ "tls_disabled" => false,
30
+ "keypair_id" => "kp",
31
+ "public" => false,
32
+ "labels" => {},
33
+ "docker_volume_size" => 3,
34
+ "server_type" => "vm",
35
+ "external_network_id" => "public",
36
+ "cluster_distro" => "fedora-atomic",
37
+ "image_id" => "fedora-atomic-latest",
38
+ "volume_driver" => "cinder",
39
+ "registry_enabled" => false,
40
+ "docker_storage_driver" => "devicemapper",
41
+ "apiserver_port" => nil,
42
+ "name" => "k8s-bm2",
43
+ "created_at" => "2016-08-29T02:08:08+00:00",
44
+ "network_driver" => "flannel",
45
+ "fixed_network" => nil,
46
+ "coe" => "kubernetes",
47
+ "flavor_id" => "m1.small",
48
+ "master_lb_enabled" => true,
49
+ "dns_nameserver" => "8.8.8.8"
50
+ }
51
+ response
52
+ end
53
+ end
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,29 @@
1
+ module Fog
2
+ module ContainerInfra
3
+ class OpenStack
4
+ class Real
5
+ def create_certificate(params)
6
+ request(
7
+ :expects => [201, 200],
8
+ :method => 'POST',
9
+ :path => "certificates",
10
+ :body => Fog::JSON.encode(params)
11
+ )
12
+ end
13
+ end
14
+
15
+ class Mock
16
+ def create_certificate(_params)
17
+ response = Excon::Response.new
18
+ response.status = 201
19
+ response.body = {
20
+ "pem" => "-----BEGIN CERTIFICATE-----\nMIIDxDCCAqygAwIBAgIRALgUbIjdKUy8lqErJmCxVfkwDQYJKoZIhvcNAQELBQAw\n-----END CERTIFICATE-----\n",
21
+ "bay_uuid" => "0b4b766f-1500-44b3-9804-5a6e12fe6df4",
22
+ "csr" => "-----BEGIN CERTIFICATE REQUEST-----\nMIIEfzCCAmcCAQAwFDESMBAGA1UEAxMJWW91ciBOYW1lMIICIjANBgkqhkiG9w0B\n-----END CERTIFICATE REQUEST-----\n"
23
+ }
24
+ response
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,27 @@
1
+ module Fog
2
+ module ContainerInfra
3
+ class OpenStack
4
+ class Real
5
+ def create_cluster(params)
6
+ request(
7
+ :expects => [202, 201, 200],
8
+ :method => 'POST',
9
+ :path => "clusters",
10
+ :body => Fog::JSON.encode(params)
11
+ )
12
+ end
13
+ end
14
+
15
+ class Mock
16
+ def create_cluster(_params)
17
+ response = Excon::Response.new
18
+ response.status = 202
19
+ response.body = {
20
+ "uuid" => "746e779a-751a-456b-a3e9-c883d734946f"
21
+ }
22
+ response
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,56 @@
1
+ module Fog
2
+ module ContainerInfra
3
+ class OpenStack
4
+ class Real
5
+ def create_cluster_template(params)
6
+ request(
7
+ :expects => [201, 200],
8
+ :method => 'POST',
9
+ :path => "clustertemplates",
10
+ :body => Fog::JSON.encode(params)
11
+ )
12
+ end
13
+ end
14
+
15
+ class Mock
16
+ def create_cluster_template(_params)
17
+ response = Excon::Response.new
18
+ response.status = 201
19
+ response.body = {
20
+ "insecure_registry" => nil,
21
+ "http_proxy" => "http://10.164.177.169:8080",
22
+ "updated_at" => nil,
23
+ "floating_ip_enabled" => true,
24
+ "fixed_subnet" => nil,
25
+ "master_flavor_id" => nil,
26
+ "uuid" => "085e1c4d-4f68-4bfd-8462-74b9e14e4f39",
27
+ "no_proxy" => "10.0.0.0/8,172.0.0.0/8,192.0.0.0/8,localhost",
28
+ "https_proxy" => "http://10.164.177.169:8080",
29
+ "tls_disabled" => false,
30
+ "keypair_id" => "kp",
31
+ "public" => false,
32
+ "labels" => {},
33
+ "docker_volume_size" => 3,
34
+ "server_type" => "vm",
35
+ "external_network_id" => "public",
36
+ "cluster_distro" => "fedora-atomic",
37
+ "image_id" => "fedora-atomic-latest",
38
+ "volume_driver" => "cinder",
39
+ "registry_enabled" => false,
40
+ "docker_storage_driver" => "devicemapper",
41
+ "apiserver_port" => nil,
42
+ "name" => "k8s-bm2",
43
+ "created_at" => "2016-08-29T02:08:08+00:00",
44
+ "network_driver" => "flannel",
45
+ "fixed_network" => nil,
46
+ "coe" => "kubernetes",
47
+ "flavor_id" => "m1.small",
48
+ "master_lb_enabled" => true,
49
+ "dns_nameserver" => "8.8.8.8"
50
+ }
51
+ response
52
+ end
53
+ end
54
+ end
55
+ end
56
+ end