aviator 0.0.2 → 0.0.3

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 (71) hide show
  1. data/README.md +9 -1
  2. data/aviator.gemspec +1 -1
  3. data/bin/aviator +6 -86
  4. data/lib/aviator/core/cli/describer.rb +95 -0
  5. data/lib/aviator/core/cli.rb +1 -0
  6. data/lib/aviator/core/request.rb +62 -65
  7. data/lib/aviator/core/service.rb +26 -41
  8. data/lib/aviator/core/session.rb +7 -0
  9. data/lib/aviator/core.rb +1 -0
  10. data/lib/aviator/openstack/compute/v2/public/list_images.rb +51 -42
  11. data/lib/aviator/openstack/compute/v2/public/list_servers.rb +58 -0
  12. data/lib/aviator/openstack/identity/v2/admin/create_tenant.rb +43 -32
  13. data/lib/aviator/openstack/identity/v2/admin/list_tenants.rb +49 -38
  14. data/lib/aviator/openstack/identity/v2/public/create_token.rb +53 -47
  15. data/lib/aviator/openstack/identity/v2/public/list_tenants.rb +36 -26
  16. data/lib/aviator/version.rb +1 -1
  17. data/lib/aviator.rb +1 -0
  18. data/test/aviator/core/cli/describer_test.rb +140 -0
  19. data/test/aviator/core/request_test.rb +132 -157
  20. data/test/aviator/core/service_test.rb +49 -26
  21. data/test/aviator/core/session_test.rb +29 -0
  22. data/test/aviator/openstack/compute/v2/public/list_images_test.rb +16 -18
  23. data/test/aviator/openstack/compute/v2/public/list_servers_test.rb +178 -0
  24. data/test/aviator/openstack/identity/v2/admin/create_tenant_test.rb +10 -12
  25. data/test/aviator/openstack/identity/v2/public/create_token_test.rb +12 -14
  26. data/test/cassettes/core/service/i_default_session_data_/sets_the_service_s_default_session_data.yml +1 -1
  27. data/test/cassettes/core/service/i_request/accepts_an_endpoint_type_option_for_selecting_a_specific_request.yml +1 -1
  28. data/test/cassettes/core/service/i_request/can_find_the_correct_request_based_on_bootstrapped_session_data.yml +1 -1
  29. data/test/cassettes/core/service/i_request/can_find_the_correct_request_based_on_non-bootstrapped_session_data.yml +1 -1
  30. data/test/cassettes/core/service/i_request/can_find_the_correct_request_if_api_version_is_not_defined_but_can_be_inferred_from_host_uri.yml +1 -1
  31. data/test/cassettes/core/service/i_request/uses_the_default_session_data_if_session_data_is_not_provided.yml +1 -1
  32. data/test/cassettes/core/session/c_load/creates_a_new_instance_from_the_given_session_dump.yml +1 -1
  33. data/test/cassettes/core/session/c_load/uses_the_loaded_auth_info_for_its_services.yml +1 -1
  34. data/test/cassettes/core/session/c_new/directs_log_entries_to_the_given_log_file.yml +1 -1
  35. data/test/cassettes/core/session/i_authenticate/authenticates_against_the_auth_service_indicated_in_the_config_file.yml +1 -1
  36. data/test/cassettes/core/session/i_authenticate/authenticates_against_the_auth_service_using_the_credentials_in_the_given_block.yml +1 -1
  37. data/test/cassettes/core/session/i_authenticate/updates_the_session_data_of_its_service_objects.yml +2 -2
  38. data/test/cassettes/core/session/i_dump/serializes_the_session_data_for_caching.yml +1 -1
  39. data/test/cassettes/core/session/i_load/returns_itself.yml +63 -0
  40. data/test/cassettes/core/session/i_load/updates_the_session_data_of_its_service_objects.yml +123 -0
  41. data/test/cassettes/core/session/i_validate/returns_false_if_session_is_no_longer_valid.yml +1 -1
  42. data/test/cassettes/core/session/i_validate/returns_true_if_session_is_still_valid.yml +1 -1
  43. data/test/cassettes/core/session/i_xxx_service/returns_an_instance_of_the_indicated_service.yml +1 -1
  44. data/test/cassettes/openstack/compute/v2/public/list_images/leads_to_a_valid_response_when_no_parameters_are_provided.yml +1 -1
  45. data/test/cassettes/openstack/compute/v2/public/list_images/leads_to_a_valid_response_when_parameters_are_invalid.yml +1 -1
  46. data/test/cassettes/openstack/compute/v2/public/list_images/leads_to_a_valid_response_when_parameters_are_valid.yml +1 -1
  47. data/test/cassettes/openstack/compute/v2/public/list_images/returns_the_correct_value_for_body.yml +1 -1
  48. data/test/cassettes/openstack/compute/v2/public/list_images/returns_the_correct_value_for_body_.yml +1 -1
  49. data/test/cassettes/openstack/compute/v2/public/list_images/returns_the_correct_value_for_headers.yml +1 -1
  50. data/test/cassettes/openstack/compute/v2/public/list_images/returns_the_correct_value_for_headers_.yml +1 -1
  51. data/test/cassettes/openstack/compute/v2/public/list_images/returns_the_correct_value_for_http_method_.yml +63 -0
  52. data/test/cassettes/openstack/compute/v2/public/list_images/returns_the_correct_value_for_url.yml +1 -1
  53. data/test/cassettes/openstack/compute/v2/public/list_images/returns_the_correct_value_for_url_.yml +1 -1
  54. data/test/cassettes/openstack/compute/v2/public/list_servers/leads_to_a_valid_response_when_no_parameters_are_provided.yml +101 -0
  55. data/test/cassettes/openstack/compute/v2/public/list_servers/leads_to_a_valid_response_when_parameters_are_invalid.yml +95 -0
  56. data/test/cassettes/openstack/compute/v2/public/list_servers/leads_to_a_valid_response_when_parameters_are_valid.yml +109 -0
  57. data/test/cassettes/openstack/compute/v2/public/list_servers/returns_the_correct_value_for_body_.yml +62 -0
  58. data/test/cassettes/openstack/compute/v2/public/list_servers/returns_the_correct_value_for_headers_.yml +62 -0
  59. data/test/cassettes/openstack/compute/v2/public/list_servers/returns_the_correct_value_for_http_method_.yml +62 -0
  60. data/test/cassettes/openstack/compute/v2/public/list_servers/returns_the_correct_value_for_url_.yml +62 -0
  61. data/test/cassettes/openstack/identity/v2/admin/create_tenant/leads_to_a_valid_response_when_params_are_invalid.yml +1 -1
  62. data/test/cassettes/openstack/identity/v2/admin/create_tenant/leads_to_a_valid_response_when_params_are_valid.yml +1 -1
  63. data/test/cassettes/openstack/identity/v2/admin/create_tenant/leads_to_a_valid_response_when_provided_with_invalid_params.yml +1 -1
  64. data/test/cassettes/openstack/identity/v2/public/create_token/leads_to_a_valid_response_when_parameters_are_valid.yml +1 -1
  65. data/test/cassettes/openstack/identity/v2/public/create_token/leads_to_a_valid_response_when_provided_with_a_token.yml +2 -2
  66. data/test/support/{openstack_request_test_helper.rb → request_helper.rb} +21 -2
  67. data/test/support/test_base_class.rb +1 -1
  68. data/test/support/test_reporter.rb +4 -2
  69. data/test/support/vcr_setup.rb +4 -0
  70. data/test/test_helper.rb +5 -1
  71. metadata +38 -10
