v1alpha1

package
v0.7.23 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: Apache-2.0 Imports: 11 Imported by: 1

Documentation

Index

Constants

View Source
const DefaultCategory = "Uncategorized"

"Uncategorized" is assigned when Category is empty in the component definitions.

Variables

This section is empty.

Functions

func CreateCategory added in v0.6.31

func CreateCategory(db *database.Handler, cat Category) (uuid.UUID, error)

func CreateComponent added in v0.6.8

func CreateComponent(db *database.Handler, c ComponentDefinition) (uuid.UUID, uuid.UUID, error)

func CreateModel added in v0.6.31

func CreateModel(db *database.Handler, cmodel Model) (uuid.UUID, error)

func CreatePolicy added in v0.6.26

func CreatePolicy(db *database.Handler, p PolicyDefinition) (uuid.UUID, uuid.UUID, error)

func CreateRelationship added in v0.6.14

func CreateRelationship(db *database.Handler, r RelationshipDefinition) (uuid.UUID, uuid.UUID, error)

func UpdateModelsStatus added in v0.7.14

func UpdateModelsStatus(db *database.Handler, modelID uuid.UUID, status string) error

Types

type Category added in v0.6.31

type Category struct {
	ID       uuid.UUID              `json:"-" yaml:"-"`
	Name     string                 `json:"name"`
	Metadata map[string]interface{} `json:"metadata" yaml:"metadata"`
}

swagger:response Category

func (*Category) GetCategoryDB added in v0.6.31

func (c *Category) GetCategoryDB(db *database.Handler) (catdb CategoryDB)

type CategoryDB added in v0.6.31

type CategoryDB struct {
	ID       uuid.UUID `json:"-"`
	Name     string    `json:"categoryName" gorm:"categoryName"`
	Metadata []byte    `json:"categoryMetadata" gorm:"categoryMetadata"`
}

func (*CategoryDB) GetCategory added in v0.6.31

func (cdb *CategoryDB) GetCategory(db *database.Handler) (cat Category)

type CategoryFilter added in v0.6.31

type CategoryFilter struct {
	Name    string
	OrderOn string
	Greedy  bool
	Sort    string //asc or desc. Default behavior is asc
	Limit   int    //If 0 or  unspecified then all records are returned and limit is not used
	Offset  int
}

func (*CategoryFilter) Create added in v0.6.31

func (cf *CategoryFilter) Create(m map[string]interface{})

Create the filter from map[string]interface{}

type ComponentDefinition added in v0.6.8

type ComponentDefinition struct {
	ID uuid.UUID `json:"id,omitempty"`
	TypeMeta
	DisplayName     string                 `json:"displayName" gorm:"displayName"`
	Format          ComponentFormat        `json:"format" yaml:"format"`
	HostName        string                 `json:"hostname,omitempty"`
	HostID          uuid.UUID              `json:"hostID,omitempty"`
	DisplayHostName string                 `json:"displayhostname,omitempty"`
	Metadata        map[string]interface{} `json:"metadata" yaml:"metadata"`
	Model           Model                  `json:"model"`
	Schema          string                 `json:"schema,omitempty" yaml:"schema"`
	CreatedAt       time.Time              `json:"-"`
	UpdatedAt       time.Time              `json:"-"`
}

swagger:response ComponentDefinition use NewComponent function for instantiating

func GetMeshModelComponents added in v0.6.21

func GetMeshModelComponents(db *database.Handler, f ComponentFilter) (c []ComponentDefinition, count int64, unique int)

func (*ComponentDefinition) GetComponentDefinitionDB added in v0.6.11

func (c *ComponentDefinition) GetComponentDefinitionDB() (cmd ComponentDefinitionDB)

func (ComponentDefinition) GetID added in v0.6.15

func (c ComponentDefinition) GetID() uuid.UUID

func (ComponentDefinition) Type added in v0.6.8

func (ComponentDefinition) WriteComponentDefinition added in v0.7.12

func (c ComponentDefinition) WriteComponentDefinition(componentDirPath string) error

type ComponentDefinitionDB added in v0.6.8

