misty 0.1.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (83) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +222 -1
  3. data/lib/misty.rb +8 -0
  4. data/lib/misty/auth.rb +60 -0
  5. data/lib/misty/auth/auth_v2.rb +46 -0
  6. data/lib/misty/auth/auth_v3.rb +58 -0
  7. data/lib/misty/autoload.rb +82 -0
  8. data/lib/misty/cloud.rb +133 -0
  9. data/lib/misty/http/client.rb +115 -0
  10. data/lib/misty/http/direct.rb +26 -0
  11. data/lib/misty/http/method_builder.rb +96 -0
  12. data/lib/misty/http/request.rb +75 -0
  13. data/lib/misty/misty.rb +51 -0
  14. data/lib/misty/openstack/aodh/aodh_v2.rb +12 -0
  15. data/lib/misty/openstack/aodh/v2.rb +20 -0
  16. data/lib/misty/openstack/ceilometer/ceilometer_v2.rb +13 -0
  17. data/lib/misty/openstack/ceilometer/v2.rb +20 -0
  18. data/lib/misty/openstack/cinder/cinder_v1.rb +35 -0
  19. data/lib/misty/openstack/cinder/cinder_v3.rb +148 -0
  20. data/lib/misty/openstack/cinder/v1.rb +24 -0
  21. data/lib/misty/openstack/cinder/v3.rb +24 -0
  22. data/lib/misty/openstack/designate/designate_v2.rb +69 -0
  23. data/lib/misty/openstack/designate/v2.rb +20 -0
  24. data/lib/misty/openstack/glance/glance_v1.rb +16 -0
  25. data/lib/misty/openstack/glance/glance_v2.rb +29 -0
  26. data/lib/misty/openstack/glance/v1.rb +20 -0
  27. data/lib/misty/openstack/glance/v2.rb +20 -0
  28. data/lib/misty/openstack/heat/heat_v1.rb +85 -0
  29. data/lib/misty/openstack/heat/v1.rb +24 -0
  30. data/lib/misty/openstack/ironic/ironic_v1.rb +71 -0
  31. data/lib/misty/openstack/ironic/v1.rb +26 -0
  32. data/lib/misty/openstack/karbor/karbor_v1.rb +32 -0
  33. data/lib/misty/openstack/karbor/v1.rb +20 -0
  34. data/lib/misty/openstack/keystone/keystone_v2_0.rb +11 -0
  35. data/lib/misty/openstack/keystone/keystone_v2_0_ext.rb +32 -0
  36. data/lib/misty/openstack/keystone/keystone_v3.rb +147 -0
  37. data/lib/misty/openstack/keystone/keystone_v3_ext.rb +124 -0
  38. data/lib/misty/openstack/keystone/v2_0.rb +23 -0
  39. data/lib/misty/openstack/keystone/v3.rb +23 -0
  40. data/lib/misty/openstack/magnum/magnum_v1.rb +41 -0
  41. data/lib/misty/openstack/magnum/v1.rb +26 -0
  42. data/lib/misty/openstack/manila/manila_v2.rb +143 -0
  43. data/lib/misty/openstack/manila/v2.rb +26 -0
  44. data/lib/misty/openstack/microversion.rb +62 -0
  45. data/lib/misty/openstack/neutron/neutron_v2_0.rb +205 -0
  46. data/lib/misty/openstack/neutron/v2_0.rb +20 -0
  47. data/lib/misty/openstack/nova/nova_v2_1.rb +269 -0
  48. data/lib/misty/openstack/nova/v2_1.rb +40 -0
  49. data/lib/misty/openstack/sahara/sahara_v1_1.rb +77 -0
  50. data/lib/misty/openstack/sahara/v1_1.rb +20 -0
  51. data/lib/misty/openstack/searchlight/searchlight_v1.rb +15 -0
  52. data/lib/misty/openstack/searchlight/v1.rb +20 -0
  53. data/lib/misty/openstack/senlin/senlin_v1.rb +66 -0
  54. data/lib/misty/openstack/senlin/v1.rb +20 -0
  55. data/lib/misty/openstack/swift/swift_v1.rb +23 -0
  56. data/lib/misty/openstack/swift/v1.rb +20 -0
  57. data/lib/misty/openstack/trove/trove_v1_0.rb +51 -0
  58. data/lib/misty/openstack/trove/v1_0.rb +20 -0
  59. data/lib/misty/openstack/zaqar/v2.rb +20 -0
  60. data/lib/misty/openstack/zaqar/zaqar_v2.rb +46 -0
  61. data/lib/misty/version.rb +2 -2
  62. data/test/integration/compute_test.rb +35 -0
  63. data/test/integration/network_test.rb +34 -0
  64. data/test/integration/orchestration_test.rb +92 -0
  65. data/test/integration/test_helper.rb +19 -0
  66. data/test/integration/vcr/compute_using_nova_v2_1.yml +1107 -0
  67. data/test/integration/vcr/network_using_neutron_v2_0.yml +1029 -0
  68. data/test/integration/vcr/orchestration_using_heat_v1.yml +1457 -0
  69. data/test/unit/auth_helper.rb +52 -0
  70. data/test/unit/auth_test.rb +99 -0
  71. data/test/unit/cloud/requests_test.rb +113 -0
  72. data/test/unit/cloud/services_test.rb +171 -0
  73. data/test/unit/cloud_test.rb +145 -0
  74. data/test/unit/http/client_test.rb +74 -0
  75. data/test/unit/http/direct_test.rb +103 -0
  76. data/test/unit/http/method_builder_test.rb +133 -0
  77. data/test/unit/http/request_test.rb +123 -0
  78. data/test/unit/misty_test.rb +36 -0
  79. data/test/unit/openstack/APIs_test.rb +40 -0
  80. data/test/unit/openstack/microversion_test.rb +70 -0
  81. data/test/unit/service_helper.rb +25 -0
  82. data/test/unit/test_helper.rb +8 -0
  83. metadata +170 -5