@@ -0,0 +1,62 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: <HOST_URI>:5000/v2.0/tokens
6
+ body:
7
+ encoding: UTF-8
8
+ string: ! '{"auth":{"passwordCredentials":{"username":"<USERNAME>","password":"<PASSWORD>"},"tenantName":"<TENANT>"}}'
9
+ headers:
10
+ Content-Type:
11
+ - application/json
12
+ User-Agent:
13
+ - Faraday v0.8.8
14
+ response:
15
+ status:
16
+ code: 200
17
+ message:
18
+ headers:
19
+ vary:
20
+ - X-Auth-Token
21
+ content-type:
22
+ - application/json
23
+ content-length:
24
+ - '2749'
25
+ date:
26
+ - Tue, 03 Sep 2013 21:21:30 GMT
27
+ connection:
28
+ - close
29
+ body:
30
+ encoding: US-ASCII
31
+ string: ! '{"access": {"token": {"issued_at": "2013-09-03T21:21:30.309056",
32
+ "expires": "2013-09-04T03:21:30Z", "id": "1df8146f7ba34ab7a311157433cf079b",
33
+ "tenant": {"description": "System account for Morphlabs mCloud administration",
34
+ "enabled": true, "id": "e7b1b62aa1474f758c4974b8be44cf6c", "name": "demo"}},
35
+ "serviceCatalog": [{"endpoints": [{"adminURL": "<HOST_URI>:8774/v2/e7b1b62aa1474f758c4974b8be44cf6c",
36
+ "region": "RegionOne", "internalURL": "<HOST_URI>:8774/v2/e7b1b62aa1474f758c4974b8be44cf6c",
37
+ "id": "6bb597a3738045f4b2c51a7702037cab", "publicURL": "<HOST_URI>:8774/v2/e7b1b62aa1474f758c4974b8be44cf6c"}],
38
+ "endpoints_links": [], "type": "compute", "name": "nova"}, {"endpoints": [{"adminURL":
39
+ "<HOST_URI>:9292", "region": "RegionOne", "internalURL": "<HOST_URI>:9292",
40
+ "id": "2985945e07b74103bb2dfef7e426cd43", "publicURL": "<HOST_URI>:9292"}],
41
+ "endpoints_links": [], "type": "image", "name": "glance"}, {"endpoints": [{"adminURL":
42
+ "<HOST_URI>:8777", "region": "RegionOne", "internalURL": "<HOST_URI>:8777",
43
+ "id": "370119dd80e84894bfe83d766fd467dd", "publicURL": "<HOST_URI>:8777"}],
44
+ "endpoints_links": [], "type": "metering", "name": "ceilometer"}, {"endpoints":
45
+ [{"adminURL": "<HOST_URI>:8776/v1/e7b1b62aa1474f758c4974b8be44cf6c", "region":
46
+ "RegionOne", "internalURL": "<HOST_URI>:8776/v1/e7b1b62aa1474f758c4974b8be44cf6c",
47
+ "id": "2492a6f5fa80466d9312e51a8f79b638", "publicURL": "<HOST_URI>:8776/v1/e7b1b62aa1474f758c4974b8be44cf6c"}],
48
+ "endpoints_links": [], "type": "volume", "name": "cinder"}, {"endpoints":
49
+ [{"adminURL": "<HOST_URI>:8773/services/Admin", "region": "RegionOne", "internalURL":
50
+ "<HOST_URI>:8773/services/Cloud", "id": "1f68f3ce931946c788e487443e772fb2",
51
+ "publicURL": "<HOST_URI>:8773/services/Cloud"}], "endpoints_links": [], "type":
52
+ "ec2", "name": "nova_ec2"}, {"endpoints": [{"adminURL": "<HOST_URI>:35357/v2.0",
53
+ "region": "RegionOne", "internalURL": "<HOST_URI>:5000/v2.0", "id": "12c722e9b9fb471fbea83c6157c0123a",
54
+ "publicURL": "<HOST_URI>:5000/v2.0"}], "endpoints_links": [], "type": "identity",
55
+ "name": "keystone"}], "user": {"username": "morphadmin", "roles_links": [],
56
+ "id": "87f34120be394c598520744d0f4a8233", "roles": [{"name": "Member"}, {"name":
57
+ "admin"}, {"name": "project_manager"}], "name": "morphadmin"}, "metadata":
58
+ {"is_admin": 0, "roles": ["f970c227c0ee4512899606886348f67f", "a0d6ba8f41b746b495a6d25c69962489",
59
+ "88141c3fd5cd48459cfe1243bfa6d4e1"]}}}'
60
+ http_version:
61
+ recorded_at: Tue, 03 Sep 2013 21:21:30 GMT
62
+ recorded_with: VCR 2.5.0
@@ -0,0 +1,62 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: <HOST_URI>:5000/v2.0/tokens
6
+ body:
7
+ encoding: UTF-8
8
+ string: ! '{"auth":{"passwordCredentials":{"username":"<USERNAME>","password":"<PASSWORD>"},"tenantName":"<TENANT>"}}'
9
+ headers:
10
+ Content-Type:
11
+ - application/json
12
+ User-Agent:
13
+ - Faraday v0.8.8
14
+ response:
15
+ status:
16
+ code: 200
17
+ message:
18
+ headers:
19
+ vary:
20
+ - X-Auth-Token
21
+ content-type:
22
+ - application/json
23
+ content-length:
24
+ - '2749'
25
+ date:
26
+ - Tue, 03 Sep 2013 21:21:29 GMT
27
+ connection:
28
+ - close
29
+ body:
30
+ encoding: US-ASCII
31
+ string: ! '{"access": {"token": {"issued_at": "2013-09-03T21:21:29.361372",
32
+ "expires": "2013-09-04T03:21:29Z", "id": "be886bbd36a441369561da14b1a1993d",
33
+ "tenant": {"description": "System account for Morphlabs mCloud administration",
34
+ "enabled": true, "id": "e7b1b62aa1474f758c4974b8be44cf6c", "name": "demo"}},
35
+ "serviceCatalog": [{"endpoints": [{"adminURL": "<HOST_URI>:8774/v2/e7b1b62aa1474f758c4974b8be44cf6c",
36
+ "region": "RegionOne", "internalURL": "<HOST_URI>:8774/v2/e7b1b62aa1474f758c4974b8be44cf6c",
37
+ "id": "6bb597a3738045f4b2c51a7702037cab", "publicURL": "<HOST_URI>:8774/v2/e7b1b62aa1474f758c4974b8be44cf6c"}],
38
+ "endpoints_links": [], "type": "compute", "name": "nova"}, {"endpoints": [{"adminURL":
39
+ "<HOST_URI>:9292", "region": "RegionOne", "internalURL": "<HOST_URI>:9292",
40
+ "id": "2985945e07b74103bb2dfef7e426cd43", "publicURL": "<HOST_URI>:9292"}],
41
+ "endpoints_links": [], "type": "image", "name": "glance"}, {"endpoints": [{"adminURL":
42
+ "<HOST_URI>:8777", "region": "RegionOne", "internalURL": "<HOST_URI>:8777",
43
+ "id": "370119dd80e84894bfe83d766fd467dd", "publicURL": "<HOST_URI>:8777"}],
44
+ "endpoints_links": [], "type": "metering", "name": "ceilometer"}, {"endpoints":
45
+ [{"adminURL": "<HOST_URI>:8776/v1/e7b1b62aa1474f758c4974b8be44cf6c", "region":
46
+ "RegionOne", "internalURL": "<HOST_URI>:8776/v1/e7b1b62aa1474f758c4974b8be44cf6c",
47
+ "id": "2492a6f5fa80466d9312e51a8f79b638", "publicURL": "<HOST_URI>:8776/v1/e7b1b62aa1474f758c4974b8be44cf6c"}],
48
+ "endpoints_links": [], "type": "volume", "name": "cinder"}, {"endpoints":
49
+ [{"adminURL": "<HOST_URI>:8773/services/Admin", "region": "RegionOne", "internalURL":
50
+ "<HOST_URI>:8773/services/Cloud", "id": "1f68f3ce931946c788e487443e772fb2",
51
+ "publicURL": "<HOST_URI>:8773/services/Cloud"}], "endpoints_links": [], "type":
52
+ "ec2", "name": "nova_ec2"}, {"endpoints": [{"adminURL": "<HOST_URI>:35357/v2.0",
53
+ "region": "RegionOne", "internalURL": "<HOST_URI>:5000/v2.0", "id": "12c722e9b9fb471fbea83c6157c0123a",
54
+ "publicURL": "<HOST_URI>:5000/v2.0"}], "endpoints_links": [], "type": "identity",
55
+ "name": "keystone"}], "user": {"username": "morphadmin", "roles_links": [],
56
+ "id": "87f34120be394c598520744d0f4a8233", "roles": [{"name": "Member"}, {"name":
57
+ "admin"}, {"name": "project_manager"}], "name": "morphadmin"}, "metadata":
58
+ {"is_admin": 0, "roles": ["f970c227c0ee4512899606886348f67f", "a0d6ba8f41b746b495a6d25c69962489",
59
+ "88141c3fd5cd48459cfe1243bfa6d4e1"]}}}'
60
+ http_version:
61
+ recorded_at: Tue, 03 Sep 2013 21:21:29 GMT
62
+ recorded_with: VCR 2.5.0
@@ -0,0 +1,62 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: <HOST_URI>:5000/v2.0/tokens
6
+ body:
7
+ encoding: UTF-8
8
+ string: ! '{"auth":{"passwordCredentials":{"username":"<USERNAME>","password":"<PASSWORD>"},"tenantName":"<TENANT>"}}'
9
+ headers:
10
+ Content-Type:
11
+ - application/json
12
+ User-Agent:
13
+ - Faraday v0.8.8
14
+ response:
15
+ status:
16
+ code: 200
17
+ message:
18
+ headers:
19
+ vary:
20
+ - X-Auth-Token
21
+ content-type:
22
+ - application/json
23
+ content-length:
24
+ - '2749'
25
+ date:
26
+ - Tue, 03 Sep 2013 21:21:26 GMT
27
+ connection:
28
+ - close
29
+ body:
30
+ encoding: US-ASCII
31
+ string: ! '{"access": {"token": {"issued_at": "2013-09-03T21:21:26.618764",
32
+ "expires": "2013-09-04T03:21:26Z", "id": "cc555b6c5ddb4f9db10fc863e26edfa1",
33
+ "tenant": {"description": "System account for Morphlabs mCloud administration",
34
+ "enabled": true, "id": "e7b1b62aa1474f758c4974b8be44cf6c", "name": "demo"}},
35
+ "serviceCatalog": [{"endpoints": [{"adminURL": "<HOST_URI>:8774/v2/e7b1b62aa1474f758c4974b8be44cf6c",
36
+ "region": "RegionOne", "internalURL": "<HOST_URI>:8774/v2/e7b1b62aa1474f758c4974b8be44cf6c",
37
+ "id": "6bb597a3738045f4b2c51a7702037cab", "publicURL": "<HOST_URI>:8774/v2/e7b1b62aa1474f758c4974b8be44cf6c"}],
38
+ "endpoints_links": [], "type": "compute", "name": "nova"}, {"endpoints": [{"adminURL":
39
+ "<HOST_URI>:9292", "region": "RegionOne", "internalURL": "<HOST_URI>:9292",
40
+ "id": "2985945e07b74103bb2dfef7e426cd43", "publicURL": "<HOST_URI>:9292"}],
41
+ "endpoints_links": [], "type": "image", "name": "glance"}, {"endpoints": [{"adminURL":
42
+ "<HOST_URI>:8777", "region": "RegionOne", "internalURL": "<HOST_URI>:8777",
43
+ "id": "370119dd80e84894bfe83d766fd467dd", "publicURL": "<HOST_URI>:8777"}],
44
+ "endpoints_links": [], "type": "metering", "name": "ceilometer"}, {"endpoints":
45
+ [{"adminURL": "<HOST_URI>:8776/v1/e7b1b62aa1474f758c4974b8be44cf6c", "region":
46
+ "RegionOne", "internalURL": "<HOST_URI>:8776/v1/e7b1b62aa1474f758c4974b8be44cf6c",
47
+ "id": "2492a6f5fa80466d9312e51a8f79b638", "publicURL": "<HOST_URI>:8776/v1/e7b1b62aa1474f758c4974b8be44cf6c"}],
48
+ "endpoints_links": [], "type": "volume", "name": "cinder"}, {"endpoints":
49
+ [{"adminURL": "<HOST_URI>:8773/services/Admin", "region": "RegionOne", "internalURL":
50
+ "<HOST_URI>:8773/services/Cloud", "id": "1f68f3ce931946c788e487443e772fb2",
51
+ "publicURL": "<HOST_URI>:8773/services/Cloud"}], "endpoints_links": [], "type":
52
+ "ec2", "name": "nova_ec2"}, {"endpoints": [{"adminURL": "<HOST_URI>:35357/v2.0",
53
+ "region": "RegionOne", "internalURL": "<HOST_URI>:5000/v2.0", "id": "12c722e9b9fb471fbea83c6157c0123a",
54
+ "publicURL": "<HOST_URI>:5000/v2.0"}], "endpoints_links": [], "type": "identity",
55
+ "name": "keystone"}], "user": {"username": "morphadmin", "roles_links": [],
56
+ "id": "87f34120be394c598520744d0f4a8233", "roles": [{"name": "Member"}, {"name":
57
+ "admin"}, {"name": "project_manager"}], "name": "morphadmin"}, "metadata":
58
+ {"is_admin": 0, "roles": ["f970c227c0ee4512899606886348f67f", "a0d6ba8f41b746b495a6d25c69962489",
59
+ "88141c3fd5cd48459cfe1243bfa6d4e1"]}}}'
60
+ http_version:
61
+ recorded_at: Tue, 03 Sep 2013 21:21:26 GMT
62
+ recorded_with: VCR 2.5.0
@@ -0,0 +1,62 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: <HOST_URI>:5000/v2.0/tokens
6
+ body:
7
+ encoding: UTF-8
8
+ string: ! '{"auth":{"passwordCredentials":{"username":"<USERNAME>","password":"<PASSWORD>"},"tenantName":"<TENANT>"}}'
9
+ headers:
10
+ Content-Type:
11
+ - application/json
12
+ User-Agent:
13
+ - Faraday v0.8.8
14
+ response:
15
+ status:
16
+ code: 200
17
+ message:
18
+ headers:
19
+ vary:
20
+ - X-Auth-Token
21
+ content-type:
22
+ - application/json
23
+ content-length:
24
+ - '2749'
25
+ date:
26
+ - Tue, 03 Sep 2013 21:21:31 GMT
27
+ connection:
28
+ - close
29
+ body:
30
+ encoding: US-ASCII
31
+ string: ! '{"access": {"token": {"issued_at": "2013-09-03T21:21:31.135715",
32
+ "expires": "2013-09-04T03:21:31Z", "id": "92b81d51dd0249a4a375123a37eb4c65",
33
+ "tenant": {"description": "System account for Morphlabs mCloud administration",
34
+ "enabled": true, "id": "e7b1b62aa1474f758c4974b8be44cf6c", "name": "demo"}},
35
+ "serviceCatalog": [{"endpoints": [{"adminURL": "<HOST_URI>:8774/v2/e7b1b62aa1474f758c4974b8be44cf6c",
36
+ "region": "RegionOne", "internalURL": "<HOST_URI>:8774/v2/e7b1b62aa1474f758c4974b8be44cf6c",
37
+ "id": "6bb597a3738045f4b2c51a7702037cab", "publicURL": "<HOST_URI>:8774/v2/e7b1b62aa1474f758c4974b8be44cf6c"}],
38
+ "endpoints_links": [], "type": "compute", "name": "nova"}, {"endpoints": [{"adminURL":
39
+ "<HOST_URI>:9292", "region": "RegionOne", "internalURL": "<HOST_URI>:9292",
40
+ "id": "2985945e07b74103bb2dfef7e426cd43", "publicURL": "<HOST_URI>:9292"}],
41
+ "endpoints_links": [], "type": "image", "name": "glance"}, {"endpoints": [{"adminURL":
42
+ "<HOST_URI>:8777", "region": "RegionOne", "internalURL": "<HOST_URI>:8777",
43
+ "id": "370119dd80e84894bfe83d766fd467dd", "publicURL": "<HOST_URI>:8777"}],
44
+ "endpoints_links": [], "type": "metering", "name": "ceilometer"}, {"endpoints":
45
+ [{"adminURL": "<HOST_URI>:8776/v1/e7b1b62aa1474f758c4974b8be44cf6c", "region":
46
+ "RegionOne", "internalURL": "<HOST_URI>:8776/v1/e7b1b62aa1474f758c4974b8be44cf6c",
47
+ "id": "2492a6f5fa80466d9312e51a8f79b638", "publicURL": "<HOST_URI>:8776/v1/e7b1b62aa1474f758c4974b8be44cf6c"}],
48
+ "endpoints_links": [], "type": "volume", "name": "cinder"}, {"endpoints":
49
+ [{"adminURL": "<HOST_URI>:8773/services/Admin", "region": "RegionOne", "internalURL":
50
+ "<HOST_URI>:8773/services/Cloud", "id": "1f68f3ce931946c788e487443e772fb2",
51
+ "publicURL": "<HOST_URI>:8773/services/Cloud"}], "endpoints_links": [], "type":
52
+ "ec2", "name": "nova_ec2"}, {"endpoints": [{"adminURL": "<HOST_URI>:35357/v2.0",
53
+ "region": "RegionOne", "internalURL": "<HOST_URI>:5000/v2.0", "id": "12c722e9b9fb471fbea83c6157c0123a",
54
+ "publicURL": "<HOST_URI>:5000/v2.0"}], "endpoints_links": [], "type": "identity",
55
+ "name": "keystone"}], "user": {"username": "morphadmin", "roles_links": [],
56
+ "id": "87f34120be394c598520744d0f4a8233", "roles": [{"name": "Member"}, {"name":
57
+ "admin"}, {"name": "project_manager"}], "name": "morphadmin"}, "metadata":
58
+ {"is_admin": 0, "roles": ["f970c227c0ee4512899606886348f67f", "a0d6ba8f41b746b495a6d25c69962489",
59
+ "88141c3fd5cd48459cfe1243bfa6d4e1"]}}}'
60
+ http_version:
61
+ recorded_at: Tue, 03 Sep 2013 21:21:31 GMT
62
+ recorded_with: VCR 2.5.0
@@ -5,7 +5,7 @@ http_interactions:
5
5
  uri: <HOST_URI>:5000/v2.0/tokens
