api/provision_broker.go
func (a *API) CreateProvisionBroker(cfg *ProvisionBroker) (*ProvisionBroker, error) {
	if cfg == nil {
		return nil, fmt.Errorf("Invalid provision broker request config [nil]")
	}

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

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

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

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

	return broker, nil
}
func (a *API) CreateProvisionBroker(cfg *ProvisionBroker) (*ProvisionBroker, error) {
	if cfg == nil {
		return nil, fmt.Errorf("Invalid provision broker request config [nil]")
	}

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

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

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

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

	return broker, nil
}
func ( a * API ) CreateProvisionBroker ( cfg * ProvisionBroker ) ( * ProvisionBroker , 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 . ProvisionBrokerPrefix , jsonCfg ) if err != nil { return nil , err } broker := & ProvisionBroker { } if err := json . Unmarshal ( result , broker ) ; err != nil { return nil , err } return broker , nil }
// CreateProvisionBroker creates a new provison broker [request].
CreateProvisionBroker creates a new provison broker [ request ] .