utils

package
Version: v0.2.2 Latest Latest
Warning

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

Go to latest
Published: May 20, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AgentStart   = "StartAgent"
	AgentStop    = "StopAgent"
	AgentRestart = "RestartAgent"

	SinkStart   = "StartSink"
	SinkStop    = "StopSink"
	SinkRestart = "RestartSink"

	SourceStart   = "StartSource"
	SourceStop    = "StopSource"
	SourceRestart = "RestartSource"
	SourceQuery   = "QuerySource"
	SourceMeta    = "SourceMeta"

	TaskPending = "PENDING"
	TaskRunning = "IN_PROGRESS"
	TaskDone    = "SUCCEEDED"
	TaskOnError = "FAILED"
)

Available Task constants

Variables

This section is empty.

Functions

func DecryptString

func DecryptString(cryptoText string, keyString string) (plainTextString string, err error)

DecryptString decrypt cryptoText string with keyString key string

func EncryptBytes

func EncryptBytes(plainText []byte, keyString string) ([]byte, error)

EncryptBytes encrypt plainText bytes with keyString key string

func EncryptString

func EncryptString(plainText string, keyString string) (string, error)

EncryptString encrypt plainText string with keyString key string

func EscapeCtrl

func EscapeCtrl(ctrl []byte) (esc []byte)

EscapeCtrl escape ctrl character

func InSlice added in v0.2.2

func InSlice(slice []string, val string) bool

FindInSlice check is val is in slice

func IsStandalone

func IsStandalone(v *viper.Viper) bool

IsStandalone check if collector is in standalone mode

Types

type Filter

type Filter struct {
	FilterPolicy string                 `json:"filter_policy" mapstructure:"filter_policy"`
	Filter       map[string]interface{} `json:"filter"`
}

Filter Represents a filter (which will allow to specify the data the user want to replicate or not on the database, schema, table or column level.

func (*Filter) IsFilteredColumn

func (f *Filter) IsFilteredColumn(database string, table string, column string) bool

IsFilteredColumn check if column is filtered

func (*Filter) IsFilteredDatabase

func (f *Filter) IsFilteredDatabase(database string) bool

IsFilteredDatabase check if database is filtered

func (*Filter) IsFilteredTable

func (f *Filter) IsFilteredTable(database string, table string) bool

IsFilteredTable check if table is filtered

type Meta

type Meta struct {
	Name      string      `json:"name"`
	Timestamp int64       `json:"timestamp"`
	Value     interface{} `json:"value"`
}

Meta description a metadata is an indicator send to API

func NewMeta

func NewMeta(name string, value interface{}) Meta

NewMeta return new meta with timestamp automatically set

type Metas

type Metas struct {
	Agent   map[string]Meta            `json:"agent"`
	Sources map[string]map[string]Meta `json:"sources"`
	Sinks   map[string]map[string]Meta `json:"sinks"`
}

Metas contains all metadata for the collector itself, the configured source and configured sink

func NewMetas

func NewMetas() (meta Metas)

NewMetas init meta struct

func (*Metas) SetMetaSinks

func (m *Metas) SetMetaSinks(sinkName string, meta Meta)

SetMetaSinks Add a metadata to a sink within the Metas struct

func (*Metas) SetMetaSources

func (m *Metas) SetMetaSources(sourceName string, meta Meta)

SetMetaSources add a metadata to a source within the Metas struct

type ParametersDescription

type ParametersDescription struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	Type        string `json:"type"`
	Required    bool   `json:"required"`
}

ParametersDescription parameters description

type Task

type Task struct {
	ID           string                 `json:"id"`
	TaskType     string                 `json:"taskType" mapstructure:"taskType"`
	Target       string                 `json:"target"`
	CreatedAt    int64                  `json:"created_at"`
	StartDate    int64                  `json:"start_date"`
	EndDate      int64                  `json:"end_date"`
	Status       string                 `json:"status"`
	Description  string                 `json:"description"`
	Parameters   map[string]interface{} `json:"params" mapstructure:"params"`
	ErrorDetails string                 `json:"error_details,omitempty"`
}

Task task description a task is an action getted from API

type TaskDescription

type TaskDescription struct {
	Description string                   `json:"description"`
	Parameters  []*ParametersDescription `json:"params" mapstructure:"params"`
}

TaskDescription task description

func DeclareNewTaskDescription

func DeclareNewTaskDescription(class interface{}, description string) (task *TaskDescription)

DeclareNewTaskDescription Create a new task type by describing it

Jump to

Keyboard shortcuts

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