cm15/codegen_client.go
func (loc *ServerTemplateLocator) Publish(accountGroupHrefs []string, descriptions *Descriptions, options rsapi.APIParams) error {
	if len(accountGroupHrefs) == 0 {
		return fmt.Errorf("accountGroupHrefs is required")
	}
	if descriptions == nil {
		return fmt.Errorf("descriptions is required")
	}
	var params rsapi.APIParams
	var p rsapi.APIParams
	p = rsapi.APIParams{
		"account_group_hrefs": accountGroupHrefs,
		"descriptions":        descriptions,
	}
	var allowCommentsOpt = options["allow_comments"]
	if allowCommentsOpt != nil {
		p["allow_comments"] = allowCommentsOpt
	}
	var categoriesOpt = options["categories"]
	if categoriesOpt != nil {
		p["categories"] = categoriesOpt
	}
	var emailCommentsOpt = options["email_comments"]
	if emailCommentsOpt != nil {
		p["email_comments"] = emailCommentsOpt
	}
	uri, err := loc.ActionPath("ServerTemplate", "publish")
	if err != nil {
		return err
	}
	req, err := loc.api.BuildHTTPRequest(uri.HTTPMethod, uri.Path, APIVersion, params, p)
	if err != nil {
		return err
	}
	resp, err := loc.api.PerformRequest(req)
	if err != nil {
		return 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 fmt.Errorf("invalid response %s%s", resp.Status, sr)
	}
	return nil
}
func (loc *ServerTemplateLocator) Publish(accountGroupHrefs []string, descriptions *Descriptions, options rsapi.APIParams) error {
	if len(accountGroupHrefs) == 0 {
		return fmt.Errorf("accountGroupHrefs is required")
	}
	if descriptions == nil {
		return fmt.Errorf("descriptions is required")
	}
	var params rsapi.APIParams
	var p rsapi.APIParams
	p = rsapi.APIParams{
		"account_group_hrefs": accountGroupHrefs,
		"descriptions":        descriptions,
	}
	var allowCommentsOpt = options["allow_comments"]
	if allowCommentsOpt != nil {
		p["allow_comments"] = allowCommentsOpt
	}
	var categoriesOpt = options["categories"]
	if categoriesOpt != nil {
		p["categories"] = categoriesOpt
	}
	var emailCommentsOpt = options["email_comments"]
	if emailCommentsOpt != nil {
		p["email_comments"] = emailCommentsOpt
	}
	uri, err := loc.ActionPath("ServerTemplate", "publish")
	if err != nil {
		return err
	}
	req, err := loc.api.BuildHTTPRequest(uri.HTTPMethod, uri.Path, APIVersion, params, p)
	if err != nil {
		return err
	}
	resp, err := loc.api.PerformRequest(req)
	if err != nil {
		return 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 fmt.Errorf("invalid response %s%s", resp.Status, sr)
	}
	return nil
}
// POST /api/server_templates/:id/publish
//
// Publishes a given ServerTemplate and its subordinates.
// Only non-HEAD revisions that are owned by the account can be published.
// Required parameters:
// account_group_hrefs: List of hrefs of account groups to publish to.
// descriptions
// Optional parameters:
// allow_comments: Allow users to leave comments on this ServerTemplate.
// categories: List of Categories.
// email_comments: Email me when a user comments on this ServerTemplate.