6
6
  body:
7
7
  encoding: UTF-8
8
- string: ! '{"auth":{"passwordCredentials":{"username":"admin","password":"<PASSWORD>"},"tenantName":"admin"}}'
8
+ string: ! '{"auth":{"passwordCredentials":{"username":"<USERNAME>","password":"<PASSWORD>"},"tenantName":"<TENANT>"}}'
9
9
  headers:
10
10
  Content-Type:
11
11
  - application/json
@@ -5,7 +5,7 @@ http_interactions:
5
5
  uri: <HOST_URI>:5000/v2.0/tokens
6
6
  body:
7
7
  encoding: UTF-8
8
- string: ! '{"auth":{"passwordCredentials":{"username":"admin","password":"<PASSWORD>"},"tenantName":"admin"}}'
8
+ string: ! '{"auth":{"passwordCredentials":{"username":"<USERNAME>","password":"<PASSWORD>"},"tenantName":"<TENANT>"}}'
9
9
  headers:
10
10
  Content-Type:
11
11
  - application/json
@@ -5,7 +5,7 @@ http_interactions:
5
5
  uri: <HOST_URI>:5000/v2.0/tokens
6
6
  body:
7
7
  encoding: UTF-8
8
- string: ! '{"auth":{"passwordCredentials":{"username":"admin","password":"<PASSWORD>"},"tenantName":"admin"}}'
8
+ string: ! '{"auth":{"passwordCredentials":{"username":"<USERNAME>","password":"<PASSWORD>"},"tenantName":"<TENANT>"}}'
9
9
  headers:
