Documentation ¶
Index ¶
- type PrometheusClient
- type PrometheusConfiguration
- type StorageClient
- type StorageClientConfiguration
- type StorageClientInterface
- type VaultClient
- func (vc *VaultClient) CheckIfEngineExists() bool
- func (vc *VaultClient) DeleteCredentials(datasourceName string) error
- func (vc *VaultClient) GetCredentials(datasourceName string) (*config.Credentials, error)
- func (vc *VaultClient) StoreCredentials(datasourceName string, credentials map[string]string) error
- type VaultClientConfiguration
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PrometheusClient ¶
type PrometheusClient struct {
// contains filtered or unexported fields
}
PrometheusClient represents the Prometheus client.
func NewPrometheusClient ¶
func NewPrometheusClient( config PrometheusConfiguration, logger logging.Logger) PrometheusClient
NewPrometheusClient creates a PrometheusClient instance.
func (PrometheusClient) QueryRange ¶
func (c PrometheusClient) QueryRange(ctx context.Context, query string, startAt, endAt time.Time, step time.Duration) (model.Value, error)
QueryRange returns range vectors as result type matrix, given the following parameters:
- query: Prometheus query
- startAt: start time
- endAt: end time
- step: interval duration
It returns the result matrix and the execution error encountered.
type PrometheusConfiguration ¶
type PrometheusConfiguration struct {
Address string `envconfig:"PROMETHEUS_ADDRESS" required:"true"`
}
PrometheusConfiguration represents the client configuration to connect to Prometheus.
func (*PrometheusConfiguration) LoadFromEnvVars ¶
func (c *PrometheusConfiguration) LoadFromEnvVars() error
LoadFromEnvVars for PrometheusConfiguration.
type StorageClient ¶
type StorageClient struct {
// contains filtered or unexported fields
}
StorageClient is a structure that holds all the dependencies for the following client
func NewStorageClient ¶
func NewStorageClient(logger logging.Logger, configuration StorageClientConfiguration) StorageClient
NewStorageClient returns an initialized struct with the required dependencies injected
func (*StorageClient) CheckIfExists ¶
func (sc *StorageClient) CheckIfExists(relativePath string) bool
CheckIfExists attempts to check if the directory exists
func (*StorageClient) CreateDirectory ¶
func (sc *StorageClient) CreateDirectory(relativePath string) error
CreateDirectory attempts to create a directory to hold requirements.txt
func (*StorageClient) RemoveDirectory ¶
func (sc *StorageClient) RemoveDirectory(relativePath string) error
RemoveDirectory attempts to remove the directory that holds requirements.txt
type StorageClientConfiguration ¶
type StorageClientConfiguration struct {
BasePath string `envconfig:"STORAGE_PATH" required:"true"`
}
StorageClientConfiguration is a struct that holds all the environment variables required to the Storage Client
func (*StorageClientConfiguration) LoadFromEnvVars ¶
func (c *StorageClientConfiguration) LoadFromEnvVars() error
LoadFromEnvVars parses the required configuration variables. Throws an error if the validations aren't met
type StorageClientInterface ¶
type StorageClientInterface interface { CreateDirectory(relativePath string) error RemoveDirectory(relativePath string) error CheckIfExists(relativePath string) bool }
StorageClientInterface defines storage client interface
type VaultClient ¶
type VaultClient struct {
// contains filtered or unexported fields
}
VaultClient defines the Vault client struct, holding all the required dependencies
func NewVaultClient ¶
func NewVaultClient(configuration VaultClientConfiguration, logger logging.Logger) (*VaultClient, error)
NewVaultClient returns an initialized struct with the required dependencies injected
func (*VaultClient) CheckIfEngineExists ¶
func (vc *VaultClient) CheckIfEngineExists() bool
CheckIfEngineExists attempts to call the /tune API endpoint on the Secrets Engine. Should it fail, it might be an indication that the Secrets Engine is not created, which it's useful to know whether or not to call CreateEngine
func (*VaultClient) DeleteCredentials ¶
func (vc *VaultClient) DeleteCredentials(datasourceName string) error
DeleteCredentials receives the name of the DataSource and attempts to delete the existing credentials on Vault. Is performs a soft delete, per docs > https://www.vaultproject.io/docs/commands/kv/delete
func (*VaultClient) GetCredentials ¶
func (vc *VaultClient) GetCredentials(datasourceName string) (*config.Credentials, error)
GetCredentials receives the name of the DataSource and attemps to retrieve the map of credentials present on the Vault server.
func (*VaultClient) StoreCredentials ¶
func (vc *VaultClient) StoreCredentials(datasourceName string, credentials map[string]string) error
StoreCredentials receives the name of the DataSource and the respective map of credentials and attempts to store them on the Vault server.
type VaultClientConfiguration ¶
type VaultClientConfiguration struct {
VaultURL string `envconfig:"VAULT_SERVER_URL" required:"true"`
}
VaultClientConfiguration is a struct that holds all the environment variables required to the Vault client
func (*VaultClientConfiguration) LoadFromEnvVars ¶
func (vlc *VaultClientConfiguration) LoadFromEnvVars() error
LoadFromEnvVars parses the required configuration variables. Throws an error if the validations aren't met