brightbox-cli 2.2.0 → 2.3.0

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 (111) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +24 -0
  3. data/Gemfile.lock +5 -2
  4. data/brightbox-cli.gemspec +1 -1
  5. data/lib/brightbox/cli/config.rb +19 -0
  6. data/lib/brightbox-cli/accounts.rb +2 -2
  7. data/lib/brightbox-cli/api.rb +4 -4
  8. data/lib/brightbox-cli/commands/accounts/default.rb +1 -1
  9. data/lib/brightbox-cli/commands/accounts/list.rb +1 -1
  10. data/lib/brightbox-cli/commands/config/client-add.rb +2 -2
  11. data/lib/brightbox-cli/commands/config/client-default.rb +3 -3
  12. data/lib/brightbox-cli/commands/config/client-list.rb +6 -6
  13. data/lib/brightbox-cli/commands/config/client-remove.rb +4 -4
  14. data/lib/brightbox-cli/commands/config/user-add.rb +2 -2
  15. data/lib/brightbox-cli/commands/login.rb +53 -0
  16. data/lib/brightbox-cli/config/accounts.rb +5 -0
  17. data/lib/brightbox-cli/config/authentication_tokens.rb +10 -3
  18. data/lib/brightbox-cli/config/cache.rb +8 -12
  19. data/lib/brightbox-cli/config/clients.rb +14 -38
  20. data/lib/brightbox-cli/config/sections.rb +70 -13
  21. data/lib/brightbox-cli/config/user_application.rb +13 -5
  22. data/lib/brightbox-cli/config.rb +22 -14
  23. data/lib/brightbox-cli/connection_manager.rb +2 -2
  24. data/lib/brightbox-cli/gli_global_hooks.rb +25 -28
  25. data/lib/brightbox-cli/version.rb +1 -1
  26. data/lib/brightbox_cli.rb +4 -0
  27. data/spec/cassettes/Brightbox_BBConfig/_add_section/when_config_exists_and_overwrite_duplicates_is_false/does_not_update_the_config_file.yml +199 -0
  28. data/spec/cassettes/Brightbox_BBConfig/_add_section/when_config_exists_and_overwrite_duplicates_is_true/does_not_update_the_config_file.yml +199 -0
  29. data/spec/cassettes/Brightbox_BBConfig_add_login/when_altering_a_custom_option/does_not_alter_the_configuration.yml +99 -0
  30. data/spec/cassettes/Brightbox_BBConfig_add_login/when_altering_a_custom_option/updates_access_token.yml +99 -0
  31. data/spec/cassettes/Brightbox_BBConfig_add_login/when_altering_a_custom_option/updates_refresh_token.yml +99 -0
  32. data/spec/cassettes/Brightbox_BBConfig_add_login/when_configured_with_custom_options/does_not_alter_the_configuration.yml +99 -0
  33. data/spec/cassettes/Brightbox_BBConfig_add_login/when_configured_with_custom_options/updates_access_token.yml +99 -0
  34. data/spec/cassettes/Brightbox_BBConfig_add_login/when_configured_with_custom_options/updates_refresh_token.yml +99 -0
  35. data/spec/cassettes/Brightbox_BBConfig_add_login/when_logged_in_previously/does_not_alter_the_configuration.yml +149 -0
  36. data/spec/cassettes/Brightbox_BBConfig_add_login/when_logged_in_previously/updates_access_token.yml +149 -0
  37. data/spec/cassettes/Brightbox_BBConfig_add_login/when_logged_in_previously/updates_refresh_token.yml +149 -0
  38. data/spec/cassettes/Brightbox_BBConfig_add_login/when_no_config_exists/creates_the_configuration.yml +101 -0
  39. data/spec/cassettes/Brightbox_BBConfig_add_login/when_no_config_exists/refreshed_tokens.yml +101 -0
  40. data/spec/cassettes/Brightbox_BBConfig_add_login/when_using_an_email_and_suffix/creates_the_configuration.yml +101 -0
  41. data/spec/cassettes/Brightbox_BBConfig_add_login/when_using_an_email_and_suffix/refreshed_tokens.yml +101 -0
  42. data/spec/cassettes/brightbox_accounts/list/_when_access_token_expired_/does_not_report_invalid_token_errors.yml +64 -18
  43. data/spec/cassettes/brightbox_accounts/list/_when_no_tokens_/does_not_report_invalid_token_errors.yml +62 -16
  44. data/spec/cassettes/brightbox_login/when_alternative_client_credentials_are_given/does_not_error.yml +101 -0
  45. data/spec/cassettes/brightbox_login/when_alternative_client_credentials_are_given/does_not_prompt_to_rerun_the_command.yml +101 -0
  46. data/spec/cassettes/brightbox_login/when_alternative_client_credentials_are_given/prompts_for_the_password.yml +101 -0
  47. data/spec/cassettes/brightbox_login/when_alternative_client_credentials_are_given/requests_access_tokens.yml +101 -0
  48. data/spec/cassettes/brightbox_login/when_alternative_client_credentials_are_given/sets_up_the_config.yml +101 -0
  49. data/spec/cassettes/brightbox_login/when_custom_api/auth_URLs_are_given/does_not_error.yml +101 -0
  50. data/spec/cassettes/brightbox_login/when_custom_api/auth_URLs_are_given/does_not_prompt_to_rerun_the_command.yml +101 -0
  51. data/spec/cassettes/brightbox_login/when_custom_api/auth_URLs_are_given/prompts_for_the_password.yml +101 -0
  52. data/spec/cassettes/brightbox_login/when_custom_api/auth_URLs_are_given/requests_access_tokens.yml +101 -0
  53. data/spec/cassettes/brightbox_login/when_custom_api/auth_URLs_are_given/sets_up_the_config.yml +101 -0
  54. data/spec/cassettes/brightbox_login/when_default_account_is_passed/does_not_error.yml +51 -0
  55. data/spec/cassettes/brightbox_login/when_default_account_is_passed/does_not_prompt_to_rerun_the_command.yml +51 -0
  56. data/spec/cassettes/brightbox_login/when_default_account_is_passed/prompts_for_the_password.yml +51 -0
  57. data/spec/cassettes/brightbox_login/when_default_account_is_passed/requests_access_tokens.yml +51 -0
  58. data/spec/cassettes/brightbox_login/when_default_account_is_passed/sets_up_the_config.yml +51 -0
  59. data/spec/cassettes/brightbox_login/when_no_config_is_present/does_not_error.yml +101 -0
  60. data/spec/cassettes/brightbox_login/when_no_config_is_present/does_not_prompt_to_rerun_the_command.yml +101 -0
  61. data/spec/cassettes/brightbox_login/when_no_config_is_present/requests_access_tokens.yml +101 -0
  62. data/spec/cassettes/brightbox_login/when_no_config_is_present/sets_up_the_config.yml +101 -0
  63. data/spec/cassettes/brightbox_login/when_no_password_is_given/does_not_error.yml +101 -0
  64. data/spec/cassettes/brightbox_login/when_no_password_is_given/does_not_prompt_to_rerun_the_command.yml +101 -0
  65. data/spec/cassettes/brightbox_login/when_no_password_is_given/prompts_for_the_password.yml +101 -0
  66. data/spec/cassettes/brightbox_login/when_no_password_is_given/requests_access_tokens.yml +101 -0
  67. data/spec/cassettes/brightbox_login/when_no_password_is_given/sets_up_the_config.yml +101 -0
  68. data/spec/commands/accounts/list_spec.rb +1 -0
  69. data/spec/commands/login_spec.rb +239 -0
  70. data/spec/configs/user_app.ini +0 -2
  71. data/spec/spec_helper.rb +1 -0
  72. data/spec/support/config_helpers.rb +5 -0
  73. data/spec/unit/brightbox/account/all_spec.rb +1 -3
  74. data/spec/unit/brightbox/api/conn_spec.rb +3 -0
  75. data/spec/unit/brightbox/api/find_spec.rb +3 -0
  76. data/spec/unit/brightbox/bb_config/account_spec.rb +2 -0
  77. data/spec/unit/brightbox/bb_config/add_login_spec.rb +222 -0
  78. data/spec/unit/brightbox/bb_config/client_name_spec.rb +4 -12
  79. data/spec/unit/brightbox/bb_config/client_named_spec.rb +1 -1
  80. data/spec/unit/brightbox/bb_config/config_directory_exists_spec.rb +5 -2
  81. data/spec/unit/brightbox/bb_config/config_directory_spec.rb +4 -2
  82. data/spec/unit/brightbox/bb_config/config_spec.rb +4 -8
  83. data/spec/unit/brightbox/bb_config/default_account_spec.rb +10 -6
  84. data/spec/unit/brightbox/bb_config/find_or_set_default_account_spec.rb +2 -0
  85. data/spec/unit/brightbox/bb_config/renew_tokens_spec.rb +3 -0
  86. data/spec/unit/brightbox/bb_config/section_names_spec.rb +46 -0
  87. data/spec/unit/brightbox/bb_config/using_client_spec.rb +12 -12
  88. data/spec/unit/brightbox/bb_config_spec.rb +0 -1
  89. data/spec/unit/brightbox/cloud_ip/find_spec.rb +3 -0
  90. data/spec/unit/brightbox/config/user_application/to_fog_spec.rb +33 -29
  91. data/spec/unit/brightbox/config/user_application/valid_spec.rb +0 -32
  92. data/spec/unit/brightbox/connection_manager/fetch_connection_spec.rb +7 -3
  93. data/spec/unit/brightbox/firewall_policy/apply_to_spec.rb +3 -0
  94. data/spec/unit/brightbox/firewall_policy/create_spec.rb +3 -0
  95. data/spec/unit/brightbox/firewall_policy/destroy_spec.rb +3 -0
  96. data/spec/unit/brightbox/firewall_policy/find_or_call_spec.rb +3 -0
  97. data/spec/unit/brightbox/firewall_policy/find_spec.rb +3 -0
  98. data/spec/unit/brightbox/firewall_rule/create_spec.rb +3 -0
  99. data/spec/unit/brightbox/firewall_rule/destroy_spec.rb +3 -0
  100. data/spec/unit/brightbox/firewall_rule/find_spec.rb +3 -0
  101. data/spec/unit/brightbox/firewall_rule/from_policy_spec.rb +3 -0
  102. data/spec/unit/brightbox/server/destroy_spec.rb +4 -0
  103. data/spec/unit/brightbox/server/find_or_call_spec.rb +3 -0
  104. data/spec/unit/brightbox/server/find_spec.rb +4 -0
  105. data/spec/unit/brightbox/server/shutdown_spec.rb +4 -0
  106. data/spec/unit/brightbox/server/start_spec.rb +4 -0
  107. data/spec/unit/brightbox/server/stop_spec.rb +4 -0
  108. data/spec/unit/brightbox/server/update_spec.rb +4 -0
  109. data/spec/unit/brightbox/server_group/find_spec.rb +3 -0
  110. data/spec/unit/brightbox/user_collaboration/get_for_account_spec.rb +3 -0
  111. metadata +90 -3
