ss/ssc/codegen_client.go
func (loc *NotificationRuleLocator) Create(minSeverity string, source string, target string, options rsapi.APIParams) (*NotificationRuleLocator, error) {
	var res *NotificationRuleLocator
	if minSeverity == "" {
		return res, fmt.Errorf("minSeverity is required")
	}
	if source == "" {
		return res, fmt.Errorf("source is required")
	}
	if target == "" {
		return res, fmt.Errorf("target is required")
	}
	var params rsapi.APIParams
	params = rsapi.APIParams{}
	var filterOpt = options["filter"]
	if filterOpt != nil {
		params["filter[]"] = filterOpt
	}
	var p rsapi.APIParams
	p = rsapi.APIParams{
		"min_severity": minSeverity,
		"source":       source,
		"target":       target,
	}
	var categoryOpt = options["category"]
	if categoryOpt != nil {
		p["category"] = categoryOpt
	}
	uri, err := loc.ActionPath("NotificationRule", "create")
	if err != nil {
		return res, err
	}
	req, err := loc.api.BuildHTTPRequest(uri.HTTPMethod, uri.Path, APIVersion, params, p)
	if err != nil {
		return res, err
	}
	resp, err := loc.api.PerformRequest(req)
	if err != nil {
		return res, err
	}
	defer resp.Body.Close()
	if resp.StatusCode < 200 || resp.StatusCode > 299 {
		respBody, _ := ioutil.ReadAll(resp.Body)
		sr := string(respBody)
		if sr != "" {
			sr = ": " + sr
		}
		return res, fmt.Errorf("invalid response %s%s", resp.Status, sr)
	}
	location := resp.Header.Get("Location")
	if len(location) == 0 {
		return res, fmt.Errorf("Missing location header in response")
	} else {
		return &NotificationRuleLocator{Href(location), loc.api}, nil
	}
}
func (loc *NotificationRuleLocator) Create(minSeverity string, source string, target string, options rsapi.APIParams) (*NotificationRuleLocator, error) {
	var res *NotificationRuleLocator
	if minSeverity == "" {
		return res, fmt.Errorf("minSeverity is required")
	}
	if source == "" {
		return res, fmt.Errorf("source is required")
	}
	if target == "" {
		return res, fmt.Errorf("target is required")
	}
	var params rsapi.APIParams
	params = rsapi.APIParams{}
	var filterOpt = options["filter"]
	if filterOpt != nil {
		params["filter[]"] = filterOpt
	}
	var p rsapi.APIParams
	p = rsapi.APIParams{
		"min_severity": minSeverity,
		"source":       source,
		"target":       target,
	}
	var categoryOpt = options["category"]
	if categoryOpt != nil {
		p["category"] = categoryOpt
	}
	uri, err := loc.ActionPath("NotificationRule", "create")
	if err != nil {
		return res, err
	}
	req, err := loc.api.BuildHTTPRequest(uri.HTTPMethod, uri.Path, APIVersion, params, p)
	if err != nil {
		return res, err
	}
	resp, err := loc.api.PerformRequest(req)
	if err != nil {
		return res, err
	}
	defer resp.Body.Close()
	if resp.StatusCode < 200 || resp.StatusCode > 299 {
		respBody, _ := ioutil.ReadAll(resp.Body)
		sr := string(respBody)
		if sr != "" {
			sr = ": " + sr
		}
		return res, fmt.Errorf("invalid response %s%s", resp.Status, sr)
	}
	location := resp.Header.Get("Location")
	if len(location) == 0 {
		return res, fmt.Errorf("Missing location header in response")
	} else {
		return &NotificationRuleLocator{Href(location), loc.api}, nil
	}
}
// POST /api/catalog/accounts/:account_id/notification_rules
//
// Create one notification rule for a specific target and source.
// The source must be unique in the scope of target and account.