Documentation ¶
Index ¶
- func APIRequest(config APIConfiguration) ([]byte, error)
- func ConvertResponse(response map[string]interface{}) map[string]float64
- func GetMetrics(config APIConfiguration) (map[string]float64, error)
- func ParseResponse(response []byte) (map[string]interface{}, error)
- func RecordMetrics(config APIConfiguration) map[string]prometheus.Gauge
- func ValidateAPIConfiguration(config APIConfiguration) error
- type APIConfiguration
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func APIRequest ¶
func APIRequest(config APIConfiguration) ([]byte, error)
APIRequest performs a request to the DirectAdmin API.
func ConvertResponse ¶
ConvertResponse converts the parsed API response into a map of string-float64.
func GetMetrics ¶
func GetMetrics(config APIConfiguration) (map[string]float64, error)
GetMetrics retrieves the metrics from the DirectAdmin API based on the provided configuration.
func ParseResponse ¶
ParseResponse parses the DirectAdmin API response into a map of string-interface{}.
func RecordMetrics ¶
func RecordMetrics(config APIConfiguration) map[string]prometheus.Gauge
RecordMetrics retrieves and records the metrics from the DirectAdmin API based on the provided configuration.
func ValidateAPIConfiguration ¶
func ValidateAPIConfiguration(config APIConfiguration) error
ValidateAPIConfiguration validates the APIConfiguration data.
Types ¶
type APIConfiguration ¶
type APIConfiguration struct { Hostname string `validate:"required,hostname|ip"` Protocol string `validate:"required,oneof=http https"` Port string `validate:"required,number"` Username string `validate:"required"` Token string `validate:"required"` }
APIConfiguration represents the configuration data for the API.
func NewAPIConfiguration ¶
func NewAPIConfiguration(filenames ...string) APIConfiguration
NewAPIConfiguration returns a new APIConfiguration struct filled with data from the environment variables.