templates

package
v4.38.17 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 30, 2024 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TemplateNameEmailIdentityVerificationJWT = "IdentityVerificationJWT"
	TemplateNameEmailIdentityVerificationOTC = "IdentityVerificationOTC"
	TemplateNameEmailEvent                   = "Event"

	TemplateNameOIDCAuthorizeFormPost = "AuthorizeResponseFormPost.html"
)

Template File Names.

View Source
const (
	TemplateCategoryNotifications = "notification"
	TemplateCategoryOpenIDConnect = "oidc"
)

Template Category Names.

Variables

This section is empty.

Functions

func FuncB32Dec added in v4.38.0

func FuncB32Dec(input string) (string, error)

FuncB32Dec is a helper function that provides similar functionality to the helm b32dec func.

func FuncB32Enc added in v4.38.0

func FuncB32Enc(input string) string

FuncB32Enc is a helper function that provides similar functionality to the helm b32enc func.

func FuncB64Dec added in v4.38.0

func FuncB64Dec(input string) (string, error)

FuncB64Dec is a helper function that provides similar functionality to the helm b64dec func.

func FuncB64Enc added in v4.38.0

func FuncB64Enc(input string) string

FuncB64Enc is a helper function that provides similar functionality to the helm b64enc func.

func FuncDefault added in v4.38.0

func FuncDefault(d any, vals ...any) any

FuncDefault is a helper function that provides similar functionality to the helm default func.

func FuncDict added in v4.38.0

func FuncDict(pairs ...any) map[string]any

FuncDict is a helper function that provides similar functionality to the helm dict func.

func FuncElemsJoin added in v4.38.0

func FuncElemsJoin(sep string, elems any) string

FuncElemsJoin is a helper function that provides similar functionality to the helm join func.

func FuncEmpty added in v4.38.0

func FuncEmpty(v any) bool

FuncEmpty is a helper function that provides similar functionality to the helm empty func.

func FuncExpandEnv added in v4.38.0

func FuncExpandEnv(s string) string

FuncExpandEnv is a special version of os.ExpandEnv that excludes secret keys.

func FuncFileContent added in v4.38.0

func FuncFileContent(path string) (data string, err error)

FuncFileContent returns the file content.

func FuncGet added in v4.38.0

func FuncGet(m map[string]any, key string) any

FuncGet is a helper function that provides similar functionality to the helm get func.

func FuncGetEnv added in v4.38.0

func FuncGetEnv(key string) string

FuncGetEnv is a special version of os.GetEnv that excludes secret keys.

func FuncHashSum added in v4.38.0

func FuncHashSum(new func() hash.Hash) func(data string) string

FuncHashSum is a helper function that provides similar functionality to helm sum funcs.

func FuncIndent added in v4.38.0

func FuncIndent(indent int, value string) string

FuncIndent is a helper function that provides similar functionality to the helm indent func.

func FuncIterate added in v4.38.0

func FuncIterate(count *uint) (out []uint)

FuncIterate is a template function which takes a single uint returning a slice of units from 0 up to that number.

func FuncKeys added in v4.38.0

func FuncKeys(maps ...map[string]any) []string

FuncKeys is a helper function that provides similar functionality to the helm keys func.

func FuncKindIs added in v4.38.0

func FuncKindIs(is string, v any) bool

FuncKindIs is a helper function that provides similar functionality to the helm kindIs func.

func FuncKindOf added in v4.38.0

func FuncKindOf(v any) string

FuncKindOf is a helper function that provides similar functionality to the helm kindOf func.

func FuncList added in v4.38.0

func FuncList(items ...any) []any

FuncList is a helper function that provides similar functionality to the helm list func.

func FuncMap added in v4.38.0

func FuncMap() map[string]any

FuncMap returns the template FuncMap commonly used in several templates.

func FuncMultilineIndent added in v4.38.0

func FuncMultilineIndent(indent int, multiline, value string) string

FuncMultilineIndent is a helper function that performs YAML multiline intending with a multiline format input such as |, |+, |-, >, >+, >-, etc. This is only true if the value has newline characters otherwise it just returns the same output as the indent function.

func FuncMustGetEnv added in v4.38.0

func FuncMustGetEnv(key string) (string, error)

FuncMustGetEnv is a special version of os.GetEnv that excludes secret keys and returns an error if it doesn't exist.

func FuncNewlineIndent added in v4.38.0

