You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: check_bundle_metrics.go
    path of file: ./repos/goldfish/vendor/github.com/circonus-labs/circonus-gometrics/api
    
    the code of the file until where you have to start completion: // Copyright 2016 Circonus, Inc. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// CheckBundleMetrics API support - Fetch, Create*, Update, and Delete**
// See: https://login.circonus.com/resources/api/calls/check_bundle_metrics
// *  : create metrics by adding to array with a status of 'active'
// ** : delete (distable collection of) metrics by changing status from 'active' to 'available'

package api

im
    
func (a *API) UpdateCheckBundleMetrics(cfg *CheckBundleMetrics) (*CheckBundleMetrics, error) {
	if cfg == nil {
		return nil, fmt.Errorf("Invalid check bundle metrics config [nil]")
	}

	metricsCID := string(cfg.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)
	}

	jsonCfg, err := json.Marshal(cfg)
	if err != nil {
		return nil, err
	}

	if a.Debug {
		a.Log.Printf("[DEBUG] update check bundle metrics, sending JSON: %s", string(jsonCfg))
	}

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

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

	return metrics, nil
}