brightbox-cli 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 (237) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +1 -0
  3. data/CHANGELOG.md +18 -0
  4. data/Gemfile.lock +18 -19
  5. data/bin/_brightbox-bash-completer +42 -0
  6. data/brightbox-cli.gemspec +5 -5
  7. data/lib/brightbox-cli/accounts.rb +1 -3
  8. data/lib/brightbox-cli/api.rb +27 -8
  9. data/lib/brightbox-cli/cloud_ips.rb +11 -15
  10. data/lib/brightbox-cli/collaborating_account.rb +23 -26
  11. data/lib/brightbox-cli/collaboration.rb +1 -1
  12. data/lib/brightbox-cli/commands/{accounts-accept-invite.rb → accounts/accept-invite.rb} +2 -3
  13. data/lib/brightbox-cli/commands/{accounts-default.rb → accounts/default.rb} +1 -3
  14. data/lib/brightbox-cli/commands/{accounts-list.rb → accounts/list.rb} +1 -1
  15. data/lib/brightbox-cli/commands/{accounts-remove.rb → accounts/remove.rb} +1 -2
  16. data/lib/brightbox-cli/commands/{accounts-reset-ftp-password.rb → accounts/reset-ftp-password.rb} +10 -5
  17. data/lib/brightbox-cli/commands/{accounts-show.rb → accounts/show.rb} +14 -6
  18. data/lib/brightbox-cli/commands/{cloudips-create.rb → cloudips/create.rb} +4 -4
  19. data/lib/brightbox-cli/commands/{cloudips-destroy.rb → cloudips/destroy.rb} +1 -1
  20. data/lib/brightbox-cli/commands/{cloudips-list.rb → cloudips/list.rb} +2 -10
  21. data/lib/brightbox-cli/commands/{cloudips-map.rb → cloudips/map.rb} +2 -8
  22. data/lib/brightbox-cli/commands/{cloudips-show.rb → cloudips/show.rb} +13 -3
  23. data/lib/brightbox-cli/commands/{cloudips-unmap.rb → cloudips/unmap.rb} +1 -1
  24. data/lib/brightbox-cli/commands/{cloudips-update.rb → cloudips/update.rb} +5 -6
  25. data/lib/brightbox-cli/commands/collaborations.rb +3 -9
  26. data/lib/brightbox-cli/commands/{config-client-add.rb → config/client-add.rb} +2 -2
  27. data/lib/brightbox-cli/commands/{config-client-default.rb → config/client-default.rb} +1 -1
  28. data/lib/brightbox-cli/commands/{config-client-list.rb → config/client-list.rb} +3 -3
  29. data/lib/brightbox-cli/commands/{config-client-remove.rb → config/client-remove.rb} +4 -1
  30. data/lib/brightbox-cli/commands/{config-user-add.rb → config/user-add.rb} +1 -1
  31. data/lib/brightbox-cli/commands/{firewall-policies-apply.rb → firewall/policies-apply.rb} +3 -4
  32. data/lib/brightbox-cli/commands/{firewall-policies-create.rb → firewall/policies-create.rb} +3 -4
  33. data/lib/brightbox-cli/commands/{firewall-policies-destroy.rb → firewall/policies-destroy.rb} +2 -3
  34. data/lib/brightbox-cli/commands/{firewall-policies-list.rb → firewall/policies-list.rb} +2 -9
  35. data/lib/brightbox-cli/commands/{firewall-policies-remove.rb → firewall/policies-remove.rb} +2 -3
  36. data/lib/brightbox-cli/commands/{firewall-policies-show.rb → firewall/policies-show.rb} +11 -3
  37. data/lib/brightbox-cli/commands/{firewall-policies-update.rb → firewall/policies-update.rb} +3 -3
  38. data/lib/brightbox-cli/commands/{firewall-rules-create.rb → firewall/rules-create.rb} +4 -4
  39. data/lib/brightbox-cli/commands/{firewall-rules-destroy.rb → firewall/rules-destroy.rb} +2 -4
  40. data/lib/brightbox-cli/commands/{firewall-rules-list.rb → firewall/rules-list.rb} +2 -2
  41. data/lib/brightbox-cli/commands/{firewall-rules-show.rb → firewall/rules-show.rb} +10 -4
  42. data/lib/brightbox-cli/commands/{firewall-rules-update.rb → firewall/rules-update.rb} +3 -3
  43. data/lib/brightbox-cli/commands/{groups-add-server.rb → groups/add-server.rb} +2 -2
  44. data/lib/brightbox-cli/commands/{groups-create.rb → groups/create.rb} +3 -3
  45. data/lib/brightbox-cli/commands/{groups-destroy.rb → groups/destroy.rb} +2 -2
  46. data/lib/brightbox-cli/commands/groups/list.rb +14 -0
  47. data/lib/brightbox-cli/commands/{groups-move_servers.rb → groups/move_servers.rb} +1 -2
  48. data/lib/brightbox-cli/commands/{groups-remove-servers.rb → groups/remove-servers.rb} +1 -1
  49. data/lib/brightbox-cli/commands/{groups-show.rb → groups/show.rb} +1 -1
  50. data/lib/brightbox-cli/commands/{groups-update.rb → groups/update.rb} +5 -10
  51. data/lib/brightbox-cli/commands/{images-destroy.rb → images/destroy.rb} +2 -2
  52. data/lib/brightbox-cli/commands/{images-list.rb → images/list.rb} +2 -10
  53. data/lib/brightbox-cli/commands/{images-register.rb → images/register.rb} +6 -6
  54. data/lib/brightbox-cli/commands/{images-show.rb → images/show.rb} +2 -11
  55. data/lib/brightbox-cli/commands/{images-update.rb → images/update.rb} +8 -8
  56. data/lib/brightbox-cli/commands/{lbs-add-nodes.rb → lbs/add-nodes.rb} +2 -2
  57. data/lib/brightbox-cli/commands/{lbs-create.rb → lbs/create.rb} +16 -10
  58. data/lib/brightbox-cli/commands/{lbs-destroy.rb → lbs/destroy.rb} +1 -1
  59. data/lib/brightbox-cli/commands/{lbs-list.rb → lbs/list.rb} +2 -10
  60. data/lib/brightbox-cli/commands/{lbs-remove-nodes.rb → lbs/remove-nodes.rb} +2 -2
  61. data/lib/brightbox-cli/commands/{lbs-show.rb → lbs/show.rb} +4 -7
  62. data/lib/brightbox-cli/commands/{lbs-update.rb → lbs/update.rb} +16 -10
  63. data/lib/brightbox-cli/commands/{servers-activate-console.rb → servers/activate-console.rb} +3 -3
  64. data/lib/brightbox-cli/commands/{servers-create.rb → servers/create.rb} +4 -4
  65. data/lib/brightbox-cli/commands/{servers-destroy.rb → servers/destroy.rb} +2 -2
  66. data/lib/brightbox-cli/commands/{servers-list.rb → servers/list.rb} +7 -8
  67. data/lib/brightbox-cli/commands/{servers-show.rb → servers/show.rb} +1 -6
  68. data/lib/brightbox-cli/commands/{servers-shutdown.rb → servers/shutdown.rb} +1 -1
  69. data/lib/brightbox-cli/commands/{servers-snapshot.rb → servers/snapshot.rb} +1 -1
  70. data/lib/brightbox-cli/commands/{servers-start.rb → servers/start.rb} +1 -1
  71. data/lib/brightbox-cli/commands/{servers-stop.rb → servers/stop.rb} +1 -1
  72. data/lib/brightbox-cli/commands/{servers-update.rb → servers/update.rb} +2 -2
  73. data/lib/brightbox-cli/commands/sql/instances_create.rb +66 -0
  74. data/lib/brightbox-cli/commands/sql/instances_destroy.rb +28 -0
  75. data/lib/brightbox-cli/commands/sql/instances_list.rb +27 -0
  76. data/lib/brightbox-cli/commands/sql/instances_reset_password.rb +33 -0
  77. data/lib/brightbox-cli/commands/sql/instances_show.rb +26 -0
  78. data/lib/brightbox-cli/commands/sql/instances_snapshot.rb +25 -0
  79. data/lib/brightbox-cli/commands/sql/instances_update.rb +45 -0
  80. data/lib/brightbox-cli/commands/sql/snapshots_destroy.rb +31 -0
  81. data/lib/brightbox-cli/commands/sql/snapshots_list.rb +25 -0
  82. data/lib/brightbox-cli/commands/sql/snapshots_show.rb +26 -0
  83. data/lib/brightbox-cli/commands/sql/snapshots_update.rb +37 -0
  84. data/lib/brightbox-cli/commands/sql/types.rb +53 -0
  85. data/lib/brightbox-cli/commands/types.rb +1 -1
  86. data/lib/brightbox-cli/commands/users/list.rb +17 -0
  87. data/lib/brightbox-cli/commands/{users-show.rb → users/show.rb} +5 -13
  88. data/lib/brightbox-cli/commands/{users-update.rb → users/update.rb} +3 -3
  89. data/lib/brightbox-cli/config.rb +4 -7
  90. data/lib/brightbox-cli/config/accounts.rb +3 -6
  91. data/lib/brightbox-cli/config/api_client.rb +12 -4
  92. data/lib/brightbox-cli/config/authentication_tokens.rb +8 -14
  93. data/lib/brightbox-cli/config/clients.rb +6 -7
  94. data/lib/brightbox-cli/config/section_name_deduplicator.rb +4 -5
  95. data/lib/brightbox-cli/config/sections.rb +7 -10
  96. data/lib/brightbox-cli/config/user_application.rb +15 -7
  97. data/lib/brightbox-cli/connection_manager.rb +1 -2
  98. data/lib/brightbox-cli/database_server.rb +100 -0
  99. data/lib/brightbox-cli/database_snapshot.rb +36 -0
  100. data/lib/brightbox-cli/database_type.rb +44 -0
  101. data/lib/brightbox-cli/detailed_server.rb +8 -7
  102. data/lib/brightbox-cli/error_parser.rb +8 -4
  103. data/lib/brightbox-cli/firewall_rule.rb +5 -5
  104. data/lib/brightbox-cli/firewall_rules.rb +2 -3
  105. data/lib/brightbox-cli/gli_global_hooks.rb +7 -7
  106. data/lib/brightbox-cli/images.rb +13 -14
  107. data/lib/brightbox-cli/legacy/args_adjuster.rb +5 -6
  108. data/lib/brightbox-cli/load_balancers.rb +10 -13
  109. data/lib/brightbox-cli/logging.rb +3 -3
  110. data/lib/brightbox-cli/nilable_hash.rb +1 -1
  111. data/lib/brightbox-cli/ruby_core_ext.rb +1 -2
  112. data/lib/brightbox-cli/server_groups.rb +5 -5
  113. data/lib/brightbox-cli/servers.rb +9 -9
  114. data/lib/brightbox-cli/tables.rb +24 -25
  115. data/lib/brightbox-cli/types.rb +6 -5
  116. data/lib/brightbox-cli/user_collaboration.rb +2 -3
  117. data/lib/brightbox-cli/users.rb +3 -3
  118. data/lib/brightbox-cli/version.rb +1 -1
  119. data/lib/brightbox_cli.rb +10 -2
  120. data/locales/en.yml +205 -0
  121. data/spec/cassettes/Brightbox_Account/_all/when_connected_using_an_application/returns_a_collection_of_Accounts.yml +10 -10
  122. data/spec/cassettes/Brightbox_Account/_all/when_connected_using_an_application/returns_resources_on_the_same_connection.yml +4 -4
  123. data/spec/cassettes/Brightbox_Account/_all/when_connected_using_an_client/returns_a_collection_of_Accounts.yml +8 -8
  124. data/spec/cassettes/Brightbox_Account/_all/when_connected_using_an_client/returns_resources_on_the_same_connection.yml +4 -4
  125. data/spec/cassettes/Brightbox_BBConfig/_add_section/when_first_and_only_client/saves_changes_to_the_config_file.yml +4 -4
  126. data/spec/cassettes/Brightbox_BBConfig/_add_section/when_first_and_only_client/saves_the_default_account.yml +4 -4
  127. data/spec/cassettes/Brightbox_BBConfig/_add_section/when_first_and_only_client/saves_the_new_client_as_the_default.yml +4 -4
  128. data/spec/cassettes/Brightbox_BBConfig/_find_or_set_default_account/when_client_is_not_authenticated/does_not_raise_an_error.yml +176 -176
  129. data/spec/cassettes/Brightbox_BBConfig/_find_or_set_default_account/when_client_may_access_one_account/updates_the_setting.yml +176 -176
  130. data/spec/cassettes/Brightbox_BBConfig/_renew_tokens/when_config_in_use_is_not_the_default/uses_correct_credentials.yml +2 -2
  131. data/spec/cassettes/Brightbox_BBConfig/_renew_tokens/when_using_a_user_app_with_a_cached_refresh_token/caches_the_new_tokens.yml +2 -2
  132. data/spec/cassettes/Brightbox_BBConfig/_renew_tokens/when_using_a_user_app_with_an_expired_refresh_token/caches_the_new_tokens.yml +4 -4
  133. data/spec/cassettes/Brightbox_BBConfig/_renew_tokens/when_using_a_user_app_with_no_tokens/caches_the_new_tokens.yml +2 -2
  134. data/spec/cassettes/Brightbox_BBConfig/_renew_tokens/when_using_a_user_app_with_no_tokens/prompts_user_to_retry_command.yml +2 -2
  135. data/spec/cassettes/Brightbox_BBConfig/_renew_tokens/when_using_an_API_client_with_no_tokens/caches_a_new_access_token.yml +2 -2
  136. data/spec/cassettes/Brightbox_CloudIP/_find_all_/when_a_Cloud_IP_exists/returns_a_suitable.yml +28 -28
  137. data/spec/cassettes/Brightbox_FirewallPolicy/_apply_to/should_apply_firewall_policy.yml +24 -24
  138. data/spec/cassettes/Brightbox_FirewallPolicy/_create/should_create_firewall_policy.yml +24 -24
  139. data/spec/cassettes/Brightbox_FirewallPolicy/_destroy/should_destroy_firewall_policy.yml +28 -28
  140. data/spec/cassettes/Brightbox_FirewallPolicy/_find_all_/when_a_policy_exists/should_list_firewall_policy.yml +24 -24
  141. data/spec/cassettes/Brightbox_FirewallPolicy/_find_or_call/when_a_policy_exists/should_show_firewall_policy.yml +20 -20
  142. data/spec/cassettes/Brightbox_FirewallRule/_create/when_policy_exists/creates_the_rule_successfully.yml +24 -24
  143. data/spec/cassettes/Brightbox_FirewallRule/_destroy/when_rule_exists/destroys_a_rule.yml +20 -20
  144. data/spec/cassettes/Brightbox_FirewallRule/_find/when_rule_exists/can_display_the_result.yml +24 -24
  145. data/spec/cassettes/Brightbox_FirewallRule/_from_policy/when_policy_exists_with_a_rule/lists_all_rules.yml +32 -32
  146. data/spec/cassettes/Brightbox_Server/_destroy/when_server_exists/should_work.yml +20 -20
  147. data/spec/cassettes/Brightbox_Server/_find_all_/when_a_server_exists/should_print_server_list.yml +28 -28
  148. data/spec/cassettes/Brightbox_Server/_show/when_server_exists/shows_detailed_attributes_of_a_server.yml +32 -32
  149. data/spec/cassettes/Brightbox_Server/_shutdown/should_work.yml +32 -32
  150. data/spec/cassettes/Brightbox_Server/_start/should_work.yml +44 -44
  151. data/spec/cassettes/Brightbox_Server/_stop/should_work.yml +32 -32
  152. data/spec/cassettes/Brightbox_Server/_update/when_passing_new_group_membership/should_update_with_group.yml +40 -40
  153. data/spec/cassettes/Brightbox_ServerGroup/_find_all_/when_a_group_exists/list_server_groups.yml +24 -24
  154. data/spec/cassettes/Firewall_policies/update/when_the_policy_does_not_exist/prints_error_to_STDERR.yml +6 -6
  155. data/spec/cassettes/brightbox_accounts/list/_when_access_token_expired_/does_not_report_invalid_token_errors.yml +18 -18
  156. data/spec/cassettes/brightbox_accounts/list/_when_both_tokens_expired_/does_not_report_invalid_token_errors.yml +18 -18
  157. data/spec/cassettes/brightbox_accounts/list/_when_invalid_tokens_/does_not_report_invalid_token_errors.yml +18 -18
  158. data/spec/cassettes/brightbox_accounts/list/_when_no_tokens_/does_not_report_invalid_token_errors.yml +16 -16
  159. data/spec/cassettes/brightbox_accounts/list/_when_no_tokens_/reports_they_were_updated.yml +14 -14
  160. data/spec/cassettes/brightbox_accounts/list/_when_no_tokens_and_password_incorrect_/does_not_report_invalid_token_errors.yml +14 -14
  161. data/spec/cassettes/brightbox_accounts/list/_when_no_tokens_and_password_incorrect_/reports_unable_to_authenticate.yml +12 -12
  162. data/spec/cassettes/brightbox_accounts/list/does_not_error.yml +6 -6
  163. data/spec/cassettes/brightbox_cloudips/map/when_destination_is_a_server_ID/passes_the_interface_identifier_to_the_API.yml +542 -0
  164. data/spec/cassettes/brightbox_cloudips/map/when_destination_is_another_value/passes_the_identifier_to_the_API.yml +317 -0
  165. data/spec/cassettes/brightbox_config/client_add/when_adding_a_new_client/does_not_error.yml +154 -154
  166. data/spec/cassettes/brightbox_config/client_add/when_adding_a_new_client/sets_up_the_config.yml +154 -154
  167. data/spec/cassettes/brightbox_config/client_add/when_new_client_is_first_and_only_client/does_not_change_the_default_client.yml +154 -154
  168. data/spec/cassettes/brightbox_config/client_add/when_new_client_is_first_and_only_client/does_not_error.yml +154 -154
  169. data/spec/cassettes/brightbox_config/client_add/when_new_client_is_first_and_only_client/sets_this_as_the_default_client.yml +154 -154
  170. data/spec/cassettes/brightbox_config/client_add/when_new_client_is_first_and_only_client/sets_up_the_config.yml +154 -154
  171. data/spec/cassettes/brightbox_config/user_add/when_NO_config_file_on_disk/sets_up_the_config.yml +10 -10
  172. data/spec/cassettes/brightbox_config/user_add/when_a_default_client_is_already_set/does_not_change_the_default_client.yml +4 -4
  173. data/spec/cassettes/brightbox_config/user_add/when_application_details_in_config/does_not_error.yml +4 -4
  174. data/spec/cassettes/brightbox_config/user_add/when_application_details_in_config/sets_up_the_config.yml +4 -4
  175. data/spec/cassettes/brightbox_config/user_add/when_application_has_access_only_one_active_account/display_an_warning_about_preselected_default.yml +4 -4
  176. data/spec/cassettes/brightbox_config/user_add/when_application_has_access_only_one_active_account/does_not_error.yml +4 -4
  177. data/spec/cassettes/brightbox_config/user_add/when_application_has_access_only_one_active_account/selects_the_active_account_for_the_default.yml +4 -4
  178. data/spec/cassettes/brightbox_config/user_add/when_application_has_access_only_one_active_account/sets_up_the_config.yml +4 -4
  179. data/spec/cassettes/brightbox_config/user_add/when_application_has_access_to_multiple_accounts/display_an_warning_about_preselected_default.yml +4 -4
  180. data/spec/cassettes/brightbox_config/user_add/when_application_has_access_to_multiple_accounts/does_not_error.yml +4 -4
  181. data/spec/cassettes/brightbox_config/user_add/when_application_has_access_to_multiple_accounts/sets_up_the_config.yml +4 -4
  182. data/spec/cassettes/brightbox_config/user_add/when_new_client_is_first_and_only_client/does_not_error.yml +4 -4
  183. data/spec/cassettes/brightbox_config/user_add/when_new_client_is_first_and_only_client/does_not_prompt_to_rerun_the_command.yml +4 -4
  184. data/spec/cassettes/brightbox_config/user_add/when_new_client_is_first_and_only_client/requests_access_tokens.yml +4 -4
  185. data/spec/cassettes/brightbox_config/user_add/when_new_client_is_first_and_only_client/sets_this_as_the_default_client.yml +4 -4
  186. data/spec/cassettes/brightbox_config/user_add/when_new_client_is_first_and_only_client/sets_up_the_config.yml +10 -10
  187. data/spec/cassettes/brightbox_config/user_add/when_passing_in_required_arguments/does_not_error.yml +4 -4
  188. data/spec/cassettes/brightbox_config/user_add/when_passing_in_required_arguments/does_not_prompt_to_rerun_the_command.yml +4 -4
  189. data/spec/cassettes/brightbox_config/user_add/when_passing_in_required_arguments/requests_access_tokens.yml +4 -4
  190. data/spec/cassettes/brightbox_config/user_add/when_passing_in_required_arguments/sets_up_the_config.yml +6 -6
  191. data/spec/cassettes/brightbox_config/user_add/when_passing_in_required_arguments_and_api_url/does_not_error.yml +4 -4
  192. data/spec/cassettes/brightbox_config/user_add/when_passing_in_required_arguments_and_api_url/requests_access_tokens.yml +4 -4
  193. data/spec/cassettes/brightbox_config/user_add/when_passing_in_required_arguments_and_api_url/sets_up_the_config.yml +4 -4
  194. data/spec/cassettes/brightbox_database-servers/create/--allow-access_10_0_0_0/correctly_sends_API_parameters.yml +93 -0
  195. data/spec/cassettes/brightbox_database-servers/create/--allow-access_srv-12345_grp-12345/correctly_sends_API_parameters.yml +93 -0
  196. data/spec/cassettes/brightbox_database-servers/create/--engine_mysql/correctly_sends_API_parameters.yml +93 -0
  197. data/spec/cassettes/brightbox_database-servers/create/--engine_mysql_--engine-version_5_6/correctly_sends_API_parameters.yml +93 -0
  198. data/spec/cassettes/brightbox_database-servers/create/without_arguments/reports_the_new_admin_password.yml +93 -0
  199. data/spec/cassettes/brightbox_database-servers/create/without_arguments/reports_the_new_admin_username.yml +93 -0
  200. data/spec/cassettes/brightbox_database-servers/snapshot/when_database_server_active/correctly_sends_API_parameters.yml +181 -0
  201. data/spec/cassettes/brightbox_database-servers/snapshot/when_database_server_can_not_be_snapshotted/reports_an_error_to_the_user.yml +91 -0
  202. data/spec/cassettes/brightbox_database-snapshots/list/when_resources_are_available/does_not_output_to_stderr.yml +93 -0
  203. data/spec/cassettes/brightbox_database-snapshots/list/when_resources_are_available/outputs_table_details_to_stdout.yml +93 -0
  204. data/spec/cassettes/brightbox_database-snapshots/show/when_resource_exists/does_not_output_to_stderr.yml +93 -0
  205. data/spec/commands/accounts/list_spec.rb +1 -1
  206. data/spec/commands/cloudips/map_spec.rb +23 -4
  207. data/spec/commands/config/user_add_spec.rb +1 -1
  208. data/spec/commands/sql/instances/create_spec.rb +69 -0
  209. data/spec/commands/sql/instances/snapshot_spec.rb +36 -0
  210. data/spec/commands/sql/snapshots/list_spec.rb +29 -0
  211. data/spec/commands/sql/snapshots/show_spec.rb +29 -0
  212. data/spec/commands/sql/types/list_spec.rb +18 -0
  213. data/spec/spec_helper.rb +1 -3
  214. data/spec/support/vcr.rb +1 -1
  215. data/spec/unit/brightbox/api/conn_spec.rb +1 -1
  216. data/spec/unit/brightbox/bb_config/add_section_spec.rb +1 -1
  217. data/spec/unit/brightbox/bb_config/renew_tokens_spec.rb +1 -1
  218. data/spec/unit/brightbox/database_server_spec.rb +9 -0
  219. data/spec/unit/brightbox/database_snapshot_spec.rb +9 -0
  220. data/spec/unit/brightbox/database_type_spec.rb +9 -0
  221. data/spec/unit/brightbox/firewall_policy/create_spec.rb +1 -1
  222. data/spec/unit/brightbox/firewall_policy/destroy_spec.rb +1 -1
  223. data/spec/unit/brightbox/firewall_rule/create_spec.rb +1 -1
  224. data/spec/unit/brightbox/firewall_rule/destroy_spec.rb +1 -1
  225. data/spec/unit/brightbox/firewall_rule/find_spec.rb +1 -1
  226. data/spec/unit/brightbox/firewall_rule/from_policy_spec.rb +1 -1
  227. data/spec/unit/brightbox/server/destroy_spec.rb +1 -1
  228. data/spec/unit/brightbox/server/find_or_call_spec.rb +1 -1
  229. data/spec/unit/brightbox/server/shutdown_spec.rb +1 -1
  230. data/spec/unit/brightbox/server/start_spec.rb +1 -1
  231. data/spec/unit/brightbox/server/stop_spec.rb +1 -1
  232. data/spec/unit/brightbox/server/update_spec.rb +1 -1
  233. data/spec/unit/brightbox/server_group/find_spec.rb +1 -1
  234. data/spec/unit/brightbox/user_collaboration/get_for_account_spec.rb +3 -3
  235. metadata +160 -115
  236. data/lib/brightbox-cli/commands/groups-list.rb +0 -21
  237. data/lib/brightbox-cli/commands/users-list.rb +0 -25
