misty 1.4.0 → 1.5.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (153) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +87 -88
  3. data/lib/misty.rb +115 -1
  4. data/lib/misty/auth/catalog.rb +38 -0
  5. data/lib/misty/auth/catalog/v2.rb +15 -0
  6. data/lib/misty/auth/catalog/v3.rb +15 -0
  7. data/lib/misty/auth/token.rb +70 -0
  8. data/lib/misty/auth/token/v2.rb +63 -0
  9. data/lib/misty/auth/token/v3.rb +90 -0
  10. data/lib/misty/cloud.rb +74 -15
  11. data/lib/misty/config.rb +37 -43
  12. data/lib/misty/errors.rb +25 -5
  13. data/lib/misty/helper.rb +26 -0
  14. data/lib/misty/http/header.rb +3 -6
  15. data/lib/misty/http/method_builder.rb +2 -2
  16. data/lib/misty/http/request.rb +3 -3
  17. data/lib/misty/microversion.rb +12 -1
  18. data/lib/misty/misty.rb +7 -62
  19. data/lib/misty/openstack.rb +39 -0
  20. data/lib/misty/openstack/{aodh → api/aodh}/aodh_v2.rb +1 -1
  21. data/lib/misty/openstack/api/aodh/v2.rb +19 -0
  22. data/lib/misty/openstack/api/barbican/barbican_v1.rb +42 -0
  23. data/lib/misty/openstack/api/barbican/v1.rb +19 -0
  24. data/lib/misty/openstack/api/blazar/blazar_v1.rb +16 -0
  25. data/lib/misty/openstack/api/blazar/v1.rb +19 -0
  26. data/lib/misty/openstack/{ceilometer → api/ceilometer}/ceilometer_v2.rb +1 -1
  27. data/lib/misty/openstack/api/ceilometer/v2.rb +19 -0
  28. data/lib/misty/openstack/{cinder → api/cinder}/cinder_v1.rb +1 -1
  29. data/lib/misty/openstack/{cinder → api/cinder}/cinder_v2.rb +3 -3
  30. data/lib/misty/openstack/{cinder → api/cinder}/cinder_v3.rb +7 -4
  31. data/lib/misty/openstack/api/cinder/v1.rb +23 -0
  32. data/lib/misty/openstack/api/cinder/v2.rb +24 -0
  33. data/lib/misty/openstack/api/cinder/v3.rb +29 -0
  34. data/lib/misty/openstack/{designate → api/designate}/designate_v2.rb +2 -2
  35. data/lib/misty/openstack/api/designate/v2.rb +19 -0
  36. data/lib/misty/openstack/{freezer → api/freezer}/freezer_v1.rb +2 -2
  37. data/lib/misty/openstack/api/freezer/v1.rb +19 -0
  38. data/lib/misty/openstack/{glance → api/glance}/glance_v1.rb +1 -1
  39. data/lib/misty/openstack/{glance → api/glance}/glance_v2.rb +1 -1
  40. data/lib/misty/openstack/api/glance/v1.rb +19 -0
  41. data/lib/misty/openstack/api/glance/v2.rb +24 -0
  42. data/lib/misty/openstack/api/gnocchi/gnocchi_v1.rb +39 -0
  43. data/lib/misty/openstack/api/gnocchi/v1.rb +19 -0
  44. data/lib/misty/openstack/{heat → api/heat}/heat_v1.rb +1 -1
  45. data/lib/misty/openstack/api/heat/v1.rb +23 -0
  46. data/lib/misty/openstack/{ironic → api/ironic}/ironic_v1.rb +8 -2
  47. data/lib/misty/openstack/api/ironic/v1.rb +25 -0
  48. data/lib/misty/openstack/{karbor → api/karbor}/karbor_v1.rb +2 -2
  49. data/lib/misty/openstack/api/karbor/v1.rb +19 -0
  50. data/lib/misty/openstack/{keystone → api/keystone}/keystone_v2_0.rb +1 -1
  51. data/lib/misty/openstack/api/keystone/keystone_v2_0_ext.rb +14 -0
  52. data/lib/misty/openstack/{keystone → api/keystone}/keystone_v3.rb +35 -3
  53. data/lib/misty/openstack/{keystone → api/keystone}/keystone_v3_ext.rb +7 -9
  54. data/lib/misty/openstack/api/keystone/v2_0.rb +23 -0
  55. data/lib/misty/openstack/api/keystone/v3.rb +23 -0
  56. data/lib/misty/openstack/{magnum → api/magnum}/magnum_v1.rb +2 -2
  57. data/lib/misty/openstack/api/magnum/v1.rb +21 -0
  58. data/lib/misty/openstack/{manila → api/manila}/manila_v2.rb +7 -3
  59. data/lib/misty/openstack/api/manila/v2.rb +25 -0
  60. data/lib/misty/openstack/api/masakari/masakari_v1_0.rb +22 -0
  61. data/lib/misty/openstack/api/masakari/v1_0.rb +19 -0
  62. data/lib/misty/openstack/api/mistral/mistral_v2.rb +44 -0
  63. data/lib/misty/openstack/api/mistral/v2.rb +19 -0
  64. data/lib/misty/openstack/api/monasca/monasca_v2_0.rb +28 -0
  65. data/lib/misty/openstack/api/monasca/v2_0.rb +19 -0
  66. data/lib/misty/openstack/{murano → api/murano}/murano_v1.rb +1 -1
  67. data/lib/misty/openstack/api/murano/v1.rb +19 -0
  68. data/lib/misty/openstack/{neutron → api/neutron}/neutron_v2_0.rb +11 -12
  69. data/lib/misty/openstack/api/neutron/v2_0.rb +19 -0
  70. data/lib/misty/openstack/{nova → api/nova}/nova_v2_1.rb +1 -2
  71. data/lib/misty/openstack/api/nova/v2_1.rb +33 -0
  72. data/lib/misty/openstack/{octavia → api/octavia}/octavia_v2_0.rb +4 -3
  73. data/lib/misty/openstack/api/octavia/v2_0.rb +19 -0
  74. data/lib/misty/openstack/api/panko/panko_v2.rb +14 -0
  75. data/lib/misty/openstack/api/panko/v2.rb +19 -0
  76. data/lib/misty/openstack/api/placement/placement_v2_1.rb +50 -0
  77. data/lib/misty/openstack/api/placement/v2_1.rb +21 -0
  78. data/lib/misty/openstack/{sahara → api/sahara}/sahara_v1_1.rb +2 -2
  79. data/lib/misty/openstack/api/sahara/v1_1.rb +19 -0
  80. data/lib/misty/openstack/{searchlight → api/searchlight}/searchlight_v1.rb +2 -2
  81. data/lib/misty/openstack/api/searchlight/v1.rb +19 -0
  82. data/lib/misty/openstack/{senlin → api/senlin}/senlin_v1.rb +2 -2
  83. data/lib/misty/openstack/api/senlin/v1.rb +19 -0
  84. data/lib/misty/openstack/{swift → api/swift}/swift_v1.rb +2 -2
  85. data/lib/misty/openstack/api/swift/v1.rb +34 -0
  86. data/lib/misty/openstack/{tacker → api/tacker}/tacker_v1_0.rb +2 -2
  87. data/lib/misty/openstack/api/tacker/v1_0.rb +19 -0
  88. data/lib/misty/openstack/{trove → api/trove}/trove_v1_0.rb +23 -8
  89. data/lib/misty/openstack/api/trove/v1_0.rb +19 -0
  90. data/lib/misty/openstack/api/watcher/v1.rb +19 -0
  91. data/lib/misty/openstack/api/watcher/watcher_v1.rb +38 -0
  92. data/lib/misty/openstack/api/zaqar/v2.rb +19 -0
  93. data/lib/misty/openstack/{zaqar → api/zaqar}/zaqar_v2.rb +2 -2
  94. data/lib/misty/openstack/api/zun/v1.rb +19 -0
  95. data/lib/misty/openstack/api/zun/zun_v1.rb +55 -0
  96. data/lib/misty/openstack/service.rb +18 -15
  97. data/lib/misty/openstack/service_pack.rb +18 -0
  98. data/lib/misty/service.rb +4 -6
  99. data/lib/misty/services.rb +11 -10
  100. data/lib/misty/version.rb +1 -1
  101. data/test/integration/compute_test.rb +2 -2
  102. data/test/integration/{networking_test.rb → network_test.rb} +10 -10
  103. data/test/integration/orchestration_test.rb +4 -4
  104. data/test/integration/vcr/{networking_using_neutron_v2_0.yml → network_using_neutron_v2_0.yml} +0 -0
  105. data/test/unit/auth/catalog_test.rb +99 -0
  106. data/test/unit/{auth_test.rb → auth/token_test.rb} +79 -45
  107. data/test/unit/cloud/config_test.rb +79 -41
  108. data/test/unit/cloud/requests_test.rb +6 -6
  109. data/test/unit/cloud/services_test.rb +23 -23
  110. data/test/unit/cloud_test.rb +10 -10
  111. data/test/unit/http/method_builder_test.rb +13 -23
  112. data/test/unit/http/request_test.rb +1 -1
  113. data/test/unit/microversion_test.rb +13 -16
  114. data/test/unit/misty_test.rb +51 -49
  115. data/test/unit/openstack/APIs_test.rb +5 -9
  116. data/test/unit/openstack/extension_test.rb +6 -6
  117. data/test/unit/openstack/service_test.rb +2 -10
  118. data/test/unit/service_helper.rb +3 -8
  119. data/test/unit/services_test.rb +5 -5
  120. metadata +91 -66
  121. data/lib/misty/auth.rb +0 -91
  122. data/lib/misty/auth/auth_v2.rb +0 -65
  123. data/lib/misty/auth/auth_v3.rb +0 -89
  124. data/lib/misty/autoload.rb +0 -99
  125. data/lib/misty/client_pack.rb +0 -16
  126. data/lib/misty/openstack/aodh/v2.rb +0 -17
  127. data/lib/misty/openstack/ceilometer/v2.rb +0 -17
  128. data/lib/misty/openstack/cinder/v1.rb +0 -21
  129. data/lib/misty/openstack/cinder/v2.rb +0 -22
  130. data/lib/misty/openstack/cinder/v3.rb +0 -31
  131. data/lib/misty/openstack/designate/v2.rb +0 -17
  132. data/lib/misty/openstack/freezer/v1.rb +0 -17
  133. data/lib/misty/openstack/glance/v1.rb +0 -17
  134. data/lib/misty/openstack/glance/v2.rb +0 -17
  135. data/lib/misty/openstack/heat/v1.rb +0 -21
  136. data/lib/misty/openstack/ironic/v1.rb +0 -27
  137. data/lib/misty/openstack/karbor/v1.rb +0 -17
  138. data/lib/misty/openstack/keystone/keystone_v2_0_ext.rb +0 -18
  139. data/lib/misty/openstack/keystone/v2_0.rb +0 -21
  140. data/lib/misty/openstack/keystone/v3.rb +0 -21
  141. data/lib/misty/openstack/magnum/v1.rb +0 -23
  142. data/lib/misty/openstack/manila/v2.rb +0 -27
  143. data/lib/misty/openstack/murano/v1.rb +0 -17
  144. data/lib/misty/openstack/neutron/v2_0.rb +0 -17
  145. data/lib/misty/openstack/nova/v2_1.rb +0 -42
  146. data/lib/misty/openstack/octavia/v2_0.rb +0 -17
  147. data/lib/misty/openstack/sahara/v1_1.rb +0 -17
  148. data/lib/misty/openstack/searchlight/v1.rb +0 -17
  149. data/lib/misty/openstack/senlin/v1.rb +0 -17
  150. data/lib/misty/openstack/swift/v1.rb +0 -32
  151. data/lib/misty/openstack/tacker/v1_0.rb +0 -17
  152. data/lib/misty/openstack/trove/v1_0.rb +0 -17
  153. data/lib/misty/openstack/zaqar/v2.rb +0 -17