@@ -20,7 +20,8 @@ module Brightbox
20
20
  include Brightbox::Config::ToFog
21
21
  include Brightbox::Config::Dirty
22
22
 
23
- attr_writer :client_name, :account
23
+ attr_accessor :client_name
24
+ attr_writer :account
24
25
 
25
26
  # @params [Hash] options Options to control loading and settings
26
27
  # @option options [String] :directory A path to the directory where config and
@@ -33,8 +34,10 @@ module Brightbox
33
34
  #
34
35
  def initialize(options = {})
35
36
  @options = options
36
- @client_name = options[:client_name]
37
- @account = options[:account]
37
+ prepare_dir
38
+ prepare_ini
39
+ @client_name = determine_client(options[:client_name])
40
+ @account = determine_account(options[:account])
38
41
  @dirty = false
39
42
  end
40
43
 
@@ -67,15 +70,7 @@ module Brightbox
67
70
  #
68
71
  # @return [Ini] The raw settings from the ini configuration file
69
72
  def config
70
- return @config_file if @config_file
71
- return {} if @config_file == false
72
-
73
- create_directory unless config_directory_exists?
74
-
75
- @config_file ||= Ini.new(config_filename)
76
73
  @config_file
77
- rescue Ini::Error => e
78
- raise BBConfigError, "Config problem in #{config_filename}: #{e}"
79
74
  end
