Documentation
¶
Index ¶
- Constants
- func FromDataSourcePB(dataSourcePB *schemapb.DataSource) (*schema.DataSource, error)
- func FromLinkSelectorPB(linkSelectorPB *schemapb.LinkSelector) *schema.LinkSelector
- func FromMappingNodePB(mappingNodePB *schemapb.MappingNode, optional bool) (*core.MappingNode, error)
- func FromResourcePB(resourcePB *schemapb.Resource) (*schema.Resource, error)
- func FromScalarValuePB(scalarValue *schemapb.ScalarValue, optional bool) (*core.ScalarValue, error)
- func FromSchemaPB(blueprintPB *schemapb.Blueprint) (*schema.Blueprint, error)
- func ToDataSourcePB(dataSource *schema.DataSource) (*schemapb.DataSource, error)
- func ToLinkSelectorPB(linkSelector *schema.LinkSelector) *schemapb.LinkSelector
- func ToMappingNodePB(mappingNode *core.MappingNode, optional bool) (*schemapb.MappingNode, error)
- func ToResourcePB(resource *schema.Resource) (*schemapb.Resource, error)
- func ToScalarValuePB(scalarValue *core.ScalarValue, optional bool) (*schemapb.ScalarValue, error)
- func ToSchemaPB(blueprint *schema.Blueprint) (*schemapb.Blueprint, error)
- type ExpandedBlueprintSerialiser
- type ProtobufExpandedBlueprintSerialiser
Constants ¶
const ( // ErrorReasonCodeMissingScalar is provided when the reason // for an expanded blueprint spec serialisation error is due to // a missing scalar value. ErrorReasonCodeMissingScalar errors.ErrorReasonCode = "expanded_blueprint_serialise_missing_scalar" // ErrorReasonCodeMissingStringOrSubValue is provided when the reason // for an expanded blueprint spec serialisation error is due to // a missing string or substitution value. ErrorReasonCodeMissingStringOrSubValue errors.ErrorReasonCode = "expanded_blueprint_serialise_missing_string_or_sub_value" // ErrorReasonCodeMissingSubstitutionValue is provided when the reason // for an expanded blueprint spec serialisation error is due to // a missing substitution value. ErrorReasonCodeMissingSubstitutionValue errors.ErrorReasonCode = "expanded_blueprint_serialise_missing_substitution_value" // ErrorReasonCodeMissingSubPathItemValue is provided when the reason // for an expanded blueprint spec serialisation error is due to // a missing substitution path item value. (e.g. [0], .key or ["key"]) ErrorReasonCodeMissingSubPathItemValue errors.ErrorReasonCode = "expanded_blueprint_serialise_missing_sub_path_item_value" // ErrorReasonCodeMissingMappingNodeValue is provided when the reason // for an expanded blueprint spec serialisation error is due to // a missing mapping node value. ErrorReasonCodeMissingMappingNodeValue errors.ErrorReasonCode = "expanded_blueprint_serialise_missing_mapping_node_value" // ErrorReasonCodeMappingNodeIsNil is provided when the reason // for an expanded blueprint spec serialisation error is due to // a required mapping node being nil. ErrorReasonCodeMappingNodeIsNil errors.ErrorReasonCode = "expanded_blueprint_serialise_mapping_node_is_nil" // ErrorReasonCodeStringOrSubsIsNil is provided when the reason // for an expanded blueprint spec serialisation error is due to // the string or substitutions being nil. ErrorReasonCodeStringOrSubsIsNil errors.ErrorReasonCode = "expanded_blueprint_serialise_string_or_subs_is_nil" // ErrorReasonCodeMissingSubFuncArgValue is provided when the reason // for an expanded blueprint spec serialisation error is due to // a missing substitution function argument value. ErrorReasonCodeMissingSubFuncArgValue errors.ErrorReasonCode = "expanded_blueprint_serialise_missing_sub_func_arg_value" )
Variables ¶
This section is empty.
Functions ¶
func FromDataSourcePB ¶
func FromDataSourcePB(dataSourcePB *schemapb.DataSource) (*schema.DataSource, error)
FromDataSourcePB converts a DataSource protobuf message to a schema.DataSource struct to be used with the blueprint framework.
func FromLinkSelectorPB ¶
func FromLinkSelectorPB(linkSelectorPB *schemapb.LinkSelector) *schema.LinkSelector
FromLinkSelectorPB converts a LinkSelector protobuf message to a schema.LinkSelector struct to be used with the blueprint framework.
func FromMappingNodePB ¶
func FromMappingNodePB(mappingNodePB *schemapb.MappingNode, optional bool) (*core.MappingNode, error)
FromMappingNodePB converts a MappingNode protobuf message to a core.MappingNode struct to be used with the blueprint framework.
func FromResourcePB ¶
FromResourcePB converts a Resource protobuf message to a schema.Resource struct to be used with the blueprint framework.
func FromScalarValuePB ¶
func FromScalarValuePB(scalarValue *schemapb.ScalarValue, optional bool) (*core.ScalarValue, error)
FromScalarValuePB converts a ScalarValue protobuf message to a core.ScalarValue struct to be used with the blueprint framework.
func FromSchemaPB ¶
FromSchemaPB converts a Blueprint protobuf message to a schema.Blueprint struct to be used with the blueprint framework.
func ToDataSourcePB ¶
func ToDataSourcePB(dataSource *schema.DataSource) (*schemapb.DataSource, error)
ToDataSourcePB converts a core data source type to a schemapb.DataSource that can be stored and transmitted as a protobuf message.
func ToLinkSelectorPB ¶
func ToLinkSelectorPB(linkSelector *schema.LinkSelector) *schemapb.LinkSelector
ToLinkSelectorPB converts a schema.LinkSelector to a schemapb.LinkSelector that can be stored and transmitted as a protobuf message.
func ToMappingNodePB ¶
func ToMappingNodePB(mappingNode *core.MappingNode, optional bool) (*schemapb.MappingNode, error)
ToMappingNodePB converts a core.MappingNode to a schemapb.MappingNode that can be stored and transmitted as a protobuf message.
func ToResourcePB ¶
ToResourcePB converts a schema.Resource to a schemapb.Resource that can be stored and transmitted as a protobuf message.
func ToScalarValuePB ¶
func ToScalarValuePB(scalarValue *core.ScalarValue, optional bool) (*schemapb.ScalarValue, error)
ToScalarValuePB converts a core.ScalarValue to a schemapb.ScalarValue that can be stored and transmitted as a protobuf message.
Types ¶
type ExpandedBlueprintSerialiser ¶
type ExpandedBlueprintSerialiser interface {
Marshal(blueprint *schema.Blueprint) ([]byte, error)
Unmarshal(data []byte) (*schema.Blueprint, error)
}
ExpandedBlueprintSerialiser is an interface that represents a service that serialises and deserialises expanded blueprints. (An expanded blueprint is a representation with substitutions expanded into an AST-like structure.)
func NewProtobufSerialiser ¶
func NewProtobufSerialiser() ExpandedBlueprintSerialiser
NewProtobufSerialiser creates an instance of an ExpandedBlueprintSerialiser that uses the Protocol Buffer format.
type ProtobufExpandedBlueprintSerialiser ¶
type ProtobufExpandedBlueprintSerialiser struct{}
ProtobufExpandedBlueprintSerialiser is a service that serialises and deserialises expanded blueprints using the Protocol Buffer format. This is especially useful for serialising expanded blueprints for storage or transmission to distributed caches/data stores.