Documentation
¶
Overview ¶
Package config provides the base configuration for Axiom related functionality like URLs and credentials for API access.
Index ¶
- Variables
- func CloudURL() *url.URL
- func IsAPIToken(token string) bool
- func IsPersonalToken(token string) bool
- func IsValidToken(token string) bool
- type Config
- func (c Config) AccessToken() string
- func (c Config) BaseURL() *url.URL
- func (c *Config) IncorporateEnvironment() error
- func (c *Config) Options(options ...Option) error
- func (c Config) OrganizationID() string
- func (c *Config) SetAccessToken(accessToken string)
- func (c *Config) SetBaseURL(baseURL *url.URL)
- func (c *Config) SetOrganizationID(organizationID string)
- func (c Config) Validate() error
- type Option
Constants ¶
This section is empty.
Variables ¶
var ( // ErrMissingAccessToken is raised when an access token is not provided. Set // it manually or export `AXIOM_TOKEN`. ErrMissingAccessToken = errors.New("missing access token") // ErrMissingOrganizationID is raised when an organization ID is not // provided. Set it manually using the SetOrgID option or export // `AXIOM_ORG_ID`. ErrMissingOrganizationID = errors.New("missing organization id") // ErrInvalidToken is returned when the access token is invalid. ErrInvalidToken = errors.New("invalid access token") )
Functions ¶
func IsAPIToken ¶
IsAPIToken returns true if the given access token is an API token.
func IsPersonalToken ¶
IsPersonalToken returns true if the given access token is a personal token.
func IsValidToken ¶
IsValidToken returns true if the given access token is a valid Axiom access token.
Types ¶
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
Config is the configuration for Axiom related functionality. It should never be created manually but always via the `Default` function.
func (Config) AccessToken ¶
AccessToken returns the access token.
func (*Config) IncorporateEnvironment ¶
IncorporateEnvironment loads configuration from environment variables. It will reject invalid values.
func (Config) OrganizationID ¶
OrganizationID returns the organization ID.
func (*Config) SetAccessToken ¶
SetAccessToken sets the access token.
func (*Config) SetBaseURL ¶
SetBaseURL sets the base URL.
func (*Config) SetOrganizationID ¶
SetOrganizationID sets the organization ID.
type Option ¶
An Option modifies the configuration. It is not safe for concurrent use.
func SetAccessToken ¶
SetAccessToken specifies the access token to use.
func SetOrganizationID ¶
SetOrganizationID specifies the organization ID to use.