domain

package
v0.0.0-...-c3bd378 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2022 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GoogleCloudBucket HostProvider = iota
	SourceFlow        FlowType     = iota
	SinkFlow
)
View Source
const NormalMode = 0666
View Source
const Parsed = "parsed"

Variables

This section is empty.

Functions

This section is empty.

Types

type Bucket

type Bucket struct {
	Name string `json:"name"`
}

type BucketRepository

type BucketRepository interface {
	List(projectId string) (buckets []Bucket, err error)
	FileExists(fileName string) (fileExists bool, err error)
	DownloadFile(fileName string) (success bool, err error)
	UploadFile(fileName string) (success bool, err error)
}

type Buckets

type Buckets struct {
	Buckets []Bucket `json:"buckets"`
}

type CloudFile

type CloudFile struct {
	Name string `json:"name"`
}

type CloudFiles

type CloudFiles struct {
	Names []CloudFile
}

type CloudPath

type CloudPath struct {
	Path string `json:"path"`
}

type CloudPaths

type CloudPaths struct {
	Paths []CloudPath
}

type CloudStorage

type CloudStorage struct {
	HostProvider HostProvider //Host location for log files, e.g., google cloud bucket
	ProjectId    string       //Project Id for this GCP storage account
	FlowType     FlowType     //source or sink
}

type Existence

type Existence struct {
	Exists bool `json:"exists"`
}

type File

type File struct {
	Id       int
	Name     string  `json:"name"`
	ErrorMsg string  `json:"error"`
	Contents LogFile `json:"logFile"`
	Bytes    []byte  `json:"bytes"`
}

func NewFile

func NewFile(fileName string) *File

NewFile returns a value representing a file. In our case only contains the file name

func (*File) AllFullParsedPath

func (f *File) AllFullParsedPath() string

Path returns the file's full path with filename (less parent directory)

func (*File) AllParsedPath

func (f *File) AllParsedPath() string

Path returns the file's parsed path (less parent directory)

func (*File) ContentsJson

func (f *File) ContentsJson() string

ContentsJson returns the file's Contents in json

func (*File) Exists

func (f *File) Exists() bool

Exists returns true if the file exists locally and is visible to the current user.

func (*File) FormatJson

func (f *File) FormatJson() (newContents string, err error)

FormatJson creates parsed directory and creates a proper .json file from the contents of the .jsonl file

func (*File) FullHostPath

func (f *File) FullHostPath(cloudDir string) string

Path returns the file's full absolute path with filename.

func (*File) FullLocalPath

func (f *File) FullLocalPath() string

Path returns the file's full absolute path with filename.

func (*File) FullParsedFileName

func (f *File) FullParsedFileName(i int) string

func (*File) FullPath

func (f *File) FullPath() string

Path returns the file's full path with filename (less parent directory)

func (*File) HostPath

func (f *File) HostPath(cloudDir string) string

Path returns the file's full host path

func (*File) LocalParsedPath

func (f *File) LocalParsedPath() string

Path returns the file's full path (less parent directory)

func (*File) LocalPath

func (f *File) LocalPath() string

Path returns the file's full local path

func (*File) NameOnly

func (f *File) NameOnly() string

NameOnly returns the file name only (no path and no extension)

func (*File) Parse

func (f *File) Parse(fileBytes []byte) (logFiles *[]LogFile, err error)

Parse parses the file Contents of JSONL (w/o new lines) into JSON

func (*File) Path

func (f *File) Path() string

Path returns the file's path (no parent directory)

func (*File) Read

func (f *File) Read() (bytes []byte, err error)

Read the downloaded file into a byte array

func (*File) ReadLogFiles

func (f *File) ReadLogFiles() (logFiles []LogFile, multiStatus MultiStatus, err error)

Read grabs the parsed data-packet json objects associated with the file

func (*File) ToJson

func (f *File) ToJson() string

func (*File) Write

func (f *File) Write(bytes []byte) (err error)

Write writes out the file's Contents to disk.

type FileRepository

type FileRepository interface {
	Store(file File)
	FindById(id int) File
}

type FlowType

type FlowType int

type HostProvider

type HostProvider int

type LocalRepository

type LocalRepository interface {
	FileExists(fileName string) (fileExists bool, err error)
}

type LogFile

type LogFile struct {
	EventId     int    `json:"eventId"`
	Timestamp   int64  `json:"timestamp"`
	Description string `json:"description"`
	User
}

func NewLogFile

func NewLogFile(logfileJson string) (logFile *LogFile, err error)

func (*LogFile) ToJson

func (lf *LogFile) ToJson() (logFileJson string, err error)

func (*LogFile) Write

func (lf *LogFile) Write(logFilename, contents string) (err error)

type MultiStatus

type MultiStatus struct {
	OutcomeAndMsgs []OutcomeAndMsg
}

type Outcome

type Outcome struct {
	Success bool `json:"success"`
}

type OutcomeAndMsg

type OutcomeAndMsg struct {
	Success bool   `json:"success"`
	Message string `json:"message"`
}

type User

type User struct {
	UserId     int    `json:"userId"`
	Country    string `json:"country"`
	DeviceType string `json:"deviceType"`
	IP         string `json:"ip"`
	SrcPort    int    `json:"srcPort"`
}

Jump to

Keyboard shortcuts

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