Documentation ¶
Index ¶
- Constants
- Variables
- func CompileInstillAcceptFormats(sch *structpb.Struct) error
- func CompileInstillFormat(sch *structpb.Struct) error
- func ConvertFromStructpb(from *structpb.Struct, to interface{}) error
- func ConvertToStructpb(from interface{}) (*structpb.Struct, error)
- func FormatErrors(inputPath string, e jsonschema.Detailed, errors *[]string)
- func TrimBase64Mime(b64 string) string
- type Component
- type Connector
- func (c *Connector) AddConnectorDefinition(def *pipelinePB.ConnectorDefinition) error
- func (c *Connector) GetConnectorDefinitionByID(defID string, resourceConfig *structpb.Struct, ...) (*pipelinePB.ConnectorDefinition, error)
- func (c *Connector) GetConnectorDefinitionByUID(defUID uuid.UUID, resourceConfig *structpb.Struct, ...) (*pipelinePB.ConnectorDefinition, error)
- func (c *Connector) IsCredentialField(defID string, target string) bool
- func (c *Connector) ListConnectorDefinitions() []*pipelinePB.ConnectorDefinition
- func (c *Connector) ListCredentialField(defID string) ([]string, error)
- func (c *Connector) LoadConnectorDefinitions(definitionsJSONBytes []byte, tasksJSONBytes []byte, ...) error
- type Execution
- func (e *Execution) ExecuteWithValidation(inputs []*structpb.Struct) ([]*structpb.Struct, error)
- func (e *Execution) GetConfig() *structpb.Struct
- func (e *Execution) GetTask() string
- func (e *Execution) GetUID() uuid.UUID
- func (e *Execution) Validate(data []*structpb.Struct, jsonSchema string, target string) error
- type IComponent
- type IConnector
- type IExecution
- type IOperator
- type InstillAcceptFormatsCompiler
- type InstillAcceptFormatsSchema
- type InstillFormatCompiler
- type InstillFormatSchema
- type Operator
- func (o *Operator) AddOperatorDefinition(def *pipelinePB.OperatorDefinition) error
- func (o *Operator) GetOperatorDefinitionByID(defID string, componentConfig *structpb.Struct) (*pipelinePB.OperatorDefinition, error)
- func (o *Operator) GetOperatorDefinitionByUID(defUID uuid.UUID, componentConfig *structpb.Struct) (*pipelinePB.OperatorDefinition, error)
- func (o *Operator) ListOperatorDefinitions() []*pipelinePB.OperatorDefinition
- func (o *Operator) LoadOperatorDefinitions(definitionsJSONBytes []byte, tasksJSONBytes []byte, ...) error
Constants ¶
const OpenAPITemplate = `` /* 1538-byte string literal not displayed */
Variables ¶
var InstillAcceptFormatsMeta = jsonschema.MustCompileString("instillAcceptFormats.json", `{
"properties" : {
"instillAcceptFormats": {
"type": "array",
"items": {
"type": "string"
}
}
}
}`)
var InstillFormatMeta = jsonschema.MustCompileString("instillFormat.json", `{
"properties" : {
"instillFormat": {
"type": "string"
}
}
}`)
Functions ¶
func CompileInstillFormat ¶
func ConvertFromStructpb ¶
ConvertFromStructpb converts from structpb.Struct to a struct
func ConvertToStructpb ¶
ConvertToStructpb converts from a struct to structpb.Struct
func FormatErrors ¶
func TrimBase64Mime ¶
Types ¶
type Component ¶
type Component struct { Name string // Logger Logger *zap.Logger // contains filtered or unexported fields }
Component is the basic component struct
func (*Component) GetTaskInputSchemas ¶
GetTaskInputSchemas returns the task input schemas
func (*Component) GetTaskOutputSchemas ¶
GetTaskOutputSchemas returns the task output schemas
type Connector ¶
type Connector struct { Component // contains filtered or unexported fields }
Connector is the base struct for all connectors
func (*Connector) AddConnectorDefinition ¶
func (c *Connector) AddConnectorDefinition(def *pipelinePB.ConnectorDefinition) error
AddConnectorDefinition adds a connector definition to the connector
func (*Connector) GetConnectorDefinitionByID ¶
func (c *Connector) GetConnectorDefinitionByID(defID string, resourceConfig *structpb.Struct, componentConfig *structpb.Struct) (*pipelinePB.ConnectorDefinition, error)
GetConnectorDefinitionByID gets the connector definition by definition id
func (*Connector) GetConnectorDefinitionByUID ¶
func (c *Connector) GetConnectorDefinitionByUID(defUID uuid.UUID, resourceConfig *structpb.Struct, componentConfig *structpb.Struct) (*pipelinePB.ConnectorDefinition, error)
GetConnectorDefinitionByUID gets the connector definition by definition uid
func (*Connector) IsCredentialField ¶
IsCredentialField checks if the target field is credential field
func (*Connector) ListConnectorDefinitions ¶
func (c *Connector) ListConnectorDefinitions() []*pipelinePB.ConnectorDefinition
ListConnectorDefinitions lists all the connector definitions
func (*Connector) ListCredentialField ¶
ListCredentialField lists the credential fields by definition id
type Execution ¶
type Execution struct { Logger *zap.Logger Component IComponent ComponentExecution IExecution UID uuid.UUID Config *structpb.Struct Task string }
Execution is the base struct for all executions
func CreateExecutionHelper ¶
func CreateExecutionHelper(e IExecution, comp IComponent, defUID uuid.UUID, task string, config *structpb.Struct, logger *zap.Logger) Execution
CreateExecutionHelper creates a new execution
func (*Execution) ExecuteWithValidation ¶
ExecuteWithValidation executes the execution with validation
type IComponent ¶
type IComponent interface { // Create a execution by definition uid and component configuration CreateExecution(defUID uuid.UUID, task string, config *structpb.Struct, logger *zap.Logger) (IExecution, error) // Get task input schemas GetTaskInputSchemas() map[string]string // Get task output schemas GetTaskOutputSchemas() map[string]string // contains filtered or unexported methods }
IComponent is the interface that wraps the basic component methods. All component need to implement this interface.
type IConnector ¶
type IConnector interface { IComponent // Functions that need to be implemented for all connectors // Test connection Test(defUID uuid.UUID, config *structpb.Struct, logger *zap.Logger) (pipelinePB.Connector_State, error) // Functions that shared for all connectors // Load connector definitions from json files LoadConnectorDefinitions(definitionsJSON []byte, tasksJSON []byte, additionalJSONBytes map[string][]byte) error // Add definition AddConnectorDefinition(def *pipelinePB.ConnectorDefinition) error // Get the connector definition by definition uid GetConnectorDefinitionByUID(defUID uuid.UUID, resourceConfig *structpb.Struct, componentConfig *structpb.Struct) (*pipelinePB.ConnectorDefinition, error) // Get the connector definition by definition id GetConnectorDefinitionByID(defID string, resourceConfig *structpb.Struct, componentConfig *structpb.Struct) (*pipelinePB.ConnectorDefinition, error) // Get the list of connector definitions under this connector ListConnectorDefinitions() []*pipelinePB.ConnectorDefinition // List the CredentialFields by definition id ListCredentialField(defID string) ([]string, error) // A helper function to check the target field a.b.c is credential IsCredentialField(defID string, target string) bool }
IConnector is the interface that all connectors need to implement
type IExecution ¶
type IExecution interface { // Functions that shared for all connectors // Validate the input and output format Validate(data []*structpb.Struct, jsonSchema string, target string) error // Execute GetTask() string GetConfig() *structpb.Struct GetUID() uuid.UUID // Execute ExecuteWithValidation(inputs []*structpb.Struct) ([]*structpb.Struct, error) // execute Execute(inputs []*structpb.Struct) ([]*structpb.Struct, error) }
IExecution is the interface that all executions need to implement
type IOperator ¶
type IOperator interface { IComponent // Functions that shared for all operators // Load operator definitions from json files, the additionalJSONBytes is only needed when you reference in-memory json file LoadOperatorDefinitions(definitionsJSON []byte, tasksJSON []byte, additionalJSONBytes map[string][]byte) error // Add definition AddOperatorDefinition(def *pipelinePB.OperatorDefinition) error // Get the operator definition by definition uid GetOperatorDefinitionByUID(defUID uuid.UUID, componentConfig *structpb.Struct) (*pipelinePB.OperatorDefinition, error) // Get the operator definition by definition id GetOperatorDefinitionByID(defID string, componentConfig *structpb.Struct) (*pipelinePB.OperatorDefinition, error) // Get the list of operator definitions under this operator ListOperatorDefinitions() []*pipelinePB.OperatorDefinition }
IOperator is the interface that all operators need to implement
type InstillAcceptFormatsCompiler ¶
type InstillAcceptFormatsCompiler struct{}
func (InstillAcceptFormatsCompiler) Compile ¶
func (InstillAcceptFormatsCompiler) Compile(ctx jsonschema.CompilerContext, m map[string]interface{}) (jsonschema.ExtSchema, error)
type InstillAcceptFormatsSchema ¶
type InstillAcceptFormatsSchema []string
func (InstillAcceptFormatsSchema) Validate ¶
func (s InstillAcceptFormatsSchema) Validate(ctx jsonschema.ValidationContext, v interface{}) error
type InstillFormatCompiler ¶
type InstillFormatCompiler struct{}
func (InstillFormatCompiler) Compile ¶
func (InstillFormatCompiler) Compile(ctx jsonschema.CompilerContext, m map[string]interface{}) (jsonschema.ExtSchema, error)
type InstillFormatSchema ¶
type InstillFormatSchema string
func (InstillFormatSchema) Validate ¶
func (s InstillFormatSchema) Validate(ctx jsonschema.ValidationContext, v interface{}) error
type Operator ¶
type Operator struct {
Component
}
Operator is the base struct for all operators
func (*Operator) AddOperatorDefinition ¶
func (o *Operator) AddOperatorDefinition(def *pipelinePB.OperatorDefinition) error
AddOperatorDefinition adds a operator definition to the operator
func (*Operator) GetOperatorDefinitionByID ¶
func (o *Operator) GetOperatorDefinitionByID(defID string, componentConfig *structpb.Struct) (*pipelinePB.OperatorDefinition, error)
GetOperatorDefinitionByID returns the operator definition by definition id
func (*Operator) GetOperatorDefinitionByUID ¶
func (o *Operator) GetOperatorDefinitionByUID(defUID uuid.UUID, componentConfig *structpb.Struct) (*pipelinePB.OperatorDefinition, error)
GetOperatorDefinitionByUID returns the operator definition by definition uid
func (*Operator) ListOperatorDefinitions ¶
func (o *Operator) ListOperatorDefinitions() []*pipelinePB.OperatorDefinition
ListOperatorDefinitions returns the list of operator definitions under this operator