Documentation ¶
Index ¶
- Constants
- func NewGrafanaHTTPReverseProxy(serverAddr string, transport http.RoundTripper) (func(writer http.ResponseWriter, request *http.Request), error)
- type BasicAuthPayload
- type Config
- type CreateDatasourceRequest
- type DatasourceResponse
- type GetPrometheusDatasourceResponse
- type GrafanaClient
- type GrafanaClientConfig
- type GrafanaClientImpl
- func (impl *GrafanaClientImpl) CreateDatasource(createDatasourceRequest CreateDatasourceRequest) (*DatasourceResponse, error)
- func (impl *GrafanaClientImpl) GetAllDatasource() ([]*GetPrometheusDatasourceResponse, error)
- func (impl *GrafanaClientImpl) GetDatasource(datasourceId int) (*GetPrometheusDatasourceResponse, error)
- func (impl *GrafanaClientImpl) UpdateDatasource(updateDatasourceRequest UpdateDatasourceRequest, datasourceId int) (*DatasourceResponse, error)
- type JsonData
- type SecureJsonData
- type SecureJsonFields
- type StatusCode
- type UpdateDatasourceRequest
Constants ¶
View Source
const AddPromDatasource = "/api/datasources"
View Source
const DeletePromDatasource = "/api/datasources/%d"
View Source
const GetPromDatasource = "/api/datasources/%d"
View Source
const GrafanaPath = "/grafana"
View Source
const PromDatasource = "/api/datasources"
View Source
const UpdatePromDatasource = "/api/datasources/%d"
Variables ¶
This section is empty.
Functions ¶
func NewGrafanaHTTPReverseProxy ¶
func NewGrafanaHTTPReverseProxy(serverAddr string, transport http.RoundTripper) (func(writer http.ResponseWriter, request *http.Request), error)
Types ¶
type BasicAuthPayload ¶
type BasicAuthPayload struct { BasicAuthUser string `json:"basicAuthUser,omitempty"` BasicAuthPassword string `json:"basicAuthPassword,omitempty"` SecureJsonData *SecureJsonData `json:"secureJsonData,omitempty"` JsonData *JsonData `json:"jsonData,omitempty"` }
type Config ¶
type CreateDatasourceRequest ¶
type DatasourceResponse ¶
type GetPrometheusDatasourceResponse ¶
type GetPrometheusDatasourceResponse struct { Id int `json:"id"` OrgId int `json:"orgId"` Name string `json:"name"` Type string `json:"type"` TypeLogoUrl string `json:"typeLogoUrl"` Access string `json:"access"` Url string `json:"url"` Password string `json:"password"` User string `json:"user"` Database string `json:"database"` BasicAuth bool `json:"basicAuth"` BasicAuthUser string `json:"basicAuthUser"` BasicAuthPassword string `json:"basicAuthPassword"` WithCredentials bool `json:"withCredentials"` IsDefault bool `json:"isDefault"` JsonData JsonData `json:"jsonData"` SecureJsonFields SecureJsonFields `json:"secureJsonFields"` Version *int `json:"version"` ReadOnly bool `json:"readOnly"` }
type GrafanaClient ¶
type GrafanaClient interface { GetAllDatasource() ([]*GetPrometheusDatasourceResponse, error) CreateDatasource(createDatasourceRequest CreateDatasourceRequest) (*DatasourceResponse, error) GetDatasource(datasourceId int) (*GetPrometheusDatasourceResponse, error) UpdateDatasource(updateDatasourceRequest UpdateDatasourceRequest, datasourceId int) (*DatasourceResponse, error) }
type GrafanaClientConfig ¶
type GrafanaClientConfig struct { GrafanaUsername string `env:"GRAFANA_USERNAME" envDefault:"admin"` GrafanaPassword string `env:"GRAFANA_PASSWORD" envDefault:"prom-operator"` GrafanaOrgId int `env:"GRAFANA_ORG_ID" envDefault:"2"` DestinationURL string `env:"GRAFANA_URL" envDefault:""` }
func GetGrafanaClientConfig ¶
func GetGrafanaClientConfig() (*GrafanaClientConfig, error)
type GrafanaClientImpl ¶
type GrafanaClientImpl struct {
// contains filtered or unexported fields
}
func NewGrafanaClientImpl ¶
func NewGrafanaClientImpl(logger *zap.SugaredLogger, client *http.Client, config *GrafanaClientConfig, attributesService attributes.AttributesService) *GrafanaClientImpl
func (*GrafanaClientImpl) CreateDatasource ¶
func (impl *GrafanaClientImpl) CreateDatasource(createDatasourceRequest CreateDatasourceRequest) (*DatasourceResponse, error)
func (*GrafanaClientImpl) GetAllDatasource ¶
func (impl *GrafanaClientImpl) GetAllDatasource() ([]*GetPrometheusDatasourceResponse, error)
func (*GrafanaClientImpl) GetDatasource ¶
func (impl *GrafanaClientImpl) GetDatasource(datasourceId int) (*GetPrometheusDatasourceResponse, error)
func (*GrafanaClientImpl) UpdateDatasource ¶
func (impl *GrafanaClientImpl) UpdateDatasource(updateDatasourceRequest UpdateDatasourceRequest, datasourceId int) (*DatasourceResponse, error)
type SecureJsonData ¶
type SecureJsonFields ¶
type SecureJsonFields struct { }
type StatusCode ¶
type StatusCode int
func (StatusCode) IsSuccess ¶
func (code StatusCode) IsSuccess() bool
type UpdateDatasourceRequest ¶
type UpdateDatasourceRequest struct { Id int `json:"id"` OrgId int `json:"orgId"` Name string `json:"name"` Type string `json:"type"` TypeLogoUrl string `json:"typeLogoUrl"` Access string `json:"access"` Url string `json:"url"` Password string `json:"password"` User string `json:"user"` Database string `json:"database"` BasicAuth bool `json:"basicAuth"` BasicAuthUser string `json:"basicAuthUser"` BasicAuthPassword string `json:"basicAuthPassword"` WithCredentials bool `json:"withCredentials"` IsDefault bool `json:"isDefault"` JsonData JsonData `json:"jsonData"` SecureJsonFields SecureJsonFields `json:"secureJsonFields"` Version *int `json:"version"` ReadOnly bool `json:"readOnly"` BasicAuthPayload `json:",inline"` }
Click to show internal directories.
Click to hide internal directories.