api

package
v0.21.0 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExpandEntity

func ExpandEntity(e *Entity, fExpand func(string) string)

func GetClientsCompletion

func GetClientsCompletion(pattern string) []string

func GetDatasetsCompletion

func GetDatasetsCompletion(pattern string) []string

func GetJobsCompletion

func GetJobsCompletion(pattern string) []string

func ValueExpander

func ValueExpander(nsMap map[string]interface{}) func(string) string

Types

type AccessControl

type AccessControl struct {
	Resource string
	Action   string
	Deny     bool
}

type ClientInfo

type ClientInfo struct {
	ClientId  string
	PublicKey []byte
	Deleted   bool
}

type CollectorSink

type CollectorSink struct {
	Entities          []*Entity
	ContinuationToken string
	Context           *Entity
}

func (*CollectorSink) End

func (s *CollectorSink) End()

func (*CollectorSink) ProcessEntities

func (s *CollectorSink) ProcessEntities(entities []*Entity) error

func (*CollectorSink) Start

func (s *CollectorSink) Start()

type ConsoleSink

type ConsoleSink struct {
	// contains filtered or unexported fields
}

func (*ConsoleSink) End

func (s *ConsoleSink) End()

func (*ConsoleSink) ProcessEntities

func (s *ConsoleSink) ProcessEntities(entities []*Entity) error

func (*ConsoleSink) Start

func (s *ConsoleSink) Start()

type Dataset

type Dataset struct {
	Name  string   `json:"name"`
	Type  []string `json:"type"`
	Items int      `json:"items"`
}

type DatasetManager

type DatasetManager struct {
	// contains filtered or unexported fields
}

func NewDatasetManager

func NewDatasetManager(server string, token string) *DatasetManager

func (*DatasetManager) Get

func (dm *DatasetManager) Get(name string) (*Entity, error)

func (*DatasetManager) List

func (dm *DatasetManager) List() ([]Dataset, error)

func (*DatasetManager) Rename

func (dm *DatasetManager) Rename(name string, newName string) error

type DatasetType

type DatasetType string
const (
	Entities DatasetType = "entities"
	Changes  DatasetType = "changes"
)

type Entity

type Entity struct {
	ID         string                 `json:"id"`
	Recorded   uint64                 `json:"recorded"`
	IsDeleted  bool                   `json:"deleted"`
	References map[string]interface{} `json:"refs"`
	Properties map[string]interface{} `json:"props"`
}

func NewContext

func NewContext() *Entity

func NewContextWithNamespaces

func NewContextWithNamespaces(namespaces map[string]interface{}) *Entity

func NewContinuation added in v0.16.0

func NewContinuation() *Entity

func NewEntity

func NewEntity(ID string) *Entity

NewEntity Create a new entity with global uri and internal resource id

func NewEntityFromMap

func NewEntityFromMap(data map[string]interface{}) *Entity

func (*Entity) GetProperty

func (e *Entity) GetProperty(propName string) interface{}

GetProperty returns the value of the named property as an interface

func (*Entity) GetStringProperty

func (e *Entity) GetStringProperty(propName string) string

GetStringProperty returns the string value of the requested property

type EntityListDatasource

type EntityListDatasource struct {
	Entities []*Entity
}

type EntityManager

type EntityManager struct {
	// contains filtered or unexported fields
}

func NewEntityManager

func NewEntityManager(server string, token string, ctx context.Context, dsType DatasetType) *EntityManager

func (*EntityManager) Read

func (em *EntityManager) Read(dataset string, since string, limit int, reverse bool, sink Sink) error

type EntityQuery

type EntityQuery struct {
	// contains filtered or unexported fields
}

func NewEntityQuery

func NewEntityQuery(server string, token string) *EntityQuery

func (*EntityQuery) Query

func (eq *EntityQuery) Query(
	entity []string,
	via string,
	inverse bool,
	datasets []string,
	limit int,
	continuations []string,
) ([]interface{}, error)

type EntityStreamParser

type EntityStreamParser struct {
	// contains filtered or unexported fields
}

func NewEntityStreamParser

func NewEntityStreamParser() *EntityStreamParser

func (*EntityStreamParser) ParseStream