func FuncNewlineIndent(indent int, value string) string

FuncNewlineIndent is a helper function that provides similar functionality to the helm nindent func.

func FuncSecret added in v4.38.0

func FuncSecret(path string) (data string, err error)

FuncSecret returns the file content stripping the newlines from the end of the content.

func FuncSet added in v4.38.0

func FuncSet(m map[string]any, key string, value any) map[string]any

FuncSet is a helper function that provides similar functionality to the helm set func.

func FuncSortAlpha added in v4.38.0

func FuncSortAlpha(slice any) []string

FuncSortAlpha is a helper function that provides similar functionality to the helm sortAlpha func.

func FuncStringContains added in v4.38.0

func FuncStringContains(substr string, s string) bool

FuncStringContains is a helper function that provides similar functionality to the helm contains func.

func FuncStringHasPrefix added in v4.38.0

func FuncStringHasPrefix(prefix string, s string) bool

FuncStringHasPrefix is a helper function that provides similar functionality to the helm hasPrefix func.

func FuncStringHasSuffix added in v4.38.0

func FuncStringHasSuffix(suffix string, s string) bool

FuncStringHasSuffix is a helper function that provides similar functionality to the helm hasSuffix func.

func FuncStringJoinX added in v4.38.0

func FuncStringJoinX(elems []string, sep string, n int, p string) string

FuncStringJoinX takes a list of string elements, joins them by the sep string, before every int n characters are written it writes string p. This is useful for line breaks mostly.

func FuncStringQuote added in v4.38.0

func FuncStringQuote(in ...any) string

FuncStringQuote is a helper function that provides similar functionality to the helm quote func.

func FuncStringQuoteMultiLine added in v4.38.0

func FuncStringQuoteMultiLine(char rune) func(in ...any) string

FuncStringQuoteMultiLine is a helper function that provides similar functionality to FuncStringQuote and FuncStringSQuote, however it skips quoting if the string contains multiple lines.

func FuncStringReplace added in v4.38.0

func FuncStringReplace(old, new, s string) string

FuncStringReplace is a helper function that provides similar functionality to the helm replace func.

func FuncStringSQuote added in v4.38.0

func FuncStringSQuote(in ...any) string

FuncStringSQuote is a helper function that provides similar functionality to the helm squote func.

func FuncStringSplit added in v4.38.0

func FuncStringSplit(sep, value string) map[string]string

FuncStringSplit is a template function which takes sep and value, splitting the value by the sep into a slice.

func FuncStringSplitList added in v4.38.0

func FuncStringSplitList(sep, s string) []string

FuncStringSplitList is a special split func that reverses the inputs to match helm templates.

func FuncStringTrimAll added in v4.38.0

func FuncStringTrimAll(cutset, s string) string

FuncStringTrimAll is a helper function that provides similar functionality to the helm trimAll func.

func FuncStringTrimPrefix added in v4.38.0

func FuncStringTrimPrefix(prefix, s string) string

FuncStringTrimPrefix is a helper function that provides similar functionality to the helm trimPrefix func.

func FuncStringTrimSuffix added in v4.38.0

func FuncStringTrimSuffix(suffix, s string) string

FuncStringTrimSuffix is a helper function that provides similar functionality to the helm trimSuffix func.

func FuncTypeIs added in v4.38.0

func FuncTypeIs(is string, v any) bool

FuncTypeIs is a helper function that provides similar functionality to the helm typeIs func.

func FuncTypeIsLike added in v4.38.0

func FuncTypeIsLike(is string, v any) bool

FuncTypeIsLike is a helper function that provides similar functionality to the helm typeIsLike func.

func FuncTypeOf added in v4.38.0

func FuncTypeOf(v any) string

FuncTypeOf is a helper function that provides similar functionality to the helm typeOf func.

func FuncUUIDv4 added in v4.38.0

func FuncUUIDv4() string

FuncUUIDv4 is a helper function that provides similar functionality to the helm uuidv4 func.

Types

type AssetTemplates added in v4.38.0

type AssetTemplates struct {
	// contains filtered or unexported fields
}

AssetTemplates are templates for specific key assets.

type Config added in v4.36.3

type Config struct {
	EmailTemplatesPath string
}

Config for the Provider.

type EmailEventValues added in v4.38.0

type EmailEventValues struct {
	Title       string
	BodyPrefix  string
	BodySuffix  string
	BodyEvent   string
	DisplayName string
	Details     map[string]any
	RemoteIP    string
}