80
75
 
81
76
  # Write out the configuration file to disk
@@ -116,11 +111,10 @@ module Brightbox
116
111
  end
117
112
 
118
113
  def configured?
119
- configured = !client_name.nil? && !clients.empty?
120
- if configured && (selected_config.nil? || selected_config.empty?)
114
+ if client_name.nil? || config[client_name].nil?
121
115
  raise BBConfigError, "client id or alias #{client_name.inspect} not defined in config"
122
116
  end
123
- configured
117
+ true
124
118
  end
125
119
 
126
120
  # Attempts to create the directory the config is expecting to find it's file
@@ -134,5 +128,19 @@ module Brightbox
134
128
  end
135
129
  end
136
130
  end
131
+
132
+ def prepare_dir
133
+ create_directory unless config_directory_exists?
134
+ end
135
+
136
+ def prepare_ini
137
+ return @config_file if @config_file
138
+ return {} if @config_file == false
139
+
140
+ @config_file ||= Ini.new(config_filename)
141
+ @config_file
142
+ rescue Ini::Error => e
143
+ raise BBConfigError, "Config problem in #{config_filename}: #{e}"
144
+ end
137
145
  end
138
146
  end
@@ -17,10 +17,10 @@ module Brightbox
17
17
 
18
18
  def connection_with_account
19
19
  if @connection
20
- @connection.scoped_account = $config.account
20
+ @connection.scoped_account = Brightbox.config.account
21
21
  @connection
22
22
  else
23
- selected_account = $config.account
23
+ selected_account = Brightbox.config.account
24
24
  @connection = create_connection(:brightbox_account => selected_account)
25
25
  end
26
26
  end
@@ -33,22 +33,28 @@ module Brightbox
33
33
  switch [:k, :insecure], :negatable => false
34
34
 
35
35
  pre do |global_options, command, _options, _args|
36
- if command.topmost_ancestor.name == :config
37
- force_default_config = false
38
- else
39
- force_default_config = true
40
- end
41
-
42
36
  # Configuration options
43
37
  config_opts = {
44
- :force_default_config => force_default_config,
45
38
  :client_name => ENV["CLIENT"] || global_options[:client],
46
39
  :account => ENV["ACCOUNT"] || global_options[:account]
47
40
  }
48
- $config = BBConfig.new(config_opts)
41
+ Brightbox.config = BBConfig.new(config_opts)
49
42
 
50
- # Outputs a snapshot of the tokens known by the client
51
- $config.debug_tokens
43
+ # Commands that alter the config files should not error here
44
+ unless [:config, :login].include?(command.topmost_ancestor.name)
45
+ raise AmbiguousClientError, AMBIGUOUS_CLIENT_ERROR if Brightbox.config.client_name.nil?
46
+
47
+ if Brightbox.config.has_multiple_clients?
48
+ if Brightbox.config.client_has_alias?
49
+ info "INFO: client_id: #{Brightbox.config.client_name} (#{Brightbox.config.client_alias})"
50
+ else
51
+ info "INFO: client_id: #{Brightbox.config.client_name}"
52
+ end
53
+ end
54
+
55
+ # Outputs a snapshot of the tokens known by the client
56
+ Brightbox.config.debug_tokens if Brightbox.config.respond_to?(:debug_tokens)
57
+ end
52
58
 