@@ -1,9 +1,8 @@
1
1
  module Brightbox
2
-
3
- desc "Manages the accounts"
2
+ desc I18n.t("accounts.desc")
4
3
  command [:accounts] do |cmd|
5
4
 
6
- cmd.desc "Accept invitation to collaborate with account"
5
+ cmd.desc I18n.t("accounts.accept_invite.desc")
7
6
  cmd.arg_name "account_id"
8
7
  cmd.command [:accept_invite] do |c|
9
8
  c.action do |global_options, options, args|
@@ -1,13 +1,11 @@
1
1
  module Brightbox
2
-
3
2
  command [:accounts] do |cmd|
4
3
 
5
- cmd.desc "Set a default account"
4
+ cmd.desc I18n.t("accounts.default.desc")
6
5
  cmd.arg_name "account-id"
7
6
  cmd.command [:default] do |c|
8
7
 
9
8
  c.action do |global_options, options, args|
10
-
11
9
  if args.empty?
12
10
  raise "You must specify the account-id to set as default."
13
11
  end
@@ -3,7 +3,7 @@ module Brightbox
3
3
 
4
4
  cmd.default_command :list
5
5
 
6
- cmd.desc "List accounts"
6
+ cmd.desc I18n.t("accounts.list.desc")
7
7
  cmd.arg_name "[account-id...]"
