Documentation
¶
Overview ¶
Package cubkit is used to interpret ConfigHub/YAML configuration units.
Index ¶
- Constants
- Variables
- func ApplyPriorityOf(entityType api.ResourceType) (int, bool)
- func BuiltinSpecSet() (yamlkit.SpecSet, error)
- func CubNormalizeName(providedText string) string
- func DeclaredReferences() []yamlkit.DeclaredReference
- func DeclaredWhereExpressions(entityType api.ResourceType) []yamlkit.AttributePath
- func DocumentSchema(entityType api.ResourceType) ([]byte, bool)
- func DocumentSchemaTypes() []api.ResourceType
- func RegisterDeclaredAttributePaths(rp *ConfigHubResourceProviderType, ...) error
- func WhereAttributes() entityfilter.AttributeTable
- type ConfigHubResourceProviderType
- func (*ConfigHubResourceProviderType) ContextPath(contextField string) string
- func (*ConfigHubResourceProviderType) DataType() api.DataType
- func (*ConfigHubResourceProviderType) DefaultResourceCategory() api.ResourceCategory
- func (*ConfigHubResourceProviderType) GetToolchainType() workerapi.ToolchainType
- func (*ConfigHubResourceProviderType) NameSeparator() string
- func (*ConfigHubResourceProviderType) NativeToYAML(data []byte) ([]byte, error)
- func (*ConfigHubResourceProviderType) NormalizeName(name string) string
- func (*ConfigHubResourceProviderType) ParseResourceName(resourceName api.ResourceName) (string, string)
- func (c *ConfigHubResourceProviderType) RemoveScopeFromResourceName(resourceName api.ResourceName) api.ResourceName
- func (rp *ConfigHubResourceProviderType) ResourceAndCategoryTypeMaps(docs gaby.Container) (resourceMap yamlkit.ResourceNameToCategoryTypesMap, ...)
- func (*ConfigHubResourceProviderType) ResourceCategoryGetter(doc *gaby.YamlDoc) (api.ResourceCategory, error)
- func (*ConfigHubResourceProviderType) ResourceNameGetter(doc *gaby.YamlDoc) (api.ResourceName, error)
- func (rp *ConfigHubResourceProviderType) ResourceNameStableCoreGetter(doc *gaby.YamlDoc) (api.ResourceName, error)
- func (*ConfigHubResourceProviderType) ResourceTypeGetter(doc *gaby.YamlDoc) (api.ResourceType, error)
- func (*ConfigHubResourceProviderType) ResourceTypesAreSimilar(resourceTypeA, resourceTypeB api.ResourceType) bool
- func (*ConfigHubResourceProviderType) ScopelessResourceNamePath() api.ResolvedPath
- func (*ConfigHubResourceProviderType) SetResourceName(doc *gaby.YamlDoc, name string) error
- func (*ConfigHubResourceProviderType) TypeDescription() string
- func (*ConfigHubResourceProviderType) YAMLToNative(yamlData []byte) ([]byte, error)
Constants ¶
const ( ResourceTypeNoEntityType = api.ResourceType("NoEntityType") ResourceNameNoName = api.ResourceName("NoName") EntityTypePath = api.ResolvedPath("EntityType") EntityNamePath = api.ResolvedPath("Slug") EntityScopePath = api.ResolvedPath("SpaceSlug") )
const ( ScopeSpace yamlkit.Scope = "Space" ScopeOrganization yamlkit.Scope = "Organization" )
Scopes of ConfigHub entity names. Most entities are named within a Space; a Space or a Component is named within the Organization.
const AttributeNameImmutable = api.AttributeName("immutable")
AttributeNameImmutable is the attribute declaring the fields that cannot change once an entity is created. vet-immutable reads it.
const AttributeNameWhereExpression = api.AttributeName("where-expression")
AttributeNameWhereExpression is the attribute declaring the fields that hold where expressions, each with the entity type it selects. vet-where-expressions reads it.
Variables ¶
var ConfigHubNonSpaceScopedEntityTypes = map[api.ResourceType]bool{ api.ResourceType("Organization"): true, api.ResourceType("OrganizationMember"): true, api.ResourceType("User"): true, api.ResourceType("Space"): true, }
Functions ¶
func ApplyPriorityOf ¶ added in v0.8.0
func ApplyPriorityOf(entityType api.ResourceType) (int, bool)
ApplyPriorityOf returns the order an entity type is applied in among others, lower first, and whether the type declares one.
func BuiltinSpecSet ¶ added in v0.8.0
BuiltinSpecSet returns the generated ConfigHub/YAML resource-type specs, parsed afresh, so a caller cannot disturb the compiled ones.
func CubNormalizeName ¶
func DeclaredReferences ¶ added in v0.8.1
func DeclaredReferences() []yamlkit.DeclaredReference
DeclaredReferences returns every path the specs declare as naming another entity, with the type it names, sorted. A reference's value is the referent's slug, or <space>/<slug> for a referent in another Space than the document's: the scope is part of the name, rather than a field beside it as a Kubernetes namespace is.
func DeclaredWhereExpressions ¶ added in v0.8.1
func DeclaredWhereExpressions(entityType api.ResourceType) []yamlkit.AttributePath
DeclaredWhereExpressions returns the paths of an entity type's fields that hold where expressions, each with the entity type it selects, sorted by path.
func DocumentSchema ¶ added in v0.8.1
func DocumentSchema(entityType api.ResourceType) ([]byte, bool)
DocumentSchema returns the JSON Schema of an entity type's document, complete with the definitions it refers to, and whether the type has one.
func DocumentSchemaTypes ¶ added in v0.8.1
func DocumentSchemaTypes() []api.ResourceType
DocumentSchemaTypes returns the entity types that have a document schema, sorted.
func RegisterDeclaredAttributePaths ¶ added in v0.8.0
func RegisterDeclaredAttributePaths(rp *ConfigHubResourceProviderType, descriptors map[api.AttributeName]yamlkit.AttributeDescriptor) error
RegisterDeclaredAttributePaths registers the attribute paths the specs declare, pairing each with the descriptor its attribute name is registered under.
func WhereAttributes ¶ added in v0.8.1
func WhereAttributes() entityfilter.AttributeTable
WhereAttributes returns what a where expression can name, by entity type and then attribute name. The table is shared, so a caller must not change it.
Types ¶
type ConfigHubResourceProviderType ¶
type ConfigHubResourceProviderType struct {
yamlkit.ResourceProviderRegistry
}
func NewConfigHubResourceProvider ¶
func NewConfigHubResourceProvider() *ConfigHubResourceProviderType
NewConfigHubResourceProvider creates a new ConfigHubResourceProviderType with its own path registry, whose structure lookups -- merge keys and map-key paths -- read the generated resource-type specs.
func (*ConfigHubResourceProviderType) ContextPath ¶
func (*ConfigHubResourceProviderType) ContextPath(contextField string) string
func (*ConfigHubResourceProviderType) DataType ¶
func (*ConfigHubResourceProviderType) DataType() api.DataType
func (*ConfigHubResourceProviderType) DefaultResourceCategory ¶
func (*ConfigHubResourceProviderType) DefaultResourceCategory() api.ResourceCategory
DefaultResourceCategory returns the default resource category to asssume, which is AppConfig in this case.
func (*ConfigHubResourceProviderType) GetToolchainType ¶
func (*ConfigHubResourceProviderType) GetToolchainType() workerapi.ToolchainType
func (*ConfigHubResourceProviderType) NameSeparator ¶
func (*ConfigHubResourceProviderType) NameSeparator() string
func (*ConfigHubResourceProviderType) NativeToYAML ¶
func (*ConfigHubResourceProviderType) NativeToYAML(data []byte) ([]byte, error)
NativeToYAML converts native YAML comments (HeadComment, LineComment, FootComment) into $comment$ map keys so they have a uniform representation across all formats.
func (*ConfigHubResourceProviderType) NormalizeName ¶
func (*ConfigHubResourceProviderType) NormalizeName(name string) string
func (*ConfigHubResourceProviderType) ParseResourceName ¶
func (*ConfigHubResourceProviderType) ParseResourceName(resourceName api.ResourceName) (string, string)
func (*ConfigHubResourceProviderType) RemoveScopeFromResourceName ¶
func (c *ConfigHubResourceProviderType) RemoveScopeFromResourceName(resourceName api.ResourceName) api.ResourceName
func (*ConfigHubResourceProviderType) ResourceAndCategoryTypeMaps ¶
func (rp *ConfigHubResourceProviderType) ResourceAndCategoryTypeMaps(docs gaby.Container) (resourceMap yamlkit.ResourceNameToCategoryTypesMap, categoryTypeMap yamlkit.ResourceCategoryTypeToNamesMap, err error)
ResourceAndCategoryTypeMaps returns maps of all resources in the provided list of parsed YAML documents, from from names to categories+types and categories+types to names.
func (*ConfigHubResourceProviderType) ResourceCategoryGetter ¶
func (*ConfigHubResourceProviderType) ResourceCategoryGetter(doc *gaby.YamlDoc) (api.ResourceCategory, error)
ResourceCategoryGetter just returns ResourceCategoryResource for ConfigHub/YAML documents.
func (*ConfigHubResourceProviderType) ResourceNameGetter ¶
func (*ConfigHubResourceProviderType) ResourceNameGetter(doc *gaby.YamlDoc) (api.ResourceName, error)
ResourceNameGetter extracts the property Slug, and returns NoName if not present.
func (*ConfigHubResourceProviderType) ResourceNameStableCoreGetter ¶ added in v0.1.15
func (rp *ConfigHubResourceProviderType) ResourceNameStableCoreGetter(doc *gaby.YamlDoc) (api.ResourceName, error)
func (*ConfigHubResourceProviderType) ResourceTypeGetter ¶
func (*ConfigHubResourceProviderType) ResourceTypeGetter(doc *gaby.YamlDoc) (api.ResourceType, error)
ResourceTypeGetter extracts the property EntityType, and returns NoEntityType if not present.
func (*ConfigHubResourceProviderType) ResourceTypesAreSimilar ¶
func (*ConfigHubResourceProviderType) ResourceTypesAreSimilar(resourceTypeA, resourceTypeB api.ResourceType) bool
TODO: Trigger and Invocation?
func (*ConfigHubResourceProviderType) ScopelessResourceNamePath ¶
func (*ConfigHubResourceProviderType) ScopelessResourceNamePath() api.ResolvedPath
func (*ConfigHubResourceProviderType) SetResourceName ¶
func (*ConfigHubResourceProviderType) SetResourceName(doc *gaby.YamlDoc, name string) error
func (*ConfigHubResourceProviderType) TypeDescription ¶
func (*ConfigHubResourceProviderType) TypeDescription() string
func (*ConfigHubResourceProviderType) YAMLToNative ¶
func (*ConfigHubResourceProviderType) YAMLToNative(yamlData []byte) ([]byte, error)
YAMLToNative converts $comment$ map keys back into native YAML comments.