Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateResource ¶
func GenerateResource(s *Struct, w io.Writer, beforeWriteHooks ...SourceWriteHookFunc) error
GenerateResource generates Terraform resource and writes it to specified output
func SourceFormatHook ¶
SourceFormatHook formats code using Go's formatter
Types ¶
type Field ¶
type Field struct {
// OriginalName is an original field name without chnages.
OriginalName string
// Name is a field name defined by struct tag.
Name string
// Required marks field as `required` in Terraform definition.
Required bool
// Optional marks field as `optional` in Terraform definition.
Optional bool
// Computed marks field as `computed` in Terraform definition.
Computed bool
// Type holds a field type.
Type string
// ElemType holds an element type if field type is List or Set
ElemType string
}
Field holds information about particular field in parsed struct.
type SourceWriteHookFunc ¶
SourceWriteHookFunc defines a hook func to mutate source before writing to destination
type Struct ¶
type Struct struct {
// Name is a of parsed struct.
Name string
// MikrotikIDField is a field name which holds MikroTik resource ID.
MikrotikIDField string
// TerraformIDField holds a field name which will be used as Terraform resource ID.
TerraformIDField string
// DeleteField holds a field name to use when deleting resource on MikroTik system.
DeleteField string
// Fields is a collection of field definitions in the parsed struct.
Fields []*Field
}
Struct holds information about parsed struct.
type Type ¶
type Type interface {
// Type returns a type name as string.
// It must be stable for the same type.
Name() string
// Is checks whether two types are the same.
Is(Type) bool
}
Type represents Terraform field type to use for particular MikroTik field.
var ( StringType Type = basetype{/* contains filtered or unexported fields */} Int64Type Type = basetype{/* contains filtered or unexported fields */} ListType Type = basetype{/* contains filtered or unexported fields */} SetType Type = basetype{/* contains filtered or unexported fields */} BoolType Type = basetype{/* contains filtered or unexported fields */} UnknownType Type = basetype{/* contains filtered or unexported fields */} )
Click to show internal directories.
Click to hide internal directories.