8
8
  cmd.command [:list] do |c|
9
9
 
@@ -1,8 +1,7 @@
1
1
  module Brightbox
2
-
3
2
  command [:accounts] do |cmd|
4
3
 
5
- cmd.desc "Refuses or removes an account collaboration"
4
+ cmd.desc I18n.t("accounts.remove.desc")
6
5
  cmd.arg_name "account_id"
7
6
  cmd.command [:remove] do |c|
8
7
  c.action do |global_options, options, args|
@@ -1,7 +1,7 @@
1
1
  module Brightbox
2
2
  command [:accounts] do |cmd|
3
3
 
4
- cmd.desc "Reset FTP Library password"
4
+ cmd.desc I18n.t("accounts.reset_ftp_password.desc")
5
5
  cmd.arg_name "account-id..."
6
6
  cmd.command [:reset_ftp_password] do |c|
7
7
 
@@ -25,13 +25,18 @@ module Brightbox
25
25
  rows << o
26
26
  end
27
27
 
28
- table_opts = global_options.merge({
28
+ table_opts = global_options.merge(
29
29
  :vertical => true,
30
- :fields => [:id, :name, :library_ftp_host, :library_ftp_user, :library_ftp_password ]
31
- })
30
+ :fields => [
31
+ :id,
32
+ :name,
33
+ :library_ftp_host,
34
+ :library_ftp_user,
35
+ :library_ftp_password
36
+ ]
37
+ )
32
38
 
33
39
  render_table(rows, table_opts)
34
-
35
40
  end
36
41
  end
37
42
  end
@@ -1,7 +1,7 @@
1
1
  module Brightbox
2
2
  command [:accounts] do |cmd|
3
3
 
4
- cmd.desc "Show detailed account info"
4
+ cmd.desc I18n.t("accounts.show.desc")
5
5
  cmd.arg_name "account-id..."
6
6
  cmd.command [:show] do |c|
7
7
 
@@ -15,14 +15,22 @@ module Brightbox
15
15
  warn "Couldn't find account #{id}"
16
16
  end
17
17
 
18
- table_opts = global_options.merge({
18
+ table_opts = global_options.merge(
19
19
  :vertical => true,
20
- :fields => [:id, :name, :cloud_ip_limit, :ram_limit, :ram_used, :lb_limit,
21
- :ram_free, :library_ftp_host, :library_ftp_user ]
22
- })
20
+ :fields => [
21
+ :id,
22
+ :name,
23
+ :cloud_ip_limit,
24
+ :ram_limit,
25
+ :ram_used,
26
+ :lb_limit,
27
+ :ram_free,
28
+ :library_ftp_host,
29
+ :library_ftp_user
30
+ ]
31
+ )
23
32
 
24
33
  render_table(accounts, table_opts)
25
-
26
34
  end
27
35
  end
28
36
  end
@@ -1,18 +1,18 @@
1
1
  module Brightbox
2
- desc "Manages an account's cloud IP addresses"
2
+ desc I18n.t("cloudips.desc")
3
3
  command [:cloudips] do |cmd|
4
4
 
5
- cmd.desc "Create a new Cloud IP address"
5
+ cmd.desc I18n.t("cloudips.create.desc")
6
6
  cmd.command [:create] do |c|
7
7
 
8
8
  c.desc "Number of Cloud IPs to create"
9
9
  c.default_value 1
10
10
  c.flag [:i, "count"]
11
11
 
12
- c.desc "Friendly name of the Cloud IP"
12
+ c.desc I18n.t("options.name.desc")
13
13
  c.flag [:n, :name]
14
14
 
15
- c.desc "Cloud IP translators. Format: in-port:out-port:protocol. Comma separate multiple translators. Protocol can be tcp or udp."
15
+ c.desc I18n.t("cloudips.options.port_translators.desc")
16
16
  c.flag [:t, :"port-translators"]
17
17
 
18
18
  c.action do |global_options, options, args|
@@ -1,7 +1,7 @@
1
1
  module Brightbox
2
2
  command [:cloudips] do |cmd|
3
3
 