type ComponentDefinitionDB struct {
	ID      uuid.UUID `json:"id"`
	ModelID uuid.UUID `json:"-" gorm:"index:idx_component_definition_dbs_model_id,column:modelID"`
	TypeMeta
	DisplayName string          `json:"displayName" gorm:"displayName"`
	Format      ComponentFormat `json:"format" yaml:"format"`
	Metadata    []byte          `json:"metadata" yaml:"metadata"`
	Schema      string          `json:"schema,omitempty" yaml:"schema"`
	CreatedAt   time.Time       `json:"-"`
	UpdatedAt   time.Time       `json:"-"`
}

func (*ComponentDefinitionDB) GetComponentDefinition added in v0.6.11

func (cmd *ComponentDefinitionDB) GetComponentDefinition(model Model) (c ComponentDefinition)

type ComponentFilter added in v0.6.8

type ComponentFilter struct {
	Name         string
	APIVersion   string
	Greedy       bool //when set to true - instead of an exact match, name will be matched as a substring
	Trim         bool //when set to true - the schema is not returned
	DisplayName  string
	ModelName    string
	CategoryName string
	Version      string
	Sort         string //asc or desc. Default behavior is asc
	OrderOn      string
	Limit        int //If 0 or  unspecified then all records are returned and limit is not used
	Offset       int
	Annotations  string //When this query parameter is "true", only components with the "isAnnotation" property set to true are returned. When this query parameter is "false", all components except those considered to be annotation components are returned. Any other value of the query parameter results in both annotations as well as non-annotation models being returned.
}

func (*ComponentFilter) Create added in v0.6.8

func (cf *ComponentFilter) Create(m map[string]interface{})

Create the filter from map[string]interface{}

type ComponentFormat added in v0.6.8

type ComponentFormat string
const (
	JSON ComponentFormat = "JSON"
	YAML ComponentFormat = "YAML"
	CUE  ComponentFormat = "CUE"
)

type EntitySummary added in v0.6.73

type EntitySummary struct {
	Models        int64 `json:"models"`
	Components    int64 `json:"components"`
	Relationships int64 `json:"relationships"`
	Policies      int64 `json:"policies"`
}

type HostFilter added in v0.6.73

type HostFilter struct {
	Name        string
	Greedy      bool //when set to true - instead of an exact match, name will be prefix matched
	Trim        bool //when set to true - the schema is not returned
	DisplayName string
	Version     string
	Sort        string //asc or desc. Default behavior is asc
	OrderOn     string
	Limit       int //If 0 or  unspecified then all records are returned and limit is not used
	Offset      int
}

type MeshModelHostsWithEntitySummary added in v0.6.73

type MeshModelHostsWithEntitySummary struct {
	ID       uuid.UUID     `json:"id"`
	Hostname string        `json:"hostname"`
	Port     int           `json:"port"`
	Summary  EntitySummary `json:"summary"`
}

type MesheryHostSummaryDB added in v0.6.73

type MesheryHostSummaryDB struct {
	HostID        uuid.UUID `json:"-" gorm:"id"`
	Hostname      string    `json:"-" gorm:"hostname"`
	Port          int       `json:"-" gorm:"port"`
	Models        int64     `json:"-" gorm:"models"`
	Components    int64     `json:"-" gorm:"components"`
	Relationships int64     `json:"-" gorm:"relationships"`
	Policies      int64     `json:"-" gorm:"policies"`
}

type Model added in v0.6.18

type Model struct {
	ID              uuid.UUID                  `json:"id,omitempty" yaml:"-"`
	Name            string                     `json:"name"`
	Version         string                     `json:"version"`
	DisplayName     string                     `json:"displayName" gorm:"modelDisplayName"`
	Status          ModelStatus                `json:"status" gorm:"status"`
	HostName        string                     `json:"hostname,omitempty"`
	HostID          uuid.UUID                  `json:"hostID,omitempty"`
	DisplayHostName string                     `json:"displayhostname,omitempty"`
	Category        Category                   `json:"category"`
	Metadata        map[string]interface{}     `json:"metadata" yaml:"modelMetadata"`
	Components      []ComponentDefinitionDB    `json:"components"`
	Relationships   []RelationshipDefinitionDB `json:"relationships"`
}

swagger:response Model

func (Model) GetID added in v0.6.68

