Documentation ¶
Overview ¶
package frontmatter includes types and functions that provide resource plan modifiers for using Markdown front matter for attribute values. Front matter is an alternative way to specify parameters for changelogs, custom pages, and docs.
Index ¶
- func GetBool(fieldName string) planmodifier.Bool
- func GetInt64(fieldName string) planmodifier.Int64
- func GetString(fieldName string) planmodifier.String
- func GetValue(ctx context.Context, body, attribute string) (reflect.Value, string)
- type FrontMatterModifier
- func (m FrontMatterModifier) Description(ctx context.Context) string
- func (m FrontMatterModifier) MarkdownDescription(ctx context.Context) string
- func (m FrontMatterModifier) PlanModifyBool(ctx context.Context, req planmodifier.BoolRequest, ...)
- func (m FrontMatterModifier) PlanModifyInt64(ctx context.Context, req planmodifier.Int64Request, ...)
- func (m FrontMatterModifier) PlanModifyString(ctx context.Context, req planmodifier.StringRequest, ...)
- type ReadmeFrontMatter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetBool ¶
func GetBool(fieldName string) planmodifier.Bool
GetBool is a plan modifier function for use on a schema bool attribute to set a value from front matter.
func GetInt64 ¶
func GetInt64(fieldName string) planmodifier.Int64
GetInt64 is a plan modifier function for use on a schema int64 attribute to set a value from front matter.
func GetString ¶
func GetString(fieldName string) planmodifier.String
GetString is a plan modifier function for use on a schema string attribute to set a value from front matter.
func GetValue ¶
GetValue parses the 'body' attribute value for Markdown front matter and returns a specified key's value if it's present in the front matter.
The `attribute` parameter is the struct field name representing the YAML front matter key.
This returns a `reflect.Value` to be evaluated as needed based on the type and other conditions.
A string value is provided in place of an error for use with the plugin framework's diagnostics package.
Types ¶
type FrontMatterModifier ¶
type FrontMatterModifier struct {
// contains filtered or unexported fields
}
FrontMatterModifier provides plan modifiers that parses Markdown front matter for attribute values.
func (FrontMatterModifier) Description ¶
func (m FrontMatterModifier) Description(ctx context.Context) string
Description returns a plain text description of the modifier's behavior.
func (FrontMatterModifier) MarkdownDescription ¶
func (m FrontMatterModifier) MarkdownDescription(ctx context.Context) string
MarkdownDescription returns a markdown formatted description of the modifier's behavior.
func (FrontMatterModifier) PlanModifyBool ¶
func (m FrontMatterModifier) PlanModifyBool( ctx context.Context, req planmodifier.BoolRequest, resp *planmodifier.BoolResponse, )
PlanModifyBool sets a bool attribute's value from the body Markdown front matter if the attribute is not set and a matching attribute is set in front matter.
func (FrontMatterModifier) PlanModifyInt64 ¶
func (m FrontMatterModifier) PlanModifyInt64( ctx context.Context, req planmodifier.Int64Request, resp *planmodifier.Int64Response, )
PlanModifyInt64 sets an int64 attribute's value from the body Markdown front matter if the attribute is not set and a matching attribute is set in front matter.
func (FrontMatterModifier) PlanModifyString ¶
func (m FrontMatterModifier) PlanModifyString( ctx context.Context, req planmodifier.StringRequest, resp *planmodifier.StringResponse, )
PlanModifyString sets a string attribute's value from the body Markdown front matter if the attribute is not set and a matching attribute is set in front matter.
type ReadmeFrontMatter ¶
type ReadmeFrontMatter struct { Body string `yaml:"body,omitempty"` // changelogs, custom pages, docs Category string `yaml:"category,omitempty"` // docs CategorySlug string `yaml:"categorySlug,omitempty"` // docs Error readme.DocErrorObject `yaml:"error,omitempty"` // docs Hidden *bool `yaml:"hidden"` // changelogs, custom pages, docs HTML string `yaml:"html,omitempty"` // custom page HTMLMode *bool `yaml:"htmlmode"` // custom page Order int64 `yaml:"order,omitempty"` // docs ParentDoc string `yaml:"parentDoc,omitempty"` // docs ParentDocSlug string `yaml:"parentDocSlug,omitempty"` // docs Slug string `yaml:"slug,omitempty"` // docs Title string `yaml:"title,omitempty"` // changelogs, custom pages, docs Type string `yaml:"type,omitempty"` // changelogs, docs }
ReadmeFrontMatter represents the front matter keys available to ReadMe changelogs, custom pages, and docs.