10
10
  Content-Type:
11
11
  - application/json
@@ -5,7 +5,7 @@ http_interactions:
5
5
  uri: <HOST_URI>:5000/v2.0/tokens
6
6
  body:
7
7
  encoding: UTF-8
8
- string: ! '{"auth":{"passwordCredentials":{"username":"admin","password":"<PASSWORD>"}}}'
8
+ string: ! '{"auth":{"passwordCredentials":{"username":"<USERNAME>","password":"<PASSWORD>"}}}'
9
9
  headers:
10
10
  Content-Type:
11
11
  - application/json
@@ -5,7 +5,7 @@ http_interactions:
5
5
  uri: <HOST_URI>:5000/v2.0/tokens
6
6
  body:
7
7
  encoding: UTF-8
8
- string: ! '{"auth":{"passwordCredentials":{"username":"admin","password":"<PASSWORD>"}}}'
8
+ string: ! '{"auth":{"passwordCredentials":{"username":"<USERNAME>","password":"<PASSWORD>"}}}'
9
9
  headers:
10
10
  Content-Type:
11
11
  - application/json
@@ -40,7 +40,7 @@ http_interactions:
40
40
  uri: <HOST_URI>:5000/v2.0/tokens
41
41
  body:
42
42
  encoding: UTF-8