@@ -1,89 +0,0 @@
1
- require 'misty/auth'
2
-
3
- module Misty
4
- class AuthV3
5
- include Misty::Auth
6
-
7
- def credentials
8
- if @token
9
- identity = {
10
- 'methods': ['token'],
11
- 'token': { 'id': @token }
12
- }
13
- else
14
- identity = {
15
- 'methods': ['password'],
16
- 'password': @user.identity
17
- }
18
- end
19
- {
20
- 'auth': {
21
- 'identity': identity,
22
- 'scope': scope
23
- }
24
- }
25
- end
26
-
27
- def endpoint_url(endpoint, region_id, interface)
28
- return endpoint['url'] if endpoint['region_id'] == region_id && endpoint['interface'] == interface
29
- end
30
-
31
- def path
32
- '/v3/auth/tokens'
33
- end
34
-
35
- def scope
36
- return @project.identity if @project
37
- return @domain.identity if @domain
38
- raise CredentialsError, "#{self.class}: No scope available"
39
- end
40
-
41
- def set(response)
42
- payload = JSON.load(response.body)
43
- token = response['x-subject-token']
44
- catalog = payload['token']['catalog']
45
- expires = payload['token']['expires_at']
46
- [token, catalog, expires]
47
- end
48
-
49
- def set_credentials(auth)
50
- if auth[:project_id] || auth[:project]
51
- if auth[:project_domain_id].nil? && auth[:project_domain].nil?
52
- project_domain_id = Misty::DOMAIN_ID
53
- else
54
- project_domain_id = auth[:project_domain_id] if auth[:project_domain_id]
55
- project_domain = auth[:project_domain] if auth[:project_domain]
56
- end
57
-
58
- @project = Misty::Auth::ProjectScope.new(auth[:project_id], auth[:project])
59
- @project.domain = Misty::Auth::Name.new(project_domain_id, auth[:project_domain])
60
- else
61
- # scope: domain
62
- if auth[:domain_id] || auth[:domain]
63
- @domain = Misty::Auth::DomainScope.new(auth[:domain_id], auth[:domain])
64
- else
65
- # Use default Domain
66
- @domain = Misty::Auth::DomainScope.new(Misty::DOMAIN_ID, nil)
67
- end
68
- end
69
-
70
- if auth[:token]
71
- @token = auth[:token]
72
- else
73
- @user = Misty::Auth::User.new(auth[:user_id], auth[:user])
74
-
75
- if auth[:user_domain_id].nil? && auth[:user_domain].nil?
76
- user_domain_id = Misty::DOMAIN_ID
77
- else
78
- user_domain_id = auth[:user_domain_id] if auth[:user_domain_id]
79
- user_domain = auth[:user_domain] if auth[:user_domain]
80
- end
81
-
82
- @user.domain = Misty::Auth::Name.new(user_domain_id, user_domain)
83
- @user.password = auth[:password]
84
- end
85
-
86
- credentials
87
- end
88
- end
89
- end
@@ -1,99 +0,0 @@
1
- module Misty
2
- module Openstack
3
- module Aodh
4
- autoload :V2, 'misty/openstack/aodh/v2'
5
- end
6
-
7
- module Ceilometer
8
- autoload :V2, 'misty/openstack/ceilometer/v2'
9
- end
10
-
11
- module Cinder
12
- autoload :V1, 'misty/openstack/cinder/v1'
13
- autoload :V2, 'misty/openstack/cinder/v2'
14
- autoload :V3, 'misty/openstack/cinder/v3'
15
- end
16
-
17
- module Designate
18
- autoload :V2, 'misty/openstack/designate/v2'
19
- end
20
-
21
- module Freezer
22
- autoload :V1, 'misty/openstack/freezer/v1'
23
- end
24
-
25
- module Glance
26
- autoload :V1, 'misty/openstack/glance/v1'
27
- autoload :V2, 'misty/openstack/glance/v2'
28
- end
29
-
30
- module Heat
31
- autoload :V1, 'misty/openstack/heat/v1'
32
- end
33
-
34
- module Ironic
35
- autoload :V1, 'misty/openstack/ironic/v1'
36
- end
37
-
38
- module Karbor
39
- autoload :V1, 'misty/openstack/karbor/v1'
40
- end
41
-
42
- module Keystone
43
- autoload :V3, 'misty/openstack/keystone/v3'
44
- autoload :V2_0, 'misty/openstack/keystone/v2_0'
45
- end
46
-
47
- module Magnum
48
- autoload :V1, 'misty/openstack/magnum/v1'
49
- end
50
-
51
- module Manila
52
- autoload :V2, 'misty/openstack/manila/v2'
53
- end
54
-
55
- module Murano
56
- autoload :V1, 'misty/openstack/murano/v1'
57
- end
58
-
59
- module Neutron
60
- autoload :V2_0, 'misty/openstack/neutron/v2_0'
61
- end
62
-
63
- module Nova
64
- autoload :V2_1, 'misty/openstack/nova/v2_1'
65
- end
66
-
67
- module Octavia
68
- autoload :V2_0, 'misty/openstack/octavia/v2_0'
69
- end
70
-
71
- module Sahara
72
- autoload :V1_1, 'misty/openstack/sahara/v1_1'
73
- end
74
-
75
- module Searchlight
76
- autoload :V1, 'misty/openstack/searchlight/v1'
77
- end
78
-
79
- module Senlin
80
- autoload :V1, 'misty/openstack/senlin/v1'
81
- end
82
-
83
- module Swift
84
- autoload :V1, 'misty/openstack/swift/v1'
85
- end
86
-
87
- module Tacker
88
- autoload :V1_0, 'misty/openstack/tacker/v1_0'
89
- end
90
-
91
- module Trove
92
- autoload :V1_0, 'misty/openstack/trove/v1_0'
93
- end
94
-
95
- module Zaqar
96
- autoload :V2, 'misty/openstack/zaqar/v2'
97
- end
98
- end
99
- end
@@ -1,16 +0,0 @@
1
- require 'misty/openstack/service'
2
- require 'misty/http/net_http'
3
- require 'misty/http/method_builder'
4
- require 'misty/http/request'
5
- require 'misty/http/direct'
6
- require 'misty/http/header'
7
-
8
- module Misty
9
- module ClientPack
10
- include Misty::Openstack::Service
11
- include Misty::HTTP::NetHTTP
12
- include Misty::HTTP::MethodBuilder
13
- include Misty::HTTP::Request
14
- include Misty::HTTP::Direct
15
- end
16
- end
@@ -1,17 +0,0 @@
1
- require 'misty/openstack/aodh/aodh_v2'
2
- require 'misty/client_pack'
3
-
4
- module Misty
5
- module Openstack
6
- module Aodh
7
- class V2
8
- include Misty::Openstack::AodhV2
9
- include Misty::ClientPack
10
-
11
- def service_names
12
- %w{alarming}
13
- end
14
- end
15
- end
16
- end
17
- end
@@ -1,17 +0,0 @@
1
- require 'misty/openstack/ceilometer/ceilometer_v2'
2
- require 'misty/client_pack'
3
-
4
- module Misty
5
- module Openstack
6
- module Ceilometer
7
- class V2
8
- include Misty::Openstack::CeilometerV2
9
- include Misty::ClientPack
10
-
11
- def service_names
12
- %w{metering}
13
- end
14
- end
15
- end
16
- end
17
- end
@@ -1,21 +0,0 @@
1
- require 'misty/openstack/cinder/cinder_v1'
2
- require 'misty/client_pack'
3
-
4
- module Misty
5
- module Openstack
6
- module Cinder
7
- class V1
8
- include Misty::Openstack::CinderV1
9
- include Misty::ClientPack
10
-
11
- def prefix_path_to_ignore
12
- '/v1/{admin_tenant_id}/'
13
- end
14
-
15
- def service_names
16
- %w{block-storage, block-store, volume}
17
- end
18
- end
19
- end
20
- end
21
- end
@@ -1,22 +0,0 @@
1
- require 'misty/openstack/cinder/cinder_v2'
2
- require 'misty/client_pack'
3
-
4
- module Misty
5
- module Openstack
6
- module Cinder
7
- class V2
8
- include Misty::Openstack::CinderV2
9
- include Misty::ClientPack
10
-
11
- # TODO: path for '/v2/{admin_project_id}'
12
- def prefix_path_to_ignore
13
- '/v2/{project_id}'
14
- end
15
-
16
- def service_names
17
- %w{block-storage, block-store, volume}
18
- end
19
- end
20
- end
21
- end
22
- end
@@ -1,31 +0,0 @@
1
- require 'misty/openstack/cinder/cinder_v3'
2
- require 'misty/client_pack'
3
- require 'misty/microversion'
4
-
5
- module Misty
6
- module Openstack
7
- module Cinder
8
- class V3
9
- include Misty::Openstack::CinderV3
10
- include Misty::ClientPack
11
- include Misty::Microversion
12
-
13
- def microversion
14
- '3.44'
15
- end
16
-
17
- def microversion_header(version)
18
- {'X-Openstack-Cinder-API-Version' => "#{version}"}
19
- end
20
-
21
- def prefix_path_to_ignore
22
- '/v3/{tenant_id}'
23
- end
24
-
25
- def service_names
26
- %w{block-storage, block-store, volume}
27
- end
28
- end
29
- end
30
- end
31
- end
@@ -1,17 +0,0 @@
1
- require 'misty/openstack/designate/designate_v2'
2
- require 'misty/client_pack'
3
-
4
- module Misty
5
- module Openstack
6
- module Designate
7
- class V2
8
- include Misty::Openstack::DesignateV2
9
- include Misty::ClientPack
10
-
11
- def service_names
12
- %w{dns}
13
- end
14
- end
15
- end
16
- end
17
- end
@@ -1,17 +0,0 @@
1
- require 'misty/openstack/freezer/freezer_v1'
2
- require 'misty/client_pack'
3
-
4
- module Misty
5
- module Openstack
6
- module Freezer
7
- class V1
8
- include Misty::Openstack::FreezerV1
9
- include Misty::ClientPack
10
-
11
- def service_names
12
- %w{backup}
13
- end
14
- end
15
- end
16
- end
17
- end
@@ -1,17 +0,0 @@
1
- require 'misty/openstack/glance/glance_v1'
2
- require 'misty/client_pack'
3
-
4
- module Misty
5
- module Openstack
6
- module Glance
7
- class V1
8
- include Misty::Openstack::GlanceV1
9
- include Misty::ClientPack
10
-
11
- def service_names
12
- %w{image}
13
- end
14
- end
15
- end
16
- end
17
- end
@@ -1,17 +0,0 @@
1
- require 'misty/openstack/glance/glance_v2'
2
- require 'misty/client_pack'
3
-
4
- module Misty
5
- module Openstack
6
- module Glance
7
- class V2
8
- include Misty::Openstack::GlanceV2
9
- include Misty::ClientPack
10
-
11
- def service_names
12
- %w{image}
13
- end
14
- end
15
- end
16
- end
17
- end
@@ -1,21 +0,0 @@
1
- require 'misty/openstack/heat/heat_v1'
2
- require 'misty/client_pack'
3
-
4
- module Misty
5
- module Openstack
6
- module Heat
7
- class V1
8
- include Misty::Openstack::HeatV1
9
- include Misty::ClientPack
10
-
11
- def prefix_path_to_ignore
12
- '/v1/{tenant_id}'
13
- end
14
-
15
- def service_names
16
- %w{orchestration}
17
- end
18
- end
19
- end
20
- end
21
- end
@@ -1,27 +0,0 @@
1
- require 'misty/openstack/ironic/ironic_v1'
2
- require 'misty/client_pack'
3
- require 'misty/microversion'
4
-
5
- module Misty
6
- module Openstack
7
- module Ironic
8
- class V1
9
- include Misty::Openstack::IronicV1
10
- include Misty::ClientPack
11
- include Misty::Microversion
12
-
13
- def microversion
14
- '1.32'
15
- end
16
-
17
- def microversion_header(version)
18
- {'X-Openstack-Ironic-API-Version' => "#{version}"}
19
- end
20
-
21
- def service_names
22
- %w{baremetal}
23
- end
24
- end
25
- end
26
- end
27
- end