53
59
  Excon.defaults[:headers]['User-Agent'] = "brightbox-cli/#{Brightbox::VERSION} Fog/#{Fog::Core::VERSION}"
54
60
 
@@ -63,13 +69,6 @@ module Brightbox
63
69
  Hirb::View.resize
64
70
  end
65
71
 
66
- if $config.has_multiple_clients?
67
- if $config.client_has_alias?
68
- info "INFO: client_id: #{$config.client_id} (#{$config.client_alias})"
69
- else
70
- info "INFO: client_id: #{$config.client_id}"
71
- end
72
- end
73
72
  true
74
73
  end
75
74
 
@@ -81,12 +80,12 @@ module Brightbox
81
80
  access_token = Api.conn.access_token
82
81
  refresh_token = Api.conn.refresh_token
83
82
 
84
- $config.update_stored_tokens(access_token, refresh_token)
85
- $config.save
83
+ Brightbox.config.update_stored_tokens(access_token, refresh_token)
84
+ Brightbox.config.save
86
85
  rescue BBConfigError
87
86
  rescue StandardError => e
88
87
  # FIXME: Other StandardErrors are available
89
- warn "Error writing auth token #{$config.access_token_filename}: #{e.class}: #{e}"
88
+ warn "Error writing auth token #{Brightbox.config.access_token_filename}: #{e.class}: #{e}"
90
89
  end
91
90
  end
92
91
 
@@ -94,15 +93,15 @@ module Brightbox
94
93
  # Try to handle invalid/expired credentials
95
94
  if e.is_a?(Excon::Errors::Unauthorized)
96
95
  begin
97
- debug "Refused access token: #{$config.access_token}"
98
- $config.reauthenticate
96
+ debug "Refused access token: #{Brightbox.config.access_token}"
97
+ Brightbox.config.reauthenticate
99
98
  # FIXME: Curious output from info
100
99
  info "Your API credentials have been updated, please re-run your command."
101
- $config.debug_tokens
100
+ Brightbox.config.debug_tokens if Brightbox.config.respond_to?(:debug_tokens)
102
101
  exit(222)
103
102
  rescue Brightbox::Api::ApiError
104
103
  error "Unable to authenticate with supplied details"
105
- $config.debug_tokens
104
+ Brightbox.config.debug_tokens if Brightbox.config.respond_to?(:debug_tokens)
106
105
  exit(111)
107
106
  rescue Exception => e
108
107
  if ENV["DEBUG"]
@@ -110,7 +109,7 @@ module Brightbox
110
109
  debug e.class.to_s
111
110
  debug e.backtrace.join("\n")
112
111
  end
113
- $config.debug_tokens
112
+ Brightbox.config.debug_tokens if Brightbox.config.respond_to?(:debug_tokens)
114
113
  exit(1)
115
114
  end
116
115
  else
@@ -122,9 +121,7 @@ module Brightbox
122
121
  debug e.class.to_s
123
122
  debug e.backtrace.join("\n")
124
123
  end
125
- if $config
126
- $config.debug_tokens
127
- end
124
+ Brightbox.config.debug_tokens if Brightbox.config.respond_to?(:debug_tokens)
128
125
  exit(1)
129
126
  end
130
127
  end
@@ -1,3 +1,3 @@
1
1
  module Brightbox
2
- VERSION = "2.2.0" unless defined?(Brightbox::VERSION)
2
+ VERSION = "2.3.0" unless defined?(Brightbox::VERSION)
3
3
  end
data/lib/brightbox_cli.rb CHANGED
@@ -33,6 +33,8 @@ I18n.load_path = [File.join(File.dirname(__FILE__) + "/../locales/en.yml")]
33
33
 
34
34
  module Brightbox
35
35
  DEFAULT_API_ENDPOINT = ENV["BRIGHTBOX_API_URL"] || "https://api.gb1.brightbox.com"
36
+ EMBEDDED_APP_ID = "app-12345"
37
+ EMBEDDED_APP_SECRET = "mocbuipbiaa6k6c"
36
38
 
37
39
  autoload :Server, File.expand_path("../brightbox-cli/servers", __FILE__)
38
40
  autoload :DetailedServer, File.expand_path("../brightbox-cli/detailed_server", __FILE__)
@@ -60,6 +62,8 @@ module Brightbox
60
62
  end
61
63
  end
62
64
 
65
+ require_relative "brightbox/cli/config"
66
+
63
67
  require_relative "brightbox-cli/connection_manager"
64
68
  require_relative 'brightbox-cli/tables'
65
69
  require_relative "brightbox-cli/logging"
