v1beta1

package
v0.7.19 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultCategory = "Uncategorized"

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

View Source
const MesheryAnnotationPrefix = "design.meshmodel.io"
View Source
const SchemaVersion = "core.meshery.io/v1beta1"

Variables

This section is empty.

Functions

func GetAPIVersionFromComponent

func GetAPIVersionFromComponent(comp Component) string

func GetAnnotationsForWorkload

func GetAnnotationsForWorkload(w ComponentDefinition) map[string]string

func GetKindFromComponent

func GetKindFromComponent(comp Component) string

Types

type ArtifactHub

type ArtifactHub struct{}

func (ArtifactHub) HandleDependents

func (ah ArtifactHub) HandleDependents(comp Component, kc *kubernetes.Client, isDeploy bool) (summary string, err error)

func (ArtifactHub) String

func (ah ArtifactHub) String() string

type Category

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) Create

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

func (*Category) GetCategoryDB

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

func (*Category) GetEntityDetail

func (cat *Category) GetEntityDetail() string

func (Category) GetID

func (cat Category) GetID() uuid.UUID

func (Category) Type

func (cat Category) Type() entity.EntityType

func (*Category) UpdateStatus

func (m *Category) UpdateStatus(db database.Handler, status entity.EntityStatus) error

type CategoryDB

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

func (*CategoryDB) GetCategory

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

type Component

type Component struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	Spec ComponentSpec `json:"spec,omitempty"`
}

Component is the structure for the core Application Component

type ComponentDefinition

type ComponentDefinition struct {
	ID uuid.UUID `json:"id,omitempty"`
	VersionMeta
	DisplayName string                 `json:"displayName" gorm:"displayName"`
	Description string                 `json:"description" gorm:"description"`
	Format      ComponentFormat        `json:"format" yaml:"format"`
	Model       Model                  `json:"model"`
	Metadata    map[string]interface{} `json:"metadata" yaml:"metadata"`
	// component corresponds to the specifications of underlying entity eg: Pod/Deployment....
	Component ComponentEntity `json:"component,omitempty" yaml:"component"`
}

swagger:response ComponentDefinition use NewComponent function for instantiating

func (*ComponentDefinition) Create

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

func (*ComponentDefinition) GetComponentDefinitionDB

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

func (*ComponentDefinition) GetEntityDetail

func (c *ComponentDefinition) GetEntityDetail() string

func (ComponentDefinition) GetID

func (c ComponentDefinition) GetID() uuid.UUID

func (ComponentDefinition) Type

func (*ComponentDefinition) UpdateStatus

func (m *ComponentDefinition) UpdateStatus(db *database.Handler, status entity.EntityStatus) error

func (ComponentDefinition) WriteComponentDefinition

func (c ComponentDefinition) WriteComponentDefinition(componentDirPath string) error

type ComponentDefinitionDB

type ComponentDefinitionDB struct {
	ID uuid.UUID `json:"id"`
	VersionMeta
	DisplayName string          `json:"displayName" gorm:"displayName"`
	Description string          `json:"description" gorm:"description"`
	Format      ComponentFormat `json:"format" yaml:"format"`
	ModelID     uuid.UUID       `json:"-" gorm:"index:idx_component_definition_dbs_model_id,column:modelID"`
	Metadata    []byte          `json:"metadata" yaml:"metadata"`
	Component   ComponentEntity `json:"component,omitempty" yaml:"component" gorm:"type:bytes;serializer:json"`
}

func (*ComponentDefinitionDB) GetComponentDefinition

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

type ComponentEntity

type ComponentEntity struct {
	TypeMeta
	Schema string `json:"schema,omitempty" yaml:"schema"`
}

Contains information as extracted from the core underlying component eg: Pod's apiVersion, kind and schema

type ComponentFormat

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

type ComponentParameter

type ComponentParameter struct {
	Name        string   `json:"name"`
	FieldPaths  []string `json:"fieldPaths"`
	Required    *bool    `json:"required,omitempty"`
	Description *string  `json:"description,omitempty"`
}

ComponentParameter is the structure for the core Application Component Paramater

type ComponentSpec

type ComponentSpec struct {
	Type       string                 `json:"type"`
	Version    string                 `json:"version"`
	APIVersion string                 `json:"apiVersion"`
	Model      string                 `json:"model"`
	Settings   map[string]interface{} `json:"settings"`
	Parameters []ComponentParameter   `json:"parameters"`
}

ComponentSpec is the structure for the core Application Component Spec

type EntitySummary

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

type Host

type Host struct {
	ID        uuid.UUID `json:"-"`
	Hostname  string    `json:"hostname"`
	Port      int       `json:"port"`
	Metadata  string    `json:""metadata`
	CreatedAt time.Time `json:"-"`
	UpdatedAt time.Time `json:"-"`
	IHost     IHost     `gorm:"-"`
}

