Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultUserAgent string
Functions ¶
func ConfigureOAuth2 ¶
func ConfigureOAuth2(cfg *Config, ctx context.Context, transport http.RoundTripper) (http.RoundTripper, error)
ConfigureOAuth2 checks the supplied to configuration to see if the (possibly nil) transport needs to be wrapped to perform authentication. The context is used for token management if necessary.
Types ¶
type Client ¶
type Config ¶
type Config struct {
// Filename is the full path to the configuration file (defaults to ~/.redsky)
Filename string `json:"-"`
// Address is the fully qualified URL of the Red Sky API
Address string `json:"address,omitempty"`
// OAuth2 is the authentication configuration for the Red Sky API
OAuth2 OAuth2 `json:"oauth2,omitempty"`
// Manager is additional configuration for the Red Sky Manager program
Manager Manager `json:"manager,omitempty"`
}
Config is the client configuration information
func DefaultConfig ¶
DefaultConfig creates a new configuration
func (*Config) LoadEnv ¶
func (c *Config) LoadEnv()
LoadEnv overwrites values in the configuration using environment variables
type Manager ¶
type Manager struct {
// Environment is list of additional environment variables to expose to the manager
Environment []ManagerEnvVar `json:"env,omitempty"`
}
Manager is additional configuration for the Red Sky Manager program
type ManagerEnvVar ¶
type ManagerEnvVar struct {
// Name is the case-sensitive name of the environment variable
Name string `json:"name"`
// Value is the environment variable value
Value string `json:"value"`
}
ManagerEnvVar is a single environment variable to expose to the manager
type OAuth2 ¶
type OAuth2 struct {
// ClientID is used to authenticate for a client credentials grant
ClientID string `json:"client_id,omitempty"`
// ClientSecret is used to authenticate for a client credentials grant
ClientSecret string `json:"client_secret,omitempty"`
// TokenURL is used to obtain an access token (defaults to `./auth/token/` relative to the server address)
TokenURL string `json:"token_url,omitempty"`
// Token is the static access token to use instead of the client credential grant
Token string `json:"token,omitempty"`
}
OAuth2 is the authentication configuration for the Red Sky API
Click to show internal directories.
Click to hide internal directories.