43
- string: ! '{"auth":{"token":{"id":"7936a6fa365a47e5b165a5d15f667a32"},"tenantName":"admin"}}'
43
+ string: ! '{"auth":{"token":{"id":"7936a6fa365a47e5b165a5d15f667a32"},"tenantName":"<TENANT>"}}'
44
44
  headers:
45
45
  Content-Type:
46
46
  - application/json
@@ -44,12 +44,31 @@ class Test
44
44
  auth_service: Environment.openstack_admin[:auth_service]
45
45
  }
46
46
  end
47
+
48
+
49
+ def get_request_class(parent, *path)
50
+ const_name = path.shift.to_s.camelize.gsub(/\.rb$/, '')
51
+
52
+ const = if parent.const_defined?(const_name)
53
+ parent.const_get(const_name)
54
+ else
55
+ raise "Constant #{ const_name } could not be found."
56
+ end
57
+
58
+ path.empty? ? const : get_request_class(const, *path)
59
+ end
60
+
61
+
62
+ def load_request(*path)
63
+ require request_path(*path)
64
+ get_request_class(Aviator, *path)
65
+ end
47
66
 
48
67
 
49
68
  def request_path(*path)
50
- Pathname.new(__FILE__).join('..', '..', '..', 'lib', 'aviator', 'openstack').expand_path.join(*path)
69
+ Pathname.new(__FILE__).join('..', '..', '..', 'lib', 'aviator').expand_path.join(*path)
51
70
  end
