checkmgr/cert.go
func (cm *CheckManager) fetchCert() ([]byte, error) {
	if !cm.enabled {
		return nil, errors.New("check manager is not enabled")
	}

	response, err := cm.apih.Get("/pki/ca.crt")
	if err != nil {
		return nil, err
	}

	cadata := new(CACert)
	if err := json.Unmarshal(response, cadata); err != nil {
		return nil, err
	}

	if cadata.Contents == "" {
		return nil, fmt.Errorf("[ERROR] Unable to find ca cert %+v", cadata)
	}

	return []byte(cadata.Contents), nil
}
func (cm *CheckManager) fetchCert() ([]byte, error) {
	if !cm.enabled {
		return nil, errors.New("check manager is not enabled")
	}

	response, err := cm.apih.Get("/pki/ca.crt")
	if err != nil {
		return nil, err
	}

	cadata := new(CACert)
	if err := json.Unmarshal(response, cadata); err != nil {
		return nil, err
	}

	if cadata.Contents == "" {
		return nil, fmt.Errorf("[ERROR] Unable to find ca cert %+v", cadata)
	}

	return []byte(cadata.Contents), nil
}
// fetchCert fetches CA certificate using Circonus API