func (esp *EntityStreamParser) ParseStream(reader io.Reader, emitEntity func(*Entity) error) error

type HistoryView

type HistoryView struct {
	LastRun      string
	LastDuration string
}

type Job

type Job struct {
	Title       string                 `json:"title"`
	Id          string                 `json:"id"`
	Description string                 `json:"description"`
	Tags        []string               `json:"tags"`
	Source      map[string]interface{} `json:"source"`
	Sink        map[string]interface{} `json:"sink"`
	Transform   map[string]interface{} `json:"transform"`
	Triggers    []JobTrigger           `json:"triggers"`
	Paused      bool                   `json:"paused"`
	BatchSize   int                    `json:"batchSize"`
}

type JobHistory

type JobHistory struct {
	Id        string    `json:"id"`
	Title     string    `json:"title"`
	Start     time.Time `json:"start"`
	End       time.Time `json:"end"`
	LastError string    `json:"lastError"`
	Processed int       `json:"processed"`
}

type JobId added in v0.17.0

type JobId struct {
	Title string
	Id    string
}

type JobManager

type JobManager struct {
	Operate *JobOperation
	// contains filtered or unexported fields
}

func NewJobManager

func NewJobManager(server string, token string) *JobManager

func (*JobManager) AddJob

func (jm *JobManager) AddJob(config []byte) (*Job, error)

AddJob adds a new job to the scheduler

func (*JobManager) AddTransform

func (jm *JobManager) AddTransform(job *Job, transform string) (*Job, error)

AddTransform adds a transform to an existing job and updates the job on the server

func (*JobManager) DeleteJob

func (jm *JobManager) DeleteJob(jobId string) error

DeleteJob deletes a job

func (*JobManager) GetJob

func (jm *JobManager) GetJob(jobId string) (*Job, error)

GetJob gets a job given its id, or error if not found.

func (*JobManager) GetJobHistories

func (jm *JobManager) GetJobHistories() []JobHistory

func (*JobManager) GetJobHistoryForId

func (jm *JobManager) GetJobHistoryForId(id string) (JobHistory, error)

func (*JobManager) GetJobListWithHistory

func (jm *JobManager) GetJobListWithHistory() []JobOutputViewItem

func (*JobManager) GetJobStatus

func (jm *JobManager) GetJobStatus(jobId string) ([]JobStatus, error)

GetJobStatus get the status for a given id or all running jobs

func (*JobManager) GetJobs

func (jm *JobManager) GetJobs() []Job

func (*JobManager) ResolveId

func (jm *JobManager) ResolveId(title string) string

func (*JobManager) ResolveIds added in v0.17.0

func (jm *JobManager) ResolveIds(titles ...string) []JobId

func (*JobManager) UpdateJob

func (jm *JobManager) UpdateJob(job *Job) (*Job, error)

UpdateJob updates a job

type JobOperation added in v0.17.0

type JobOperation struct {
	// contains filtered or unexported fields
}

func NewJobOperation added in v0.17.0

func NewJobOperation(server string, token string) *JobOperation

NewJobOperation will return a new JobOperation service. If you are already using the JobManager, then this will have been initiated for you already, and you can call jm.Operate.XX. Note that all methods take an ignored context, these should be refactored later together with a rework of the http clients, as they are a bit all over the place.

func (*JobOperation) Kill added in v0.17.0

Kill will attempt to stop an already running job

func (*JobOperation) Pause added in v0.17.0

Pause will pause the operation of a job

func (*JobOperation) Reset added in v0.17.0

func (o *JobOperation) Reset(_ context.Context, jobId string, since string) (JobOperationResponse, error)

Reset will reset the since tokens on a job, running the job from the start of the dataset

func (*JobOperation) Resume added in v0.17.0

Resume will resume a paused job

func (*JobOperation) Run added in v0.17.0

func (o *JobOperation) Run(_ context.Context, jobId string, jobType string) (JobOperationResponse, error)

Run will attempt to manually start a job

func (*JobOperation) Test added in v0.17.0

Test is just for testing and will always fail

type JobOperationResponse added in v0.17.0

type JobOperationResponse struct {
	JobId string `json:"jobId"`
}

type JobOutput

type JobOutput struct {
	Job     Job
	History *JobHistory
}