4
- cmd.desc "destroy Cloud IPs"
4
+ cmd.desc I18n.t("cloudips.destroy.desc")
5
5
  cmd.arg_name "[cloudip-id...]"
6
6
  cmd.command [:destroy] do |c|
7
7
 
@@ -3,20 +3,12 @@ module Brightbox
3
3
 
4
4
  cmd.default_command :list
5
5
 
6
- cmd.desc "List Cloud IPs"
6
+ cmd.desc I18n.t("cloudips.list.desc")
7
7
  cmd.arg_name "[cloudip-id...]"
8
8
  cmd.command [:list] do |c|
9
9
 
10
10
  c.action do |global_options, options, args|
11
-
12
- if args.empty?
13
- ips = CloudIP.find(:all)
14
- else
15
- ips = CloudIP.find_or_call(args) do |id|
16
- warn "Couldn't find Cloud IP #{id}"
17
- end
18
- end
19
-
11
+ ips = CloudIP.find_all_or_warn(args)
20
12
  render_table(ips.sort, global_options)
21
13
  end
22
14
  end
@@ -1,7 +1,7 @@
1
1
  module Brightbox
2
2
  command [:cloudips] do |cmd|
3
3
 
4
- cmd.desc "map Cloud IPs"
4
+ cmd.desc I18n.t("cloudips.map.desc")
5
5
  cmd.arg_name "cloudip-id destination"
6
6
  cmd.command [:map] do |c|
7
7
 
