Documentation ¶
Index ¶
- type ConversionGraph
- func (graph *ConversionGraph) FindHub(name astmodel.InternalTypeName, definitions astmodel.TypeDefinitionSet) (astmodel.InternalTypeName, error)
- func (graph *ConversionGraph) FindHubAndDistance(name astmodel.InternalTypeName, definitions astmodel.TypeDefinitionSet) (astmodel.InternalTypeName, int, error)
- func (graph *ConversionGraph) FindInPath(start astmodel.InternalTypeName, ...) (astmodel.InternalTypeName, bool)
- func (graph *ConversionGraph) FindNextProperty(ref astmodel.PropertyReference, definitions astmodel.TypeDefinitionSet) (astmodel.PropertyReference, error)
- func (graph *ConversionGraph) FindNextType(name astmodel.InternalTypeName, definitions astmodel.TypeDefinitionSet) (astmodel.InternalTypeName, error)
- func (graph *ConversionGraph) LookupTransition(name astmodel.InternalTypeName) astmodel.InternalTypeName
- func (graph *ConversionGraph) SaveTo(group string, kind string, filename string) error
- func (graph *ConversionGraph) String(group string, kind string) (string, error)
- func (graph *ConversionGraph) TransitionCount() int
- func (graph *ConversionGraph) WriteTo(group string, kind string, writer io.Writer) error
- type ConversionGraphBuilder
- type GroupConversionGraph
- type GroupConversionGraphBuilder
- type HubVersionMarker
- type PropertyConverter
- type ResourceConversionGraph
- func (graph *ResourceConversionGraph) LookupTransition(name astmodel.InternalTypeName) astmodel.InternalTypeName
- func (graph *ResourceConversionGraph) TransitionCount() int
- func (graph *ResourceConversionGraph) WriteLines(writer io.Writer, lines ...string) error
- func (graph *ResourceConversionGraph) WriteTo(writer io.Writer) error
- func (graph *ResourceConversionGraph) WriteVersions(writer io.Writer, versions set.Set[string]) error
- type ResourceConversionGraphBuilder
- type TypeConverter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConversionGraph ¶
type ConversionGraph struct {
// contains filtered or unexported fields
}
ConversionGraph builds up a set of graphs of the required conversions between versions For each group (e.g. microsoft.storage or microsoft.batch) we have a separate subgraph of directed conversions
func (*ConversionGraph) FindHub ¶
func (graph *ConversionGraph) FindHub( name astmodel.InternalTypeName, definitions astmodel.TypeDefinitionSet, ) (astmodel.InternalTypeName, error)
FindHub returns the type name of the hub resource, given the type name of one of the resources that is persisted using that hub type. This is done by following links in the conversion graph until we either reach the end or we find that a newer version of the type does not exist. Returns the hub type if found; an empty name and an error if not.
func (*ConversionGraph) FindHubAndDistance ¶
func (graph *ConversionGraph) FindHubAndDistance( name astmodel.InternalTypeName, definitions astmodel.TypeDefinitionSet, ) (astmodel.InternalTypeName, int, error)
FindHubAndDistance returns the type name of the hub resource, given the type name of one of the resources that is persisted using that hub type. This is done by following links in the conversion graph until we either reach the end or we find that a newer version of the type does not exist. Returns the distance if a hub was found, an error if not.
func (*ConversionGraph) FindInPath ¶
func (graph *ConversionGraph) FindInPath( start astmodel.InternalTypeName, predicate func(name astmodel.InternalTypeName) bool, ) (astmodel.InternalTypeName, bool)
FindInPath searches the path from the specified type name to the hub for a type name that matches the predicate, returning either the first matching type, and true, or an empty type name and false.
func (*ConversionGraph) FindNextProperty ¶
func (graph *ConversionGraph) FindNextProperty( ref astmodel.PropertyReference, definitions astmodel.TypeDefinitionSet, ) (astmodel.PropertyReference, error)
FindNextProperty finds what a given property would be called on the next type in our conversion graph. Type renames are respected. When implemented, property renames need to be respected as well (this is why the method has been implemented here). declaringType is the type containing the property. property is the name of the property. definitions is a set of known definitions.
func (*ConversionGraph) FindNextType ¶
func (graph *ConversionGraph) FindNextType( name astmodel.InternalTypeName, definitions astmodel.TypeDefinitionSet, ) (astmodel.InternalTypeName, error)
FindNextType returns the type name of the next closest type on the path to the hub type. Returns the type name and no error if the next type is found; empty name and no error if not; empty name and an error if something goes wrong. If the name passed in is for the hub type for the given resource, no next type will be found. This is used to identify the next type needed for property assignment functions, and is a building block for identification of hub definitions.
func (*ConversionGraph) LookupTransition ¶
func (graph *ConversionGraph) LookupTransition(name astmodel.InternalTypeName) astmodel.InternalTypeName
LookupTransition accepts a type name and looks up the transition to the next version in the graph Returns the next version and true if it's found, or an empty type name and false if not.
func (*ConversionGraph) SaveTo ¶
func (graph *ConversionGraph) SaveTo(group string, kind string, filename string) error
func (*ConversionGraph) String ¶
func (graph *ConversionGraph) String(group string, kind string) (string, error)
func (*ConversionGraph) TransitionCount ¶
func (graph *ConversionGraph) TransitionCount() int
TransitionCount returns the number of transitions in the graph
type ConversionGraphBuilder ¶
type ConversionGraphBuilder struct {
// contains filtered or unexported fields
}
ConversionGraphBuilder is used to construct a conversion graph with all the required conversions to/from/between the storage variants of the packages. It uses a separate GroupConversionGraphBuilder for each distinct group
func NewConversionGraphBuilder ¶
func NewConversionGraphBuilder( configuration *config.ObjectModelConfiguration, versionPrefix string, ) *ConversionGraphBuilder
NewConversionGraphBuilder creates a new builder for all our required conversion graphs
func (*ConversionGraphBuilder) Add ¶
func (b *ConversionGraphBuilder) Add(names ...astmodel.InternalTypeName)
Add includes the supplied TypeNames in the conversion graph
func (*ConversionGraphBuilder) AddAll ¶
func (b *ConversionGraphBuilder) AddAll(set astmodel.InternalTypeNameSet)
AddAll includes the TypeNames in the supplied set in conversion graph
func (*ConversionGraphBuilder) Build ¶
func (b *ConversionGraphBuilder) Build() (*ConversionGraph, error)
Build connects all the provided API definitions together into a single conversion graph
type GroupConversionGraph ¶
type GroupConversionGraph struct {
// contains filtered or unexported fields
}
GroupConversionGraph represents the directed graph of conversions between versions for a single group
func (*GroupConversionGraph) LookupTransition ¶
func (graph *GroupConversionGraph) LookupTransition(name astmodel.InternalTypeName) astmodel.InternalTypeName
LookupTransition accepts a type name and looks up the transition to the next version in the graph Returns the next version if it's found, or an empty type name if not.
func (*GroupConversionGraph) TransitionCount ¶
func (graph *GroupConversionGraph) TransitionCount() int
TransitionCount returns the number of transitions in the graph
type GroupConversionGraphBuilder ¶
type GroupConversionGraphBuilder struct {
// contains filtered or unexported fields
}
GroupConversionGraphBuilder is used to construct a conversion graph with all the required conversions to/from/between the storage variants of the packages. It uses a separate ResourceConversionGraphBuilder for each distinct resource/type
func NewGroupConversionGraphBuilder ¶
func NewGroupConversionGraphBuilder( group string, configuration *config.ObjectModelConfiguration, versionPrefix string, ) *GroupConversionGraphBuilder
NewGroupConversionGraphBuilder creates a new builder for all our required conversion graphs
func (*GroupConversionGraphBuilder) Add ¶
func (b *GroupConversionGraphBuilder) Add(names ...astmodel.InternalTypeName)
Add includes the supplied type names in the conversion graph
func (*GroupConversionGraphBuilder) AddAll ¶
func (b *GroupConversionGraphBuilder) AddAll(names astmodel.InternalTypeNameSet)
AddAll includes all the supplied types names in the conversion graph
func (*GroupConversionGraphBuilder) Build ¶
func (b *GroupConversionGraphBuilder) Build() (*GroupConversionGraph, error)
Build connects all the provided API definitions together into a single conversion graph
type HubVersionMarker ¶
type HubVersionMarker struct {
// contains filtered or unexported fields
}
HubVersionMarker is a utility for marking resource definitions as "hub" versions
func NewHubVersionMarker ¶
func NewHubVersionMarker() *HubVersionMarker
NewHubVersionMarker returns a new hub version marker for flagging resource definitions
func (*HubVersionMarker) MarkAsStorageVersion ¶
func (m *HubVersionMarker) MarkAsStorageVersion(def astmodel.TypeDefinition) (astmodel.TypeDefinition, error)
MarkAsStorageVersion marks the supplied type definition as the storage version
type PropertyConverter ¶
type PropertyConverter struct {
// contains filtered or unexported fields
}
PropertyConverter is used to convert the properties of object definitions as required for storage variants
func NewPropertyConverter ¶
func NewPropertyConverter(definitions astmodel.TypeDefinitionSet) *PropertyConverter
NewPropertyConverter creates a new property converter for modifying object properties
func (*PropertyConverter) ConvertProperty ¶
func (p *PropertyConverter) ConvertProperty(property *astmodel.PropertyDefinition) (*astmodel.PropertyDefinition, error)
ConvertProperty applies our conversion rules to a specific property
type ResourceConversionGraph ¶
type ResourceConversionGraph struct {
// contains filtered or unexported fields
}
ResourceConversionGraph represents the directed graph of conversions between versions for a single resource/type
func (*ResourceConversionGraph) LookupTransition ¶
func (graph *ResourceConversionGraph) LookupTransition(name astmodel.InternalTypeName) astmodel.InternalTypeName
LookupTransition accepts a type name and looks up the transition to the next version in the graph Returns the next version, or an empty type name if not.
func (*ResourceConversionGraph) TransitionCount ¶
func (graph *ResourceConversionGraph) TransitionCount() int
TransitionCount returns the number of transitions in the graph
func (*ResourceConversionGraph) WriteLines ¶
func (graph *ResourceConversionGraph) WriteLines(writer io.Writer, lines ...string) error
func (*ResourceConversionGraph) WriteTo ¶
func (graph *ResourceConversionGraph) WriteTo(writer io.Writer) error
WriteTo gives a debug dump of the conversion graph for a particular type name
func (*ResourceConversionGraph) WriteVersions ¶
type ResourceConversionGraphBuilder ¶
type ResourceConversionGraphBuilder struct {
// contains filtered or unexported fields
}
ResourceConversionGraphBuilder is used to construct a group conversion graph with all the required conversions to/from/between storage variants of the packages
func NewResourceConversionGraphBuilder ¶
func NewResourceConversionGraphBuilder(name string, versionPrefix string) *ResourceConversionGraphBuilder
NewResourceConversionGraphBuilder creates a new builder for a specific resource/type
func (*ResourceConversionGraphBuilder) Add ¶
func (b *ResourceConversionGraphBuilder) Add(names ...astmodel.InternalTypeName)
Add includes the supplied package reference(s) in the conversion graph for this group
func (*ResourceConversionGraphBuilder) Build ¶
func (b *ResourceConversionGraphBuilder) Build() (*ResourceConversionGraph, error)
Build connects all the provided API definitions together into a single conversion graph
type TypeConverter ¶
type TypeConverter struct {
// contains filtered or unexported fields
}
TypeConverter is used to create a storage variant of an API type
func NewTypeConverter ¶
func NewTypeConverter(definitions astmodel.TypeDefinitionSet) *TypeConverter
NewTypeConverter creates a new converter for the creation of storage variants
func (*TypeConverter) ConvertDefinition ¶
func (t *TypeConverter) ConvertDefinition(def astmodel.TypeDefinition) (astmodel.TypeDefinition, error)
ConvertDefinition applies our type conversion to a specific type definition