Documentation
¶
Index ¶
- Constants
- func CalculatePropertiesMap(s *schema_validator.Schema, m *SchemaPropertiesMap) error
- func CompileJSONSchema(in []byte) (*schema_validator.Schema, error)
- func FromConfig(data Configuration, v any) error
- func GenerateJSONSchema(schema any) ([]byte, error)
- func SummaryTable(req *ExecutionRequest, opts ...RenderOpt) (string, error)
- func ValidateAttachmentRequest(i Integration, jsonPayload []byte) error
- func ValidateRegistrationRequest(i Integration, jsonPayload []byte) error
- type AttachmentRequest
- type AttachmentResponse
- type AvailablePlugins
- type ChainloopMetadata
- type ChainloopMetadataWorkflow
- type ChainloopMetadataWorkflowRun
- type Configuration
- type Credentials
- type ExecuteAttestation
- type ExecuteInput
- type ExecuteMaterial
- type ExecutionRequest
- type FanOut
- type FanOutFactory
- type FanOutIntegration
- func (i *FanOutIntegration) Attach(_ context.Context, _ *AttachmentRequest) (*AttachmentResponse, error)
- func (i *FanOutIntegration) Execute(_ context.Context, _ *ExecutionRequest) error
- func (i *FanOutIntegration) GetSubscribedMaterials() []*InputMaterial
- func (i *FanOutIntegration) IsSubscribedTo(m string) bool
- func (i *FanOutIntegration) Register(_ context.Context, _ *RegistrationRequest) (*RegistrationResponse, error)
- func (i *FanOutIntegration) String() string
- type FanOutP
- type InputMaterial
- type InputSchema
- type Integration
- type IntegrationBase
- type IntegrationBaseOptions
- type IntegrationInfo
- type NewOpt
- type NewParams
- type RegistrationRequest
- type RegistrationResponse
- type RenderOpt
- type SchemaPropertiesMap
- type SchemaProperty
Constants ¶
const IntegrationKindFanOut = "fan-out"
Variables ¶
This section is empty.
Functions ¶
func CalculatePropertiesMap ¶
func CalculatePropertiesMap(s *schema_validator.Schema, m *SchemaPropertiesMap) error
CalculatePropertiesMap Denormalizes the properties of a json schema
func CompileJSONSchema ¶
func CompileJSONSchema(in []byte) (*schema_validator.Schema, error)
CompileJSONSchema compiles a JSON schema using github.com/santhosh-tekuri/jsonschema
func FromConfig ¶
func FromConfig(data Configuration, v any) error
func GenerateJSONSchema ¶ added in v1.46.0
GenerateJSONSchema generates a flat JSON schema from a struct using https://github.com/invopop/jsonschema We've put some limitations on the kind of input structs we support, for example: - Nested schemas are not supported - Array based properties are not supported
func SummaryTable ¶ added in v0.14.0
func SummaryTable(req *ExecutionRequest, opts ...RenderOpt) (string, error)
func ValidateAttachmentRequest ¶ added in v1.46.0
func ValidateAttachmentRequest(i Integration, jsonPayload []byte) error
ValidateAttachmentRequest Validates the attachment payload against the attachment JSON schema
func ValidateRegistrationRequest ¶ added in v1.46.0
func ValidateRegistrationRequest(i Integration, jsonPayload []byte) error
ValidateRegistrationRequest Validates the registration payload against the registration JSON schema
Types ¶
type AttachmentRequest ¶
type AttachmentRequest struct {
Payload Configuration
RegistrationInfo *RegistrationResponse
}
type AttachmentResponse ¶
type AttachmentResponse struct {
// JSON serializable configuration to be persisted
Configuration
}
type AvailablePlugins ¶
type AvailablePlugins []*FanOutP
List of loaded integrations
func (AvailablePlugins) Cleanup ¶ added in v0.13.0
func (i AvailablePlugins) Cleanup()
type ChainloopMetadata ¶
type ChainloopMetadata struct {
Workflow *ChainloopMetadataWorkflow
WorkflowRun *ChainloopMetadataWorkflowRun
}
type ChainloopMetadataWorkflow ¶ added in v0.14.0
type ChainloopMetadataWorkflow struct {
ID, Name, Team, Project string
}
type ChainloopMetadataWorkflowRun ¶ added in v0.14.0
type Configuration ¶
type Configuration []byte
Configuration represents any raw configuration to be stored in the DB This wrapper is just a way to clearly indicate that the content needs to be JSON serializable
func ToConfig ¶
func ToConfig(m any) (Configuration, error)
type Credentials ¶
type Credentials struct {
URL, Username, Password string
}
type ExecuteAttestation ¶
type ExecuteInput ¶
type ExecuteInput struct {
Attestation *ExecuteAttestation
Materials []*ExecuteMaterial
}
An execute method will receive either the envelope or a material as input The material will contain its content as well as the metadata
type ExecuteMaterial ¶
type ExecuteMaterial struct {
*chainloop.NormalizedMaterial
// Content of the material already downloaded
Content []byte
}
type ExecutionRequest ¶
type ExecutionRequest struct {
*ChainloopMetadata
Input *ExecuteInput
RegistrationInfo *RegistrationResponse
AttachmentInfo *AttachmentResponse
}
ExecutionRequest is the request to execute the integration
type FanOut ¶
type FanOut interface {
// Integration has to be implemented by all integrations
Integration
// GetSubscribedMaterials returns material types an integration expect as part of the execution
GetSubscribedMaterials() []*InputMaterial
// IsSubscribedTo Returns if the integration is subscribed to the material type
IsSubscribedTo(materialType string) bool
// Execute runs the fanout integration
Execute(ctx context.Context, req *ExecutionRequest) error
}
FanOut a FanOut is an integration for which we expect to fan out data to other systems
type FanOutIntegration ¶
type FanOutIntegration struct {
*IntegrationBase
Logger *log.Helper
// contains filtered or unexported fields
}
FanOutIntegration provides a base implementation to be embedded in FanOut plugins
func (*FanOutIntegration) Attach ¶ added in v1.46.0
func (i *FanOutIntegration) Attach(_ context.Context, _ *AttachmentRequest) (*AttachmentResponse, error)
func (*FanOutIntegration) Execute ¶ added in v1.46.0
func (i *FanOutIntegration) Execute(_ context.Context, _ *ExecutionRequest) error
func (*FanOutIntegration) GetSubscribedMaterials ¶ added in v1.46.0
func (i *FanOutIntegration) GetSubscribedMaterials() []*InputMaterial
func (*FanOutIntegration) IsSubscribedTo ¶
func (i *FanOutIntegration) IsSubscribedTo(m string) bool
func (*FanOutIntegration) Register ¶ added in v1.46.0
func (i *FanOutIntegration) Register(_ context.Context, _ *RegistrationRequest) (*RegistrationResponse, error)
func (*FanOutIntegration) String ¶
func (i *FanOutIntegration) String() string
type InputMaterial ¶
type InputMaterial struct {
// Name of the material kind that the integration expects
Type schemaapi.CraftingSchema_Material_MaterialType
}
type InputSchema ¶
type InputSchema struct {
// Structs defining the registration and attachment schemas
Registration, Attachment any
}
type Integration ¶ added in v1.46.0
type Integration interface {
fmt.Stringer
Describe() *IntegrationInfo
// Register Validates, marshalls and returns the configuration that needs to be persisted
Register(ctx context.Context, req *RegistrationRequest) (*RegistrationResponse, error)
// Attach Validates that the attachment configuration is valid in the context of the provided registration
Attach(ctx context.Context, req *AttachmentRequest) (*AttachmentResponse, error)
}
Integration is the basic interface for all integrations
type IntegrationBase ¶ added in v1.46.0
type IntegrationBase struct {
// Identifier of the integration
ID string
// Friendly Name of the integration
Name string
// Integration version
Version string
// Optional description
Description string
// kinds of integration (e.g. "notification", "task-manager", "fanout", etc.)
Kinds []string
// contains filtered or unexported fields
}
IntegrationBase provides a base implementation to be embedded in integrations
func NewIntegrationBase ¶ added in v1.46.0
func NewIntegrationBase(opts *IntegrationBaseOptions) (*IntegrationBase, error)
NewIntegrationBase helper to create a new IntegrationBase
func (*IntegrationBase) Describe ¶ added in v1.46.0
func (i *IntegrationBase) Describe() *IntegrationInfo
type IntegrationBaseOptions ¶ added in v1.46.0
type IntegrationBaseOptions struct {
ID string
Name string
Version string
Description string
Kinds []string
Schema *InputSchema
}
IntegrationBaseOptions holds the options for creating a new IntegrationBase
type IntegrationInfo ¶
type IntegrationInfo struct {
// Identifier of the integration
ID string
// Friendly Name of the integration
Name string
// Integration version
Version string
// Integration description
Description string
// Kinds of integration (e.g. "notification", "task-manager", "fanout", etc.)
Kinds []string
// Schemas in JSON schema format
RegistrationJSONSchema, AttachmentJSONSchema []byte
}
type NewOpt ¶
type NewOpt func(*FanOutIntegration)
func WithInputMaterial ¶
func WithInputMaterial(materialType schemaapi.CraftingSchema_Material_MaterialType) NewOpt
type RegistrationRequest ¶
type RegistrationRequest struct {
// Custom Payload to be used by the integration
Payload Configuration
}
type RegistrationResponse ¶
type RegistrationResponse struct {
// Credentials to be persisted in Credentials Manager
// JSON serializable
Credentials *Credentials
// Configuration to be persisted in DB
Configuration
}
type RenderOpt ¶ added in v0.14.0
type RenderOpt func(r *renderer) error
func WithFormat ¶ added in v0.14.0
func WithMaxSize ¶ added in v0.16.0
type SchemaPropertiesMap ¶
type SchemaPropertiesMap map[string]*SchemaProperty