type JobOutputViewItem

type JobOutputViewItem struct {
	Job         Job          `json:"job"`
	History     *JobHistory  `json:"history"`
	HistoryView *HistoryView `json:"historyView"`
}

type JobStatus

type JobStatus struct {
	JobId    string    `json:"jobId"`
	JobTitle string    `json:"jobTitle"`
	Started  time.Time `json:"started"`
}

type JobTrigger

type JobTrigger struct {
	TriggerType      string `json:"triggerType"`
	JobType          string `json:"jobType"`
	Schedule         string `json:"schedule"`
	MonitoredDataset string `json:"monitoredDataset"`
}

type Pipeline

type Pipeline struct {
	// contains filtered or unexported fields
}

func NewPipeline

func NewPipeline(source Source, sink Sink) *Pipeline

func (*Pipeline) Sync

func (pipeline *Pipeline) Sync(ctx context.Context, since string, limit int) error

type PrettySink

type PrettySink struct{}

func (*PrettySink) End

func (s *PrettySink) End()

func (*PrettySink) ProcessEntities

func (s *PrettySink) ProcessEntities(entities []*Entity) error

func (*PrettySink) Start

func (s *PrettySink) Start()

type ProviderConfig

type ProviderConfig struct {
	Name         string       `json:"name"`
	Type         string       `json:"type"`
	User         *ValueReader `json:"user,omitempty"`
	Password     *ValueReader `json:"password,omitempty"`
	ClientId     *ValueReader `json:"key,omitempty"`
	ClientSecret *ValueReader `json:"secret,omitempty"`
	Audience     *ValueReader `json:"audience,omitempty"`
	GrantType    *ValueReader `json:"grantType,omitempty"`
	Endpoint     *ValueReader `json:"endpoint,omitempty"`
}

type RawSink

type RawSink struct {
	// contains filtered or unexported fields
}

func (*RawSink) End

func (s *RawSink) End()

func (*RawSink) ProcessEntities

func (s *RawSink) ProcessEntities(entities []*Entity) error

func (*RawSink) Start

func (s *RawSink) Start()

type SecurityManager

type SecurityManager struct {
	// contains filtered or unexported fields
}

func NewSecurityManager

func NewSecurityManager(server string, token string) *SecurityManager

func (*SecurityManager) AddClient

func (secManager *SecurityManager) AddClient(id string, key []byte) error

func (*SecurityManager) AddClientAcl

func (secManager *SecurityManager) AddClientAcl(id string, acls []byte) error

func (*SecurityManager) AddTokenProvider

func (secManager *SecurityManager) AddTokenProvider(tokenProviderConfig []byte) error

func (*SecurityManager) DeleteClient

func (secManager *SecurityManager) DeleteClient(id string) error

func (*SecurityManager) GetClientAcl

func (secManager *SecurityManager) GetClientAcl(id string) ([]AccessControl, error)

func (*SecurityManager) ListClients

func (secManager *SecurityManager) ListClients() (map[string]ClientInfo, error)

func (*SecurityManager) ListTokenProviders

func (secManager *SecurityManager) ListTokenProviders() ([]ProviderConfig, error)

type Sink

type Sink interface {
	ProcessEntities(entities []*Entity) error
	Start()
	End()
}

type SinkExpander

type SinkExpander struct {
	Sink Sink
}

func (SinkExpander) End

func (s SinkExpander) End()

func (SinkExpander) ProcessEntities

func (s SinkExpander) ProcessEntities(entities []*Entity) error

func (SinkExpander) Start

func (s SinkExpander) Start()

type Source

type Source interface {
	// contains filtered or unexported methods
}

type StdinDatasetSource

type StdinDatasetSource struct{}

type TxnManager

type TxnManager struct {
	// contains filtered or unexported fields
}

func NewTxnManager

func NewTxnManager(server string, token string) *TxnManager

func (*TxnManager) ExecuteTransaction

func (txnMgr *TxnManager) ExecuteTransaction(txnData []byte) error

ExecuteTransaction send txn to the server for execution

type ValueReader

type ValueReader struct {
	Type  string `json:"type"`
	Value string `json:"value"`
}

Jump to

Keyboard shortcuts

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