Documentation ¶
Index ¶
- Constants
- type MapBuilder
- func (b *MapBuilder) ApplyTemplate(reverse bool) error
- func (b MapBuilder) Get(key string) interface{}
- func (b MapBuilder) GetBody() (interface{}, error)
- func (b MapBuilder) GetFileContents() *os.File
- func (b MapBuilder) GetMap() map[string]interface{}
- func (b MapBuilder) GetString(key string) (string, bool)
- func (b *MapBuilder) GetTemplateVariablesJsonnet() (string, error)
- func (b MapBuilder) MarshalJSON() ([]byte, error)
- func (b *MapBuilder) MergeJsonnet(snippet string, reverse bool) error
- func (b *MapBuilder) Set(path string, value interface{}) error
- func (b *MapBuilder) SetFile(path string)
- func (b *MapBuilder) SetMap(body map[string]interface{})
- func (b *MapBuilder) SetRequiredKeys(keys ...string)
- func (b *MapBuilder) SetTemplate(template string) *MapBuilder
- func (b *MapBuilder) SetTemplateVariables(variables map[string]interface{})
- func (b *MapBuilder) SetValidationTemplate(template string)
- func (b MapBuilder) Validate() error
Constants ¶
const (
Separator = "."
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MapBuilder ¶
type MapBuilder struct {
// contains filtered or unexported fields
}
MapBuilder creates body builder
func NewMapBuilder ¶
func NewMapBuilder() *MapBuilder
func NewMapBuilderFromJSON ¶
func NewMapBuilderFromJSON(data string) (*MapBuilder, error)
NewMapBuilderFromJSON returns a new mapper builder object created from json
func NewMapBuilderFromJsonnetSnippet ¶
func NewMapBuilderFromJsonnetSnippet(snippet string) (*MapBuilder, error)
NewMapBuilderFromJsonnetSnippet returns a new mapper builder from a jsonnet snippet See https://jsonnet.org/learning/tutorial.html for details on how to create a snippet
func NewMapBuilderWithInit ¶
func NewMapBuilderWithInit(body map[string]interface{}) *MapBuilder
func (*MapBuilder) ApplyTemplate ¶ added in v1.6.0
func (b *MapBuilder) ApplyTemplate(reverse bool) error
func (MapBuilder) Get ¶
func (b MapBuilder) Get(key string) interface{}
GetMap returns the body as a map[string]interface{}
func (MapBuilder) GetBody ¶ added in v1.8.0
func (b MapBuilder) GetBody() (interface{}, error)
func (MapBuilder) GetFileContents ¶ added in v1.8.0
func (b MapBuilder) GetFileContents() *os.File
func (MapBuilder) GetMap ¶
func (b MapBuilder) GetMap() map[string]interface{}
GetMap returns the body as a map[string]interface{}
func (MapBuilder) GetString ¶
func (b MapBuilder) GetString(key string) (string, bool)
Get the value as a string
func (*MapBuilder) GetTemplateVariablesJsonnet ¶ added in v1.6.0
func (b *MapBuilder) GetTemplateVariablesJsonnet() (string, error)
func (MapBuilder) MarshalJSON ¶
func (b MapBuilder) MarshalJSON() ([]byte, error)
MarshalJSON returns the body as json
func (*MapBuilder) MergeJsonnet ¶
func (b *MapBuilder) MergeJsonnet(snippet string, reverse bool) error
MergeJsonnet merges the existing body data with a given jsonnet snippet. When reverse is false, then the snippet will be applied to the existing data, when reverse is true, then the given snippet will be the base, and the existing data will be applied to the new snippet.
func (*MapBuilder) Set ¶
func (b *MapBuilder) Set(path string, value interface{}) error
Set sets a value to a give dot notation path
func (*MapBuilder) SetFile ¶ added in v1.8.0
func (b *MapBuilder) SetFile(path string)
SetFile sets the body to the contents of the file path
func (*MapBuilder) SetMap ¶
func (b *MapBuilder) SetMap(body map[string]interface{})
SetMap sets a new map to the body. This will remove any existing values in the body
func (*MapBuilder) SetRequiredKeys ¶ added in v1.6.0
func (b *MapBuilder) SetRequiredKeys(keys ...string)
func (*MapBuilder) SetTemplate ¶ added in v1.6.0
func (b *MapBuilder) SetTemplate(template string) *MapBuilder
func (*MapBuilder) SetTemplateVariables ¶ added in v1.6.0
func (b *MapBuilder) SetTemplateVariables(variables map[string]interface{})
func (*MapBuilder) SetValidationTemplate ¶ added in v1.6.0
func (b *MapBuilder) SetValidationTemplate(template string)
SetValidationTemplate sets the validation template to be applied. The template accepts a jsonnet string
func (MapBuilder) Validate ¶ added in v1.6.0
func (b MapBuilder) Validate() error
Validate checks the body if it is valid and contains all of the required keys