misty 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. checksums.yaml +4 -4
  2. data/lib/misty/auth.rb +5 -13
  3. data/lib/misty/auth/auth_v2.rb +13 -11
  4. data/lib/misty/auth/auth_v3.rb +11 -9
  5. data/lib/misty/auth/errors.rb +12 -0
  6. data/lib/misty/auth/name.rb +4 -4
  7. data/lib/misty/client.rb +105 -0
  8. data/lib/misty/client_pack.rb +16 -0
  9. data/lib/misty/http/method_builder.rb +36 -20
  10. data/lib/misty/misty.rb +14 -0
  11. data/lib/misty/openstack/aodh/aodh_v2.rb +1 -1
  12. data/lib/misty/openstack/aodh/v2.rb +5 -8
  13. data/lib/misty/openstack/ceilometer/ceilometer_v2.rb +1 -1
  14. data/lib/misty/openstack/ceilometer/v2.rb +5 -8
  15. data/lib/misty/openstack/cinder/cinder_v1.rb +1 -1
  16. data/lib/misty/openstack/cinder/cinder_v2.rb +1 -1
  17. data/lib/misty/openstack/cinder/cinder_v3.rb +1 -1
  18. data/lib/misty/openstack/cinder/v1.rb +6 -9
  19. data/lib/misty/openstack/cinder/v2.rb +6 -9
  20. data/lib/misty/openstack/cinder/v3.rb +7 -10
  21. data/lib/misty/openstack/designate/designate_v2.rb +1 -1
  22. data/lib/misty/openstack/designate/v2.rb +5 -8
  23. data/lib/misty/openstack/extension.rb +33 -0
  24. data/lib/misty/openstack/freezer/freezer_v1.rb +1 -1
  25. data/lib/misty/openstack/freezer/v1.rb +5 -8
  26. data/lib/misty/openstack/glance/glance_v1.rb +1 -1
  27. data/lib/misty/openstack/glance/glance_v2.rb +1 -1
  28. data/lib/misty/openstack/glance/v1.rb +5 -8
  29. data/lib/misty/openstack/glance/v2.rb +5 -8
  30. data/lib/misty/openstack/heat/heat_v1.rb +1 -1
  31. data/lib/misty/openstack/heat/v1.rb +6 -9
  32. data/lib/misty/openstack/ironic/ironic_v1.rb +1 -1
  33. data/lib/misty/openstack/ironic/v1.rb +6 -9
  34. data/lib/misty/openstack/karbor/karbor_v1.rb +1 -1
  35. data/lib/misty/openstack/karbor/v1.rb +5 -8
  36. data/lib/misty/openstack/keystone/keystone_v2_0.rb +1 -1
  37. data/lib/misty/openstack/keystone/keystone_v2_0_ext.rb +2 -2
  38. data/lib/misty/openstack/keystone/keystone_v3.rb +1 -1
  39. data/lib/misty/openstack/keystone/keystone_v3_ext.rb +2 -2
  40. data/lib/misty/openstack/keystone/v2_0.rb +8 -10
  41. data/lib/misty/openstack/keystone/v3.rb +8 -10
  42. data/lib/misty/openstack/magnum/magnum_v1.rb +1 -1
  43. data/lib/misty/openstack/magnum/v1.rb +6 -9
  44. data/lib/misty/openstack/manila/manila_v2.rb +1 -1
  45. data/lib/misty/openstack/manila/v2.rb +6 -9
  46. data/lib/misty/openstack/murano/murano_v1.rb +1 -1
  47. data/lib/misty/openstack/murano/v1.rb +5 -8
  48. data/lib/misty/openstack/neutron/neutron_v2_0.rb +1 -1
  49. data/lib/misty/openstack/neutron/v2_0.rb +5 -8
  50. data/lib/misty/openstack/nova/nova_v2_1.rb +1 -1
  51. data/lib/misty/openstack/nova/v2_1.rb +7 -9
  52. data/lib/misty/openstack/octavia/octavia_v2_0.rb +1 -1
  53. data/lib/misty/openstack/octavia/v2_0.rb +5 -8
  54. data/lib/misty/openstack/sahara/sahara_v1_1.rb +1 -1
  55. data/lib/misty/openstack/sahara/v1_1.rb +5 -8
  56. data/lib/misty/openstack/searchlight/searchlight_v1.rb +1 -1
  57. data/lib/misty/openstack/searchlight/v1.rb +5 -8
  58. data/lib/misty/openstack/senlin/senlin_v1.rb +1 -1
  59. data/lib/misty/openstack/senlin/v1.rb +5 -8
  60. data/lib/misty/openstack/swift/swift_v1.rb +1 -1
  61. data/lib/misty/openstack/swift/v1.rb +17 -9
  62. data/lib/misty/openstack/tacker/tacker_v1_0.rb +1 -1
  63. data/lib/misty/openstack/tacker/v1_0.rb +5 -8
  64. data/lib/misty/openstack/trove/trove_v1_0.rb +1 -1
  65. data/lib/misty/openstack/trove/v1_0.rb +5 -8
  66. data/lib/misty/openstack/zaqar/v2.rb +5 -8
  67. data/lib/misty/openstack/zaqar/zaqar_v2.rb +1 -1
  68. data/lib/misty/version.rb +1 -1
  69. data/test/unit/{http/client_test.rb → client_test.rb} +20 -8
  70. data/test/unit/cloud/requests_test.rb +77 -5
  71. data/test/unit/cloud/services_test.rb +20 -5
  72. data/test/unit/http/header_test.rb +0 -1
  73. data/test/unit/http/method_builder_test.rb +4 -4
  74. data/test/unit/http/request_test.rb +29 -20
  75. data/test/unit/microversion_test.rb +1 -1
  76. data/test/unit/misty_test.rb +18 -0
  77. data/test/unit/openstack/APIs_test.rb +18 -13
  78. data/test/unit/openstack/extension_test.rb +68 -0
  79. data/test/unit/service_helper.rb +1 -1
  80. metadata +8 -4
  81. data/lib/misty/http/client.rb +0 -108
