core

package
v0.5.72 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2021 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrGetK8sComponentsCode     = "2154"
	ErrParseK8sManifestCode     = "2155"
	ErrCreatePatternServiceCode = "2156"
)

Variables

This section is empty.

Functions

func DeleteK8sWorkloads added in v0.5.61

func DeleteK8sWorkloads(ctx string)

DeleteK8sWorkloads deletes the registered in memory k8s workloads for a given k8s contextID.

func ErrCreatePatternService added in v0.5.69

func ErrCreatePatternService(err error) error

func ErrGetK8sComponents added in v0.5.62

func ErrGetK8sComponents(err error) error

func ErrParseK8sManifest added in v0.5.69

func ErrParseK8sManifest(err error) error

func GetK8Components added in v0.5.61

func GetK8Components(config []byte, ctx string) (*manifests.Component, error)

GetK8Components returns all the generated definitions and schemas for available api resources

func RegisterMesheryOAMTraits

func RegisterMesheryOAMTraits() error

RegisterMesheryOAMTraits will register local meshery traits with meshery server

func RegisterMesheryOAMWorkloads

func RegisterMesheryOAMWorkloads() error

RegisterMesheryOAMWorkloads will register local meshery workloads with meshery server

func RegisterScope

func RegisterScope(data []byte) (err error)

RegisterScope will register a Scope definition into the database

func RegisterTrait

func RegisterTrait(data []byte) (err error)

RegisterTrait will register a TraitDefinition into the database

func RegisterWorkload

func RegisterWorkload(data []byte) (err error)

RegisterWorkload will register a workload definition into the database

Types

type Pattern

type Pattern struct {
	// Name is the human-readable, display-friendly descriptor of the pattern
	Name string `yaml:"name,omitempty" json:"name,omitempty"`
	// PatternID is the moniker use to uniquely identify any given pattern
	// Convention: SMP-###-v#.#.#
	PatternID string              `yaml:"patternID,omitempty" json:"patternID,omitempty"`
	Services  map[string]*Service `yaml:"services,omitempty" json:"services,omitempty"`
}

Pattern is the golang representation of the Pattern config file model

func NewPatternFile

func NewPatternFile(yml []byte) (af Pattern, err error)

NewPatternFile takes in raw yaml and encodes it into a construct

func NewPatternFileFromCytoscapeJSJSON

func NewPatternFileFromCytoscapeJSJSON(byt []byte) (Pattern, error)

NewPatternFileFromCytoscapeJSJSON takes in CytoscapeJS JSON and creates a PatternFile from it

func NewPatternFileFromK8sManifest added in v0.5.69

func NewPatternFileFromK8sManifest(data string, ignoreErrors bool) (Pattern, error)

func (*Pattern) GenerateApplicationConfiguration

func (p *Pattern) GenerateApplicationConfiguration() (v1alpha1.Configuration, error)

GenerateApplicationConfiguration generates OAM Application Configuration from the the given Pattern file for a particular deploymnet

func (*Pattern) GetApplicationComponent

func (p *Pattern) GetApplicationComponent(name string) (v1alpha1.Component, error)

GetApplicationComponent generates OAM Application Components from the the given Pattern file

func (*Pattern) GetServiceType

func (p *Pattern) GetServiceType(name string) string

GetServiceType returns the type of the service

func (*Pattern) ToCytoscapeJS

func (p *Pattern) ToCytoscapeJS() (cytoscapejs.GraphElem, error)

ToCytoscapeJS converts pattern file into cytoscape object

func (*Pattern) ToYAML

func (p *Pattern) ToYAML() ([]byte, error)

ToYAML converts a patternfile to yaml

type ScopeCapability

type ScopeCapability struct {
	OAMDefinition v1alpha1.ScopeDefinition `json:"oam_definition,omitempty"`
	// contains filtered or unexported fields
}

ScopeCapability is the struct for capturing the ScopeDefinition of a particular type

func GetScope added in v0.5.65

func GetScope(name string) (s []ScopeCapability)

GetScope takes in a scope name and will return a SLICE of all of the scopes registered against the name

func GetScopeByID added in v0.5.65

func GetScopeByID(name, id string) (w *ScopeCapability)

GetScopeByID takes an id of a scope and returns the scope

func GetScopes

func GetScopes() (scopes []ScopeCapability)

GetScopes return all of the scopes

func GetScopesByK8sAPIVersionKind added in v0.5.69

