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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ec633eb5c336342f8a86380b8c9b624520ac1e2b
4
- data.tar.gz: 51a3e89f79256a33c926ed55800135084ab1e0e3
3
+ metadata.gz: 0c484478917eb09469e637f0b6c4f3ebe46c977b
4
+ data.tar.gz: c1200a007c58cc7cced9a07fb1e0b4e51e60cc5e
5
5
  SHA512:
6
- metadata.gz: 0bcb3e7a8b98d4b599700e65d59d89ff83d44fe86c3badee004f6579e4cd3939950c397f042d9c629c92d25ffde06b690a782d4cee803e0886a2861146e2361e
7
- data.tar.gz: 5360efb6444ee46248d0f4d7467f90d33bf930985044082b7519e1e57935512feb90dd4039ce3ecc6aed4dffa33c60ed28cc82f826ace38082f0f1948a219dda
6
+ metadata.gz: e56315c7dcc72fe5d17e616ce48f0363962344d55e0859fb950f3f0641bb3c8cc5a3673fbd6ced7f835fe51bdce76a9c9a3a43ff35e1ced8218147faae87d147
7
+ data.tar.gz: 34be9722e4a6d4993c749184e0fa7e923ab878ad34a7678612dccba3ca7dc66fd23f0435d658821dbfd47b43292de20f33808bfb299d3dd7a69b7c167ea32058
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # Introduction
2
2
  Misty is a HTTP client for OpenStack APIs, aiming to be slick and dynamic.
3
3
 
4
- Misty handles OpenStack APIs requests as Transparently as possible by:
4
+ Misty handles OpenStack APIs requests as transparently as possible by:
5
5
  * Directly submitting request to Openstack Service endpoints
6
6
  * Or by using APIs Schema defined functions which are dynamically extracted from OpenStackAPI reference.
7
7
 
@@ -13,18 +13,44 @@ Misty handles OpenStack APIs requests as Transparently as possible by:
13
13
  * Custom HTTP Methods for special needs
14
14
  * And also: Lazy service loading, Low gem dependency (use only Net/HTTP and JSON), Persistent HTTP connections (default since HTTP 1.1 anyway)
15
15
 
16
- ### Current Microversion support
17
- * Cinder
18
- v3.44
19
- * Ironic
20
- v1.32
21
- * Magnum
22
- v1.4
23
- * Manilla
24
- v2.40
25
- * Nova
26
- v2.60
16
+ ## OpenStack Services
27
17
 
18
+ The current list of Openstack services supported, can be obtained from `Misty.services` is:
19
+ ```ruby
20
+ application_catalog: murano, versions: ["v1"]
21
+ alarming: aodh, versions: ["v2"]
22
+ backup: freezer, versions: ["v1"]
23
+ baremetal: ironic, versions: ["v1"], microversion: 1.32
24
+ block_storage: cinder, versions: ["v3", "v2", "v1"], microversion: 3.44
25
+ clustering: senlin, versions: ["v1"]
26
+ compute: nova, versions: ["v2.1"], microversion: 2.60
27
+ container_infrastructure_management: magnum, versions: ["v1"], microversion: 1.4
28
+ container_service: zun, versions: ["v1"]
29
+ data_processing: sahara, versions: ["v1.1"]
30
+ data_protection_orchestration: karbor, versions: ["v1"]
31
+ database: trove, versions: ["v1.0"]
32
+ dns: designate, versions: ["v2"]
33
+ event: panko, versions: ["v2"]
34
+ identity: keystone, versions: ["v3", "v2.0"]
35
+ image: glance, versions: ["v2", "v1"]
36
+ instance_ha: masakari, versions: ["v1.0"]
37
+ key_manager: barbican, versions: ["v1"]
38
+ load_balancer: octavia, versions: ["v2.0"]
39
+ metric: gnocchi, versions: ["v1"]
40
+ messaging: zaqar, versions: ["v2"]
41
+ metering: ceilometer, versions: ["v2"]
42
+ monitoring: monasca, versions: ["v2.0"]
43
+ network: neutron, versions: ["v2.0"]
44
+ nfv_orchestration: tacker, versions: ["v1.0"]
45
+ object_storage: swift, versions: ["v1"]
46
+ orchestration: heat, versions: ["v1"]
47
+ placement: placement, versions: ["v2.1"], microversion: 2.60
48
+ reservation: blazar, versions: ["v1"]
49
+ resource_optimization: watcher, versions: ["v1"]
50
+ search: searchlight, versions: ["v1"]
51
+ shared_file_systems: manila, versions: ["v2"], microversion: 2.40
52
+ workflow: mistral, versions: ["v2"]
53
+ ```
28
54
 
