cloudflare

package
v0.0.0-...-38b46e5 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2016 License: Apache-2.0 Imports: 23 Imported by: 1

Documentation

Index

Constants

View Source
const (
	API_BASE = "https://api.cloudflare.com"
)

Variables

This section is empty.

Functions

func BuildMapStr

func BuildMapStr(logEntry map[string]interface{}) common.MapStr

BuildMapStr creates a valid common.MapStr struct only containing non-empty fields

func DeleteLogLife

func DeleteLogLife(filename string)

Types

type CloudflareClient

type CloudflareClient struct {
	ApiKey         string
	Email          string
	UserServiceKey string
	RequestLogFile *RequestLogFile
	LogfileName    string
	// contains filtered or unexported fields
}

func NewClient

func NewClient(params map[string]interface{}) *CloudflareClient

NewClient returns a new instance of a CloudflareClient struct

func (*CloudflareClient) GetLogRangeFromTimestamp

func (c *CloudflareClient) GetLogRangeFromTimestamp(opts map[string]interface{}) (string, error)

type LogConsumer

type LogConsumer struct {
	TotalLogFileSegments int

	LogFilesReady         chan string
	EventsReady           chan common.MapStr
	CompletedNotifier     chan bool
	ProcessorTerminateSig chan bool
	WaitGroup             sync.WaitGroup
	// contains filtered or unexported fields
}

func NewLogConsumer

func NewLogConsumer(cfEmail string, cfAPIKey string, numSegments int, eventBufferSize int, processors int) *LogConsumer

NewLogConsumer reutrns a instance of the LogConsumer struct

func (*LogConsumer) DownloadCurrentLogFiles

func (lc *LogConsumer) DownloadCurrentLogFiles(zoneTag string, timeStart int, timeEnd int)

DownloadCurrentLogFiles downloads the log file segments from the Cloudflare ELS API

func (*LogConsumer) PrepareEvents

func (lc *LogConsumer) PrepareEvents()

type Properties

type Properties struct {
	LastStartTS   int `json:"last_start_ts"`
	LastEndTS     int `json:"last_end_ts"`
	LastCount     int `json:"last_count"`
	LastRequestTS int `json:"last_request_ts"`
	LastUpdateTS  int `json:"last_update_ts"`
}

func (*Properties) ToJsonBytes

func (p *Properties) ToJsonBytes() []byte

type RequestLogFile

type RequestLogFile struct {
	Filename string
}

func NewRequestLogFile

func NewRequestLogFile(filename string) *RequestLogFile

func (*RequestLogFile) Destroy

func (l *RequestLogFile) Destroy()

func (*RequestLogFile) SaveFromHttpResponseBody

func (l *RequestLogFile) SaveFromHttpResponseBody(respBody *goreq.Body) (int64, error)

type StateFile

type StateFile struct {
	FileName    string
	FilePath    string
	ZoneName    string
	StorageType string
	// contains filtered or unexported fields
}

func NewStateFile

func NewStateFile(config map[string]string) (*StateFile, error)

func (*StateFile) GetLastCount

func (s *StateFile) GetLastCount() int

func (*StateFile) GetLastEndTS

func (s *StateFile) GetLastEndTS() int

func (*StateFile) GetLastRequestTS

func (s *StateFile) GetLastRequestTS() int

func (*StateFile) GetLastStartTS

func (s *StateFile) GetLastStartTS() int

func (*StateFile) Save

func (s *StateFile) Save() error

func (*StateFile) UpdateLastCount

func (s *StateFile) UpdateLastCount(count int)

func (*StateFile) UpdateLastEndTS

func (s *StateFile) UpdateLastEndTS(ts int)

func (*StateFile) UpdateLastRequestTS

func (s *StateFile) UpdateLastRequestTS(ts int)

func (*StateFile) UpdateLastStartTS

func (s *StateFile) UpdateLastStartTS(ts int)

Jump to

Keyboard shortcuts

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