func (a *API) CreateDashboard(cfg *Dashboard) (*Dashboard, error) {
	if cfg == nil {
		return nil, fmt.Errorf("Invalid dashboard config [nil]")
	}

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

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

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

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

	return dashboard, nil
}
func (a *API) CreateDashboard(cfg *Dashboard) (*Dashboard, error) {
	if cfg == nil {
		return nil, fmt.Errorf("Invalid dashboard config [nil]")
	}

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

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

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

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

	return dashboard, nil
}
func ( a * API ) CreateDashboard ( cfg * Dashboard ) ( * Dashboard , 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 . DashboardPrefix , jsonCfg ) if err != nil { return nil , err } dashboard := & Dashboard { } if err := json . Unmarshal ( result , dashboard ) ; err != nil { return nil , err } return dashboard , nil }
// CreateDashboard creates a new dashboard.
CreateDashboard creates a new dashboard .