Documentation
¶
Index ¶
- func NoOpFilter(g *gorm.DB) *gorm.DB
- type DB
- type Dependencies
- type Dependency
- type DependencyAttribute
- type DependencyAttributeMappings
- type DependencyAttributes
- type DependencyResult
- type FarmRelease
- type FilterOption
- func ComponentRequestToFilters(req *terrariumpb.ListComponentsRequest) []FilterOption
- func ComponentsFilterByDependencySearch(query string) FilterOption
- func ComponentsFilterByPlatformID(ids ...string) FilterOption
- func ComponentsFilterByTaxonomy(tax *Taxonomy) FilterOption
- func DependencyFilterByTaxonomy(tax *Taxonomy) FilterOption
- func DependencyRequestToFilters(req *terrariumpb.ListDependenciesRequest) []FilterOption
- func DependencySearchFilter(query string) FilterOption
- func ModuleAttrByIDsFilter(moduleId uuid.UUID, ids ...uuid.UUID) FilterOption
- func ModuleAttrSearchFilter(query string) FilterOption
- func ModuleByIDsFilter(ids ...uuid.UUID) FilterOption
- func ModuleNamespaceFilter(namespace []string) FilterOption
- func ModuleSearchFilter(query string) FilterOption
- func PaginateGlobalFilter(pageSize, pageIndex int32, totalPages *int32) FilterOption
- func PlatformFilterByDependencyID(depIDs ...string) FilterOption
- func PlatformFilterBySearch(query string) FilterOption
- func PlatformFilterByTaxonomy(tax *Taxonomy) FilterOption
- func PlatformRequestToFilters(req *terrpb.ListPlatformsRequest) []FilterOption
- func PopulateModuleAttrMappingsFilter(enable bool) FilterOption
- func PopulateModuleMappingsFilter(enable bool) FilterOption
- func TaxonomyByLevelsFilter(t *Taxonomy) FilterOption
- func TaxonomyRequestToFilters(req *terrariumpb.ListTaxonomyRequest) []FilterOption
- type Model
- type Platform
- type PlatformComponent
- type PlatformComponents
- type Platforms
- type TFModule
- type TFModuleAttribute
- type TFModuleAttributes
- type TFModules
- type TFProvider
- type TFResourceAttribute
- type TFResourceAttributesMapping
- type TFResourceType
- type Taxonomies
- type Taxonomy
- type Version
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DB ¶
type DB interface {
CreateTFProvider(e *TFProvider) (uuid.UUID, error)
CreateTFResourceType(e *TFResourceType) (uuid.UUID, error)
CreateTFResourceAttribute(e *TFResourceAttribute) (uuid.UUID, error)
CreateTFResourceAttributesMapping(e *TFResourceAttributesMapping) (uuid.UUID, error)
CreateTFModule(e *TFModule) (uuid.UUID, error)
CreateTFModuleAttribute(e *TFModuleAttribute) (uuid.UUID, error)
CreateTaxonomy(e *Taxonomy) (uuid.UUID, error)
CreateDependencyInterface(e *Dependency) (uuid.UUID, error)
CreateDependencyAttribute(e *DependencyAttribute) (uuid.UUID, error)
CreatePlatform(p *Platform) (uuid.UUID, error)
CreatePlatformComponents(p *PlatformComponent) (uuid.UUID, error)
// GetOrCreateTFProvider finds and updates `e` and if the record doesn't exists, it creates a new record `e` and updates ID.
GetOrCreateTFProvider(e *TFProvider) (id uuid.UUID, isNew bool, err error)
GetTFProvider(e *TFProvider, where *TFProvider) error
GetTFResourceType(e *TFResourceType, where *TFResourceType) error
GetTFResourceAttribute(e *TFResourceAttribute, where *TFResourceAttribute) error
// QueryTFModules list terraform modules
QueryTFModules(filterOps ...FilterOption) (result TFModules, err error)
// QueryTFModuleAttributes list terraform module attributes
QueryTFModuleAttributes(filterOps ...FilterOption) (result TFModuleAttributes, err error)
QueryDependencies(filterOps ...FilterOption) (result Dependencies, err error)
QueryTaxonomies(filterOps ...FilterOption) (result Taxonomies, err error)
QueryPlatforms(filterOps ...FilterOption) (result Platforms, err error)
QueryPlatformComponents(filterOps ...FilterOption) (result PlatformComponents, err error)
Fetchdeps() []DependencyResult
ExecuteSQLStatement(statement string) error
CreateRelease(e *FarmRelease) (uuid.UUID, error)
FindReleaseByRepo(e *FarmRelease, repo string) error
}
type Dependencies ¶
type Dependencies []Dependency
func (Dependencies) ToProto ¶
func (depArr Dependencies) ToProto() []*terrariumpb.Dependency
type Dependency ¶
type Dependency struct {
Model
TaxonomyID *uuid.UUID `gorm:"default:null"` // Given taxonomy's uncertain presence in YAML, setting TaxonomyID default as NULL accommodates potential absence of taxonomy data.
InterfaceID string `gorm:"unique"`
Title string `gorm:"default:null"`
Description string `gorm:"default:null"`
ExtendsID string `gorm:"-"` //This is yet to be finalized
Attributes DependencyAttributes `gorm:"foreignKey:DependencyID"`
Taxonomy *Taxonomy `gorm:"foreignKey:TaxonomyID"`
}
func (Dependency) GetInputs ¶
func (d Dependency) GetInputs() *jsonschema.Node
func (Dependency) GetOutputs ¶
func (d Dependency) GetOutputs() *jsonschema.Node
func (Dependency) ToProto ¶
func (d Dependency) ToProto() *terrariumpb.Dependency
type DependencyAttribute ¶
type DependencyAttribute struct {
Model
DependencyID uuid.UUID `gorm:"uniqueIndex:dependency_attribute_unique"`
Name string `gorm:"uniqueIndex:dependency_attribute_unique"`
Schema *jsonschema.Node `gorm:"type:jsonb"`
Computed bool `gorm:"uniqueIndex:dependency_attribute_unique"` // true means output, false means input
Dependency *Dependency `gorm:"foreignKey:DependencyID"`
}
func (DependencyAttribute) ToProto ¶
func (dbAttr DependencyAttribute) ToProto() *terrariumpb.DependencyInputsAndOutputs
type DependencyAttributes ¶
type DependencyAttributes []DependencyAttribute
func (DependencyAttributes) GetByCompute ¶
func (dbAttrs DependencyAttributes) GetByCompute(wantComputed bool) DependencyAttributes
func (DependencyAttributes) ToJSONSchema ¶
func (dbAttrs DependencyAttributes) ToJSONSchema() *jsonschema.Node
func (DependencyAttributes) ToProto ¶
func (dbAttrs DependencyAttributes) ToProto() []*terrariumpb.DependencyInputsAndOutputs
type DependencyResult ¶
type FarmRelease ¶
type FilterOption ¶
func ComponentRequestToFilters ¶
func ComponentRequestToFilters(req *terrariumpb.ListComponentsRequest) []FilterOption
func ComponentsFilterByDependencySearch ¶
func ComponentsFilterByDependencySearch(query string) FilterOption
func ComponentsFilterByPlatformID ¶
func ComponentsFilterByPlatformID(ids ...string) FilterOption
func ComponentsFilterByTaxonomy ¶
func ComponentsFilterByTaxonomy(tax *Taxonomy) FilterOption
func DependencyFilterByTaxonomy ¶
func DependencyFilterByTaxonomy(tax *Taxonomy) FilterOption
func DependencyRequestToFilters ¶
func DependencyRequestToFilters(req *terrariumpb.ListDependenciesRequest) []FilterOption
func DependencySearchFilter ¶
func DependencySearchFilter(query string) FilterOption
func ModuleAttrByIDsFilter ¶
func ModuleAttrByIDsFilter(moduleId uuid.UUID, ids ...uuid.UUID) FilterOption
func ModuleAttrSearchFilter ¶
func ModuleAttrSearchFilter(query string) FilterOption
func ModuleByIDsFilter ¶
func ModuleByIDsFilter(ids ...uuid.UUID) FilterOption
func ModuleNamespaceFilter ¶
func ModuleNamespaceFilter(namespace []string) FilterOption
func ModuleSearchFilter ¶
func ModuleSearchFilter(query string) FilterOption
func PaginateGlobalFilter ¶
func PaginateGlobalFilter(pageSize, pageIndex int32, totalPages *int32) FilterOption
func PlatformFilterByDependencyID ¶
func PlatformFilterByDependencyID(depIDs ...string) FilterOption
func PlatformFilterBySearch ¶
func PlatformFilterBySearch(query string) FilterOption
PlatformFilterBySearch perform search on name & repo columns
func PlatformFilterByTaxonomy ¶
func PlatformFilterByTaxonomy(tax *Taxonomy) FilterOption
func PlatformRequestToFilters ¶
func PlatformRequestToFilters(req *terrpb.ListPlatformsRequest) []FilterOption
func PopulateModuleAttrMappingsFilter ¶
func PopulateModuleAttrMappingsFilter(enable bool) FilterOption
func PopulateModuleMappingsFilter ¶
func PopulateModuleMappingsFilter(enable bool) FilterOption
func TaxonomyByLevelsFilter ¶
func TaxonomyByLevelsFilter(t *Taxonomy) FilterOption
func TaxonomyRequestToFilters ¶
func TaxonomyRequestToFilters(req *terrariumpb.ListTaxonomyRequest) []FilterOption
type Model ¶
type Model struct {
ID uuid.UUID `gorm:"type:uuid;primarykey"`
CreatedAt time.Time
UpdatedAt time.Time
DeletedAt gorm.DeletedAt `gorm:"index"`
}
Model a basic GoLang struct which includes the following fields: ID, CreatedAt, UpdatedAt, DeletedAt
func (*Model) GenerateID ¶
func (m *Model) GenerateID()
type Platform ¶
type Platform struct {
Model
Title string
Description string
RepoURL string `gorm:"uniqueIndex:platform_ref_unique"`
RepoDirectory string `gorm:"uniqueIndex:platform_ref_unique"`
CommitSHA string `gorm:"uniqueIndex:platform_ref_unique"`
RefLabel string // can be tag/branch/commit that user wrote in the yaml. example v0.1 or main.
LabelType terrpb.GitLabelEnum // 1=branch, 2=tag, 3=commit
Components []PlatformComponent `gorm:"foreignKey:PlatformID"`
}
Platform table lists all terrarium platform template references Unique constraint - the unique constraint is setup such that the git reference (gir repo, commit & directory) of a platform cannot be duplicated in the table. There may be duplicate title in the table though, which is meant for grouping the references belonging to the same platform.
type PlatformComponent ¶
type PlatformComponent struct {
Model
PlatformID uuid.UUID `gorm:"uniqueIndex:platform_components_unique"`
DependencyID uuid.UUID `gorm:"uniqueIndex:platform_components_unique"`
Platform Platform `gorm:"foreignKey:PlatformID"`
Dependency Dependency `gorm:"foreignKey:DependencyID"`
}
func (PlatformComponent) ToProto ¶
func (c PlatformComponent) ToProto() *terrariumpb.Component
type PlatformComponents ¶
type PlatformComponents []PlatformComponent
func (PlatformComponents) ToProto ¶
func (c PlatformComponents) ToProto() []*terrariumpb.Component
type TFModule ¶
type TFModule struct {
Model
ModuleName string
Source string `gorm:"uniqueIndex:module_unique"`
Version Version `gorm:"uniqueIndex:module_unique"`
Namespace string
Description string
TaxonomyID *uuid.UUID `gorm:"default:null"`
Taxonomy *Taxonomy `gorm:"foreignKey:TaxonomyID"`
Attributes []TFModuleAttribute `gorm:"foreignKey:ModuleID"` // Attributes of the module
}
func (TFModule) GetInputAttributesWithMappings ¶
func (m TFModule) GetInputAttributesWithMappings() (input TFModuleAttributes)
func (TFModule) ToProto ¶
func (m TFModule) ToProto() *terrariumpb.Module
type TFModuleAttribute ¶
type TFModuleAttribute struct {
Model
ModuleID uuid.UUID `gorm:"uniqueIndex:module_attribute_unique"`
ModuleAttributeName string `gorm:"uniqueIndex:module_attribute_unique"`
Description string
RelatedResourceTypeAttributeID uuid.UUID
Optional bool
Computed bool
Module *TFModule `gorm:"foreignKey:ModuleID"`
ResourceAttribute *TFResourceAttribute `gorm:"foreignKey:RelatedResourceTypeAttributeID"` // Resource attribute with relates to this module attribute
}
func (*TFModuleAttribute) GetConnectedModuleOutputs ¶
func (ma *TFModuleAttribute) GetConnectedModuleOutputs() TFModuleAttributes
func (TFModuleAttribute) ToProto ¶
func (dbAttr TFModuleAttribute) ToProto() *terrariumpb.ModuleAttribute
type TFModuleAttributes ¶
type TFModuleAttributes []TFModuleAttribute
func (TFModuleAttributes) ToProto ¶
func (dbAttrs TFModuleAttributes) ToProto() []*terrariumpb.ModuleAttribute
type TFModules ¶
type TFModules []TFModule
func (TFModules) ToProto ¶
func (mArr TFModules) ToProto() []*terrariumpb.Module
type TFProvider ¶
func (*TFProvider) IsEq ¶
func (p1 *TFProvider) IsEq(p2 *TFProvider) bool
type TFResourceAttribute ¶
type TFResourceAttribute struct {
Model
ResourceTypeID uuid.UUID `gorm:"uniqueIndex:resource_attribute_unique"`
ProviderID uuid.UUID `gorm:"uniqueIndex:resource_attribute_unique"`
AttributePath string `gorm:"uniqueIndex:resource_attribute_unique"`
DataType string
Description string
Optional bool
Computed bool
ResourceType TFResourceType `gorm:"foreignKey:ResourceTypeID"`
Provider TFProvider `gorm:"foreignKey:ProviderID"`
RelatedModuleAttrs []TFModuleAttribute `gorm:"foreignKey:RelatedResourceTypeAttributeID"` // Module attributes that relates to this resource attribute
OutputMappings []TFResourceAttributesMapping `gorm:"foreignKey:InputAttributeID"` // Mappings with another resources's output attribute
InputMappings []TFResourceAttributesMapping `gorm:"foreignKey:OutputAttributeID"` // Mappings with another resources's input attribute
}
func (TFResourceAttribute) GetConnectedModuleOutputs ¶
func (a TFResourceAttribute) GetConnectedModuleOutputs() TFModuleAttributes
type TFResourceAttributesMapping ¶
type TFResourceAttributesMapping struct {
Model
InputAttributeID uuid.UUID `gorm:"uniqueIndex:resource_attribute_mapping_unique"`
OutputAttributeID uuid.UUID `gorm:"uniqueIndex:resource_attribute_mapping_unique"`
InputAttribute TFResourceAttribute `gorm:"foreignKey:InputAttributeID"` // Resource input-attribute object
OutputAttribute TFResourceAttribute `gorm:"foreignKey:OutputAttributeID"` // Resource attribute object that provides the input-attribute
}
type TFResourceType ¶
type TFResourceType struct {
Model
ProviderID uuid.UUID `gorm:"uniqueIndex:resource_type_unique"`
ResourceType string `gorm:"uniqueIndex:resource_type_unique"`
TaxonomyID *uuid.UUID `gorm:"default:null"`
Provider TFProvider `gorm:"foreignKey:ProviderID"`
Taxonomy *Taxonomy `gorm:"foreignKey:TaxonomyID"`
}
type Taxonomies ¶
type Taxonomies []Taxonomy
func (Taxonomies) ToProto ¶
func (tArr Taxonomies) ToProto() []*terrariumpb.Taxonomy
type Taxonomy ¶
type Taxonomy struct {
Model
Level1 string `gorm:"uniqueIndex:taxonomy_unique"`
Level2 string `gorm:"uniqueIndex:taxonomy_unique"`
Level3 string `gorm:"uniqueIndex:taxonomy_unique"`
Level4 string `gorm:"uniqueIndex:taxonomy_unique"`
Level5 string `gorm:"uniqueIndex:taxonomy_unique"`
Level6 string `gorm:"uniqueIndex:taxonomy_unique"`
Level7 string `gorm:"uniqueIndex:taxonomy_unique"`
}
func TaxonomyFromLevels ¶
func (*Taxonomy) ToProto ¶
func (t *Taxonomy) ToProto() *terrariumpb.Taxonomy
Source Files
¶
Click to show internal directories.
Click to hide internal directories.