@@ -1,20 +1,18 @@
1
- require 'misty/http/client'
2
1
  require 'misty/openstack/keystone/keystone_v3'
3
2
  require 'misty/openstack/keystone/keystone_v3_ext'
3
+ require 'misty/openstack/extension'
4
+ require 'misty/client_pack'
4
5
 
5
6
  module Misty
6
7
  module Openstack
7
8
  module Keystone
8
- class V3 < Misty::HTTP::Client
9
- extend Misty::Openstack::KeystoneV3
9
+ class V3
10
+ include Misty::Openstack::KeystoneV3
11
+ include Misty::Openstack::KeystoneV3_ext
12
+ include Misty::ClientPack
13
+ include Misty::Openstack::Extension
10
14
 
11
- def self.api
12
- api = v3
13
- api.merge!(v3_ext)
14
- api
15
- end
16
-
17
- def self.service_names
15
+ def service_names
18
16
  %w{identity}
19
17
  end
20
18
  end
@@ -1,5 +1,5 @@
1
1
  module Misty::Openstack::MagnumV1
2
- def v1
2
+ def api
3
3
  {"/"=>{:GET=>[:list_api_versions]},
4
4
  "/v1/"=>{:GET=>[:show_v1_api_version]},
5
5
  "/v1/bays"=>{:POST=>[:create_new_bay]},
@@ -1,19 +1,16 @@
1
- require 'misty/http/client'
2
- require 'misty/openstack/microversion'
3
1
  require 'misty/openstack/magnum/magnum_v1'
2
+ require 'misty/client_pack'
3
+ require 'misty/openstack/microversion'
4
4
 
5
5
  module Misty
6
6
  module Openstack
7
7
  module Magnum
8
- class V1 < Misty::HTTP::Client
9
- extend Misty::Openstack::MagnumV1
8
+ class V1
9
+ include Misty::Openstack::MagnumV1
10
+ include Misty::ClientPack
10
11
  include Misty::HTTP::Microversion
11
12
 
12
- def self.api
13
- v1
14
- end
15
-
16
- def self.service_names
13
+ def service_names
17
14
  %w{container}
18
15
  end
19
16
  end
@@ -1,5 +1,5 @@
1
1
  module Misty::Openstack::ManilaV2
2
- def v2
2
+ def api
3
3
  {"/"=>{:GET=>[:list_all_major_versions]},
4
4
  "/{api_version}"=>{:GET=>[:show_details_of_specific_api_version]},
5
5
  "/v2/{tenant_id}/extensions"=>{:GET=>[:list_extensions]},
@@ -1,19 +1,16 @@
1
- require 'misty/http/client'
2
- require 'misty/microversion'
3
1
  require 'misty/openstack/manila/manila_v2'
2
+ require 'misty/client_pack'
3
+ require 'misty/microversion'
4
4
 
5
5
  module Misty
6
6
  module Openstack
7
7
  module Manila
8
- class V2 < Misty::HTTP::Client
9
- extend Misty::Openstack::ManilaV2
8
+ class V2
9
+ include Misty::Openstack::ManilaV2
10
+ include Misty::ClientPack
10
11
  include Misty::Microversion
11
12
 
12
- def self.api
13
- v2
14
- end
15
-
16
- def self.service_names
13
+ def service_names
17
14
  %w{shared-file-systems shared}
18
15
  end
19
16
  end
@@ -1,5 +1,5 @@
1
1
  module Misty::Openstack::MuranoV1
2
- def v1
2
+ def api
3
3
  {"/environments/{environment_id}/actions/{action_id}"=>
4
4
  {:POST=>[:execute_action]},
5
5
  "/environments/{environment_id}/actions/{task_id}"=>
@@ -1,17 +1,14 @@
1
- require 'misty/http/client'
2
1
  require 'misty/openstack/murano/murano_v1'
2
+ require 'misty/client_pack'
3
3
 
4
4
  module Misty
5
5
  module Openstack
6
6
  module Murano
7
- class V1 < Misty::HTTP::Client
8
- extend Misty::Openstack::MuranoV1
7
+ class V1
8
+ include Misty::Openstack::MuranoV1
9
+ include Misty::ClientPack
9
10
 
10
- def self.api
11
- v1
12
- end
13
-
14
- def self.service_names
11
+ def service_names
15
12
  %w{application-catalog}
16
13
  end
17
14
  end
@@ -1,5 +1,5 @@
1
1
  module Misty::Openstack::NeutronV2_0
2
- def v2_0
2
+ def api
3
3
  {"/"=>{:GET=>[:list_api_versions]},
4
4
  "/v2.0/"=>{:GET=>[:show_api_v2_details]},
5
5
  "/v2.0/extensions"=>{:GET=>[:list_extensions]},
@@ -1,17 +1,14 @@
1
- require 'misty/http/client'
2
1
  require 'misty/openstack/neutron/neutron_v2_0'
2
+ require 'misty/client_pack'
3
3
 
4
4
  module Misty
5
5
  module Openstack
6
6
  module Neutron
7
- class V2_0 < Misty::HTTP::Client
8
- extend Misty::Openstack::NeutronV2_0
7
+ class V2_0
8
+ include Misty::Openstack::NeutronV2_0
9
+ include Misty::ClientPack
9
10
 
10
- def self.api
11
- v2_0
12
- end
13
-
14
- def self.service_names
11
+ def service_names
15
12
  %w{network networking}
16
13
  end
17
14
  end
@@ -1,5 +1,5 @@
1
1
  module Misty::Openstack::NovaV2_1
2
- def v2_1
2
+ def api
3
3
  {"/"=>{:GET=>[:list_all_major_versions]},
4
4
  "/{api_version}"=>{:GET=>[:show_details_of_specific_api_version]},
5
5
  "/servers"=>
@@ -1,18 +1,16 @@
1
- require 'misty/http/client'
2
- require 'misty/microversion'
3
1
  require 'misty/openstack/nova/nova_v2_1'
2
+ require 'misty/client_pack'
3
+ require 'misty/microversion'
4
4
 
5
5
  module Misty
6
6
  module Openstack
7
7
  module Nova
8
- class V2_1 < Misty::HTTP::Client
9
- extend Misty::Openstack::NovaV2_1
8
+ class V2_1
9
+ include Misty::Openstack::NovaV2_1
10
+ include Misty::ClientPack
10
11
  include Misty::Microversion
11
12
 
12
- def self.api
13
- v2_1
14
- end
15
-
13
+ # TODO: Verify
16
14
  # Overrides API because the definitions don't specify prefix
17
15
  def self.list_all_major_versions
18
16
  http_get('/', headers)
@@ -22,7 +20,7 @@ module Misty
22
20
  http_get("/#{version}", headers)
23
21
  end
24
22
 
25
- def self.service_names
23
+ def service_names
26
24
  %w{compute}
27
25
  end
28
26
 
@@ -1,5 +1,5 @@
1
1
  module Misty::Openstack::OctaviaV2_0
2
- def v2_0
2
+ def api
3
3
  {"/v2.0/lbaas/loadbalancers"=>
4
4
  {:GET=>[:list_load_balancers], :POST=>[:create_a_load_balancer]},
5
5
  "/v2.0/lbaas/loadbalancers/{loadbalancer_id}"=>
@@ -1,17 +1,14 @@
1
- require 'misty/http/client'
2
1
  require 'misty/openstack/octavia/octavia_v2_0'
2
+ require 'misty/client_pack'
3
3
 
4
4
  module Misty
5
5
  module Openstack
6
6
  module Octavia
7
- class V2_0 < Misty::HTTP::Client
8
- extend Misty::Openstack::OctaviaV2_0
7
+ class V2_0
8
+ include Misty::Openstack::OctaviaV2_0
9
+ include Misty::ClientPack
9
10
 
10
- def self.api
11
- v2_0
12
- end
13
-
14
- def self.service_names
11
+ def service_names
15
12
  %w{load-balancer}
16
13
  end
17
14
  end
@@ -1,5 +1,5 @@
1
1
  module Misty::Openstack::SaharaV1_1
2
- def v1_1
2
+ def api
3
3
  {"/v1.1/{project_id}/cluster-templates/{cluster_template_id}"=>
4
4
  {:GET=>[:show_cluster_template_details],
5
5
  :PUT=>[:update_cluster_templates],
@@ -1,17 +1,14 @@
1
- require 'misty/http/client'
2
1
  require 'misty/openstack/sahara/sahara_v1_1'
2
+ require 'misty/client_pack'
3
3
 
4
4
  module Misty
5
5
  module Openstack
6
6
  module Sahara
7
- class V1_1 < Misty::HTTP::Client
8
- extend Misty::Openstack::SaharaV1_1
7
+ class V1_1
8
+ include Misty::Openstack::SaharaV1_1
9
+ include Misty::ClientPack
9
10
 
10
- def self.api
11
- v1_1
12
- end
13
-
14
- def self.service_names
11
+ def service_names
15
12
  %w{data-processing}
16
13
  end
17
14
  end
@@ -1,5 +1,5 @@
1
1
  module Misty::Openstack::SearchlightV1
2
- def v1
2
+ def api
3
3
  {"/v1/search/plugins"=>{:GET=>[:list_plugins]},
4
4
  "/v1/search/facets"=>{:GET=>[:list_facets]},
5
5
  "/v1/search"=>
@@ -1,17 +1,14 @@
1
- require 'misty/http/client'
2
1
  require 'misty/openstack/searchlight/searchlight_v1'
2
+ require 'misty/client_pack'
3
3
 
4
4
  module Misty
5
5
  module Openstack
6
6
  module Searchlight
7
- class V1 < Misty::HTTP::Client
8
- extend Misty::Openstack::SearchlightV1
7
+ class V1
8
+ include Misty::Openstack::SearchlightV1
9
+ include Misty::ClientPack
9
10
 
10
- def self.api
11
- v1
12
- end
13
-
14
- def self.service_names
11
+ def service_names
15
12
  %w{search}
16
13
  end
17
14
  end
@@ -1,5 +1,5 @@
1
1
  module Misty::Openstack::SenlinV1
2
- def v1
2
+ def api
3
3
  {"/"=>{:GET=>[:list_major_versions]},
4
4
  "/{version}/"=>{:GET=>[:show_details_of_an_api_version]},
5
5
  "/v1/build-info"=>{:GET=>[:shows_build_information]},
@@ -1,17 +1,14 @@
1
- require 'misty/http/client'
2
1
  require 'misty/openstack/senlin/senlin_v1'
2
+ require 'misty/client_pack'
3
3
 
4
4
  module Misty
5
5
  module Openstack
6
6
  module Senlin
7
- class V1 < Misty::HTTP::Client
8
- extend Misty::Openstack::SenlinV1
7
+ class V1
8
+ include Misty::Openstack::SenlinV1
9
+ include Misty::ClientPack
9
10
 
10
- def self.api
11
- v1
12
- end
13
-
14
- def self.service_names
11
+ def service_names
15
12
  %w{clustering}
16
13
  end
17
14
  end
@@ -1,5 +1,5 @@
1
1
  module Misty::Openstack::SwiftV1
2
- def v1
2
+ def api
3
3
  {"/info"=>{:GET=>[:list_activated_capabilities]},
4
4
  "/v1/{account}"=>
5
5
  {:GET=>[:show_account_details_and_list_containers],
@@ -1,23 +1,31 @@
1
- require 'misty/http/client'
2
1
  require 'misty/openstack/swift/swift_v1'
2
+ require 'misty/client_pack'
3
3
 
4
4
  module Misty
5
5
  module Openstack
6
6
  module Swift
7
- class V1 < Misty::HTTP::Client
8
- extend Misty::Openstack::SwiftV1
7
+ class V1
8
+ include Misty::Openstack::SwiftV1
9
+ include Misty::ClientPack
9
10
 
10
- def self.api
11
- v1
12
- end
13
-
14
- def self.prefix_path_to_ignore
11
+ def prefix_path_to_ignore
15
12
  '/v1/{account}'
16
13
  end
17
14
 
18
- def self.service_names
15
+ def service_names
19
16
  %w{object-storage object-store}
20
17
  end
18
+
19
+ # Custom requests
20
+ def requests_custom
21
+ [ :bulk_delete ]
22
+ end
23
+
24
+ def bulk_delete(data)
25
+ param = 'bulk-delete=1'
26
+ header = Misty::HTTP::Header.new('Content-Type' => 'text/plain')
27
+ create_update_or_delete_account_metadata(param, data, header)
28
+ end
21
29
  end
22
30
  end
23
31
  end
@@ -1,5 +1,5 @@
1
1
  module Misty::Openstack::TackerV1_0
2
- def v1_0
2
+ def api
3
3
  {"/"=>{:GET=>[:list_versions]},
4
4
  "/v1.0/extensions"=>{:GET=>[:list_extensions]},
5
5
  "/v1.0/extensions/{alias}"=>{:GET=>[:show_extension]},
@@ -1,17 +1,14 @@
1
- require 'misty/http/client'
2
1
  require 'misty/openstack/tacker/tacker_v1_0'
2
+ require 'misty/client_pack'
3
3
 
4
4
  module Misty
5
5
  module Openstack
6
6
  module Tacker
7
- class V1_0 < Misty::HTTP::Client
8
- extend Misty::Openstack::TackerV1_0
7
+ class V1_0
8
+ include Misty::Openstack::TackerV1_0
9
+ include Misty::ClientPack
9
10
 
10
- def self.api
11
- v1_0
12
- end
13
-
14
- def self.service_names
11
+ def service_names
15
12
  %w{nfv-orchestration}
16
13
  end
17
14
  end
@@ -1,5 +1,5 @@
1
1
  module Misty::Openstack::TroveV1_0
2
- def v1_0
2
+ def api
3
3
  {"/"=>{:GET=>[:list_versions]},
4
4
  "/v1.0"=>{:GET=>[:show_version_details]},
5
5
  "/v1.0/{accountId}/instances/{instanceId}"=>
@@ -1,17 +1,14 @@
1
- require 'misty/http/client'
2
1
  require 'misty/openstack/trove/trove_v1_0'
2
+ require 'misty/client_pack'
3
3
 
4
4
  module Misty
5
5
  module Openstack
6
6
  module Trove
7
- class V1_0 < Misty::HTTP::Client
8
- extend Misty::Openstack::TroveV1_0
7
+ class V1_0
8
+ include Misty::Openstack::TroveV1_0
9
+ include Misty::ClientPack
9
10
 
10
- def self.api
11
- v1_0
12
- end
13
-
14
- def self.service_names
11
+ def service_names
15
12
  %w{database}
16
13
  end
17
14
  end
@@ -1,17 +1,14 @@
1
- require 'misty/http/client'
2
1
  require 'misty/openstack/zaqar/zaqar_v2'
2
+ require 'misty/client_pack'
3
3
 
4
4
  module Misty
5
5
  module Openstack
6
6
  module Zaqar
7
- class V2 < Misty::HTTP::Client
8
- extend Misty::Openstack::ZaqarV2
7
+ class V2
8
+ include Misty::Openstack::ZaqarV2
9
+ include Misty::ClientPack
9
10
 
10
- def self.api
11
- v2
12
- end
13
-
14
- def self.service_names
11
+ def service_names
15
12
  %w{messaging}
16
13
  end
17
14
  end