api/metric_cluster.go
func (a *API) FetchMetricClusters(extras string) (*[]MetricCluster, error) {
	reqURL := url.URL{
		Path: config.MetricClusterPrefix,
	}

	extra := ""
	switch extras {
	case "metrics":
		extra = "_matching_metrics"
	case "uuids":
		extra = "_matching_uuid_metrics"
	}

	if extra != "" {
		q := url.Values{}
		q.Set("extra", extra)
		reqURL.RawQuery = q.Encode()
	}

	result, err := a.Get(reqURL.String())
	if err != nil {
		return nil, err
	}

	var clusters []MetricCluster
	if err := json.Unmarshal(result, &clusters); err != nil {
		return nil, err
	}

	return &clusters, nil
}
func (a *API) FetchMetricClusters(extras string) (*[]MetricCluster, error) {
	reqURL := url.URL{
		Path: config.MetricClusterPrefix,
	}

	extra := ""
	switch extras {
	case "metrics":
		extra = "_matching_metrics"
	case "uuids":
		extra = "_matching_uuid_metrics"
	}

	if extra != "" {
		q := url.Values{}
		q.Set("extra", extra)
		reqURL.RawQuery = q.Encode()
	}

	result, err := a.Get(reqURL.String())
	if err != nil {
		return nil, err
	}

	var clusters []MetricCluster
	if err := json.Unmarshal(result, &clusters); err != nil {
		return nil, err
	}

	return &clusters, nil
}
func ( a * API ) FetchMetricClusters ( extras string ) ( * [ ] MetricCluster , error ) { reqURL := url . URL { Path : config . MetricClusterPrefix , } extra := " " switch extras { case " " : extra = " " case " " : extra = " " } if extra != " " { q := url . Values { } q . Set ( " " , extra ) reqURL . RawQuery = q . Encode ( ) } result , err := a . Get ( reqURL . String ( ) ) if err != nil { return nil , err } var clusters [ ] MetricCluster if err := json . Unmarshal ( result , & clusters ) ; err != nil { return nil , err } return & clusters , nil }
// FetchMetricClusters retrieves all metric clusters available to API Token.
FetchMetricClusters retrieves all metric clusters available to API Token .