EmailEventValues are the values used for event templates.

type EmailIdentityVerificationJWTValues added in v4.38.0

type EmailIdentityVerificationJWTValues struct {
	Title              string
	DisplayName        string
	Domain             string
	RemoteIP           string
	LinkURL            string
	LinkText           string
	RevocationLinkURL  string
	RevocationLinkText string
}

EmailIdentityVerificationJWTValues are the values used for the identity verification JWT templates.

type EmailIdentityVerificationOTCValues added in v4.38.0

type EmailIdentityVerificationOTCValues struct {
	Title              string
	DisplayName        string
	Domain             string
	RemoteIP           string
	OneTimeCode        string
	RevocationLinkURL  string
	RevocationLinkText string
}

EmailIdentityVerificationOTCValues are the values used for the identity verification OTP templates.

type EmailTemplate added in v4.38.0

type EmailTemplate struct {
	HTML *th.Template
	Text *tt.Template
}

EmailTemplate is the template type which contains both the html and txt versions of a template.

type NotificationTemplates added in v4.36.3

type NotificationTemplates struct {
	// contains filtered or unexported fields
}

NotificationTemplates are the templates for the notification system.

type OpenAPIAssetTemplates added in v4.38.0

type OpenAPIAssetTemplates struct {
	// contains filtered or unexported fields
}

OpenAPIAssetTemplates are asset templates for the OpenAPI specification.

type OpenIDConnectTemplates added in v4.38.0

type OpenIDConnectTemplates struct {
	// contains filtered or unexported fields
}

type Provider added in v4.36.3

type Provider struct {
	// contains filtered or unexported fields
}

Provider of templates.

func New added in v4.36.3

func New(config Config) (provider *Provider, err error)

New creates a new templates' provider.

func (*Provider) GetAssetIndexTemplate added in v4.38.0

func (p *Provider) GetAssetIndexTemplate() (t Template)

GetAssetIndexTemplate returns a Template used to generate the React index document.

func (*Provider) GetAssetOpenAPIIndexTemplate added in v4.38.0

func (p *Provider) GetAssetOpenAPIIndexTemplate() (t Template)

GetAssetOpenAPIIndexTemplate returns a Template used to generate the OpenAPI index document.

func (*Provider) GetAssetOpenAPISpecTemplate added in v4.38.0

func (p *Provider) GetAssetOpenAPISpecTemplate() (t Template)

GetAssetOpenAPISpecTemplate returns a Template used to generate the OpenAPI specification document.

func (*Provider) GetEventEmailTemplate added in v4.38.0

func (p *Provider) GetEventEmailTemplate() (t *EmailTemplate)

GetEventEmailTemplate returns an EmailTemplate used for generic event notifications.

func (*Provider) GetIdentityVerificationJWTEmailTemplate added in v4.38.0

func (p *Provider) GetIdentityVerificationJWTEmailTemplate() (t *EmailTemplate)

GetIdentityVerificationJWTEmailTemplate returns the EmailTemplate for Identity Verification notifications.

func (*Provider) GetIdentityVerificationOTCEmailTemplate added in v4.38.0

func (p *Provider) GetIdentityVerificationOTCEmailTemplate() (t *EmailTemplate)

GetIdentityVerificationOTCEmailTemplate returns the EmailTemplate for Identity Verification notifications.

func (*Provider) GetOpenIDConnectAuthorizeResponseFormPostTemplate added in v4.38.0

func (p *Provider) GetOpenIDConnectAuthorizeResponseFormPostTemplate() (t *th.Template)

GetOpenIDConnectAuthorizeResponseFormPostTemplate returns a Template used to generate the OpenID Connect 1.0 Form Post Authorize Response.

func (*Provider) LoadTemplatedAssets added in v4.38.0

func (p *Provider) LoadTemplatedAssets(fs fs.ReadFileFS) (err error)

LoadTemplatedAssets takes an embed.FS and loads each templated asset document into a Template.

type Template added in v4.38.0

type Template interface {
	Execute(wr io.Writer, data any) error
	ExecuteTemplate(wr io.Writer, name string, data any) error
	Name() string
	DefinedTemplates() string
}

Template covers shared implementations between the text and html template.Template.

type Templates added in v4.36.3

type Templates struct {
	// contains filtered or unexported fields
}

Templates is the struct which holds all the *template.Template values.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL