utils

package
v0.0.0-...-28787c5 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2023 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TokenType_APIKEY = iota
	TokenType_BEARER = iota
)
View Source
const (
	KeyCluster    = "cluster"
	KeyPort       = "port"
	DefaultPort   = "8081"
	KeyNamespace  = "namespace"
	AuthToken     = "uitoken"
	KeyUiUser     = "uiuser"
	KeyUiPassword = "uipassword"
)
View Source
const LineBreaksKey = "lineBreaksAfterEachLogEntry"

Variables

View Source
var EventRuleGroupsFlag string
View Source
var FlagAppName string
View Source
var FlagBegTime string
View Source
var FlagCluster string
View Source
var FlagDashboardName string
View Source
var FlagDashboardSource string
View Source
var FlagEnablePsmod bool
View Source
var FlagEnableSerial bool
View Source
var FlagEndTime string
View Source
var FlagFile string
View Source
var FlagInputMap string
View Source
var FlagLogsFollow bool
View Source
var FlagLogsPageSize uint32
View Source
var FlagLogsSince string
View Source
var FlagMaxLogLines int
View Source
var FlagNamespace string
View Source
var FlagNetTrace bool
View Source
var FlagOut string
View Source
var FlagParCopies int
View Source
var FlagParPeriod int
View Source
var FlagProcId string
View Source
var FlagRegex bool
View Source
var FlagSubSecond bool
View Source
var FlagTimeFormat string

Functions

func AddNetTrace

func AddNetTrace(req *http.Request) *http.Request

func CheckMesgErr

func CheckMesgErr(resp map[string]interface{}, orgi string)

func GetClusterUrl

func GetClusterUrl() string

func GetDefaultNamespace

func GetDefaultNamespace() string

func GetEndpointWithProtocol

func GetEndpointWithProtocol(endpoint string) string

func GetPageSize

func GetPageSize() uint32

func GetStartTime

func GetStartTime(lastSeen int64) time.Time

func GetTimeAsString

func GetTimeAsString(s int64) string

func GetUIPass

func GetUIPass() string

func GetUIUser

func GetUIUser() string

func GetUrlForResource

func GetUrlForResource(r defines.Resource, args ...string) string

func HandleError

func HandleError(err error)

func HandleError2

func HandleError2(err error, mesg string)

func InitApiClient

func InitApiClient(authToken string, authType TokenType, endpoint string, trace bool) error

func NeedsLineBreak

func NeedsLineBreak() bool

func PreRun

func PreRun(cmd *cobra.Command, args []string)

func PreRunUiTokenOrCredentials

func PreRunUiTokenOrCredentials(cmd *cobra.Command, args []string)

func PreRunWithNs

func PreRunWithNs(cmd *cobra.Command, args []string)

func PrintResponse

func PrintResponse(data interface{}) bool

func PrintResult

func PrintResult(responseList []types.Resource, asList bool)

func PrintTable

func PrintTable(responseList []types.Resource)

Types

type Api

type Api interface {
	MakeApiCall(method string, url string, payload *bytes.Buffer) (*http.Response, error)
}

type ApiClient

type ApiClient struct {
	AuthToken string
	AuthType  TokenType
	Url       string

	TraceFlag bool
	// contains filtered or unexported fields
}

func GetApiClient

func GetApiClient() *ApiClient

func (*ApiClient) GetResponseString

func (c *ApiClient) GetResponseString(resp *http.Response) ([]byte, error)

func (*ApiClient) MakeApiCall

func (c *ApiClient) MakeApiCall(method string, url string, payload *bytes.Buffer) (*http.Response, error)

type TokenType

type TokenType int

Jump to

Keyboard shortcuts

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