Documentation
¶
Index ¶
- Constants
- Variables
- func AssignDefaultsForCompDefs(componentDef *component.ComponentDefinition, modelDef *_model.ModelDefinition)
- func ConstructRelationshipPath(modelName, version, defVersion, outputLocation, filename string) (string, error)
- func CreateComponentsMetadataAndCreateSVGsForMDStyle(model ModelCSV, components []ComponentCSV, path, svgDir string) (string, error)
- func CreateComponentsMetadataAndCreateSVGsForMDXStyle(model ModelCSV, components []ComponentCSV, path, svgDir string) (string, error)
- func CreateRelationshipsMetadata(model ModelCSV, relationships []RelationshipCSV) (string, error)
- func DownloadCSVAndGetDownloadURL(sheetURL, csvPath string, spreadsheetID int64) (string, error)
- func ErrAppendToSheet(err error, id string) error
- func ErrCSVFileNotFound(path string) error
- func ErrGenerateComponent(err error, modelName, compName string) error
- func ErrGenerateModel(err error, modelName string) error
- func ErrUpdateComponent(err error, modelName, compName string) error
- func ErrUpdateRelationshipFile(err error) error
- func ErrUpdateToSheet(err error, id string) error
- func GenerateComponentsFromPkg(pkg models.Package, compDirPath string, defVersion string, ...) (int, int, error)
- func GenerateDefsForCoreRegistrant(model ModelCSV, ComponentCSVHelper *ComponentCSVHelper, path string, ...) error
- func GenerateModels(registrant string, sourceURl string, modelName string) (models.Package, string, error)
- func GetCsv(csvDirectory string) (string, string, string, error)
- func GetIndexForRegisterCol(cols []string, shouldRegister string) int
- func HandleRelationshipFile(filePath string, rel _rel.RelationshipDefinition) (bool, error)
- func InvokeGenerationFromSheet(wg *sync.WaitGroup, path string, modelsheetID, componentSheetID int64, ...) error
- func ProcessModelToComponentsMap(existingComponents map[string]map[string][]ComponentCSV)
- func ProcessRelationships(relationshipCSVHelper *RelationshipCSVHelper, ...)
- func RateLimitArtifactHub()
- func SetLogger(ismultiWriter bool) error
- func SetupLogger(name string, debugLevel bool, output io.Writer) logger.Handler
- func VerifyandUpdateSpreadsheet(cred string, wg *sync.WaitGroup, srv *sheets.Service, ...)
- type ComponentCSV
- type ComponentCSVHelper
- type ModelCSV
- func (m ModelCSV) CreateJSONItem(iconDir string) string
- func (m ModelCSV) CreateMarkDownForMDStyle(componentsMetadata, relationshipMetadata string, ...) string
- func (m ModelCSV) CreateMarkDownForMDXStyle(componentsMetadata string) string
- func (mcv *ModelCSV) CreateModelDefinition(version, defVersion string) _model.ModelDefinition
- func (m *ModelCSV) UpdateModelDefinition(modelDef *_model.ModelDefinition) error
- type ModelCSVHelper
- type RelationshipCSV
- type RelationshipCSVHelper
- type SpreadsheetData
Constants ¶
const ( SVG_WIDTH = 20 SVG_HEIGHT = 20 )
Variables ¶
var ( ErrAppendToSheetCode = "meshkit-11302" ErrUpdateToSheetCode = "meshkit-11303" ErrGeneratesModelCode = "meshkit-11305" ErrCSVFileNotFoundCode = "meshkit-11307" ErrUpdateComponentsCode = "meshkit-11308" ErrGeneratesComponentCode = "meshkit-11309" ErrUpdateRelationshipFileCode = "meshkit-11310" )
var ( // global logger variable Log logger.Handler //global logger error variable LogError logger.Handler )
var ( // refers to all cells in the fourth row (explain how is table clulte in ghsset and henc this rang is valid and will not reuire udpate or when it hould require update) ComponentsSheetAppendRange = "Components!A4" ModelsSheetAppendRange = "Models!A4" )
var (
GoogleSpreadSheetURL = "https://docs.google.com/spreadsheets/d/"
)
var RegistrantToModelsMap = make(map[string]map[string]bool)
registrant:model:true/false Tracks if component sheet requires update
registrant:model:component:true/false Tracks if component sheet requires update
Functions ¶
func AssignDefaultsForCompDefs ¶
func AssignDefaultsForCompDefs(componentDef *component.ComponentDefinition, modelDef *_model.ModelDefinition)
func CreateComponentsMetadataAndCreateSVGsForMDStyle ¶
func CreateComponentsMetadataAndCreateSVGsForMDStyle(model ModelCSV, components []ComponentCSV, path, svgDir string) (string, error)
func CreateComponentsMetadataAndCreateSVGsForMDXStyle ¶
func CreateComponentsMetadataAndCreateSVGsForMDXStyle(model ModelCSV, components []ComponentCSV, path, svgDir string) (string, error)
func CreateRelationshipsMetadata ¶
func CreateRelationshipsMetadata(model ModelCSV, relationships []RelationshipCSV) (string, error)
func DownloadCSVAndGetDownloadURL ¶ added in v0.8.27
Downloads CSV file using spreadsheet URL
func ErrAppendToSheet ¶
func ErrCSVFileNotFound ¶
func ErrGenerateComponent ¶
func ErrGenerateModel ¶
func ErrUpdateComponent ¶
func ErrUpdateToSheet ¶
func GenerateDefsForCoreRegistrant ¶
func GenerateDefsForCoreRegistrant(model ModelCSV, ComponentCSVHelper *ComponentCSVHelper, path string, modelName string) error
For registrants eg: meshery, whose components needs to be directly created by referencing meshery/schemas repo. the sourceURL contains the path of models component definitions
func GenerateModels ¶
func GetIndexForRegisterCol ¶
func HandleRelationshipFile ¶
func HandleRelationshipFile(filePath string, rel _rel.RelationshipDefinition) (bool, error)
HandleRelationshipFile checks if the file exists and compares its content. It writes the new data only if the file doesn't exist or the contents differ. Returns true if the file was written or updated, false if no changes were made.
func InvokeGenerationFromSheet ¶
func InvokeGenerationFromSheet(wg *sync.WaitGroup, path string, modelsheetID, componentSheetID int64, spreadsheeetID string, modelName string, modelCSVFilePath, componentCSVFilePath, spreadsheeetCred, relationshipCSVFilePath string, relationshipSheetID int64, srv *sheets.Service) error
- Sheet Parsing: Parse the three sheets and prepare their respective csvHelper instances.
- Registrant-Based Processing: 2.1 Meshery: Use the Meshery components sheet as the source. 2.2 GitHub/ArtifactHub: Perform additional steps, such as determining the registrant type via the URL and generating a package. This package serves as the basis for component generation (refer to the MeshKit function for details). 2.3 File Writing: Write the generated components to their respective paths in the format {model-name/{release-version-in-repo}/defversion/}.
- Handling Relationships: Relationships marked with * as the version are written to all versions, with the filenames updated in the sheet.
If their is ever an error with the writing of file back to spreadsheet of column mismatch just update utils.ComponentCSV struct.
func ProcessModelToComponentsMap ¶
func ProcessModelToComponentsMap(existingComponents map[string]map[string][]ComponentCSV)
func ProcessRelationships ¶
func ProcessRelationships(relationshipCSVHelper *RelationshipCSVHelper, spreadsheetUpdateChan chan RelationshipCSV, path string)
func RateLimitArtifactHub ¶
func RateLimitArtifactHub()
func SetupLogger ¶
Initialize Meshkit Logger instance
func VerifyandUpdateSpreadsheet ¶
func VerifyandUpdateSpreadsheet(cred string, wg *sync.WaitGroup, srv *sheets.Service, spreadsheetUpdateChan chan SpreadsheetData, sheetId, modelCSVFilePath, componentCSVFilePath string)
Verifies if the component entry already exist in the spreadsheet, otherwise updates the spreadshhet to include new component entry.
Types ¶
type ComponentCSV ¶
type ComponentCSV struct {
Registrant string `json:"registrant" csv:"registrant"`
Model string `json:"model" csv:"model"`
Component string `json:"component" csv:"component"`
Category category.CategoryDefinitionName `json:"category" csv:"category"`
SubCategory subcategory.SubCategoryDefinition `json:"subCategory" csv:"subCategory"`
Description string `json:"description" csv:"description"`
Shape string `json:"shape" csv:"shape"`
PrimaryColor string `json:"primaryColor" csv:"primaryColor"`
SecondaryColor string `json:"secondaryColor" csv:"secondaryColor"`
SVGColor string `json:"svgColor" csv:"svgColor"`
SVGWhite string `json:"svgWhite" csv:"svgWhite"`
SVGComplete string `json:"svgComplete" csv:"svgComplete"`
Schema string `json:"schema" csv:"schema"`
Docs string `json:"docs" csv:"docs"`
StyleOverrides string `json:"styleOverrides" csv:"styleOverrides"`
Styles string `json:"styles" csv:"styles"`
ShapePolygonPoints string `json:"shapePolygonPoints" csv:"shapePolygonPoints"`
DefaultData string `json:"defaultData" csv:"defaultData"`
Capabilities string `json:"capabilities" csv:"capabilities"`
LogoURL string `json:"logoURL" csv:"logoURL"`
Genealogy string `json:"genealogy" csv:"genealogy"`
IsAnnotation string `json:"isAnnotation" csv:"isAnnotation"`
Version string `json:"version" csv:"version"`
ModelDisplayName string `json:"modelDisplayName" csv:"-"`
Status string `json:"status" csv:"status"`
}
func ConvertCompDefToCompCSV ¶
func ConvertCompDefToCompCSV(modelcsv *ModelCSV, compDef component.ComponentDefinition) *ComponentCSV
func (*ComponentCSV) CreateComponentDefinition ¶
func (c *ComponentCSV) CreateComponentDefinition(isModelPublished bool, defVersion string) (component.ComponentDefinition, error)
The Component Definition generated assumes or is only for components which have registrant as "meshery"
func (*ComponentCSV) UpdateCompDefinition ¶
func (c *ComponentCSV) UpdateCompDefinition(compDef *component.ComponentDefinition) error
type ComponentCSVHelper ¶
type ComponentCSVHelper struct {
SpreadsheetID int64
SpreadsheetURL string
Title string
CSVPath string
Components map[string]map[string][]ComponentCSV
}
func NewComponentCSVHelper ¶
func NewComponentCSVHelper(sheetURL, spreadsheetName string, spreadsheetID int64, localCsvPath string) (*ComponentCSVHelper, error)
func (ComponentCSVHelper) Cleanup ¶
func (m ComponentCSVHelper) Cleanup() error
func (*ComponentCSVHelper) GetColumns ¶
func (mch *ComponentCSVHelper) GetColumns() ([]string, error)
func (*ComponentCSVHelper) ParseComponentsSheet ¶
func (mch *ComponentCSVHelper) ParseComponentsSheet(modelName string) error
type ModelCSV ¶
type ModelCSV struct {
Registrant string `json:"registrant" csv:"registrant"`
ModelDisplayName string `json:"modelDisplayName" csv:"modelDisplayName"`
Model string `json:"model" csv:"model"`
Category category.CategoryDefinitionName `json:"category" csv:"category"`
SubCategory subcategory.SubCategoryDefinition `json:"subCategory" csv:"subCategory"`
Description string `json:"description" csv:"description"`
SourceURL string `json:"sourceURL" csv:"sourceURL"`
Website string `json:"website" csv:"website"`
Docs string `json:"docs" csv:"docs"`
Shape string `json:"shape" csv:"shape"`
PrimaryColor string `json:"primaryColor" csv:"primaryColor"`
SecondaryColor string `json:"secondaryColor" csv:"secondaryColor"`
StyleOverrides string `json:"styleOverrides" csv:"styleOverrides"`
Styles string `json:"styles" csv:"styles"`
ShapePolygonPoints string `json:"shapePolygonPoints" csv:"shapePolygonPoints"`
DefaultData string `json:"defaultData" csv:"defaultData"`
Capabilities string `json:"capabilities" csv:"capabilities"`
LogoURL string `json:"logoURL" csv:"logoURL"`
SVGColor string `json:"svgColor" csv:"svgColor"`
SVGWhite string `json:"svgWhite" csv:"svgWhite"`
SVGComplete string `json:"svgComplete" csv:"svgComplete"`
IsAnnotation string `json:"isAnnotation" csv:"isAnnotation"`
PublishToRegistry string `json:"publishToRegistry" csv:"publishToRegistry"`
Group string `json:"group" csv:"group"`
AboutProject string `json:"aboutProject" csv:"-"`
PageSubtTitle string `json:"pageSubtitle" csv:"-"`
DocsURL string `json:"docsURL" csv:"-"`
StandardBlurb string `json:"standardBlurb" csv:"-"`
Feature1 string `json:"feature1" csv:"-"`
Feature2 string `json:"feature2" csv:"-"`
Feature3 string `json:"feature3" csv:"-"`
HowItWorks string `json:"howItWorks" csv:"-"`
HowItWorksDetails string `json:"howItWorksDetails" csv:"-"`
Screenshots string `json:"screenshots" csv:"-"`
FullPage string `json:"fullPage" csv:"-"`
PublishToSites string `json:"publishToSites" csv:"-"`
}
keep
func (ModelCSV) CreateJSONItem ¶
Creates JSON formatted meshmodel attribute item for JSON Style docs
func (ModelCSV) CreateMarkDownForMDStyle ¶
func (ModelCSV) CreateMarkDownForMDXStyle ¶
template := `--- title: <model-display-name> subtitle: <Page Subtitle> integrationIcon: ../../../assets/images/service-mesh-icons/aws-app-mesh.svg darkModeIntegrationIcon: ../../../assets/images/service-mesh-icons/aws-app-mesh_white.svg docURL: <Docs URL> category: <Category> subcategory: <Sub-Category> featureList: [<Feature 1>,<Feature 2>,<Feature 3>] workingSlides: [
../_images/meshmap-visualizer.png, ../_images/meshmap-designer.png]
howItWorks: <howItWorks> howItWorksDetails: howItWorksDetails published: <Publish> --- <p>
<About Project>
</p> <p>
<Standard Blurb>
</p>`
func (*ModelCSV) CreateModelDefinition ¶
func (mcv *ModelCSV) CreateModelDefinition(version, defVersion string) _model.ModelDefinition
func (*ModelCSV) UpdateModelDefinition ¶
func (m *ModelCSV) UpdateModelDefinition(modelDef *_model.ModelDefinition) error
keep
type ModelCSVHelper ¶
type ModelCSVHelper struct {
SpreadsheetID int64
SpreadsheetURL string
Title string
CSVPath string
Models []ModelCSV
}
func NewModelCSVHelper ¶
func NewModelCSVHelper(sheetURL, spreadsheetName string, spreadsheetID int64, localCsvPath string) (*ModelCSVHelper, error)
func (ModelCSVHelper) Cleanup ¶
func (m ModelCSVHelper) Cleanup() error
func (*ModelCSVHelper) ParseModelsSheet ¶
func (mch *ModelCSVHelper) ParseModelsSheet(parseForDocs bool, modelName string) error
type RelationshipCSV ¶
type RelationshipCSV struct {
RowIndex int `json:"-" csv:"-"`
Model string `json:"Model" csv:"Model"`
Version string `json:"Version" csv:"Version"`
KIND string `json:"kind" csv:"kind"`
Type string `json:"type" csv:"type"`
SubType string `json:"subType" csv:"subType"`
PublishToRegistry string `json:"PublishToRegistry" csv:"PublishToRegistry"`
Description string `json:"metadata.description" csv:"metadata.description"`
IsAnnotation string `json:"metadata.isAnnotation" csv:"metadata.isAnnotation"`
Styles string `json:"metadata.styles" csv:"metadata.styles"`
EvalPolicy string `json:"evalPolicy" csv:"evalPolicy"`
Selector string `json:"selector" csv:"selector"`
Filename string `json:"filename" csv:"filename"`
}
type RelationshipCSVHelper ¶
type RelationshipCSVHelper struct {
SpreadsheetID int64
SpreadsheetURL string
Title string
CSVPath string
Relationships []RelationshipCSV
UpdatedRelationships []RelationshipCSV
}
func NewRelationshipCSVHelper ¶
func NewRelationshipCSVHelper(sheetURL, spreadsheetName string, spreadsheetID int64, localCsvPath string) (*RelationshipCSVHelper, error)
func (*RelationshipCSVHelper) ParseRelationshipsSheet ¶
func (mrh *RelationshipCSVHelper) ParseRelationshipsSheet(modelName string) error
func (*RelationshipCSVHelper) UpdateRelationshipSheet ¶
func (mrh *RelationshipCSVHelper) UpdateRelationshipSheet(srv *sheets.Service, cred, sheetId, csvPath string) error
type SpreadsheetData ¶
type SpreadsheetData struct {
Model *ModelCSV
Components []component.ComponentDefinition
}