v1beta1

package
v0.7.54 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2024 License: Apache-2.0 Imports: 14 Imported by: 7

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 ModelSchemaVersion = "models.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, performUpgrade bool) (summary string, err error)

func (ArtifactHub) String

func (ah ArtifactHub) String() string

type Category

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

swagger:response Category

func (*Category) Create

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

func (*Category) GenerateID added in v0.7.34

func (cat *Category) GenerateID() (uuid.UUID, error)

func (*Category) GetEntityDetail

func (cat *Category) GetEntityDetail() string

func (Category) GetID

func (cat Category) GetID() uuid.UUID

func (Category) TableName

func (c Category) TableName() string

func (Category) Type

func (cat Category) Type() entity.EntityType

func (*Category) UpdateStatus

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

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"`
	VersionMeta `json:",inline" yaml:",inline"`
	DisplayName string                 `json:"displayName" gorm:"column:display_name"`
	Description string                 `json:"description" gorm:"column:description"`
	Format      ComponentFormat        `json:"format" yaml:"format"`
	ModelID     uuid.UUID              `json:"-" gorm:"index:idx_component_definition_dbs_model_id,column:model_id"`
	Model       Model                  `json:"model" gorm:"foreignKey:ModelID;references:ID"`
	Metadata    map[string]interface{} `json:"metadata" yaml:"metadata" gorm:"type:bytes;serializer:json"`
	Component   ComponentEntity        `json:"component,omitempty" yaml:"component" gorm:"type:bytes;serializer:json"`
}

swagger:response ComponentDefinition

func (*ComponentDefinition) Create

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

func (*ComponentDefinition) GenerateID added in v0.7.34

func (c *ComponentDefinition) GenerateID() (uuid.UUID, error)

func (*ComponentDefinition) GetEntityDetail

func (c *ComponentDefinition) GetEntityDetail() string

func (ComponentDefinition) GetID

func (c ComponentDefinition) GetID() uuid.UUID

func (ComponentDefinition) TableName

func (c ComponentDefinition) TableName() string

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 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"

	ComponentSchemaVersion = "components.meshery.io/v1beta1"
)

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,omitempty"`
	Metadata  string    `json:"metadata,omitempty"`
	CreatedAt time.Time `json:"-"`
	UpdatedAt time.Time `json:"-"`
	IHost     IHost     `json:"-" 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)

func (*Host) GenerateID added in v0.7.34

func (h *Host) GenerateID() (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, performUpgrade 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, performUpgrade 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"`
	VersionMeta `yaml:",inline"`

	Name          string                 `json:"name" gorm:"modelName"`
	DisplayName   string                 `json:"displayName"`
	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
	Registrant    Host                   `json:"registrant" gorm:"foreignKey:RegistrantID;references:ID"`
	CategoryID    uuid.UUID              `json:"-" gorm:"categoryID"`
	Category      Category               `json:"category" gorm:"foreignKey:CategoryID;references:ID"`
	SubCategory   string                 `json:"subCategory" gorm:"subCategory"`
	Metadata      map[string]interface{} `json:"metadata" gorm:"type:bytes;serializer:json"`
	Model         ModelEntity            `json:"model,omitempty" gorm:"model;type:bytes;serializer:json"`
	Components    []ComponentDefinition  `json:"components" gorm:"-"`
	Relationships interface{}            `json:"relationships" gorm:"-"`
}

swagger:response Model

func (*Model) Create

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

func (*Model) GenerateID added in v0.7.34

func (m *Model) GenerateID() (uuid.UUID, error)

func (*Model) GetEntityDetail

func (m *Model) GetEntityDetail() string

func (Model) GetID

func (m Model) GetID() uuid.UUID

func (Model) TableName

func (m Model) TableName() string

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, outputType string) error

WriteModelDefinition writes out the model to the given `modelDefPath` in the `outputType` format. `outputType` can be `yaml` or `json`. Usage: model.WriteModelDefinition("./modelName/model.yaml", "yaml")

type ModelEntity

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

type PolicyDefinition

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

swagger:response PolicyDefinition

func (*PolicyDefinition) Create

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

func (*PolicyDefinition) GenerateID added in v0.7.34

func (p *PolicyDefinition) GenerateID() (uuid.UUID, error)

func (*PolicyDefinition) GetEntityDetail

func (p *PolicyDefinition) GetEntityDetail() string

func (PolicyDefinition) GetID

func (p PolicyDefinition) GetID() uuid.UUID

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 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" gorm:"column:schema_version"`
	Version       string `json:"version,omitempty" yaml:"version" gorm:"column:version"`
}

Jump to

Keyboard shortcuts

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