func (a *API) FetchCheckBundleMetrics(cid CIDType) (*CheckBundleMetrics, error) {
	if cid == nil || *cid == "" {
		return nil, fmt.Errorf("Invalid check bundle metrics CID [none]")
	}

	metricsCID := string(*cid)

	matched, err := regexp.MatchString(config.CheckBundleMetricsCIDRegex, metricsCID)
	if err != nil {
		return nil, err
	}
	if !matched {
		return nil, fmt.Errorf("Invalid check bundle metrics CID [%s]", metricsCID)
	}

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

	if a.Debug {
		a.Log.Printf("[DEBUG] fetch check bundle metrics, received JSON: %s", string(result))
	}

	metrics := &CheckBundleMetrics{}
	if err := json.Unmarshal(result, metrics); err != nil {
		return nil, err
	}

	return metrics, nil
}
func (a *API) FetchCheckBundleMetrics(cid CIDType) (*CheckBundleMetrics, error) {
	if cid == nil || *cid == "" {
		return nil, fmt.Errorf("Invalid check bundle metrics CID [none]")
	}

	metricsCID := string(*cid)

	matched, err := regexp.MatchString(config.CheckBundleMetricsCIDRegex, metricsCID)
	if err != nil {
		return nil, err
	}
	if !matched {
		return nil, fmt.Errorf("Invalid check bundle metrics CID [%s]", metricsCID)
	}

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

	if a.Debug {
		a.Log.Printf("[DEBUG] fetch check bundle metrics, received JSON: %s", string(result))
	}

	metrics := &CheckBundleMetrics{}
	if err := json.Unmarshal(result, metrics); err != nil {
		return nil, err
	}

	return metrics, nil
}
func ( a * API ) FetchCheckBundleMetrics ( cid CIDType ) ( * CheckBundleMetrics , error ) { if cid == nil || * cid == " " { return nil , fmt . Errorf ( " " ) } metricsCID := string ( * cid ) matched , err := regexp . MatchString ( config . CheckBundleMetricsCIDRegex , metricsCID ) if err != nil { return nil , err } if ! matched { return nil , fmt . Errorf ( " " , metricsCID ) } result , err := a . Get ( metricsCID ) if err != nil { return nil , err } if a . Debug { a . Log . Printf ( " " , string ( result ) ) } metrics := & CheckBundleMetrics { } if err := json . Unmarshal ( result , metrics ) ; err != nil { return nil , err } return metrics , nil }
// FetchCheckBundleMetrics retrieves metrics for the check bundle with passed cid.
FetchCheckBundleMetrics retrieves metrics for the check bundle with passed cid .