52
-
71
+
53
72
  end
54
73
  end
55
74
 
@@ -1,7 +1,7 @@
1
1
  module Aviator
2
2
  class Test < MiniTest::Spec
3
3
 
4
- def self.validate(name, extra_desc=nil, &block)
4
+ def self.validate_attr(name, extra_desc=nil, &block)
5
5
  it "returns the correct value for #{ name.to_s } #{ extra_desc }", &block
6
6
  end
7
7
 
@@ -1,6 +1,7 @@
1
1
  require "minitest/reporters"
2
2
 
3
- module MiniTest::Reporters::RedStack
3
+ module Aviator
4
+ class Test
4
5
 
5
6
  class SpecReporter < MiniTest::Reporters::SpecReporter
6
7
 
@@ -41,5 +42,6 @@ module MiniTest::Reporters::RedStack
41
42
  end
42
43
 
43
44
  end
45
+ end
44
46
 
45
- MiniTest::Reporters.use! MiniTest::Reporters::RedStack::ProgressReporter.new
47
+ MiniTest::Reporters.use! Aviator::Test::ProgressReporter.new
@@ -15,8 +15,12 @@ VCR.configure do |c|
15
15
  @vcr_port_matcher_registered = true
16
16
  end
17
17
 
18
+ c.filter_sensitive_data('"username":"<USERNAME>"') { %Q{"username":"#{ Aviator::Test::Environment.openstack_admin[:auth_credentials][:username] }"} }
19
+ c.filter_sensitive_data('"username":"<USERNAME>"') { %Q{"username":"#{ Aviator::Test::Environment.openstack_member[:auth_credentials][:username] }"} }
18
20
  c.filter_sensitive_data('"password":"<PASSWORD>"') { %Q{"password":"#{ Aviator::Test::Environment.openstack_admin[:auth_credentials][:password] }"} }
19
21
  c.filter_sensitive_data('"password":"<PASSWORD>"') { %Q{"password":"#{ Aviator::Test::Environment.openstack_member[:auth_credentials][:password] }"} }
22
+ c.filter_sensitive_data('"tenantName":"<TENANT>"') { %Q{"tenantName":"#{ Aviator::Test::Environment.openstack_admin[:auth_credentials][:tenantName] }"} }
23
+ c.filter_sensitive_data('"tenantName":"<TENANT>"') { %Q{"tenantName":"#{ Aviator::Test::Environment.openstack_member[:auth_credentials][:tenantName] }"} }
20
24
  c.filter_sensitive_data('<HOST_URI>') do
21
25
  auth_url = URI(Aviator::Test::Environment.openstack[:auth_service][:host_uri])
22
26
  auth_url.scheme + '://' + auth_url.host
data/test/test_helper.rb CHANGED
@@ -12,6 +12,9 @@ SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
12
12
  ]
13
13
  SimpleCov.start do
14
14
  add_filter '/test/'
15
+
16
+ add_group 'Core', 'lib/aviator/core'
17
+ add_group 'OpenStack', 'lib/aviator/openstack'
15
18
  end
16
19
 
17
20
  require 'minitest/autorun'
