mirror of
https://github.com/grafana/grafana.git
synced 2024-11-27 03:11:01 -06:00
017da781cf
* refactor dimension values backend * fix test file name
38 lines
822 B
Go
38 lines
822 B
Go
package request
|
|
|
|
import (
|
|
"net/url"
|
|
)
|
|
|
|
type DimensionValuesRequest struct {
|
|
*ResourceRequest
|
|
Namespace string
|
|
MetricName string
|
|
DimensionKey string
|
|
DimensionFilter []*Dimension
|
|
}
|
|
|
|
func GetDimensionValuesRequest(parameters url.Values) (*DimensionValuesRequest, error) {
|
|
resourceRequest, err := getResourceRequest(parameters)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
request := &DimensionValuesRequest{
|
|
ResourceRequest: resourceRequest,
|
|
Namespace: parameters.Get("namespace"),
|
|
MetricName: parameters.Get("metricName"),
|
|
DimensionKey: parameters.Get("dimensionKey"),
|
|
DimensionFilter: []*Dimension{},
|
|
}
|
|
|
|
dimensions, err := parseDimensionFilter(parameters.Get("dimensionFilters"))
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
request.DimensionFilter = dimensions
|
|
|
|
return request, nil
|
|
}
|