@@ -28,14 +28,8 @@ module Brightbox
28
28
  server = Server.find destination_id
29
29
  destination_id = server.interfaces.first["id"]
30
30
  info "Mapping #{ip} to interface #{destination_id} on #{server}"
31
- when /^lba\-/
32
- lb = LoadBalancer.find destination_id
33
- info "Mapping #{ip} to load balancer #{lb}"
34
- when /grp\-/
35
- group = ServerGroup.find destination_id
36
- info "Mapping #{ip} to server group #{group}"
37
31
  else
38
- raise "Unknown destination '#{destination_id}'"
32
+ info "Mapping #{ip} to destination #{destination_id}"
39
33
  end
40
34
 
41
35
  if ip.mapped?
@@ -1,7 +1,7 @@
1
1
  module Brightbox
2
2
  command [:cloudips] do |cmd|
3
3
 
4
- cmd.desc "show details on Cloud IPs"
4
+ cmd.desc I18n.t("cloudips.show.desc")
5
5
  cmd.arg_name "cloudip-id..."
6
6
  cmd.command [:show] do |c|
7
7
 
@@ -15,9 +15,19 @@ module Brightbox
15
15
  warn "Couldn't find Cloud IP #{id}"
16
16
  end
17
17
 
18
- fields = [:id, :name, :reverse_dns, :status, :public_ip, :reverse_dns, :destination, :interface_id, :port_translators]
18
+ fields = [
19
+ :id,
20
+ :name,
21
+ :reverse_dns,
22
+ :status,
23
+ :public_ip,
24
+ :reverse_dns,
25
+ :destination,
26
+ :interface_id,
27
+ :port_translators
28
+ ]
19
29
 
20
- render_table(ips.compact, global_options.merge({ :vertical => true, :fields => fields}))
30
+ render_table(ips.compact, global_options.merge(:vertical => true, :fields => fields))
21
31
  end
22
32
  end
23
33
  end
@@ -1,7 +1,7 @@
1
1
  module Brightbox
2
2
  command [:cloudips] do |cmd|
3
3
 
4
- cmd.desc "unmap Cloud IPs"
4
+ cmd.desc I18n.t("cloudips.map.desc")
5
5
  cmd.arg_name "cloudip-id..."
6
6
  cmd.command [:unmap] do |c|
7
7
 
@@ -1,7 +1,7 @@
1
1
  module Brightbox
2
2
  command [:cloudips] do |cmd|
3
3
 
4
- cmd.desc "update Cloud IPs"
4
+ cmd.desc I18n.t("cloudips.update.desc")
5
5
  cmd.arg_name "cloudip-id"
6
6
  cmd.command [:update] do |c|
7
7
 
@@ -11,23 +11,22 @@ module Brightbox
11
11
  c.desc "Delete the reverse DNS for this Cloud IP"
12
12
  c.switch ["delete-reverse-dns"], :negatable => false
13
13
 
14
- c.desc "Friendly name of the Cloud IP"
14
+ c.desc I18n.t("options.name.desc")
15
15
  c.flag [:n, :name]
16
16
 
17
- c.desc "Cloud IP translators. Format: in-port:out-port:protocol. Comma separate multiple translators. Protocol can be tcp or udp."
17
+ c.desc I18n.t("cloudips.options.port_translators.desc")
18
18
  c.flag [:t, :"port-translators"]
19
19
 
20
20
  c.action do |global_options, options, args|
21
21
  cip_id = args.shift
22
22
  raise "You must specify the Cloud IP id as the first argument" unless cip_id =~ /^cip-/
23
23
 
24
- if options[:r] && options[:r] != "" && options[:"delete-reverse-dns"]
25
- raise "You must either specify a reverse DNS record or --delete-reverse-dns"
24
+ if options[:r] && options[:r] != "" && options[:"delete-reverse-dns"]
25
+ raise "You must either specify a reverse DNS record or --delete-reverse-dns"
26
26
  end
27
27
 
28
28
  cip = CloudIP.find cip_id
29
29
 
30
-
31
30
  cip.update(options)
32
31
  cip.reload
33
32
 
@@ -8,13 +8,7 @@ module Brightbox
8
8
  cmd.arg_name "[collaboration-id...]"
9
9
  cmd.command [:list] do |c|
10
10
  c.action do |global_options, options, args|
11
- if args.empty?
12
- collaborations = Collaboration.find(:all)
13
- else
14
- collaborations = Collaboration.find_or_call(args) do |id|
15
- warn "Couldn't find collaboration #{id}"
16
- end
17
- end
11
+ collaborations = Collaboration.find_all_or_warn(args)
18
12
  render_table(collaborations, global_options)
19
13
  end
20
14
  end
@@ -42,7 +36,7 @@ module Brightbox
42
36
  collaborations = Collaboration.find_or_call(args) do |id|
43
37
  warn "Couldn't find collaboration #{id}"
44
38
  end
45
- collaborations.each {|col| col.resend }
39
+ collaborations.each { |col| col.resend }
46
40
  render_table(collaborations, global_options)
47
41
  end
48
42
  end
@@ -65,7 +59,7 @@ module Brightbox
65
59
  collaborations = Collaboration.find_or_call(args) do |id|
66
60
  warn "Couldn't find collaboration #{id}"
67
61
  end
68
- collaborations.each {|col| col.destroy }
62
+ collaborations.each { |col| col.destroy }
69
63
  render_table(collaborations, global_options)
70
64
  end
71
65
  end
@@ -1,8 +1,8 @@
1
1
  module Brightbox