func (m Model) GetID() uuid.UUID

func (*Model) GetModelDB added in v0.6.31

func (c *Model) GetModelDB() (cmd ModelDB)

func (Model) Type added in v0.6.68

func (m Model) Type() types.EntityType

func (Model) WriteModelDefinition added in v0.7.12

func (c Model) WriteModelDefinition(modelDefPath string) error

type ModelDB added in v0.6.31

type ModelDB struct {
	ID          uuid.UUID   `json:"id"`
	CategoryID  uuid.UUID   `json:"-" gorm:"categoryID"`
	Name        string      `json:"modelName" gorm:"modelName"`
	Version     string      `json:"version"`
	DisplayName string      `json:"modelDisplayName" gorm:"modelDisplayName"`
	SubCategory string      `json:"subCategory" gorm:"subCategory"`
	Metadata    []byte      `json:"modelMetadata" gorm:"modelMetadata"`
	Status      ModelStatus `json:"status" gorm:"status"`
}

func (*ModelDB) GetModel added in v0.6.31

func (cmd *ModelDB) GetModel(cat Category) (c Model)

type ModelFilter added in v0.6.18

type ModelFilter struct {
	Name        string
	Registrant  string //name of the registrant for a given model
	DisplayName string //If Name is already passed, avoid passing Display name unless greedy=true, else the filter will translate to an AND returning only the models where name and display name match exactly. Ignore, if this behavior is expected.
	Greedy      bool   //when set to true - instead of an exact match, name will be prefix matched. Also an OR will be performed of name and display_name
	Version     string
	Category    string
	OrderOn     string
	Sort        string //asc or desc. Default behavior is asc
	Limit       int    //If 0 or unspecified then all records are returned and limit is not used
	Offset      int
	Annotations string //When this query parameter is "true", only models with the "isAnnotation" property set to true are returned. When  this query parameter is "false", all models except those considered to be annotation models are returned. Any other value of the query parameter results in both annoations as well as non-annotation models being returned.

	// When these are set to true, we also retrieve components/relationships associated with the model.
	Components    bool
	Relationships bool
	Status        string
}

func (*ModelFilter) Create added in v0.6.18

func (cf *ModelFilter) Create(m map[string]interface{})

Create the filter from map[string]interface{}

type ModelStatus added in v0.7.14

type ModelStatus string

type PolicyDefinition added in v0.6.26

type PolicyDefinition struct {
	ID uuid.UUID `json:"-"`
	TypeMeta
	Model      Model                  `json:"model"`
	SubType    string                 `json:"subType" yaml:"subType"`
	Expression map[string]interface{} `json:"expression" yaml:"expression"`
	CreatedAt  time.Time              `json:"-"`
	UpdatedAt  time.Time              `json:"-"`
}

func GetMeshModelPolicy added in v0.6.26

func GetMeshModelPolicy(db *database.Handler, f PolicyFilter) (pl []PolicyDefinition)

func (PolicyDefinition) GetID added in v0.6.26

func (p PolicyDefinition) GetID() uuid.UUID

func (*PolicyDefinition) GetPolicyDefinitionDB added in v0.6.26

func (p *PolicyDefinition) GetPolicyDefinitionDB() (pdb PolicyDefinitionDB)

func (PolicyDefinition) Type added in v0.6.26

type PolicyDefinitionDB added in v0.6.26

type PolicyDefinitionDB struct {
	ID      uuid.UUID `json:"-"`
	ModelID uuid.UUID `json:"-" gorm:"modelID"`
	TypeMeta
	SubType    string    `json:"subType" yaml:"subType"`
	Expression []byte    `json:"expression" yaml:"expression"`
	CreatedAt  time.Time `json:"-"`
	UpdatedAt  time.Time `json:"-"`
}

func (*PolicyDefinitionDB) GetPolicyDefinition added in v0.6.26

func (pdb *PolicyDefinitionDB) GetPolicyDefinition(m Model) (p PolicyDefinition)

type PolicyFilter added in v0.6.26

type PolicyFilter struct {
	Kind      string
	Greedy    bool
	SubType   string
	ModelName string
	OrderOn   string
	Sort      string
	Limit     int
	Offset    int
}