@@ -0,0 +1,199 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: http://api.brightbox.dev/token
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"grant_type":"password","username":"jason.null@brightbox.com","password":"N:B3e%7Cmh"}'
9
+ headers:
10
+ User-Agent:
11
+ - fog-core/1.32.1
12
+ Authorization:
13
+ - Basic YXBwLTEyMzQ1Om1vY2J1aXBiaWFhNms2Yw==
14
+ Content-Type:
15
+ - application/json
16
+ response:
17
+ status:
18
+ code: 200
19
+ message:
20
+ headers:
21
+ Content-Type:
22
+ - application/json
23
+ Cache-Control:
24
+ - no-store
25
+ X-Oauth-Scopes:
26
+ - infrastructure, orbit
27
+ Content-Length:
28
+ - '190'
29
+ X-Content-Type-Options:
30
+ - nosniff
31
+ X-Ua-Compatible:
32
+ - IE=Edge
33
+ Etag:
34
+ - '"46fbbfb8a2a2a7ac18ddeb0827caecd5"'
35
+ X-Request-Id:
36
+ - f023fab1e85e0bfa6dd2047ba00a56e2
37
+ X-Runtime:
38
+ - '0.089060'
39
+ Server:
40
+ - WEBrick/1.3.1 (Ruby/1.9.3/2014-11-13)
41
+ Date:
42
+ - Wed, 30 Sep 2015 14:34:22 GMT
43
+ Connection:
44
+ - Keep-Alive
45
+ body:
46
+ encoding: UTF-8
47
+ string: '{"access_token":"64f68b5dddea1c6b774286180375ba883b896cac","token_type":"Bearer","refresh_token":"b7716ed2480d2831c8cb8af8ea536666c27815b1","scope":"infrastructure,
48
+ orbit","expires_in":7200}'
49
+ http_version:
50
+ recorded_at: Wed, 30 Sep 2015 14:34:22 GMT
51
+ - request:
52
+ method: get
53
+ uri: http://api.brightbox.dev/1.0/accounts
54
+ body:
55
+ encoding: US-ASCII
56
+ string: ''
57
+ headers:
58
+ User-Agent:
59
+ - fog-core/1.32.1
60
+ Authorization:
61
+ - Bearer 64f68b5dddea1c6b774286180375ba883b896cac
62
+ Content-Type:
63
+ - application/json
64
+ response:
65
+ status:
66
+ code: 200
67
+ message:
68
+ headers:
69
+ X-Oauth-Scopes:
70
+ - infrastructure, orbit
71
+ Content-Type:
72
+ - application/json; charset=utf-8
73
+ X-Ua-Compatible:
74
+ - IE=Edge
75
+ Etag:
76
+ - '"79022220a299b096df8561e8b08c2a6c"'
77
+ Cache-Control:
78
+ - max-age=0, private, must-revalidate
79
+ X-Request-Id:
80
+ - d9bf84944cdefeb0ad6eec2208adb07b
81
+ X-Runtime:
82
+ - '0.115969'
83
+ Server:
84
+ - WEBrick/1.3.1 (Ruby/1.9.3/2014-11-13)
85
+ Date:
86
+ - Wed, 30 Sep 2015 14:34:22 GMT
87
+ Content-Length:
88
+ - '1611'
89
+ Connection:
90
+ - Keep-Alive
91
+ body:
92
+ encoding: UTF-8
93
+ string: '[{"id":"acc-12345","resource_type":"account","url":"https://api.gb1.brightbox.com/1.0/accounts/acc-12345","name":"CLI
94
+ test account","status":"active","ram_limit":3200000,"ram_used":0,"dbs_ram_limit":32768,"dbs_ram_used":0,"cloud_ips_limit":32,"cloud_ips_used":0,"load_balancers_limit":5,"load_balancers_used":0,"clients":[{"id":"cli-12345","resource_type":"api_client","url":"https://api.gb1.brightbox.com/1.0/api_clients/cli-12345","name":"CLI
95
+ test API client","description":"","revoked_at":null,"permissions_group":"full"}],"images":[],"servers":[],"load_balancers":[],"database_servers":[],"database_snapshots":[],"cloud_ips":[],"server_groups":[{"id":"grp-12345","resource_type":"server_group","url":"https://api.gb1.brightbox.com/1.0/server_groups/grp-12345","name":"default","description":"All
96
+ new servers are added to this group unless specified otherwise.","created_at":"2015-09-29T08:22:15Z","default":true}],"firewall_policies":[{"id":"fwp-12345","resource_type":"firewall_policy","url":"https://api.gb1.brightbox.com/1.0/firewall_policies/fwp-12345","default":true,"name":"default","created_at":"2015-09-29T08:22:15Z","description":"Applied
97
+ to the default server group."}],"owner":{"id":"usr-12345","resource_type":"user","url":"https://api.gb1.brightbox.com/1.0/users/usr-12345","name":"Jason
98
+ Null","email_address":"jason.null@brightbox.com"},"users":[],"zones":[{"id":"zon-12345","resource_type":"zone","url":"https://api.gb1.brightbox.com/1.0/zones/zon-12345","handle":"gb1-a"},{"id":"zon-12345","resource_type":"zone","url":"https://api.gb1.brightbox.com/1.0/zones/zon-12345","handle":"gb1-b"}]}]'
99
+ http_version:
100
+ recorded_at: Wed, 30 Sep 2015 14:34:22 GMT
101
+ - request:
102
+ method: post
103
+ uri: http://api.brightbox.dev/token
104
+ body:
105
+ encoding: UTF-8
106
+ string: '{"grant_type":"refresh_token","refresh_token":"b7716ed2480d2831c8cb8af8ea536666c27815b1"}'
107
+ headers:
108
+ User-Agent:
109
+ - fog-core/1.32.1
110
+ Authorization:
111
+ - Basic YXBwLTEyMzQ1Om1vY2J1aXBiaWFhNms2Yw==
112
+ Content-Type:
113
+ - application/json
114
+ response:
115
+ status:
116
+ code: 200
117
+ message:
118
+ headers:
119
+ Content-Type:
120
+ - application/json
121
+ Cache-Control:
122
+ - no-store
123
+ X-Oauth-Scopes:
124
+ - infrastructure, orbit
125
+ Content-Length:
126
+ - '190'
127
+ X-Content-Type-Options:
128
+ - nosniff
129
+ X-Ua-Compatible:
130
+ - IE=Edge
131
+ Etag:
132
+ - '"dd8fd24413fcd0a0a60481951e332374"'
133
+ X-Request-Id:
134
+ - e937501889b560dac744be408f920d6b
135
+ X-Runtime:
136
+ - '0.044393'
137
+ Server:
138
+ - WEBrick/1.3.1 (Ruby/1.9.3/2014-11-13)
139
+ Date:
140
+ - Wed, 30 Sep 2015 14:34:22 GMT
141
+ Connection:
142
+ - Keep-Alive
143
+ body:
144
+ encoding: UTF-8
145
+ string: '{"access_token":"c8975689c865aafc885cf964a76fa72418451e25","token_type":"Bearer","refresh_token":"9f7921dbea20637a80b117f3e677060831b6522d","scope":"infrastructure,
146
+ orbit","expires_in":7200}'
147
+ http_version:
148
+ recorded_at: Wed, 30 Sep 2015 14:34:22 GMT
149
+ - request:
150
+ method: get
151
+ uri: http://api.brightbox.dev/1.0/accounts
152
+ body:
153
+ encoding: US-ASCII
154
+ string: ''
155
+ headers:
156
+ User-Agent:
157
+ - fog-core/1.32.1
158
+ Authorization:
159
+ - Bearer c8975689c865aafc885cf964a76fa72418451e25
160
+ Content-Type:
161
+ - application/json
162
+ response:
163
+ status:
164
+ code: 200
165
+ message:
166
+ headers:
167
+ X-Oauth-Scopes:
168
+ - infrastructure, orbit
169
+ Content-Type:
170
+ - application/json; charset=utf-8
171
+ X-Ua-Compatible:
172
+ - IE=Edge
173
+ Etag:
174
+ - '"79022220a299b096df8561e8b08c2a6c"'
175
+ Cache-Control:
176
+ - max-age=0, private, must-revalidate
177
+ X-Request-Id:
178
+ - a1371291bf1482c522f967fff0d1b86f
179
+ X-Runtime:
180
+ - '0.044154'
181
+ Server:
182
+ - WEBrick/1.3.1 (Ruby/1.9.3/2014-11-13)
183
+ Date:
184
+ - Wed, 30 Sep 2015 14:34:22 GMT
185
+ Content-Length:
186
+ - '1611'
187
+ Connection:
188
+ - Keep-Alive
189
+ body:
190
+ encoding: UTF-8
191
+ string: '[{"id":"acc-12345","resource_type":"account","url":"https://api.gb1.brightbox.com/1.0/accounts/acc-12345","name":"CLI
192
+ test account","status":"active","ram_limit":3200000,"ram_used":0,"dbs_ram_limit":32768,"dbs_ram_used":0,"cloud_ips_limit":32,"cloud_ips_used":0,"load_balancers_limit":5,"load_balancers_used":0,"clients":[{"id":"cli-12345","resource_type":"api_client","url":"https://api.gb1.brightbox.com/1.0/api_clients/cli-12345","name":"CLI
193
+ test API client","description":"","revoked_at":null,"permissions_group":"full"}],"images":[],"servers":[],"load_balancers":[],"database_servers":[],"database_snapshots":[],"cloud_ips":[],"server_groups":[{"id":"grp-12345","resource_type":"server_group","url":"https://api.gb1.brightbox.com/1.0/server_groups/grp-12345","name":"default","description":"All
194
+ new servers are added to this group unless specified otherwise.","created_at":"2015-09-29T08:22:15Z","default":true}],"firewall_policies":[{"id":"fwp-12345","resource_type":"firewall_policy","url":"https://api.gb1.brightbox.com/1.0/firewall_policies/fwp-12345","default":true,"name":"default","created_at":"2015-09-29T08:22:15Z","description":"Applied
195
+ to the default server group."}],"owner":{"id":"usr-12345","resource_type":"user","url":"https://api.gb1.brightbox.com/1.0/users/usr-12345","name":"Jason
196
+ Null","email_address":"jason.null@brightbox.com"},"users":[],"zones":[{"id":"zon-12345","resource_type":"zone","url":"https://api.gb1.brightbox.com/1.0/zones/zon-12345","handle":"gb1-a"},{"id":"zon-12345","resource_type":"zone","url":"https://api.gb1.brightbox.com/1.0/zones/zon-12345","handle":"gb1-b"}]}]'
197
+ http_version:
198
+ recorded_at: Wed, 30 Sep 2015 14:34:22 GMT
199
+ recorded_with: VCR 2.5.0
@@ -0,0 +1,199 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: http://api.brightbox.dev/token
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"grant_type":"password","username":"jason.null@brightbox.com","password":"N:B3e%7Cmh"}'
9
+ headers:
10
+ User-Agent:
11
+ - fog-core/1.32.1
12
+ Authorization:
13
+ - Basic YXBwLTEyMzQ1Om1vY2J1aXBiaWFhNms2Yw==
14
+ Content-Type:
15
+ - application/json
16
+ response:
17
+ status:
18
+ code: 200
19
+ message:
20
+ headers:
21
+ Content-Type:
22
+ - application/json
23
+ Cache-Control:
24
+ - no-store
25
+ X-Oauth-Scopes:
26
+ - infrastructure, orbit
27
+ Content-Length:
28
+ - '190'
29
+ X-Content-Type-Options:
30
+ - nosniff
31
+ X-Ua-Compatible:
32
+ - IE=Edge
33
+ Etag:
34
+ - '"2a4be747fd46075bcb395a242ed76253"'
35
+ X-Request-Id:
36
+ - dd49f50cea13daa0e840b1ed350b06cf
37
+ X-Runtime:
38
+ - '0.089367'
39
+ Server:
40
+ - WEBrick/1.3.1 (Ruby/1.9.3/2014-11-13)
41
+ Date:
42
+ - Wed, 30 Sep 2015 14:55:23 GMT
43
+ Connection:
44
+ - Keep-Alive
45
+ body:
46
+ encoding: UTF-8
47
+ string: '{"access_token":"13824deca216ba81d5963d75659755d76083c490","token_type":"Bearer","refresh_token":"6b70b12f95df7b7e95e6cf0a99e5982ea7087f2c","scope":"infrastructure,
48
+ orbit","expires_in":7200}'
49
+ http_version:
50
+ recorded_at: Wed, 30 Sep 2015 14:55:23 GMT
51
+ - request:
52
+ method: get
53
+ uri: http://api.brightbox.dev/1.0/accounts
54
+ body:
55
+ encoding: US-ASCII
56
+ string: ''
57
+ headers:
58
+ User-Agent:
59
+ - fog-core/1.32.1
60
+ Authorization:
61
+ - Bearer 13824deca216ba81d5963d75659755d76083c490
62
+ Content-Type:
63
+ - application/json
64
+ response:
65
+ status:
66
+ code: 200
67
+ message:
68
+ headers:
69
+ X-Oauth-Scopes:
70
+ - infrastructure, orbit
71
+ Content-Type:
72
+ - application/json; charset=utf-8
73
+ X-Ua-Compatible:
74
+ - IE=Edge
75
+ Etag:
76
+ - '"79022220a299b096df8561e8b08c2a6c"'
77
+ Cache-Control:
78
+ - max-age=0, private, must-revalidate
79
+ X-Request-Id:
80
+ - 9f7629fdd50646311d4cb022dfd867c4
81
+ X-Runtime:
82
+ - '0.116434'
83
+ Server:
84
+ - WEBrick/1.3.1 (Ruby/1.9.3/2014-11-13)
85
+ Date:
86
+ - Wed, 30 Sep 2015 14:55:23 GMT
87
+ Content-Length:
88
+ - '1611'
89
+ Connection:
90
+ - Keep-Alive
91
+ body:
92
+ encoding: UTF-8
93
+ string: '[{"id":"acc-12345","resource_type":"account","url":"https://api.gb1.brightbox.com/1.0/accounts/acc-12345","name":"CLI
94
+ test account","status":"active","ram_limit":3200000,"ram_used":0,"dbs_ram_limit":32768,"dbs_ram_used":0,"cloud_ips_limit":32,"cloud_ips_used":0,"load_balancers_limit":5,"load_balancers_used":0,"clients":[{"id":"cli-12345","resource_type":"api_client","url":"https://api.gb1.brightbox.com/1.0/api_clients/cli-12345","name":"CLI
95
+ test API client","description":"","revoked_at":null,"permissions_group":"full"}],"images":[],"servers":[],"load_balancers":[],"database_servers":[],"database_snapshots":[],"cloud_ips":[],"server_groups":[{"id":"grp-12345","resource_type":"server_group","url":"https://api.gb1.brightbox.com/1.0/server_groups/grp-12345","name":"default","description":"All
96
+ new servers are added to this group unless specified otherwise.","created_at":"2015-09-29T08:22:15Z","default":true}],"firewall_policies":[{"id":"fwp-12345","resource_type":"firewall_policy","url":"https://api.gb1.brightbox.com/1.0/firewall_policies/fwp-12345","default":true,"name":"default","created_at":"2015-09-29T08:22:15Z","description":"Applied
97
+ to the default server group."}],"owner":{"id":"usr-12345","resource_type":"user","url":"https://api.gb1.brightbox.com/1.0/users/usr-12345","name":"Jason
98
+ Null","email_address":"jason.null@brightbox.com"},"users":[],"zones":[{"id":"zon-12345","resource_type":"zone","url":"https://api.gb1.brightbox.com/1.0/zones/zon-12345","handle":"gb1-a"},{"id":"zon-12345","resource_type":"zone","url":"https://api.gb1.brightbox.com/1.0/zones/zon-12345","handle":"gb1-b"}]}]'
99
+ http_version:
100
+ recorded_at: Wed, 30 Sep 2015 14:55:23 GMT
101
+ - request:
102
+ method: post
103
+ uri: http://api.brightbox.dev/token
104
+ body:
105
+ encoding: UTF-8
106
+ string: '{"grant_type":"refresh_token","refresh_token":"6b70b12f95df7b7e95e6cf0a99e5982ea7087f2c"}'
107
+ headers:
108
+ User-Agent:
109
+ - fog-core/1.32.1
110
+ Authorization:
111
+ - Basic YXBwLTEyMzQ1Om1vY2J1aXBiaWFhNms2Yw==
112
+ Content-Type:
113
+ - application/json
114
+ response:
115
+ status:
116
+ code: 200
117
+ message:
118
+ headers:
119
+ Content-Type:
120
+ - application/json
121
+ Cache-Control:
122
+ - no-store
123
+ X-Oauth-Scopes:
124
+ - infrastructure, orbit
125
+ Content-Length:
126
+ - '190'
127
+ X-Content-Type-Options:
128
+ - nosniff
129
+ X-Ua-Compatible:
130
+ - IE=Edge
131
+ Etag:
132
+ - '"42b98dac6f17fff4a57b51c71f165c16"'
133
+ X-Request-Id:
134
+ - 5d1c861531e840a9462d3b33ee81f1ee
135
+ X-Runtime:
136
+ - '0.025472'
137
+ Server:
138
+ - WEBrick/1.3.1 (Ruby/1.9.3/2014-11-13)
139
+ Date:
140
+ - Wed, 30 Sep 2015 14:55:23 GMT
141
+ Connection:
142
+ - Keep-Alive
143
+ body:
144
+ encoding: UTF-8
145
+ string: '{"access_token":"9f1758514b2245dc6d52c550d252074287277e7b","token_type":"Bearer","refresh_token":"514aa63f8de3113429e721e117cc60f5a6e2e004","scope":"infrastructure,
146
+ orbit","expires_in":7200}'
147
+ http_version:
148
+ recorded_at: Wed, 30 Sep 2015 14:55:23 GMT
149
+ - request:
150
+ method: get
151
+ uri: http://api.brightbox.dev/1.0/accounts
152
+ body:
153
+ encoding: US-ASCII
154
+ string: ''
155
+ headers:
156
+ User-Agent:
157
+ - fog-core/1.32.1
158
+ Authorization:
159
+ - Bearer 9f1758514b2245dc6d52c550d252074287277e7b
160
+ Content-Type:
161
+ - application/json
162
+ response:
163
+ status:
164
+ code: 200
165
+ message:
166
+ headers:
167
+ X-Oauth-Scopes:
168
+ - infrastructure, orbit
169
+ Content-Type:
170
+ - application/json; charset=utf-8
171
+ X-Ua-Compatible:
172
+ - IE=Edge
173
+ Etag:
174
+ - '"79022220a299b096df8561e8b08c2a6c"'
175
+ Cache-Control:
176
+ - max-age=0, private, must-revalidate
177
+ X-Request-Id:
178
+ - 88733c18e03e378dbe83da0b01468469
179
+ X-Runtime:
180
+ - '0.044765'
181
+ Server:
182
+ - WEBrick/1.3.1 (Ruby/1.9.3/2014-11-13)
183
+ Date:
184
+ - Wed, 30 Sep 2015 14:55:23 GMT
185
+ Content-Length:
186
+ - '1611'
187
+ Connection:
188
+ - Keep-Alive
189
+ body:
190
+ encoding: UTF-8
191
+ string: '[{"id":"acc-12345","resource_type":"account","url":"https://api.gb1.brightbox.com/1.0/accounts/acc-12345","name":"CLI
192
+ test account","status":"active","ram_limit":3200000,"ram_used":0,"dbs_ram_limit":32768,"dbs_ram_used":0,"cloud_ips_limit":32,"cloud_ips_used":0,"load_balancers_limit":5,"load_balancers_used":0,"clients":[{"id":"cli-12345","resource_type":"api_client","url":"https://api.gb1.brightbox.com/1.0/api_clients/cli-12345","name":"CLI
193
+ test API client","description":"","revoked_at":null,"permissions_group":"full"}],"images":[],"servers":[],"load_balancers":[],"database_servers":[],"database_snapshots":[],"cloud_ips":[],"server_groups":[{"id":"grp-12345","resource_type":"server_group","url":"https://api.gb1.brightbox.com/1.0/server_groups/grp-12345","name":"default","description":"All
194
+ new servers are added to this group unless specified otherwise.","created_at":"2015-09-29T08:22:15Z","default":true}],"firewall_policies":[{"id":"fwp-12345","resource_type":"firewall_policy","url":"https://api.gb1.brightbox.com/1.0/firewall_policies/fwp-12345","default":true,"name":"default","created_at":"2015-09-29T08:22:15Z","description":"Applied
195
+ to the default server group."}],"owner":{"id":"usr-12345","resource_type":"user","url":"https://api.gb1.brightbox.com/1.0/users/usr-12345","name":"Jason
196
+ Null","email_address":"jason.null@brightbox.com"},"users":[],"zones":[{"id":"zon-12345","resource_type":"zone","url":"https://api.gb1.brightbox.com/1.0/zones/zon-12345","handle":"gb1-a"},{"id":"zon-12345","resource_type":"zone","url":"https://api.gb1.brightbox.com/1.0/zones/zon-12345","handle":"gb1-b"}]}]'
197
+ http_version:
198
+ recorded_at: Wed, 30 Sep 2015 14:55:23 GMT
199
+ recorded_with: VCR 2.5.0