Class Fog::Brightbox::Config
In: lib/fog/brightbox/config.rb
Parent: Object

The {Fog::Brightbox::Config} class is designed to encapsulate a group of settings for reuse between Brightbox services. The same config can be used for any service.

The config also holds the latest set of access tokens which when shared means when one service is told a token has expired then another will not retry it.

Methods

Public Class methods

Creates a new set of configuration settings based on the options provided.

@param [Hash] options The configuration settings @option options [String] :brightbox_access_token

  Set to use a cached OAuth access token to avoid having to request new access rights.

@option options [String] :brightbox_account

  Set to specify the account to scope requests to if relevant. API clients are limited to
  their owning accounts but users can access any account they collaborate on.

@option options [String] :brightbox_api_url (api.gb1.brightbox.com)

  Set an alternative API endpoint to send requests to.

@option options [String] :brightbox_auth_url (api.gb1.brightbox.com)

  Set an alternative OAuth authentication endpoint to send requests to.

@option options [String] :brightbox_client_id

  Set to specify the client identifier to use for requests. Either +cli-12345+ or
  +app-12345+ are suitable settings.

@option options [String] :brightbox_default_image

  Set to specify a preferred image to use by default in the Compute service.

@option options [String] :brightbox_password

  Set to specify your user's password to authenticate yourself. This is independent of the
  client used to access the API.

@option options [String] :brightbox_refresh_token

  Set to use a cached OAuth refresh token to avoid having to request new access rights.

@option options [String] :brightbox_secret

  Set to specify the client secret to use for requests.

@option options [String] :brightbox_token_management (true)

  Set to specify if the service should handle expired tokens or raise an error instead.

@option options [String] :brightbox_username

  Set to specify your user account. Either user identifier (+usr-12345+) or email address
  may be used.

@option options [String] :connection_options ({})

  Set to pass options through to the HTTP connection.

@option options [Boolean] :persistent (false)

  Set to specify if the HTTP connection be persistent

@example Use Fog.credentials

  # Assuming credentials are setup to return Brightbox settings and not other providers!
  @config = Fog::Brightbox::Config.new(Fog.credentials)

Public Instance methods

@return [String] The configured account identifier to scope API requests by.

api_url()

Alias for compute_url

@return [URI::HTTPS] A URI object for the authentication endpoint

This changes the scoped account from the originally configured one to another.

@return [String] The new account identifier used to scope API requests by.

@return [String] The configured identifier of the API client or user application.

@return [String] The configured secret to use to identify the client.

@return [URI::HTTPS] A URI object for the main API/compute service endpoint

Can this be used to configure services? Yes, yes it can.

@return [true]

Allows classes sharing to mark the tokens as invalid in response to API status codes.

This is the current, most up to date refresh token.

@return [String] The configured password to use to identify the user.

Sets the scoped account back to originally configured one.

@return [String] The configured account identifier to scope API requests by.

The {storage_management_url} is based on the {storage_url} and the account details used when autheticating. This is normally automatically discovered within the servive but can be overridden in the {Config}

@return [URI] if the URL is configured @return [nil] if the URL is not configured

@param [URI] management_url The URI to use for management requests. @raise [ArgumentError] if non URI object passed

@param [String] access_token The new access token to use @param [String] refresh_token The new refresh token to use

@return [Boolean]

@return [String] The configured email or user identified to use when accessing the API.

[Validate]