cf

package
v0.0.0-...-3b0dce6 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CloudFlareURL main API URL - for resty only
	CloudFlareURL = "https://api.cloudflare.com/client/v4"
)

Variables

This section is empty.

Functions

func ListZones

func ListZones(token, email string) []cloudflare.Zone

get all our zones uses cloudflare-go library

Types

type ListWAFevents

type ListWAFevents struct {
	Pages []WAFevents
}

list of WAFevents

func GetAllZoneWAFevents

func GetAllZoneWAFevents(token, email, zoneID string, moment time.Time, duration time.Duration) (ListWAFevents, error)

func (*ListWAFevents) GetActionCount

func (list *ListWAFevents) GetActionCount(filter string) int

count with filter by Action for list

func (*ListWAFevents) GetResultCount

func (list *ListWAFevents) GetResultCount() int

get count of result events for list

func (*ListWAFevents) GetSourceCount

func (list *ListWAFevents) GetSourceCount(filter string) int

count with filter by Source for list

type WAFevents

type WAFevents struct {
	Result []struct {
		RayID   string `json:"ray_id"`
		Kind    string `json:"kind"`
		Source  string `json:"source"`
		Action  string `json:"action"`
		RuleID  string `json:"rule_id"`
		IP      string `json:"ip"`
		IPClass string `json:"ip_class"`
		Country string `json:"country"`
		Colo    string `json:"colo"`
		Host    string `json:"host"`
		Method  string `json:"method"`
		Proto   string `json:"proto"`
		Scheme  string `json:"scheme"`
		Ua      string `json:"ua"`
		URI     string `json:"uri"`
		Match   []struct {
			RuleID   string `json:"rule_id"`
			Source   string `json:"source"`
			Action   string `json:"action"`
			Metadata struct {
				IPClass string `json:"ip_class"`
			} `json:"metadata"`
		} `json:"matches"`
		OccurredAt string `json:"occurred_at"`
	} `json:"result"`
	ResultInfo struct {
		Cursors struct {
			After  string `json:"after"`
			Before string `json:"before"`
		} `json:"cursors"`
		ScannedRange struct {
			Since string `json:"since"`
			Until string `json:"until"`
		} `json:"scanned_range"`
	} `json:"result_info"`
	Success bool `json:"success"`
	Errors  []struct {
		Code    int    `json:"code"`
		Message string `json:"message"`
	} `json:"errors"`
	Messages []string `json:"messages"`
}

WAFevents main structure of response data of WAF events page

func GetPageZoneWAFevents

func GetPageZoneWAFevents(token, email, zoneID, cursor string, moment time.Time, duration time.Duration) (WAFevents, error)

get part events for WAF and Firewall for one separate zone uses resty library and WAFevents structure

func (*WAFevents) GetActionCount

func (resp *WAFevents) GetActionCount(filter string) int

count with filter by Action

func (*WAFevents) GetAfterCursor

func (resp *WAFevents) GetAfterCursor() string

get After cursor

func (*WAFevents) GetResultCount

func (resp *WAFevents) GetResultCount() int

get count of result events

func (*WAFevents) GetSourceCount

func (resp *WAFevents) GetSourceCount(filter string) int

count with filter by Source

Jump to

Keyboard shortcuts

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