api/check_bundle.go
func (a *API) CreateCheckBundle(cfg *CheckBundle) (*CheckBundle, error) {
	if cfg == nil {
		return nil, fmt.Errorf("Invalid check bundle config [nil]")
	}

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

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

	result, err := a.Post(config.CheckBundlePrefix, jsonCfg)
	if err != nil {
		return nil, err
	}

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

	return checkBundle, nil
}
func (a *API) CreateCheckBundle(cfg *CheckBundle) (*CheckBundle, error) {
	if cfg == nil {
		return nil, fmt.Errorf("Invalid check bundle config [nil]")
	}

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

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

	result, err := a.Post(config.CheckBundlePrefix, jsonCfg)
	if err != nil {
		return nil, err
	}

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

	return checkBundle, nil
}
func ( a * API ) CreateCheckBundle ( cfg * CheckBundle ) ( * CheckBundle , error ) { if cfg == nil { return nil , fmt . Errorf ( " " ) } jsonCfg , err := json . Marshal ( cfg ) if err != nil { return nil , err } if a . Debug { a . Log . Printf ( " " , string ( jsonCfg ) ) } result , err := a . Post ( config . CheckBundlePrefix , jsonCfg ) if err != nil { return nil , err } checkBundle := & CheckBundle { } if err := json . Unmarshal ( result , checkBundle ) ; err != nil { return nil , err } return checkBundle , nil }
// CreateCheckBundle creates a new check bundle (check).
CreateCheckBundle creates a new check bundle ( check ) .