helpers

package
v0.0.0-...-b75b796 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2021 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ByteCountDecimal

func ByteCountDecimal(b int64) string

func Check

func Check(e error, panicCheck bool, logs string, trace TraceData)

Check logger for errors

func GetConfig

func GetConfig() (*config.ServerDetails, error)

GetConfig get config from cli

func GetMetricsDataJSON

func GetMetricsDataJSON(config *config.ServerDetails, prettyPrint bool) ([]byte, error)

func GetMetricsDataRaw

func GetMetricsDataRaw(config *config.ServerDetails) ([]byte, error)

func GetRestAPI

func GetRestAPI(method string, auth bool, urlInput string, config *config.ServerDetails, providedfilepath string, header map[string]string, retry int) ([]byte, int, http.Header)

GetRestAPI GET rest APIs response with error handling

func GetServersIdAndDefault

func GetServersIdAndDefault() ([]string, string, error)

func GetStatus

func GetStatus(repo, pkgtype, uri, sha256, scanType string, config *config.ServerDetails) (string, bool)

func StringToInt64

func StringToInt64(data string) (int64, error)

StringToInt64 self explanatory

Types

type Data

type Data struct {
	Name   string    `json:"name"`
	Help   string    `json:"help"`
	Type   string    `json:"type"`
	Metric []Metrics `json:"metrics"`
}

Data struct

func GetMetricsData

func GetMetricsData(config *config.ServerDetails, counter int, prettyPrint bool, interval int) ([]Data, string, int, error)

type Extensions

type Extensions struct {
	Extension string `json:"extension"`
	IsFile    bool   `json:"is_file"`
}

type FileInfo

type FileInfo struct {
	Size     string          `json:"size"`
	MimeType string          `json:"mimeType"`
	Children []FileInfoChild `json:"children"`
}

type FileInfoChild

type FileInfoChild struct {
	Uri string `json:"uri"`
}

type FileList

type FileList struct {
	Files []Files `json:"files"`
}

type Files

type Files struct {
	Uri    string `json:"uri"`
	Sha256 string `json:"sha2"`
}

type IndexedRepo

type IndexedRepo struct {
	Name    string `json:"name"`
	PkgType string `json:"pkgType"`
	Type    string `json:"type"`
}

func CheckTypeAndRepoParams

func CheckTypeAndRepoParams(config *config.ServerDetails) ([]IndexedRepo, error)

Test if remote repository exists and is a remote

type LabelsStruct

type LabelsStruct struct {
	Start     string `json:"start"`
	End       string `json:"end"`
	Status    string `json:"status"`
	Type      string `json:"type"`
	Max       string `json:"max"`
	Pool      string `json:"pool"`
	QueueName string `json:"queue_name"`
}

LabelsStruct struct

type Metrics

type Metrics struct {
	TimestampMs string       `json:"timestamp_ms"`
	Value       string       `json:"value"`
	Labels      LabelsStruct `json:"labels,omitempty"`
}

Metrics struct

type SupportedPackageType

type SupportedPackageType struct {
	Type      string       `json:"type"`
	Extension []Extensions `json:"extensions"`
}

type SupportedTypes

type SupportedTypes struct {
	SupportedPackageTypes []SupportedPackageType `json:"supportedPackageTypes"`
}

func GetSupportedTypesJSON

func GetSupportedTypesJSON() (SupportedTypes, error)

type TraceData

type TraceData struct {
	File string
	Line int
	Fn   string
}

TraceData trace data struct

func Trace

func Trace() TraceData

Trace get function data

Jump to

Keyboard shortcuts

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