func (*PolicyFilter) Create added in v0.6.26

func (pf *PolicyFilter) Create(m map[string]interface{})

type RelationshipDefinition added in v0.6.14

type RelationshipDefinition struct {
	ID uuid.UUID `json:"id"`
	TypeMeta
	Model           Model                  `json:"model"`
	HostName        string                 `json:"hostname"`
	HostID          uuid.UUID              `json:"hostID"`
	DisplayHostName string                 `json:"displayhostname"`
	Metadata        map[string]interface{} `json:"metadata" yaml:"metadata"`
	// The property has been named RelationshipType instead of Type to avoid collision from Type() function, which enables support for dynamic type.
	// Though, the column name and the json representation is "type".
	RelationshipType string                   `json:"type" yaml:"type" gorm:"type"`
	SubType          string                   `json:"subType" yaml:"subType" gorm:"subType"`
	EvaluationQuery  string                   `json:"evaluationQuery" yaml:"evaluationQuery" gorm:"evaluationQuery"`
	Selectors        []map[string]interface{} `json:"selectors" yaml:"selectors"`
	CreatedAt        time.Time                `json:"-"`
	UpdatedAt        time.Time                `json:"-"`
}

https://docs.google.com/drawings/d/1_qzQ_YxvCWPYrOBcdqGMlMwfbsZx96SBuIkbn8TfKhU/edit?pli=1 see RELATIONSHIPDEFINITIONS table in the diagram swagger:response RelationshipDefinition TODO: Add support for Model

func GetMeshModelRelationship added in v0.6.21

func GetMeshModelRelationship(db *database.Handler, f RelationshipFilter) (r []RelationshipDefinition, count int64)

func (RelationshipDefinition) GetID added in v0.6.15

func (r RelationshipDefinition) GetID() uuid.UUID

func (*RelationshipDefinition) GetRelationshipDefinitionDB added in v0.6.14

func (r *RelationshipDefinition) GetRelationshipDefinitionDB() (rdb RelationshipDefinitionDB)

func (RelationshipDefinition) Type added in v0.6.14

type RelationshipDefinitionDB added in v0.6.14

type RelationshipDefinitionDB struct {
	ID      uuid.UUID `json:"id"`
	ModelID uuid.UUID `json:"-" gorm:"index:idx_relationship_definition_dbs_model_id,column:modelID"`
	TypeMeta
	Metadata []byte `json:"metadata" yaml:"metadata"`
	// The property has been named RelationshipType instead of Type to avoid collision from Type() function, which enables support for dynamic type.
	// Though, the column name and the json representation is "type".
	RelationshipType string    `json:"type" yaml:"type" gorm:"type"`
	SubType          string    `json:"subType" yaml:"subType"`
	EvaluationQuery  string    `json:"evaluationQuery" yaml:"evaluationQuery" gorm:"evaluationQuery"`
	Selectors        []byte    `json:"selectors" yaml:"selectors"`
	CreatedAt        time.Time `json:"-"`
	UpdatedAt        time.Time `json:"-"`
}

func (*RelationshipDefinitionDB) GetRelationshipDefinition added in v0.6.14

func (rdb *RelationshipDefinitionDB) GetRelationshipDefinition(m Model) (r RelationshipDefinition)

type RelationshipFilter added in v0.6.14

type RelationshipFilter struct {
	Kind             string
	Greedy           bool //when set to true - instead of an exact match, kind will be prefix matched
	SubType          string
	RelationshipType string
	Version          string
	ModelName        string
	OrderOn          string
	Sort             string //asc or desc. Default behavior is asc
	Limit            int    //If 0 or  unspecified then all records are returned and limit is not used
	Offset           int
}

For now, only filtering by Kind and SubType are allowed. In the future, we will add support to query using `selectors` (using CUE) TODO: Add support for Model

func (*RelationshipFilter) Create added in v0.6.14

func (rf *RelationshipFilter) Create(m map[string]interface{})

Create the filter from map[string]interface{}

type TypeMeta

type TypeMeta struct {
	Kind       string `json:"kind,omitempty" yaml:"kind"`
	APIVersion string `json:"apiVersion,omitempty" yaml:"apiVersion"`
}

Jump to

Keyboard shortcuts

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