func GetScopesByK8sAPIVersionKind(apiVersion, kind string) (s []ScopeCapability)

GetScopesByK8sAPIVersionKind takes in kubernetes API version of a resource and its kind and returns all of the resources that matches that description

Meshery core resources DO NOT have these attached to themselves, hence in order to get them just pass in empty string for both the parameters

func (*ScopeCapability) GetID added in v0.5.65

func (cap *ScopeCapability) GetID() string

GetID returns the ID of the capability

func (*ScopeCapability) SetID added in v0.5.65

func (cap *ScopeCapability) SetID(id string)

SetID sets the ID of the capability

type Service

type Service struct {
	// ID is the id of the service and is completely internal to
	// Meshery Server and meshery providers
	ID *uuid.UUID `yaml:"id,omitempty" json:"id,omitempty"`
	// Name is the name of the service and is an optional parameter
	// If given then this supercedes the name of the service inherited
	// from the parent
	Name      string `yaml:"name,omitempty" json:"name,omitempty"`
	Type      string `yaml:"type,omitempty" json:"type,omitempty"`
	Namespace string `yaml:"namespace" json:"namespace"`
	// DependsOn correlates one or more objects as a required dependency of this service
	// DependsOn is used to determine sequence of operations
	DependsOn []string `yaml:"dependsOn,omitempty" json:"dependsOn,omitempty"`

	Settings map[string]interface{} `yaml:"settings,omitempty" json:"settings,omitempty"`
	Traits   map[string]interface{} `yaml:"traits,omitempty" json:"traits,omitempty"`
}

Service represents the services defined within the appfile

type TraitCapability

type TraitCapability struct {
	OAMDefinition v1alpha1.TraitDefinition `json:"oam_definition,omitempty"`
	// contains filtered or unexported fields
}

TraitCapability is the struct for capturing the workload definition of a particular type

func GetTrait added in v0.5.65

func GetTrait(name string) (t []TraitCapability)

GetTrait takes in a trait name and will return a SLICE of all of the traits registered against the name

func GetTraitByID added in v0.5.65

func GetTraitByID(name, id string) *TraitCapability

GetTraitByID takes an id of a trait and returns the trait

func GetTraits

func GetTraits() (traits []TraitCapability)

GetTraits return all of the traits

func GetTraitsByK8sAPIVersionKind added in v0.5.69

func GetTraitsByK8sAPIVersionKind(apiVersion, kind string) (t []TraitCapability)

GetTraitsByK8sAPIVersionKind takes in kubernetes API version of a resource and its kind and returns all of the resources that matches that description

Meshery core resources DO NOT have these attached to themselves, hence in order to get them just pass in empty string for both the parameters

func (*TraitCapability) GetID added in v0.5.65

func (cap *TraitCapability) GetID() string

GetID returns the ID of the capability

func (*TraitCapability) SetID added in v0.5.65

func (cap *TraitCapability) SetID(id string)

SetID sets the ID of the capability

type WorkloadCapability

type WorkloadCapability struct {
	OAMDefinition v1alpha1.WorkloadDefinition `json:"oam_definition,omitempty"`
	// contains filtered or unexported fields
}

WorkloadCapability is the struct for capturing the workload definition of a particular type

func GetWorkload added in v0.5.65

func GetWorkload(name string) (w []WorkloadCapability)

GetWorkload takes in a workload name and will return a SLICE of all of the workloads registered against the name

func GetWorkloadByID added in v0.5.65

func GetWorkloadByID(name, id string) *WorkloadCapability

GetWorkloadByID takes an id of a workload and returns the workload

func GetWorkloads

func GetWorkloads() (caps []WorkloadCapability)

GetWorkloads return all of the workloads

func GetWorkloadsByK8sAPIVersionKind added in v0.5.69

func GetWorkloadsByK8sAPIVersionKind(apiVersion, kind string) (w []WorkloadCapability)

GetWorkloadsByK8sAPIVersionKind takes in kubernetes API version of a resource and its kind and returns all of the resources that matches that description

Meshery core resources DO NOT have these attached to themselves, hence in order to get them just pass in empty string for both the parameters

func (*WorkloadCapability) GetID added in v0.5.65

func (cap *WorkloadCapability) GetID() string

GetID returns the ID of the capability

func (*WorkloadCapability) SetID added in v0.5.65

func (cap *WorkloadCapability) SetID(id string)

SetID sets the ID of the capability

Jump to

Keyboard shortcuts

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