Documentation ¶
Index ¶
- Constants
- func AnnotationsFromAttributeSet(set model.AttributeSet) (map[string]string, error)
- func AnnotationsFromAttributes(attributes map[string]json.RawMessage) (map[string]string, error)
- func AnnotationsToAttributeSet(annotations map[string]string, skip func(string) bool) (model.AttributeSet, error)
- func AnnotationsToAttributes(annotations map[string]string) (map[string]json.RawMessage, error)
- func AttributesFromAttributeSet(set model.AttributeSet) (map[string]json.RawMessage, error)
- func AttributesToAttributeSet(specAttributes map[string]json.RawMessage) (model.AttributeSet, error)
- func CollectionToOCI(desc empspec.Descriptor) (ocispec.Descriptor, error)
- func OCIToCollection(desc ocispec.Descriptor) (empspec.Descriptor, error)
- type JSONSubsetMatcher
- type ParseError
- type Properties
- func (p *Properties) Exists(attribute model.Attribute) (bool, error)
- func (p *Properties) ExistsBySchema(schema string, attribute model.Attribute) (bool, error)
- func (p *Properties) Find(s string) model.Attribute
- func (p *Properties) FindBySchema(schema, key string) model.Attribute
- func (p *Properties) HasFileInfo() bool
- func (p *Properties) HasRuntimeInfo() bool
- func (p *Properties) IsAComponent() bool
- func (p *Properties) IsALink() bool
- func (p *Properties) IsASchema() bool
- func (p *Properties) Len() int
- func (p *Properties) List() map[string]model.Attribute
- func (p *Properties) MarshalJSON() ([]byte, error)
- func (p *Properties) Merge(sets map[string]model.AttributeSet) error
Constants ¶
const ( TypeLink = "core-link" TypeDescriptor = "core-descriptor" TypeSchema = "core-schema" TypeRuntime = "core-runtime" TypeFile = "core-file" )
Variables ¶
This section is empty.
Functions ¶
func AnnotationsFromAttributeSet ¶
func AnnotationsFromAttributeSet(set model.AttributeSet) (map[string]string, error)
AnnotationsFromAttributeSet converts an AttributeSet to annotations. All annotation values are saved in a JSON valid syntax to allow for typing upon retrieval.
func AnnotationsFromAttributes ¶
AnnotationsFromAttributes converts collection spec attributes to collection annotations // for OCI descriptor compatibility.
func AnnotationsToAttributeSet ¶
func AnnotationsToAttributeSet(annotations map[string]string, skip func(string) bool) (model.AttributeSet, error)
AnnotationsToAttributeSet converts annotations from descriptors to an AttributeSet. This also performs annotation validation.
func AnnotationsToAttributes ¶
AnnotationsToAttributes OCI descriptor annotations to collection spec attributes if the AnnotationsEmporousAttributes key is found.
func AttributesFromAttributeSet ¶
func AttributesFromAttributeSet(set model.AttributeSet) (map[string]json.RawMessage, error)
AttributesFromAttributeSet converts an attribute set on collection spec attributes.
func AttributesToAttributeSet ¶
func AttributesToAttributeSet(specAttributes map[string]json.RawMessage) (model.AttributeSet, error)
AttributesToAttributeSet converts collection spec attributes to an attribute set.
func CollectionToOCI ¶
func CollectionToOCI(desc empspec.Descriptor) (ocispec.Descriptor, error)
CollectionToOCI converts collection descriptor to OCI descriptor.
func OCIToCollection ¶
func OCIToCollection(desc ocispec.Descriptor) (empspec.Descriptor, error)
OCIToCollection converts OCI descriptor to collection descriptor.
Types ¶
type JSONSubsetMatcher ¶
type JSONSubsetMatcher json.RawMessage
JSONSubsetMatcher check that the node attributes are a superset or an exact match to the given json input. The JSONSubsetMatcher should be used when to filter descriptor type nodes to include core schema fields.
type ParseError ¶
ParseError defines an error when parsing attributes into Properties.
func (ParseError) Error ¶
func (e ParseError) Error() string
type Properties ¶
type Properties struct { Runtime *ocispec.ImageConfig `json:"core-runtime,omitempty"` Link *empspec.LinkAttributes `json:"core-link,omitempty"` Descriptor *empspec.DescriptorAttributes `json:"core-descriptor,omitempty"` Schema *empspec.SchemaAttributes `json:"core-schema,omitempty"` File *empspec.File `json:"core-file,omitempty"` // A map of attribute sets where the string is the schema ID. Others map[string]model.AttributeSet `json:"-"` }
Properties define all properties an Emporous collection descriptor can have.
func Parse ¶
func Parse(in map[string]json.RawMessage) (*Properties, error)
Parse attempt to resolve attribute types in a set of json.RawMessage types into known types and adds unknown attributes to an attribute set, if supported.
func (*Properties) Exists ¶
func (p *Properties) Exists(attribute model.Attribute) (bool, error)
Exists checks for the existence of an attribute pair in the AttributeSet in the Properties. Only the "Others" field is evaluated during the search.
func (*Properties) ExistsBySchema ¶
ExistsBySchema checks the existence of the attributes in the AttributeSet matching the given schema ID. Only the "Others" field is evaluated during the search.
func (*Properties) Find ¶
func (p *Properties) Find(s string) model.Attribute
Find searches all AttributeSets in the Properties for a key and returns an attribute value. Only the "Others" field is evaluated during the search.
func (*Properties) FindBySchema ¶
func (p *Properties) FindBySchema(schema, key string) model.Attribute
FindBySchema find the attribute value in the AttributeSet matching the given schema ID. Only the "Others" field is evaluated during the search.
func (*Properties) HasFileInfo ¶
func (p *Properties) HasFileInfo() bool
HasFileInfo returns whether the descriptor has file information set.
func (*Properties) HasRuntimeInfo ¶
func (p *Properties) HasRuntimeInfo() bool
HasRuntimeInfo returns whether the descriptor has runtime information set.
func (*Properties) IsAComponent ¶
func (p *Properties) IsAComponent() bool
IsAComponent returns whether the descriptor has a component name.
func (*Properties) IsALink ¶
func (p *Properties) IsALink() bool
IsALink returns whether a descriptor is a link.
func (*Properties) IsASchema ¶
func (p *Properties) IsASchema() bool
IsASchema returns whether the descriptor is a schema.
func (*Properties) Len ¶
func (p *Properties) Len() int
Len returns the length of the all AttributeSets in the Properties. Only the "Others" field is evaluated.
func (*Properties) List ¶
func (p *Properties) List() map[string]model.Attribute
List lists the AttributeSet attributes in the Properties. If the attribute under different schemas cannot merge, nil will be returned. Only the "Others" field is evaluated.
func (*Properties) MarshalJSON ¶
func (p *Properties) MarshalJSON() ([]byte, error)
MarshalJSON marshal an instance of Properties into the JSON format.
func (*Properties) Merge ¶
func (p *Properties) Merge(sets map[string]model.AttributeSet) error
Merge merges a given AttributeSet into the descriptor Others AttributeSets.