@@ -32,4 +35,5 @@ Dir[Pathname.new(__FILE__).join('..', 'support', '*.rb')].each do |f|
32
35
  require f
33
36
  end
34
37
 
35
- require 'aviator/core'
38
+ require 'aviator'
39
+ require 'aviator/core/cli'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aviator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-08-30 00:00:00.000000000 Z
12
+ date: 2013-09-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: faraday
@@ -32,17 +32,17 @@ dependencies:
32
32
  requirement: !ruby/object:Gem::Requirement
33
33
  none: false
34
34
  requirements:
35
- - - ~>
35
+ - - ! '>='
36
36
  - !ruby/object:Gem::Version
37
- version: 4.0.0
37
+ version: 3.2.8
38
38
  type: :runtime
39
39
  prerelease: false
40
40
  version_requirements: !ruby/object:Gem::Requirement
41
41
  none: false
42
42
  requirements:
43
- - - ~>
43
+ - - ! '>='
44
44
  - !ruby/object:Gem::Version
45
- version: 4.0.0
45
+ version: 3.2.8
46
46
  - !ruby/object:Gem::Dependency
47
47
  name: thor
48
48
  requirement: !ruby/object:Gem::Requirement
@@ -255,21 +255,27 @@ files:
255
255
  - Rakefile
256
256
  - aviator.gemspec
257
257
  - bin/aviator
258
+ - lib/aviator.rb
258
259
  - lib/aviator/core.rb
260
+ - lib/aviator/core/cli.rb
261
+ - lib/aviator/core/cli/describer.rb
259
262
  - lib/aviator/core/request.rb
260
263
  - lib/aviator/core/response.rb
261
264
  - lib/aviator/core/service.rb
262
265
  - lib/aviator/core/session.rb
263
266
  - lib/aviator/openstack/compute/v2/public/list_images.rb
267
+ - lib/aviator/openstack/compute/v2/public/list_servers.rb
264
268
  - lib/aviator/openstack/identity/v2/admin/create_tenant.rb
265
269
  - lib/aviator/openstack/identity/v2/admin/list_tenants.rb
266
270
  - lib/aviator/openstack/identity/v2/public/create_token.rb
267
271
  - lib/aviator/openstack/identity/v2/public/list_tenants.rb
268
272
  - lib/aviator/version.rb
273
+ - test/aviator/core/cli/describer_test.rb
269
274
  - test/aviator/core/request_test.rb
270
275
  - test/aviator/core/service_test.rb
271
276
  - test/aviator/core/session_test.rb
272
277
  - test/aviator/openstack/compute/v2/public/list_images_test.rb
278
+ - test/aviator/openstack/compute/v2/public/list_servers_test.rb
273
279
  - test/aviator/openstack/identity/v2/admin/create_tenant_test.rb
274
280
  - test/aviator/openstack/identity/v2/public/create_token_test.rb
275
281
  - test/cassettes/core/service/i_default_session_data_/sets_the_service_s_default_session_data.yml
@@ -286,6 +292,8 @@ files:
286
292
  - test/cassettes/core/session/i_authenticate/raises_an_AuthenticationError_when_authentication_fails.yml
287
293
  - test/cassettes/core/session/i_authenticate/updates_the_session_data_of_its_service_objects.yml
288
294
  - test/cassettes/core/session/i_dump/serializes_the_session_data_for_caching.yml
295
+ - test/cassettes/core/session/i_load/returns_itself.yml
296
+ - test/cassettes/core/session/i_load/updates_the_session_data_of_its_service_objects.yml
289
297
  - test/cassettes/core/session/i_validate/returns_false_if_session_is_no_longer_valid.yml
290
298
  - test/cassettes/core/session/i_validate/returns_true_if_session_is_still_valid.yml
291
299
  - test/cassettes/core/session/i_xxx_service/returns_an_instance_of_the_indicated_service.yml
@@ -296,8 +304,16 @@ files:
296
304
  - test/cassettes/openstack/compute/v2/public/list_images/returns_the_correct_value_for_body_.yml
297
305
  - test/cassettes/openstack/compute/v2/public/list_images/returns_the_correct_value_for_headers.yml
298
306
  - test/cassettes/openstack/compute/v2/public/list_images/returns_the_correct_value_for_headers_.yml
307
+ - test/cassettes/openstack/compute/v2/public/list_images/returns_the_correct_value_for_http_method_.yml
299
308
  - test/cassettes/openstack/compute/v2/public/list_images/returns_the_correct_value_for_url.yml
300
309
  - test/cassettes/openstack/compute/v2/public/list_images/returns_the_correct_value_for_url_.yml
310
+ - test/cassettes/openstack/compute/v2/public/list_servers/leads_to_a_valid_response_when_no_parameters_are_provided.yml
311
+ - test/cassettes/openstack/compute/v2/public/list_servers/leads_to_a_valid_response_when_parameters_are_invalid.yml
312
+ - test/cassettes/openstack/compute/v2/public/list_servers/leads_to_a_valid_response_when_parameters_are_valid.yml
313
+ - test/cassettes/openstack/compute/v2/public/list_servers/returns_the_correct_value_for_body_.yml
314
+ - test/cassettes/openstack/compute/v2/public/list_servers/returns_the_correct_value_for_headers_.yml
315
+ - test/cassettes/openstack/compute/v2/public/list_servers/returns_the_correct_value_for_http_method_.yml
316
+ - test/cassettes/openstack/compute/v2/public/list_servers/returns_the_correct_value_for_url_.yml
301
317
  - test/cassettes/openstack/identity/v2/admin/create_tenant/leads_to_a_valid_response_when_params_are_invalid.yml
302
318
  - test/cassettes/openstack/identity/v2/admin/create_tenant/leads_to_a_valid_response_when_params_are_valid.yml
