reader

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EdgeTemplatesFromFs

func EdgeTemplatesFromFs(dir fs.FS) (map[string]*knowledgebase.EdgeTemplate, error)

func InitializeProperty

func InitializeProperty(ptype string) (knowledgebase.Property, error)

func ModelsFromFS

func ModelsFromFS(dir fs.FS) (map[string]*Model, error)

func NewKBFromFs

func NewKBFromFs(resources, edges, models fs.FS) (*knowledgebase.KnowledgeBase, error)

func TemplatesFromFs

func TemplatesFromFs(dir fs.FS, models map[string]*Model) (map[construct.ResourceId]*knowledgebase.ResourceTemplate, error)

Types

type Model

type Model struct {
	Name       string     `json:"name" yaml:"name"`
	Properties Properties `json:"properties" yaml:"properties"`
	Property   *Property  `json:"property" yaml:"property"`
}

func (Model) Convert

func (m Model) Convert() (*knowledgebase.Model, error)

type Properties

type Properties map[string]*Property

Properties defines the structure of properties defined in yaml as a part of a template.

func (Properties) Clone

func (p Properties) Clone() Properties

func (*Properties) Convert

func (p *Properties) Convert() (knowledgebase.Properties, error)

func (*Properties) UnmarshalYAML

func (p *Properties) UnmarshalYAML(n *yaml.Node) error

type Property

type Property struct {
	Name string `json:"name" yaml:"name"`
	// Type defines the type of the property
	Type string `json:"type" yaml:"type"`

	Description string `json:"description" yaml:"description"`
	IsImportant bool   `json:"important" yaml:"important"`

	Namespace bool `json:"namespace" yaml:"namespace"`

	DefaultValue any `json:"default_value" yaml:"default_value"`

	Required bool `json:"required" yaml:"required"`

	ConfigurationDisabled bool `json:"configuration_disabled" yaml:"configuration_disabled"`

	DeployTime bool `json:"deploy_time" yaml:"deploy_time"`

	OperationalRule *knowledgebase.PropertyRule `json:"operational_rule" yaml:"operational_rule"`

	Properties Properties `json:"properties" yaml:"properties"`

	// MinLength defines the minimum length of a string, list, set, or map (number of entries)
	MinLength *int `yaml:"min_length"`
	MaxLength *int `yaml:"max_length"`

	MinValue *float64 `yaml:"min_value"`
	MaxValue *float64 `yaml:"max_value"`

	// UniqueItems defines whether the items in a list or set must be unique
	UniqueItems *bool `yaml:"unique_items"`
	// UniqueKeys defines whether the keys in a map must be unique (default true)
	UniqueKeys *bool `yaml:"unique_keys"`

	AllowedTypes construct.ResourceList `yaml:"allowed_types"`

	SanitizeTmpl  string   `yaml:"sanitize"`
	AllowedValues []string `yaml:"allowed_values"`

	KeyProperty   *Property `yaml:"key_property"`
	ValueProperty *Property `yaml:"value_property"`

	ItemProperty *Property `yaml:"item_property"`

	Path string `json:"-" yaml:"-"`
}

Property defines the structure of a property defined in yaml as a part of a template. these fields must be exactly the union of all the fields in the different property types.

func (*Property) Clone

func (p *Property) Clone() *Property

func (*Property) Convert

func (p *Property) Convert() (knowledgebase.Property, error)

func (Property) ModelType

func (p Property) ModelType() *string

type ResourceTemplate

type ResourceTemplate struct {
	QualifiedTypeName string `json:"qualified_type_name" yaml:"qualified_type_name"`

	DisplayName string `json:"display_name" yaml:"display_name"`

	Properties Properties `json:"properties" yaml:"properties"`

	Classification knowledgebase.Classification `json:"classification" yaml:"classification"`

	PathSatisfaction knowledgebase.PathSatisfaction `json:"path_satisfaction" yaml:"path_satisfaction"`

	AdditionalRules []knowledgebase.AdditionalRule `json:"additional_rules" yaml:"additional_rules"`

	Consumption knowledgebase.Consumption `json:"consumption" yaml:"consumption"`

	// DeleteContext defines the context in which a resource can be deleted
	DeleteContext knowledgebase.DeleteContext `json:"delete_context" yaml:"delete_context"`
	// Views defines the views that the resource should be added to as a distinct node
	Views map[string]string `json:"views" yaml:"views"`

	NoIac bool `json:"no_iac" yaml:"no_iac"`

	DeploymentPermissions knowledgebase.DeploymentPermissions `json:"deployment_permissions" yaml:"deployment_permissions"`

	SanitizeNameTmpl string `yaml:"sanitize_name"`
}

ResourceTemplate defines how rules are handled by the engine in terms of making sure they are functional in the graph

func (*ResourceTemplate) Convert

Jump to

Keyboard shortcuts

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