@@ -0,0 +1,124 @@
1
+ module Misty::Openstack::KeystoneV3
2
+ def v3_ext
3
+ {"/v3/policies/{policy_id}/OS-ENDPOINT-POLICY/endpoints/{endpoint_id}"=>
4
+ {:PUT=>[:associate_policy_and_endpoint],
5
+ :GET=>[:verify_a_policy_and_endpoint_association],
6
+ :DELETE=>[:delete_a_policy_and_endpoint_association]},
7
+ "/v3/policies/{policy_id}/OS-ENDPOINT-POLICY/services/{service_id}"=>
8
+ {:PUT=>[:associate_policy_and_service_type_endpoint],
9
+ :GET=>[:verify_a_policy_and_service_type_endpoint_association],
10
+ :DELETE=>[:delete_a_policy_and_service_type_endpoint_association]},
11
+ "/v3/policies/{policy_id}/OS-ENDPOINT-POLICY/policy"=>
12
+ {:GET=>[:show_policy_for_endpoint],
13
+ :HEAD=>[:check_policy_and_service_endpoint_association]},
14
+ "/v3/policies/{policy_id}/OS-ENDPOINT-POLICY/services/{service_id}/regions/{region_id}"=>
15
+ {:PUT=>[:associate_policy_and_service_type_endpoint_in_a_region],
16
+ :GET=>[:verify_a_policy_and_service_type_endpoint_in_a_region_association],
17
+ :DELETE=>
18
+ [:delete_a_policy_and_service_type_endpoint_in_a_region_association]},
19
+ "/v3/policies/{policy_id}/OS-ENDPOINT-POLICY/endpoints"=>
20
+ {:GET=>[:list_policy_and_service_endpoint_associations]},
21
+ "/v3/endpoints/{endpoint_id}/OS-ENDPOINT-POLICY/policy"=>
22
+ {:GET=>[:show_the_effective_policy_associated_with_an_endpoint]},
23
+ "/v3/OS-OAUTH1/consumers"=>
24
+ {:POST=>[:create_consumer], :GET=>[:list_consumers]},
25
+ "/v3/OS-OAUTH1/consumers/{consumer_id}"=>
26
+ {:DELETE=>[:delete_consumer],
27
+ :GET=>[:show_consumer_details],
28
+ :PATCH=>[:update_consumer]},
29
+ "/v3/OS-OAUTH1/request_token"=>{:POST=>[:create_request_token]},
30
+ "/v3/OS-OAUTH1/authorize/{request_token_id}"=>
31
+ {:POST=>[:authorize_request_token]},
32
+ "/v3/OS-OAUTH1/access_token"=>{:POST=>[:create_access_token]},
33
+ "/v3/users/{user_id}/OS-OAUTH1/access_tokens/{access_token_id}"=>
34
+ {:GET=>[:get_access_token], :DELETE=>[:revoke_access_token]},
35
+ "/v3/users/{user_id}/OS-OAUTH1/access_tokens"=>{:GET=>[:list_access_tokens]},
36
+ "/v3/users/{user_id}/OS-OAUTH1/access_tokens/{access_token_id}/roles"=>
37
+ {:GET=>[:list_roles_for_an_access_token]},
38
+ "/v3/users/{user_id}/OS-OAUTH1/access_tokens/{access_token_id}/roles/{role_id}"=>
39
+ {:GET=>[:show_role_details_for_an_access_token]},
40
+ "/v3/auth/tokens"=>
41
+ {:POST=>
42
+ [:authenticate_with_identity_api,
43
+ :consuming_a_trust,
44
+ :request_a_scoped_os_federation_token]},
45
+ "/v3/OS-TRUST/trusts"=>{:POST=>[:create_trust], :GET=>[:list_trusts]},
46
+ "/v3/OS-TRUST/trusts/{trust_id}"=>
47
+ {:GET=>[:get_trust], :DELETE=>[:delete_trust]},
48
+ "/v3/OS-TRUST/trusts/{trust_id}/roles"=>
49
+ {:GET=>[:list_roles_delegated_by_a_trust]},
50
+ "/v3/OS-TRUST/trusts/{trust_id}/roles/{role_id}"=>
51
+ {:HEAD=>[:check_if_a_role_is_delegated_by_a_trust],
52
+ :GET=>[:get_role_delegated_by_a_trust]},
53
+ "/v3/OS-REVOKE/events"=>{:GET=>[:list_revocation_events]},
54
+ "/v3/OS-EP-FILTER/endpoint_groups"=>
55
+ {:POST=>[:create_endpoint_group], :GET=>[:list_endpoint_groups]},
56
+ "/v3/OS-EP-FILTER/endpoint_groups/{endpoint_group_id}"=>
57
+ {:GET=>[:get_endpoint_group],
58
+ :HEAD=>[:check_endpoint_group],
59
+ :PATCH=>[:update_endpoint_group],
60
+ :DELETE=>[:delete_endpoint_group]},
61
+ "/v3/OS-EP-FILTER/projects/{project_id}/endpoints/{endpoint_id}"=>
62
+ {:PUT=>[:create_association],
63
+ :HEAD=>[:check_association],
64
+ :DELETE=>[:delete_association]},
65
+ "/v3/OS-EP-FILTER/projects/{project_id}/endpoints"=>
66
+ {:GET=>[:list_associations_by_project]},
67
+ "/v3/OS-EP-FILTER/endpoints/{endpoint_id}/projects"=>
68
+ {:GET=>[:list_associations_by_endpoint]},
69
+ "/v3/OS-EP-FILTER/endpoint_groups/{endpoint_group_id}/projects/{project_id}"=>
70
+ {:PUT=>[:create_endpoint_group_to_project_association],
71
+ :GET=>[:get_endpoint_group_to_project_association],
72
+ :HEAD=>[:check_endpoint_group_to_project_association],
73
+ :DELETE=>[:delete_endpoint_group_to_project_association]},
74
+ "/v3/OS-EP-FILTER/endpoint_groups/{endpoint_group_id}/projects"=>
75
+ {:GET=>[:list_projects_associated_with_endpoint_group]},
76
+ "/v3/OS-EP-FILTER/endpoint_groups/{endpoint_group_id}/endpoints"=>
77
+ {:GET=>[:list_endpoints_associated_with_endpoint_group]},
78
+ "/v3/OS-EP-FILTER/projects/{project_id}/endpoint_groups"=>
79
+ {:GET=>[:list_endpoint_groups_associated_with_project]},
80
+ "/v3/OS-FEDERATION/identity_providers/{id}"=>
81
+ {:PUT=>[:register_an_identity_provider],
82
+ :GET=>[:get_identity_provider],
83
+ :DELETE=>[:delete_identity_provider],
84
+ :PATCH=>[:update_identity_provider]},
85
+ "/v3/OS-FEDERATION/identity_providers"=>{:GET=>[:list_identity_providers]},
86
+ "/v3/OS-FEDERATION/identity_providers/{idp_id}/protocols/{protocol_id}"=>
87
+ {:PUT=>[:add_a_protocol_and_attribute_mapping_to_an_identity_provider],
88
+ :GET=>[:get_a_protocol_and_attribute_mapping_for_an_identity_provider],
89
+ :PATCH=>
90
+ [:update_the_attribute_mapping_for_an_identity_provider_and_protocol],
91
+ :DELETE=>
92
+ [:delete_a_protocol_and_attribute_mapping_from_an_identity_provider]},
93
+ "/v3/OS-FEDERATION/identity_providers/{id}/protocols"=>
94
+ {:GET=>[:list_all_protocol_and_attribute_mappings_of_an_identity_provider]},
95
+ "/v3/OS-FEDERATION/mappings/{id}"=>
96
+ {:PUT=>[:create_a_mapping],
97
+ :GET=>[:get_a_mapping],
98
+ :PATCH=>[:update_a_mapping],
99
+ :DELETE=>[:delete_a_mapping]},
100
+ "/v3/OS-FEDERATION/mappings"=>{:GET=>[:list_all_mappings]},
101
+ "/v3/OS-FEDERATION/service_providers/{id}"=>
102
+ {:PUT=>[:register_a_service_provider],
103
+ :GET=>[:get_service_provider],
104
+ :DELETE=>[:delete_service_provider],
105
+ :PATCH=>[:update_service_provider]},
106
+ "/v3/OS-FEDERATION/service_providers"=>{:GET=>[:listing_service_providers]},
107
+ "/v3/OS-FEDERATION/projects"=>
108
+ {:GET=>[:list_projects_a_federated_user_can_access]},
109
+ "/v3/OS-FEDERATION/domains"=>
110
+ {:GET=>[:list_domains_a_federated_user_can_access]},
111
+ "/v3/OS-FEDERATION/identity_providers/{idp_id}/protocols/{protocol_id}/auth"=>
112
+ {:GET=>[:request_an_unscoped_os_federation_token]},
113
+ "/v3/auth/OS-FEDERATION/websso/{protocol_id}?origin=https%3A//horizon.example.com"=>
114
+ {:GET=>[:web_single_sign_on_authentication_new_in_version_1_2]},
115
+ "/v3/auth/OS-FEDERATION/identity_providers/{idp_id}/protocol/{protocol_id}/websso?origin=https%3A//horizon.example.com"=>
116
+ {:GET=>[:web_single_sign_on_authentication_new_in_version_1_3]},
117
+ "/v3/auth/OS-FEDERATION/saml2"=>{:POST=>[:generate_a_saml_assertion]},
118
+ "/v3/auth/OS-FEDERATION/saml2/ecp"=>
119
+ {:POST=>[:generate_an_ecp_wrapped_saml_assertion]},
120
+ "/v3/OS-FEDERATION/saml2/metadata"=>{:GET=>[:retrieve_metadata_properties]},
121
+ "/v3/OS-SIMPLE-CERT/ca"=>{:GET=>[:show_ca_certificate]},
122
+ "/v3/OS-SIMPLE-CERT/certificates"=>{:GET=>[:show_signing_certificate]}}
123
+ end
124
+ end
@@ -0,0 +1,23 @@
1
+ require 'misty/http/client'
2
+ require "misty/openstack/keystone/keystone_v2_0"
3
+ require "misty/openstack/keystone/keystone_v2_0_ext"
4
+
5
+ module Misty
6
+ module Openstack
7
+ module Keystone
8
+ class V2_0 < Misty::HTTP::Client
9
+ extend Misty::Openstack::KeystoneV2_0
10
+
11
+ def self.api
12
+ api = v2_0
13
+ api.merge!(v2_0_ext)
14
+ api
15
+ end
16
+
17
+ def self.service_names
18
+ %w{identity}
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,23 @@
1
+ require 'misty/http/client'
2
+ require "misty/openstack/keystone/keystone_v3"
3
+ require "misty/openstack/keystone/keystone_v3_ext"
4
+
5
+ module Misty
6
+ module Openstack
7
+ module Keystone
8
+ class V3 < Misty::HTTP::Client
9
+ extend Misty::Openstack::KeystoneV3
10
+
11
+ def self.api
12
+ api = v3
13
+ api.merge!(v3_ext)
14
+ api
15
+ end
16
+
17
+ def self.service_names
18
+ %w{identity}
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,41 @@
1
+ module Misty::Openstack::MagnumV1
2
+ def v1
3
+ {"/"=>{:GET=>[:list_api_versions]},
4
+ "/v1/"=>{:GET=>[:show_v1_api_version]},
5
+ "/v1/bays"=>{:POST=>[:create_new_bay]},
6
+ "/v1/bays/"=>{:GET=>[:list_all_bay]},
7
+ "/v1/bays/{bay_ident}"=>
8
+ {:GET=>[:show_details_of_a_bay],
9
+ :DELETE=>[:delete_a_bay],
10
+ :PATCH=>[:update_information_of_bay]},
11
+ "/v1/baymodels/"=>
12
+ {:POST=>[:create_new_baymodel], :GET=>[:list_all_baymodels]},
13
+ "/v1/baymodels/{baymodel_ident}"=>
14
+ {:GET=>[:show_details_of_a_baymodel],
15
+ :DELETE=>[:delete_a_baymodel],
16
+ :PATCH=>[:update_information_of_baymodel]},
17
+ "/v1/clusters"=>{:POST=>[:create_new_cluster], :GET=>[:list_all_cluster]},
18
+ "/v1/clusters/{cluster_ident}"=>
19
+ {:GET=>[:show_details_of_a_cluster],
20
+ :DELETE=>[:delete_a_cluster],
21
+ :PATCH=>[:update_information_of_cluster]},
22
+ "/v1/clustertemplates"=>
23
+ {:POST=>[:create_new_cluster_template], :GET=>[:list_all_cluster_templates]},
24
+ "/v1/clustertemplates/{clustertemplate_ident}"=>
25
+ {:GET=>[:show_details_of_a_cluster_template],
26
+ :DELETE=>[:delete_a_cluster_template],
27
+ :PATCH=>[:update_information_of_cluster_template]},
28
+ "/v1/certificates/{bay_uuid/cluster_uuid}"=>
29
+ {:GET=>[:show_details_about_the_ca_certificate_for_a_bay_cluster],
30
+ :PATCH=>[:rotate_the_ca_certificate_for_a_bay_cluster]},
31
+ "/v1/certificates/"=>
32
+ {:POST=>[:generate_the_ca_certificate_for_a_bay_cluster]},
33
+ "/v1/mservices"=>
34
+ {:GET=>[:show_container_infrastructure_management_service_status]},
35
+ "/v1/stats?project_id="=>{:GET=>[:show_stats_for_a_tenant]},
36
+ "/v1/stats"=>{:GET=>[:show_overall_stats]},
37
+ "/v1/quotas"=>{:POST=>[:set_new_quota], :GET=>[:list_all_quotas]},
38
+ "/v1/quotas/{project_id}/{resource}"=>
39
+ {:GET=>[:show_details_of_a_quota], :PATCH=>[:update_a_resource_quota]}}
40
+ end
41
+ end
@@ -0,0 +1,26 @@
1
+ require 'misty/http/client'
2
+ require 'misty/openstack/microversion'
3
+ require "misty/openstack/magnum/magnum_v1"
4
+
5
+ module Misty
6
+ module Openstack
7
+ module Magnum
8
+ class V1 < Misty::HTTP::Client
9
+ extend Misty::Openstack::MagnumV1
10
+ include Misty::HTTP::Microversion
11
+
12
+ def self.api
13
+ v1
14
+ end
15
+
16
+ def self.service_names
17
+ %w{container}
18
+ end
19
+
20
+ def microversion_header
21
+ { "X-Openstack-API-Version" => "#{baseclass.downcase} #{@version}" }
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,143 @@
1
+ module Misty::Openstack::ManilaV2
2
+ def v2
3
+ {"/"=>{:GET=>[:list_all_major_versions]},
4
+ "/{api_version}"=>{:GET=>[:show_details_of_specific_api_version]},
5
+ "/v2/{tenant_id}/extensions"=>{:GET=>[:list_extensions]},
6
+ "/v2/{tenant_id}/limits"=>{:GET=>[:list_share_limits]},
7
+ "/v2/{tenant_id}/shares"=>{:GET=>[:list_shares], :POST=>[:create_share]},
8
+ "/v2/{tenant_id}/shares/detail"=>{:GET=>[:list_shares_with_details]},
9
+ "/v2/{tenant_id}/shares/{share_id}"=>
10
+ {:GET=>[:show_share_details],
11
+ :PUT=>[:update_share],
12
+ :DELETE=>[:delete_share]},
13
+ "/v2/{tenant_id}/shares/manage"=>{:GET=>[:manage_share]},
14
+ "/v2/{tenant_id}/shares/{share_id}/export_locations"=>
15
+ {:GET=>[:list_export_locations]},
16
+ "/v2/{tenant_id}/shares/{share_id}/export_locations/​{export_location_id}​"=>
17
+ {:GET=>[:show_single_export_location]},
18
+ "/v2/{tenant_id}/shares/{share_id}/metadata"=>
19
+ {:GET=>[:show_share_metadata],
20
+ :POST=>[:set_share_metadata],
21
+ :PUT=>[:update_share_metadata]},
22
+ "/v2/{tenant_id}/shares/{share_id}/metadata/{key}"=>
23
+ {:DELETE=>[:unset_share_metadata]},
24
+ "/v2/{tenant_id}/shares/{share_id}/action"=>
25
+ {:POST=>
26
+ [:grant_access,
27
+ :revoke_access,
28
+ :list_access_rules,
29
+ :reset_share_state,
30
+ :force_delete_share,
31
+ :extend_share,
32
+ :shrink_share,
33
+ :unmanage_share,
34
+ :revert_share_to_snapshot,
35
+ :migrate_share_versions_2_5_to_2_14,
36
+ :start_migration_since_version_2_15,
37
+ :complete_migration_since_version_2_15]},
38
+ "/v2/{tenant_id}/snapshots"=>
39
+ {:GET=>[:list_share_snapshots], :POST=>[:create_share_snapshot]},
40
+ "/v2/{tenant_id}/snapshots/detail"=>
41
+ {:GET=>[:list_share_snapshots_with_details]},
42
+ "/v2/{tenant_id}/snapshots/{snapshot_id}"=>
43
+ {:GET=>[:show_share_snapshot_details],
44
+ :PUT=>[:update_share_snapshot],
45
+ :DELETE=>[:delete_share_snapshot]},
46
+ "/v2/{tenant_id}/snapshots/manage"=>{:POST=>[:manage_share_snapshot]},
47
+ "/v2/{tenant_id}/snapshots/{snapshot_id}/action"=>
48
+ {:POST=>
49
+ [:unmanage_share_snapshot,
50
+ :reset_share_snapshot_state,
51
+ :force_delete_share_snapshot]},
52
+ "/v2/{tenant_id}/share-networks"=>
53
+ {:GET=>[:list_share_networks], :POST=>[:create_share_network]},
54
+ "/v2/{tenant_id}/share-networks/detail"=>
55
+ {:GET=>[:list_share_networks_with_details]},
56
+ "/v2/{tenant_id}/share-networks/{share_network_id}"=>
57
+ {:GET=>[:show_share_network_details],
58
+ :PUT=>[:update_share_network],
59
+ :DELETE=>[:delete_share_network]},
60
+ "/v2/{tenant_id}/share-networks/{share_network_id}/action"=>
61
+ {:POST=>
62
+ [:add_security_service_to_share_network,
63
+ :remove_security_service_from_share_network]},
64
+ "/v2/{tenant_id}/security-services"=>
65
+ {:GET=>[:list_security_services], :POST=>[:create_security_service]},
66
+ "/v2/{tenant_id}/security-services/detail"=>
67
+ {:GET=>[:list_security_services_with_details]},
68
+ "/v2/{tenant_id}/security-services/{security_service_id}"=>
69
+ {:GET=>[:show_security_service_details],
70
+ :PUT=>[:update_security_service],
71
+ :DELETE=>[:delete_security_service]},
72
+ "/v2/{tenant_id}/share-servers"=>{:GET=>[:list_share_servers]},
73
+ "/v2/{tenant_id}/share-servers/{share_server_id}/detail"=>
74
+ {:GET=>[:show_share_server_details]},
75
+ "/v2/{tenant_id}/share-servers/{share_server_id}"=>
76
+ {:DELETE=>[:delete_share_server]},
77
+ "/v2/{tenant_id}/share_instances"=>{:GET=>[:list_share_instances]},
78
+ "/v2/{tenant_id}/share_instances/{share_instance_id}"=>
79
+ {:GET=>[:show_share_instance_details]},
80
+ "/v2/{tenant_id}/share_instances/{share_instance_id}/action"=>
81
+ {:POST=>[:reset_share_instance_state, :force_delete_share_instance]},
82
+ "/v2/{tenant_id}/share_instances/{share_instance_id}/export_locations"=>
83
+ {:GET=>[:list_export_locations_by_share_instance]},
84
+ "/v2/{tenant_id}/share_instances/{share_instance_id}/export_locations/{export_location_id}"=>
85
+ {:GET=>[:show_single_export_location_by_share_instance]},
86
+ "/v2/{tenant_id}/types"=>
87
+ {:GET=>[:list_share_types], :POST=>[:create_share_type]},
88
+ "/v2/{tenant_id}/types/default"=>{:GET=>[:list_default_share_types]},
89
+ "/v2/{tenant_id}/types/{share_type_id}/extra_specs"=>
90
+ {:GET=>[:list_extra_specs], :POST=>[:set_extra_spec_for_share_type]},
91
+ "/v2/{tenant_id}/types/{share_type_id}/share_type_access"=>
92
+ {:GET=>[:show_share_type_access_details]},
93
+ "/v2/{tenant_id}/types/{share_type_id}/extra_specs/{extra-spec-key}"=>
94
+ {:DELETE=>[:unset_an_extra_spec]},
95
+ "/v2/{tenant_id}/types/{share_type_id}/action"=>
96
+ {:POST=>[:add_share_type_access, :remove_share_type_access]},
97
+ "/v2/{tenant_id}/types/{share_type_id}"=>{:DELETE=>[:delete_share_type]},
98
+ "/v2/{tenant_id}/scheduler-stats/pools?pool={pool_name}&host={host_name}&backend={backend_name}&capabilities={capabilities}&share_type={share_type}"=>
99
+ {:GET=>[:list_back_end_storage_pools]},
100
+ "/v2/{tenant_id}/scheduler-stats/pools/detail?pool={pool_name}&host={host_name}&backend={backend_name}&capabilities={capabilities}&share_type={share_type}"=>
101
+ {:GET=>[:list_back_end_storage_pools_with_details]},
102
+ "/v2/{tenant_id}/services?host={host}&binary={binary}&zone={zone}&state={state}&status={status}"=>
103
+ {:GET=>[:list_services]},
104
+ "/v2/{tenant_id}/services/enable"=>{:PUT=>[:enable_service]},
105
+ "/v2/{tenant_id}/services/disable"=>{:PUT=>[:disable_service]},
106
+ "/v2/{tenant_id}/availability-zones"=>{:GET=>[:list_availability_zones]},
107
+ "/v2/{tenant_id}/os-share-manage"=>{:POST=>[:manage_share], :version => {:min => "2.0", :max => "2.6"}},
108
+ "/v2/{tenant_id}/os-share-unmanage/{share_id}/unmanage"=>{:POST=> [:unmanage_share], :version => {:min => "2.0", :max => "2.6"}},
109
+ "/v2/{tenant_id}/quota-sets/{tenant_id}/defaults"=>
110
+ {:GET=>[:show_default_quota_set]},
111
+ "/v2/{tenant_id}/quota-sets/{tenant_id}?user_id={user_id}"=>
112
+ {:GET=>[:show_quota_set],
113
+ :PUT=>[:update_quota_set],
114
+ :DELETE=>[:delete_quota_set]},
115
+ "/v2/{tenant_id}/quota-sets/{tenant_id}/detail?user_id={user_id}"=>
116
+ {:GET=>[:show_quota_set_in_detail]},
117
+ "/v2/{tenant_id}/consistency-groups"=>
118
+ {:GET=>[:list_consistency_groups], :POST=>[:create_consistency_group]},
119
+ "/v2/{tenant_id}/consistency-groups/detail"=>
120
+ {:GET=>[:list_consistency_groups_with_details]},
121
+ "/v2/{tenant_id}/consistency-groups/{consistency_group_id}"=>
122
+ {:GET=>[:show_consistency_group_details],
123
+ :PUT=>[:update_consistency_group],
124
+ :DELETE=>[:delete_consistency_group]},
125
+ "/v2/{tenant_id}/consistency-groups/{consistency_group_id}/action"=>
126
+ {:POST=>[:reset_consistency_group_state, :force_delete_consistency_group]},
127
+ "/v2/{tenant_id}/cgsnapshots"=>
128
+ {:GET=>[:list_consistency_group_snapshots],
129
+ :POST=>[:create_consistency_group_snapshot]},
130
+ "/v2/{tenant_id}/cgsnapshots/detail"=>
131
+ {:GET=>[:list_consistency_group_snapshots_with_details]},
132
+ "/v2/{tenant_id}/cgsnapshots/{cgsnapshot_id}"=>
133
+ {:GET=>[:show_consistency_group_snapshot_details],
134
+ :PUT=>[:update_consistency_group_snapshot],
135
+ :DELETE=>[:delete_consistency_group_snapshot]},
136
+ "/v2/{tenant_id}/cgsnapshots/{cgsnapshot_id}/members"=>
137
+ {:GET=>[:list_consistency_group_snapshot_members]},
138
+ "/v2/{tenant_id}/cgsnapshots/{cgsnapshot_id}/action"=>
139
+ {:POST=>
140
+ [:reset_consistency_group_snapshot_state,
141
+ :force_delete_consistency_group_snapshot]}}
142
+ end
143
+ end
@@ -0,0 +1,26 @@
1
+ require 'misty/http/client'
2
+ require 'misty/openstack/microversion'
3
+ require "misty/openstack/manila/manila_v2"
4
+
5
+ module Misty
6
+ module Openstack
7
+ module Manila
8
+ class V2 < Misty::HTTP::Client
9
+ extend Misty::Openstack::ManilaV2
10
+ include Misty::HTTP::Microversion
11
+
12
+ def self.api
13
+ v2
14
+ end
15
+
16
+ def self.service_names
17
+ %w{shared-file-systems shared}
18
+ end
19
+
20
+ def microversion_header
21
+ { "X-Openstack-Manila-API-Version" => "#{@version}" }
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,62 @@
1
+ module Misty
2
+ # TODO: move to Openstack module
3
+ module HTTP
4
+ module Microversion
5
+ class VersionError < RuntimeError; end
6
+
7
+ VERSION_STATES = %w{CURRENT LATEST SUPPORTED}
8
+
9
+ def initialize(cloud, options)
10
+ super
11
+ @microversion = true
12
+ @version = version_get(@options.version)
13
+ end
14
+
15
+ def version_get(version_option)
16
+ if VERSION_STATES.include?(version_option)
17
+ return version_by_state(version_option)
18
+ else
19
+ return version_by_number(version_option)
20
+ end
21
+ end
22
+
23
+ def versions
24
+ @versions ||= versions_fetch
25
+ end
26
+
27
+ private
28
+
29
+ def version_by_number(number)
30
+ versions.each do |version|
31
+ return number if version["min_version"] <= number && version["version"] >= number
32
+ end
33
+ raise VersionError, "Version #{number} is out of range of available versions #{versions}"
34
+ end
35
+
36
+ def version_by_state(state)
37
+ version_details = nil
38
+ versions.each do |version|
39
+ if version["status"] == state
40
+ version_details = version
41
+ break
42
+ end
43
+ end
44
+ raise VersionError, "Version #{state} is not available among #{versions}" if version_details.nil?
45
+ if version_details["version"].empty?
46
+ @microversion = false
47
+ return ""
48
+ end
49
+ version_details["version"]
50
+ end
51
+
52
+ def versions_fetch
53
+ request = Net::HTTP::Get.new("/", headers_default)
54
+ response = @http.request request
55
+ raise VersionError, "Code: #{response.code}, Message: #{response.msg}" unless response.code =~ /2??/
56
+ list = JSON.load(response.body)["versions"]
57
+ raise VersionError, "Missing version data" unless list
58
+ list
59
+ end
60
+ end
61
+ end
62
+ end