303
319
  - test/cassettes/openstack/identity/v2/admin/create_tenant/leads_to_a_valid_response_when_provided_with_invalid_params.yml
@@ -306,7 +322,7 @@ files:
306
322
  - test/cassettes/openstack/identity/v2/public/create_token/leads_to_a_valid_response_when_provided_with_a_token.yml
307
323
  - test/environment.yml.example
308
324
  - test/environment.yml.travis-ci
309
- - test/support/openstack_request_test_helper.rb
325
+ - test/support/request_helper.rb
310
326
  - test/support/test_base_class.rb
311
327
  - test/support/test_environment.rb
312
328
  - test/support/test_reporter.rb
@@ -328,7 +344,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
328
344
  version: '0'
329
345
  segments:
330
346
  - 0
331
- hash: -4283040040147461386
347
+ hash: -4214225132738261812
332
348
  required_rubygems_version: !ruby/object:Gem::Requirement
333
349
  none: false
334
350
  requirements:
@@ -337,7 +353,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
337
353
  version: '0'
338
354
  segments:
339
355
  - 0
340
- hash: -4283040040147461386
356
+ hash: -4214225132738261812
341
357
  requirements: []
342
358
  rubyforge_project:
343
359
  rubygems_version: 1.8.25
@@ -345,10 +361,12 @@ signing_key:
345
361
  specification_version: 3
346
362
  summary: Lightweight Ruby bindings for the OpenStack API
347
363
  test_files:
364
+ - test/aviator/core/cli/describer_test.rb
348
365
  - test/aviator/core/request_test.rb
349
366
  - test/aviator/core/service_test.rb
350
367
  - test/aviator/core/session_test.rb
351
368
  - test/aviator/openstack/compute/v2/public/list_images_test.rb
369
+ - test/aviator/openstack/compute/v2/public/list_servers_test.rb
352
370
  - test/aviator/openstack/identity/v2/admin/create_tenant_test.rb
353
371
  - test/aviator/openstack/identity/v2/public/create_token_test.rb
354
372
  - test/cassettes/core/service/i_default_session_data_/sets_the_service_s_default_session_data.yml
@@ -365,6 +383,8 @@ test_files:
365
383
  - test/cassettes/core/session/i_authenticate/raises_an_AuthenticationError_when_authentication_fails.yml
366
384
  - test/cassettes/core/session/i_authenticate/updates_the_session_data_of_its_service_objects.yml
367
385
  - test/cassettes/core/session/i_dump/serializes_the_session_data_for_caching.yml
386
+ - test/cassettes/core/session/i_load/returns_itself.yml
387
+ - test/cassettes/core/session/i_load/updates_the_session_data_of_its_service_objects.yml
368
388
  - test/cassettes/core/session/i_validate/returns_false_if_session_is_no_longer_valid.yml
369
389
  - test/cassettes/core/session/i_validate/returns_true_if_session_is_still_valid.yml
370
390
  - test/cassettes/core/session/i_xxx_service/returns_an_instance_of_the_indicated_service.yml
@@ -375,8 +395,16 @@ test_files:
375
395
  - test/cassettes/openstack/compute/v2/public/list_images/returns_the_correct_value_for_body_.yml
376
396
  - test/cassettes/openstack/compute/v2/public/list_images/returns_the_correct_value_for_headers.yml
377
397
  - test/cassettes/openstack/compute/v2/public/list_images/returns_the_correct_value_for_headers_.yml
398
+ - test/cassettes/openstack/compute/v2/public/list_images/returns_the_correct_value_for_http_method_.yml
378
399
  - test/cassettes/openstack/compute/v2/public/list_images/returns_the_correct_value_for_url.yml
379
400
  - test/cassettes/openstack/compute/v2/public/list_images/returns_the_correct_value_for_url_.yml
401
+ - test/cassettes/openstack/compute/v2/public/list_servers/leads_to_a_valid_response_when_no_parameters_are_provided.yml
402
+ - test/cassettes/openstack/compute/v2/public/list_servers/leads_to_a_valid_response_when_parameters_are_invalid.yml
403
+ - test/cassettes/openstack/compute/v2/public/list_servers/leads_to_a_valid_response_when_parameters_are_valid.yml
404
+ - test/cassettes/openstack/compute/v2/public/list_servers/returns_the_correct_value_for_body_.yml
405
+ - test/cassettes/openstack/compute/v2/public/list_servers/returns_the_correct_value_for_headers_.yml
406
+ - test/cassettes/openstack/compute/v2/public/list_servers/returns_the_correct_value_for_http_method_.yml
407
+ - test/cassettes/openstack/compute/v2/public/list_servers/returns_the_correct_value_for_url_.yml
380
408
  - test/cassettes/openstack/identity/v2/admin/create_tenant/leads_to_a_valid_response_when_params_are_invalid.yml
381
409
  - test/cassettes/openstack/identity/v2/admin/create_tenant/leads_to_a_valid_response_when_params_are_valid.yml
382
410
  - test/cassettes/openstack/identity/v2/admin/create_tenant/leads_to_a_valid_response_when_provided_with_invalid_params.yml
@@ -385,7 +413,7 @@ test_files:
385
413
  - test/cassettes/openstack/identity/v2/public/create_token/leads_to_a_valid_response_when_provided_with_a_token.yml
386
414
  - test/environment.yml.example
387
415
  - test/environment.yml.travis-ci
388
- - test/support/openstack_request_test_helper.rb
416
+ - test/support/request_helper.rb
389
417
  - test/support/test_base_class.rb
390
418
  - test/support/test_environment.rb
391
419
  - test/support/test_reporter.rb