29
55
  # How To
30
56
  Fetch and install
@@ -51,10 +77,10 @@ cloud = Misty::Cloud.new(
51
77
 
52
78
  ```
53
79
  servers = cloud.compute.list_servers.body
54
- networks = cloud.networking.list_networks
80
+ networks = cloud.network.list_networks
55
81
  first_network_id = networks.body['networks'][0]['id']
56
- first_network = cloud.networking.show_network_details(first_network_id)
57
- network = Misty.to_json(:network => {:name => 'misty-example'})
82
+ first_network = cloud.network.show_network_details(first_network_id)
83
+ network = Misty::Helper.to_json(:network => {:name => 'misty-example'})
58
84
  cloud.network.create_network(network)
59
85
  v1 = cloud.baremetal.show_v1_api
60
86
  ```
@@ -93,7 +119,10 @@ cloud.compute.list_servers
93
119
  ```
94
120
 
95
121
  ### Authentication
96
- Openstack Identity service Keystone version 3 is the default, version 2.0, although deprecated, is available.
122
+ Openstack Identity service Keystone version 3 is the default, version 2.0, although deprecated, is also available.
123
+ Keystone v3 can handle v2.0 and v3 for authentications and services.
124
+ V3 relies on the concept of domains and projects while V2 credentials use tenant. Authentication are assumed against v3
125
+ unless a tenant is used in the credentials.
97
126
 
98
127
  #### Parameters
99
128
  The following parameters can be used:
@@ -117,11 +146,6 @@ To authenticate with credentials details:
117
146
  * `:user_domain` - User domain name
118
147
 
119
148
  ##### Keystone v3
120
- Version 3 relies on the concept of domain name or id to authenticates
121
-
122
- `Misty::AuthV3` is used by default unless authentication credentials contains a tenant name or id in wich case it
123
- will use on `Misty::AuthV2`.
124
-
125
149
  The credentials are a combination of "id" and "name" used to uniquely identify projects, users and their domains.
126
150
  When using only the name, a domain must be specified to guarantee a unique record from the Identity service.
127
151
 
@@ -183,98 +207,73 @@ cloud.identity(:api_version => 'v2.0')
183
207
 
184
208
  ### Global configuration options
185
209
  The configuration parameters used to initialize `Misty::Cloud` are global. They are optionals and Misty::Config
186
- defaults are applied if needed.
210
+ defaults are applied if not specified.
187
211
 
188
212
  * `:auth` - Authentication credentials hash containing 'auth_url' and user context. See `Misty::Auth`.
189
- * `:content_type` - HTTP responses body format. :json or :hash structures. Default is `Misty::Config::CONTENT_TYPE`.
213
+ * `:content_type` - HTTP responses body format. :json or :hash structures. Default is `Misty::Config::CONTENT_TYPE` (`:hash`).
190
214
  * `:headers` - Hash of extra HTTP headers to be applied to all services
191
215
  * `:interface` - Endpoint interface, allowed values are: "public", "internal", "admin".
192
216
  * `:log_file` - Log destination, Value is either file path (./misty.log) or IO object (SDOUT). Default is '/dev/null'
193
217
  * `:log_level` - Value is Fixnum - Default is 1 (Logger::INFO) - See Logger from Ruby standard Library
194
- * `:region_id` - Alternative Region identifier. Default is `Misty::Config::REGION_ID`
195
- Default is `Misty::Config::INTERFACE`
196
- * `:ssl_verify_mode` - Boolean flag for SSL client verification. SSL is defined when URI scheme => "https://".
197
- Default is `Misty::Config::SSL_VERIFY_MODE`
218
+ * `:region` - Alternative Region name. Default is `Misty::Config::REGION` (`'regionOne'`)
219
+ Default is `Misty::Config::INTERFACE` (`'public'`)
220
+ * `:ssl_verify_mode` - Boolean flag for SSL client verification. Applies when URI scheme is SSL ("https://").
221
+ Default is `Misty::Config::SSL_VERIFY_MODE` (`true`)
198
222
  See `Misty::Config` for more details
199
223
 
224
+ ### Service and Request levels configuration parameters
225
+ The following parameters which are global defined can also be changed at the service level.
226
+ * `:content_type` - Overridden
227
+ * `:headers` - Cumulative
228
+ * `:interface` - Overridden
229
+ * `:region` - Overridden
230
+
231
+ The following parameters are specific to the service level:
232
+ * `:api_version` - String for specifying Openstack API service version to use. Default is latest supported version.
233
+ * `:base_path` - Allows to force the base path for every URL requests. Default is endpoint's path.
234
+ * `:endpoint` - Overrides service endpoint discovery by providing url.
235
+ * `:service_name` - Provides alternative service name for endpoint discovery.
236
+ Allowed values: `'latest'`, or a version number such as '2.10'
237
+
238
+ The following parameters can be changed at a service's request level.
239
+ * `:content_type` - Overridden
240
+ * `:headers` - Cumulative
241
+ * `:version` - Version to be used when microversion is supported by the service. Default: none
242
+
200
243
  ### Headers
201
- Headers are cumulative, applied from Cloud top level, then at Service level and finally at request level.
244
+ Headers are cumulative when applied at any level, Cloud level, Service level and/or finally at service's request
245
+ level.
202
246
 
203
247
  HTTP headers can effectively be optionally added to any request.
204
248
  An Header object must be created and passed as the last parameter of a request.
205
249
 
206
- For example for an already initialized cloud:
207
250
  ```ruby
208
- header = Misty::HTTP::Header.new(
251
+ container_header = {
209
252
  'x-container-meta-web-listings' => false,
210
253
  'x-container-meta-quota-count' => "",
211
254
  'x-container-meta-quota-bytes' => nil,
212
255
  'x-versions-location' => "",
213
256
  'x-container-meta-web-index' => ""
214
- )
215
- openstack.object_storage.create_update_or_delete_container_metadata(container_name, header)
216
- ```
217
-
218
- ### Service and Request levels configuration parameters
219
- The same parameters used at the global configuration variables can be applied at Service level or at a Request level.
220
- The global values passed from `Misty::Cloud` level are then overridden at the Service level.
221
-
222
- The following parameters can be also used:
223
- * `:api_version` - String for specifying Openstack API service version to use. Default is latest supported version.
224
- Applies only at service level as it's needed for service creation.
225
- * `:base_path` - Allows to force the base path for every URL requests Default nil.
226
- * `:base_url` - Allows to force the base URL for every requests. Default nil.
227
- * `:version` - Version to be used when microversion is supported by the service. Default: `nil`
228
- Allowed values: `'latest'`, or a version number such as '2.10'
257
+ }
229
258
 
230
- #### Examples
231
- Initialize cloud
232
- ```ruby
233
- cloud = Misty::Cloud.new(:auth => { ... }, region_id => 'regionOne', :log_level => 0)
259
+ cloud = Misty::Cloud.new{:auth { ... }}
260
+ cloud.object_storage.create_update_or_delete_container_metadata(container_name, container_header)
234
261
  ```
235
262
 
236
- Then use different options, for example, the identify service, therefore overriding respective global defaults or
237
- specified values
263
+ ### Examples
264
+ Initialize cloud with different options, and for the identify service, override respective global values
238
265
  ```ruby
239
- cloud.identity => {:region_id => 'regionTwo', :interface => 'admin'}
240
- Provide service specific option
241
- cloud.compute => {:version => '2.27'})
242
- ```
243
-
244
- ## Services
245
- The latest list of supported service can be obtain from `Misty.services`:
246
- ```
247
- require 'misty'
248
- puts Misty.services
249
- =>
250
- application_catalog: murano, versions: ["v1"]
251
- alarming: aodh, versions: ["v2"]
252
- backup: freezer, versions: ["v1"]
253
- baremetal: ironic, versions: ["v1"], microversion: v1
254
- block_storage: cinder, versions: ["v3", "v2", "v1"], microversion: v3
255
- clustering: senlin, versions: ["v1"]
256
- compute: nova, versions: ["v2.1"], microversion: v2.1
257
- container_infrastructure_management: magnum, versions: ["v1"], microversion: v1
258
- data_processing: sahara, versions: ["v1.1"]
259
- data_protection_orchestration: karbor, versions: ["v1"]
260
- database: trove, versions: ["v1.0"]
261
- dns: designate, versions: ["v2"]
262
- identity: keystone, versions: ["v3", "v2.0"]
263
- image: glance, versions: ["v2", "v1"]
264
- load_balancer: octavia, versions: ["v2.0"]
265
- messaging: zaqar, versions: ["v2"]
266
- metering: ceilometer, versions: ["v2"]
267
- networking: neutron, versions: ["v2.0"]
268
- nfv_orchestration: tacker, versions: ["v1.0"]
269
- object_storage: swift, versions: ["v1"]
270
- orchestration: heat, versions: ["v1"]
271
- search: searchlight, versions: ["v1"]
272
- shared_file_systems: manila, versions: ["v2"], microversion: v2
266
+ cloud = Misty::Cloud.new(:auth => { ... }, region_id => 'regionOne', :log_level => 0, {identity => {region_id => 'regionTwo', :interface => 'admin'})
273
267
  ```
268
+
269
+ At Request level, provide specific options like the microversion
270
+ ```ruby
271
+ cloud.compute(:version => '2.27', :content_type => :json).list_servers
272
+ ```
274
273
 
275
274
  ### Service Prefix
276
275
  A shorter name can be used to call a service only if it's unique among all services.
277
- For instance `net` or `network` can be used instead of `networking` because it's not ambiguous.
276
+ For instance `net` or `network` can be used instead of `network` because it's not ambiguous.
278
277
  Meanwhile `data` doesn't work because it's ambiguous between `data_processing` and `data_protection_orchestration`
279
278
 
280
279
  ### Aliases
@@ -354,7 +353,7 @@ heat_template = {
354
353
  require 'misty'
355
354
  require 'pp'
356
355
  cloud = Misty::Cloud.new(:auth => { ... })
357
- data_heat_template = Misty.to_json(heat_template)
356
+ data_heat_template = Misty::Helper.to_json(heat_template)
358
357
  response = cloud.orchestration.create_stack(data_heat_template)
359
358
  id = response.body['stack']['id']
360
359
  stack = cloud.orchestration.show_stack_details('test_stack', id)
@@ -381,7 +380,7 @@ pp cloud.compute.versions
381
380
 
382
381
  ```ruby
383
382
  cloud.compute(:version => '2.25')
384
- data_keypair = Misty.to_json('keypair': {'name': 'admin-keypair'})
383
+ data_keypair = Misty::Helper.to_json('keypair': {'name': 'admin-keypair'})
385
384
  admin_keypair = cloud.compute.create_or_import_keypair(data_keypair)
386
385
  user_id = admin_keypair.body['keypair']['user_id']
387
386
  keypairs = cloud.compute.list_keypairs
@@ -3,6 +3,120 @@ require 'net/http'
3
3
  require 'time'
4
4
  require 'uri'
5
5
  require 'misty/misty'
6
- require 'misty/autoload'
6
+
7
+ module Misty
8
+ module Auth
9
+ module Token
10
+ autoload :V2, 'misty/auth/token/v2'
11
+ autoload :V3, 'misty/auth/token/v3'
12
+ end
13
+
14
+ module Catalog
15
+ autoload :V2, 'misty/auth/catalog/v2'
16
+ autoload :V3, 'misty/auth/catalog/v3'
17
+ end
18
+ end
19
+
20
+ module Openstack
21
+ module API
22
+ module Aodh
23
+ autoload :V2, 'misty/openstack/api/aodh/v2'
24
+ end
25
+
26
+ module Ceilometer
27
+ autoload :V2, 'misty/openstack/api/ceilometer/v2'
28
+ end
29
+
30
+ module Cinder
31
+ autoload :V1, 'misty/openstack/api/cinder/v1'
32
+ autoload :V2, 'misty/openstack/api/cinder/v2'
33
+ autoload :V3, 'misty/openstack/api/cinder/v3'
34
+ end
35
+
36
+ module Designate
37
+ autoload :V2, 'misty/openstack/api/designate/v2'
38
+ end
39
+
40
+ module Freezer
41
+ autoload :V1, 'misty/openstack/api/freezer/v1'
42
+ end
43
+
44
+ module Glance
45
+ autoload :V1, 'misty/openstack/api/glance/v1'
46
+ autoload :V2, 'misty/openstack/api/glance/v2'
47
+ end
48
+
49
+ module Heat
50
+ autoload :V1, 'misty/openstack/api/heat/v1'
51
+ end
52
+
53
+ module Ironic
54
+ autoload :V1, 'misty/openstack/api/ironic/v1'
55
+ end
56
+
57
+ module Karbor
58
+ autoload :V1, 'misty/openstack/api/karbor/v1'
59
+ end
60
+
61
+ module Keystone
62
+ autoload :V3, 'misty/openstack/api/keystone/v3'
63
+ autoload :V2_0, 'misty/openstack/api/keystone/v2_0'
64
+ end
65
+
66
+ module Magnum
67
+ autoload :V1, 'misty/openstack/api/magnum/v1'
68
+ end
69
+
70
+ module Manila
71
+ autoload :V2, 'misty/openstack/api/manila/v2'
72
+ end
73
+
74
+ module Murano
75
+ autoload :V1, 'misty/openstack/api/murano/v1'
76
+ end
77
+
78
+ module Neutron
79
+ autoload :V2_0, 'misty/openstack/api/neutron/v2_0'
80
+ end
81
+
82
+ module Nova
83
+ autoload :V2_1, 'misty/openstack/api/nova/v2_1'
84
+ end
85
+
86
+ module Octavia
87
+ autoload :V2_0, 'misty/openstack/api/octavia/v2_0'
88
+ end
89
+
90
+ module Sahara
91
+ autoload :V1_1, 'misty/openstack/api/sahara/v1_1'
92
+ end
93
+
94
+ module Searchlight
95
+ autoload :V1, 'misty/openstack/api/searchlight/v1'
96
+ end
97
+
98
+ module Senlin
99
+ autoload :V1, 'misty/openstack/api/senlin/v1'
100
+ end
101
+
102
+ module Swift
103
+ autoload :V1, 'misty/openstack/api/swift/v1'
104
+ end
105
+
106
+ module Tacker
107
+ autoload :V1_0, 'misty/openstack/api/tacker/v1_0'
108
+ end
109
+
110
+ module Trove
111
+ autoload :V1_0, 'misty/openstack/api/trove/v1_0'
112
+ end
113
+
114
+ module Zaqar
115
+ autoload :V2, 'misty/openstack/api/zaqar/v2'
116
+ end
117
+ end
118
+ end
119
+ end
120
+
7
121
  require 'misty/cloud'
8
122
  require 'misty/errors'
@@ -0,0 +1,38 @@
1
+ module Misty
2
+ module Auth
3
+ module Catalog
4
+ attr_reader :payload
5
+
6
+ def initialize(payload)
7
+ @payload = payload
8
+ end
9
+
10
+ def get_endpoint_url(names, region, interface)
11
+ entry = get_service(names)
12
+ raise ServiceTypeError, 'Endpoint discovery: No service type match' unless entry
13
+ find_url(entry, region, interface)
14
+ end
15
+
16
+ private
17
+
18
+ def get_service(names)
19
+ @payload.each do |entry|
20
+ return entry if names.include?(entry['type'])
21
+ end
22
+ nil
23
+ end
24
+
25
+ def find_url(service, region, interface)
26
+ if service['endpoints']
27
+ service['endpoints'].each do |endpoint|
28
+ if (url = endpoint_url(endpoint, region, interface))
29
+ return url
30
+ end
31
+ end
32
+ end
33
+ raise EndpointError, "No endpoint found: service '#{service['type']}', region '#{region}',
34
+ interface '#{interface}'"
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,15 @@
1
+ require 'misty/auth/catalog'
2
+
3
+ module Misty
4
+ module Auth
5
+ module Catalog
6
+ class V2
7
+ include Misty::Auth::Catalog
8
+
9
+ def endpoint_url(endpoint, region, interface)
10
+ endpoint["#{interface}URL"] if endpoint['region'] == region && endpoint["#{interface}URL"]
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ require 'misty/auth/catalog'
2
+
3
+ module Misty
4
+ module Auth
5
+ module Catalog
6
+ class V3
7
+ include Misty::Auth::Catalog
8
+
9
+ def endpoint_url(endpoint, region, interface)
10
+ endpoint['url'] if endpoint['region'] == region && endpoint['interface'] == interface
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end