2
- desc "Manages local configuration settings and credentials"
2
+ desc I18n.t("config.desc")
3
3
  command [:config] do |cmd|
4
4
 
5
- cmd.desc "Add new api client details to config"
5
+ cmd.desc I18n.t("config.client_add.desc")
6
6
  cmd.arg_name "client-id secret [api_url, auth_url]"
7
7
  cmd.command [:client_add] do |c|
8
8
 
@@ -1,7 +1,7 @@
1
1
  module Brightbox
2
2
  command [:config] do |cmd|
3
3
 
4
- cmd.desc "Set the default api client in the config"
4
+ cmd.desc I18n.t("config.client_default.desc")
5
5
  cmd.arg_name "alias"
6
6
  cmd.command [:client_default] do |c|
7
7
 
@@ -3,19 +3,19 @@ module Brightbox
3
3
 
4
4
  cmd.default_command :client_list
5
5
 
6
- cmd.desc "Lists the api clients defined in the config"
6
+ cmd.desc I18n.t("config.client_list.desc")
7
7
  cmd.command [:client_list] do |c|
8
8
 
9
9
  c.action do |global_options, options, args|
10
10
 
11
11
  info "Using config file #{$config.config_filename}"
12
12
 
13
- clients = $config.clients.collect do |cid|
13
+ clients = $config.clients.map do |cid|
14
14
  c = $config[cid]
15
15
  calias = c["alias"] || cid
16
16
 
17
17
  # Append a star for the configured default client
18
- if $config.default_client == cid and $config.has_multiple_clients?
18
+ if $config.default_client == cid && $config.has_multiple_clients?
19
19
  calias = "*#{calias}"
20
20
  end
21
21
 
@@ -15,7 +15,10 @@ module Brightbox
15
15
  raise "You must specify the api alias you want to remove"
16
16
  end
17
17
 
18
- client_config = $config.clients.detect{|c| $config[c]["alias"] == calias}
18
+ client_config = $config.clients.find do |config|
19
+ $config[config]["alias"] == calias
20
+ end
21
+
19
22
  if client_config.nil?
20
23
  raise "An api client with the alias #{calias} does not exist in the config"
21
24
  end
@@ -1,7 +1,7 @@
1
1
  module Brightbox
2
2
  command [:config] do |cmd|
3
3
 
4
- cmd.desc "Add new user credentials to config"
4
+ cmd.desc I18n.t("config.user_add.desc")
5
5
  cmd.arg_name "email client-id secret [api_url auth_url]"
6
6
  cmd.command [:user_add] do |c|
7
7
 
@@ -1,8 +1,8 @@
1
1
  module Brightbox
2
- desc "Manages an account's firewall policies"
2
+ desc I18n.t("firewall.policies.desc")
3
3
  command [:"firewall-policies"] do |cmd|
4
4
 
5
- cmd.desc "Apply firewall policy to a server group"
5
+ cmd.desc I18n.t("firewall.policies.apply.desc")
6
6
  cmd.arg_name "firewall-policy-id server-group-id"
7
7
  cmd.command [:apply] do |c|
8
8
 
@@ -22,13 +22,12 @@ module Brightbox
22
22
  raise "Could not find firewall policy with #{firewall_policy_id}"
23
23
  end
24
24
 
25
-
26
25
  server_group = ServerGroup.find(server_group_id)
27
26
  unless server_group
28
27
  raise "Can\'t find group with #{options[:g]}"
29
28
  end
30
29
  firewall_policy.apply_to(server_group.id)
31
- render_table([firewall_policy],global_options)
30
+ render_table([firewall_policy], global_options)
32
31
  end
33
32
  end
34
33
  end
@@ -1,14 +1,14 @@
1
1
  module Brightbox
2
2
  command [:"firewall-policies"] do |cmd|
3
3
 
4
- cmd.desc "Create Firewall Policy"
4
+ cmd.desc I18n.t("firewall.policies.create.desc")
5
5
  cmd.arg_name "[server-group-id...]"
6
6
  cmd.command [:create] do |c|
7
7
 
8
- c.desc "Name of firewall policy"
8
+ c.desc I18n.t("options.name.desc")
9
9
  c.flag [:n, :name]
10
10
 
11
- c.desc "Description of firewall policy"
11
+ c.desc I18n.t("options.description.desc")
12
12
  c.flag [:d, :description]
13
13
 
14
14
  c.action do |global_options, options, args|
@@ -23,7 +23,6 @@ module Brightbox
23
23
  server_group = ServerGroup.find(server_group_id)
24
24
  end
25
25
 
26
-
27
26
  name = options[:n]
28
27
  description = options[:d]
29
28
 
@@ -1,7 +1,7 @@
1
1
  module Brightbox
2
2
  command [:"firewall-policies"] do |cmd|
3
3
 
4
- cmd.desc "Destroy Firewall Policy"
4
+ cmd.desc I18n.t("firewall.policies.destroy.desc")
5
5
  cmd.arg_name "[firewall-policy-id...]"
6
6
  cmd.command [:destroy] do |c|
7
7
 
@@ -17,11 +17,10 @@ module Brightbox
17
17
  info "Destroying firewall policy #{firewall_policy}"
18
18
  begin
19
19
  firewall_policy.destroy
20
- rescue Brightbox::Api::Conflict => e
20
+ rescue Brightbox::Api::Conflict
21
21
  error "Could not destroy #{firewall_policy}"
22
22
  end
23
23
  end
24
-
25
24
  end
26
25
  end
27
26
  end