func (*Host) AfterFind

func (h *Host) AfterFind(tx *gorm.DB) error

func (*Host) Create

func (h *Host) Create(db *database.Handler) (uuid.UUID, error)

type HostFilter

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 IHost

type IHost interface {
	HandleDependents(comp Component, kc *kubernetes.Client, isDeploy bool) (string, error)
	String() string
}

Each host from where meshmodels can be generated needs to implement this interface HandleDependents, contains host specific logic for provisioning required CRDs/operators for corresponding components.

type Kubernetes

type Kubernetes struct{}

func (Kubernetes) HandleDependents

func (k Kubernetes) HandleDependents(comp Component, kc *kubernetes.Client, isDeploy bool) (summary string, err error)

func (Kubernetes) String

func (k Kubernetes) String() string

type MeshModelHostsWithEntitySummary

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

type MesheryHostSummaryDB

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

type Model struct {
	ID uuid.UUID `json:"id,omitempty" yaml:"-"`
	VersionMeta
	Name        string                 `json:"name"`
	DisplayName string                 `json:"displayName" gorm:"modelDisplayName"`
	Description string                 `json:"description" gorm:"description"`
	Status      entity.EntityStatus    `json:"status" gorm:"status"`
	Registrant  Host                   `json:"registrant" gorm:"registrant"` // to be Connection
	Category    Category               `json:"category"`
	SubCategory string                 `json:"subCategory" gorm:"subCategory"`
	Metadata    map[string]interface{} `json:"metadata" yaml:"modelMetadata"`
	Model       ModelEntity            `json:"model,omitempty" gorm:"model;type:bytes;serializer:json"`
}

swagger:response Model

func (*Model) Create

func (m *Model) Create(db *database.Handler, hostID uuid.UUID) (uuid.UUID, error)

func (*Model) GetEntityDetail

func (m *Model) GetEntityDetail() string

func (Model) GetID

func (m Model) GetID() uuid.UUID

func (*Model) GetModelDB

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

func (Model) Type

func (m Model) Type() entity.EntityType

func (*Model) UpdateStatus

func (m *Model) UpdateStatus(db *database.Handler, status entity.EntityStatus) error

func (Model) WriteModelDefinition

func (c Model) WriteModelDefinition(modelDefPath string) error

type ModelDB

type ModelDB struct {
	ID uuid.UUID `json:"id"`
	VersionMeta
	Name         string              `json:"modelName" gorm:"modelName"`
	DisplayName  string              `json:"modelDisplayName" gorm:"modelDisplayName"`
	Description  string              `json:"description" gorm:"description"`
	Status       entity.EntityStatus `json:"status" gorm:"status"`
	RegistrantID uuid.UUID           `json:"hostID" gorm:"column:host_id"` // make as a foreign refer to host's table
	CategoryID   uuid.UUID           `json:"-" gorm:"categoryID"`
	SubCategory  string              `json:"subCategory" gorm:"subCategory"`
	Metadata     []byte              `json:"modelMetadata" gorm:"modelMetadata"`
	Model        ModelEntity         `json:"model,omitempty" gorm:"model;type:bytes;serializer:json"`
}

func (*ModelDB) GetModel

func (cmd *ModelDB) GetModel(cat Category, reg Host) (c Model)

is reg should be passed as param?

type ModelEntity

type ModelEntity struct {
	Version string `json:"version,omitempty" yaml:"version"`
}

type PolicyDefinition

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 (*PolicyDefinition) Create

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

func (*PolicyDefinition) GetEntityDetail

func (p *PolicyDefinition) GetEntityDetail() string

func (PolicyDefinition) GetID

func (p PolicyDefinition) GetID() uuid.UUID

func (*PolicyDefinition) GetPolicyDefinitionDB

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

func (PolicyDefinition) Type

func (*PolicyDefinition) UpdateStatus

func (m *PolicyDefinition) UpdateStatus(db *database.Handler, status entity.EntityStatus) error

func (PolicyDefinition) WritePolicyDefinition

func (p PolicyDefinition) WritePolicyDefinition(policyDirPath string) error

type PolicyDefinitionDB

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

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

type TypeMeta

type TypeMeta struct {
	Kind    string `json:"kind,omitempty" yaml:"kind"`
	Version string `json:"version,omitempty" yaml:"version"`
}

type VersionMeta

type VersionMeta struct {
	SchemaVersion string `json:"schemaVersion,omitempty" yaml:"schemaVersion"`
	Version       string `json:"version,omitempty" yaml:"version"`
}

Jump to

Keyboard shortcuts

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