// PublishingTemplate Publisher's functional option. Provide template
// amqp.Publishing and save typing.
358990
func PublishingTemplate(t amqp.Publishing) PublisherOpt {
	return func(p *Publisher) {
		p.tmpl = t
	}
}
995636
func (c *Client) PrepareTemplate(p *PrepareTemplateParameter) (*Template, error) {
	obj, err := c.Request("prepareTemplate", convertParamToMap(p))
	if err != nil {
		return nil, err
	}
	return obj.(*Template), err
}
378808
func (c *Controller) RenderTemplate(templatePath string) Result {
	c.setStatusIfNil(http.StatusOK)

	// Get the Template.
	lang, _ := c.ViewArgs[CurrentLocaleViewArg].(string)
	template, err := MainTemplateLoader.TemplateLang(templatePath, lang)
	if err != nil {
		return c.RenderError(err)
	}

	return &RenderTemplateResult{
		Template: template,
		ViewArgs: c.ViewArgs,
	}
}
1244605
func TransformTemplate(tpl *templatev1.Template, templateProcessor templateclientv1.TemplateProcessorInterface, namespace string, parameters map[string]string, ignoreUnknownParameters bool) (*templatev1.Template, error) {
	// only set values that match what's expected by the template.
	for k, value := range parameters {
		v := templateprocessing.GetParameterByName(tpl, k)
		if v != nil {
			v.Value = value
			v.Generate = ""
		} else if !ignoreUnknownParameters {
			return nil, fmt.Errorf("unexpected parameter name %q", k)
		}
	}

	name := localOrRemoteName(tpl.ObjectMeta, namespace)

	// transform the template
	result, err := templateProcessor.Process(tpl)
	if err != nil {
		return nil, fmt.Errorf("error processing template %q: %v", name, err)
	}

	return result, nil
}
531075
func (a *MandrillAPI) TemplatePublish(name string) (Template, error) {
	if name == "" {
		return Template{}, errors.New("name cannot be blank")
	}
	var params map[string]interface{} = make(map[string]interface{})
	params["name"] = name
	return execute(a, params, templates_publish_endpoint)
}
898277
func NewTemplate() *Template {
	return &Template{
		AWSTemplateFormatVersion: "2010-09-09",
		Description:              "",
		Metadata:                 map[string]interface{}{},
		Parameters:               map[string]interface{}{},
		Mappings:                 map[string]interface{}{},
		Conditions:               map[string]interface{}{},
		Resources:                Resources{},
		Outputs:                  map[string]interface{}{},
	}
}
297219
func (a *ArgType) ExecuteTemplate(tt TemplateType, name string, sub string, obj interface{}) error {
	var err error

	// setup generated
	if a.Generated == nil {
		a.Generated = []TBuf{}
	}

	// create store
	v := TBuf{
		TemplateType: tt,
		Name:         name,
		Subname:      sub,
		Buf:          new(bytes.Buffer),
	}

	// build template name
	loaderType := ""
	if tt != XOTemplate {
		if a.LoaderType == "oci8" || a.LoaderType == "ora" {
			// force oracle for oci8 since the oracle driver doesn't recognize
			// 'oracle' as valid protocol
			loaderType = "oracle."
		} else {
			loaderType = a.LoaderType + "."
		}
	}
	templateName := fmt.Sprintf("%s%s.go.tpl", loaderType, tt)

	// execute template
	err = a.TemplateSet().Execute(v.Buf, templateName, obj)
	if err != nil {
		return err
	}

	a.Generated = append(a.Generated, v)
	return nil
}
468345
func (mg *MailgunImpl) UpdateTemplate(ctx context.Context, template *Template) error {
	if template.Name == "" {
		return errors.New("UpdateTemplate() Template.Name cannot be empty")
	}

	r := newHTTPRequest(generateApiUrl(mg, templatesEndpoint) + "/" + template.Name)
	r.setClient(mg.Client())
	r.setBasicAuth(basicAuthUser, mg.APIKey())
	p := newUrlEncodedPayload()

	if template.Name != "" {
		p.addValue("name", template.Name)
	}
	if template.Description != "" {
		p.addValue("description", template.Description)
	}

	var resp templateResp
	err := putResponseFromJSON(ctx, r, p, &resp)
	if err != nil {
		return err
	}
	*template = resp.Item
	return nil
}
631309
func (a *MandrillAPI) TemplateAdd(name string, code string, publish bool) (Template, error) {
	if name == "" {
		return Template{}, errors.New("name cannot be blank")
	}
	if code == "" {
		return Template{}, errors.New("code cannot be blank")
	}
	var params map[string]interface{} = make(map[string]interface{})
	params["name"] = name
	params["code"] = code
	params["publish"] = publish
	return execute(a, params, templates_add_endpoint)
}
449081
func (p *Publisher) PublishWithRoutingKey(pub amqp.Publishing, key string) error {
	reqRepl := publishMaybeErr{
		pub: make(chan amqp.Publishing, 2),
		err: make(chan error, 2),
		key: key,
	}

	reqRepl.pub <- pub

	select {
	case <-p.stop:
		// received stop signal
		return ErrPublisherDead
	case p.pubChan <- reqRepl:
	}

	err := <-reqRepl.err
	return err
}
735203
func (s *Store) SetTemplate(context.Context, string, []byte) error {
	return fmt.Errorf("not supported")
}
434648
func (p *partial) template() (*Template, error) {
	if p.tpl == nil {
		var err error

		p.tpl, err = Parse(p.source)
		if err != nil {
			return nil, err
		}
	}

	return p.tpl, nil
}
330173
func (s *CreateFunctionInput) SetRequestMappingTemplate(v string) *CreateFunctionInput {
	s.RequestMappingTemplate = &v
	return s
}
602242
func (t *Template) ExecuteTemplate(wr io.Writer, name string, data interface{}) error {
	return t.tmpl.ExecuteTemplate(wr, name, data)
}
406353
func WritePageTemplate(qq422016 qtio422016.Writer, p Page) {
	
	qw422016 := qt422016.AcquireWriter(qq422016)
	
	StreamPageTemplate(qw422016, p)
	
	qt422016.ReleaseWriter(qw422016)

}
365275
func (pr *publishRequest) serveSubjectTemplate() {
	res, err := pr.ph.deepDescribe(pr.subject)
	if err != nil {
		httputil.ServeError(pr.rw, pr.req, err)
		return
	}
	pr.ph.cacheDescribed(res.Meta)

	subdes := res.Meta[pr.subject.String()]
	if subdes.CamliType == "file" {
		pr.serveFileDownload(subdes)
		return
	}

	headerFunc := func() *publish.PageHeader {
		return pr.subjectHeader(res.Meta)
	}
	fileFunc := func() *publish.PageFile {
		file, err := pr.subjectFile(res.Meta)
		if err != nil {
			logf("%v", err)
			return nil
		}
		return file
	}
	membersFunc := func() *publish.PageMembers {
		members, err := pr.subjectMembers(res.Meta)
		if err != nil {
			logf("%v", err)
			return nil
		}
		return members
	}
	page := &publish.SubjectPage{
		Header:  headerFunc,
		File:    fileFunc,
		Members: membersFunc,
	}

	err = pr.ph.goTemplate.Execute(pr.rw, page)
	if err != nil {
		logf("Error serving subject template: %v", err)
		http.Error(pr.rw, "Error serving template", http.StatusInternalServerError)
		return
	}
}
969116
func (s *TemplatesService) ApplyTemplate(accountID string, templateIdentifier string, domainIdentifier string) (*templateResponse, error) {
	path := versioned(fmt.Sprintf("%v/templates/%v", domainPath(accountID, domainIdentifier), templateIdentifier))
	templateResponse := &templateResponse{}

	resp, err := s.client.post(path, nil, nil)
	if err != nil {
		return nil, err
	}

	templateResponse.HttpResponse = resp
	return templateResponse, nil
}