client

package
v4.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 13, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsNotFoundError

func IsNotFoundError(target error) bool

func JSONMarshal

func JSONMarshal(t any) ([]byte, error)

We cannot use `json.MarshalIndent` because it will escape HTML by default. An Encoder will let us control that behavior, and add the indenting we want.

func SkipThisError

func SkipThisError(msg string) bool

Validation errors can be wordy and redundant. Skip ones that don't make sense ourside of the schema's context.

Types

type AccessKey

type AccessKey struct {
	Id             string `json:"id"`
	Title          string `json:"title"`
	SharedSourceId string `json:"gateway_route_id"`
	Type           string `json:"type"`
	Key            string `json:"key,omitempty"`
}

type Alert

type Alert struct {
	Id            string         `json:"id,omitempty"`
	PipelineId    string         `json:"pipeline_id,omitempty"`
	ComponentKind string         `json:"component_kind,omitempty"`
	ComponentId   string         `json:"component_id,omitempty"`
	Inputs        []string       `json:"inputs,omitempty"`
	AlertConfig   map[string]any `json:"alert_config,omitempty"`
	Active        bool           `json:"active"`
}

Represents an Alert, which is similar to a component, but not treated as such.

type ApiResponseError

type ApiResponseError struct {
	Message string            `json:"message"`
	Code    string            `json:"code,omitempty"`
	Status  uint16            `json:"status"`
	Errors  []validationError `json:"errors,omitempty"`
}

func (ApiResponseError) Error

func (e ApiResponseError) Error() string

implement errors.Error interface

type BaseNode

type BaseNode struct {
	Id           string         `json:"id,omitempty"`
	Type         string         `json:"type"`
	Inputs       []string       `json:"inputs,omitempty"`
	Title        string         `json:"title,omitempty"`
	Description  string         `json:"description,omitempty"`
	UserConfig   map[string]any `json:"user_config"`
	GenerationId int64          `json:"generation_id"`
}

Represents a source, processor or destination.

type Client

type Client interface {
	Pipeline(id string, ctx context.Context) (*Pipeline, error)
	CreatePipeline(pipeline *Pipeline, ctx context.Context) (*Pipeline, error)
	UpdatePipeline(pipeline *Pipeline, ctx context.Context) (*Pipeline, error)
	DeletePipeline(id string, ctx context.Context) error

	Source(pipelineId string, id string, ctx context.Context) (*Source, error)
	CreateSource(pipelineId string, component *Source, ctx context.Context) (*Source, error)
	UpdateSource(pipelineId string, component *Source, ctx context.Context) (*Source, error)
	DeleteSource(pipelineId string, id string, ctx context.Context) error

	Destination(pipelineId string, id string, ctx context.Context) (*Destination, error)
	CreateDestination(pipelineId string, component *Destination, ctx context.Context) (*Destination, error)
	UpdateDestination(pipelineId string, component *Destination, ctx context.Context) (*Destination, error)
	DeleteDestination(pipelineId string, id string, ctx context.Context) error

	Processor(pipelineId string, id string, ctx context.Context) (*Processor, error)
	CreateProcessor(pipelineId string, component *Processor, ctx context.Context) (*Processor, error)
	UpdateProcessor(pipelineId string, component *Processor, ctx context.Context) (*Processor, error)
	DeleteProcessor(pipelineId string, id string, ctx context.Context) error

	Alert(pipelineId string, id string, ctx context.Context) (*Alert, error)
	CreateAlert(pipelineId string, alert *Alert, ctx context.Context) (*Alert, error) // POST
	UpdateAlert(pipelineId string, alert *Alert, ctx context.Context) (*Alert, error) // PUT
	DeleteAlert(pipelineId string, alert *Alert, ctx context.Context) error           // DELETE

	CreateAccessKey(accessKey *AccessKey, ctx context.Context) (*AccessKey, error)
	DeleteAccessKey(accessKey *AccessKey, ctx context.Context) error

	SharedSource(id string, ctx context.Context) (*SharedSource, error)
	CreateSharedSource(source *SharedSource, ctx context.Context) (*SharedSource, error)
	UpdateSharedSource(source *SharedSource, ctx context.Context) (*SharedSource, error)
	DeleteSharedSource(source *SharedSource, ctx context.Context) error

	PublishPipeline(pipelineId string, ctx context.Context) (*PublishPipeline, error)
}

func NewClient

func NewClient(endpoint string, authKey string, headers map[string]string) Client

type Destination

type Destination struct {
	BaseNode
}

type Pipeline

type Pipeline struct {
	Id        string     `json:"id,omitempty"`
	Title     string     `json:"title"`
	CreatedAt *time.Time `json:"created_at,omitempty"`
	UpdatedAt *time.Time `json:"updated_at,omitempty"`
}

Represents a Pipeline.

type Processor

type Processor struct {
	BaseNode
	Outputs []struct {
		Id    string `json:"id"`
		Label string `json:"label"`
	} `json:"outputs,omitempty"`
}

type PublishPipeline

type PublishPipeline struct {
	PipelineId string `json:"id"`
}

type SharedSource

type SharedSource struct {
	Id          string `json:"id"`
	ConsumerId  string `json:"consumer_id"`
	Title       string `json:"title"`
	Description string `json:"description,omitempty"`
	Type        string `json:"type"`
}

type Source

type Source struct {
	BaseNode
	SharedSourceId string `json:"gateway_route_id,omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL