domain

package
v0.0.0-...-73e0b8f Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2021 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ELog

func ELog(log string)

ELog is utility function to print error logging statements

func GenerateRequestURL

func GenerateRequestURL(baseURL string, pathToAppend string) (string, error)

GenerateRequestURL is a utility function to cleanly generate a URL based on the passed baseURL and path

func GetAndPrintActuatorCustom

func GetAndPrintActuatorCustom(inventory Inventory, endpoint string) error

GetAndPrintActuatorCustom retrieves data a custom /actuator endpoint and prints it based on the passed params

func GetAndPrintActuatorLogs

func GetAndPrintActuatorLogs(inventory Inventory)

func GetAndPrintKnownActuator

func GetAndPrintKnownActuator(inventory Inventory, cmdName string) error

GetAndPrintKnownActuator contains the logic to hit the right endpoint and print the data based on the passed cmdName

func GetGenericActuatorResponse

func GetGenericActuatorResponse(inventory Inventory, endpoint string) (string, error)

GetGenericActuatorResponse retrieves data from a generic actuator endpoint and returns the response as a string TODO: perform better error handling to top

func GetStrBetween

func GetStrBetween(input string, start string, end string) string

GetStrBetween returns the trimmed string based on the input, start and end eg -

input="class path resource [application.yml]"
start="[" 	end="]"
return="application.yml"

func GetTerminalSize

func GetTerminalSize() (int, int)

func LookupFlagInCmd

func LookupFlagInCmd(flagName string, cmd *cobra.Command) bool

LookupFlagInCmd returns whether a flag is set in the cmd

func MakeDynamicStructReader

func MakeDynamicStructReader(structToExtent interface{}, jsonStr string) dynamicstruct.Reader

func MakeHTTPCall

func MakeHTTPCall(requestMethod string, requestURL string, authorizationHeader string, rangeHeader string, skipVerifySSL bool) (*http.Response, error)

MakeHTTPCall is a wrapper function to aid performing an HTTP call

func MakeTable

func MakeTable() table.Writer

func PrettyJSON

func PrettyJSON(jsonStr string) string

func PrettyPrintActuatorEnvResponse

func PrettyPrintActuatorEnvResponse(actuatorEnvResponseStr string)

PrettyPrintActuatorEnvResponse pretty prints the response from /actuator/env

func PrettyPrintActuatorHealthResponse

func PrettyPrintActuatorHealthResponse(actuatorResponse string)

PrettyPrintActuatorHealthResponse pretty prints the response from /actuator/health

func PrettyPrintActuatorInfoResponse

func PrettyPrintActuatorInfoResponse(actuatorResponse string)

PrettyPrintActuatorInfoResponse pretty prints the response from /actuator/info

func PrettyPrintActuatorLinksResponse

func PrettyPrintActuatorLinksResponse(actuatorResponse string)

PrettyPrintActuatorLinksResponse pretty prints the response from /actuator

func PrettyPrintActuatorMetricsResponse

func PrettyPrintActuatorMetricsResponse(actuatorResponse string)

PrettyPrintActuatorMetricsResponse pretty prints the response from /actuator/metrics

func PrettyPrintJSON

func PrettyPrintJSON(jsonStr string)

PrettyPrintJSON prints a JSON string in a pretty format using the colorjson library

func PrintInventoryFooter

func PrintInventoryFooter(inventory Inventory)

PrintInventoryFooter is a util function that prints a pretty Header text This is intended to be run for each Inventory - Post execution of the domain specific function

func PrintInventoryHeader

func PrintInventoryHeader(inventory Inventory)

PrintInventoryHeader is a util function that prints a pretty Header text This is intended to be run for each Inventory - Prior execution of the domain specific function

func ResponseBodyToStr

func ResponseBodyToStr(response *http.Response) (string, error)

func SetupConfig

func SetupConfig(cmd *cobra.Command)

SetupConfig sets up the Config based on the config file and any passed params

func VLog

func VLog(log string)

VLog is a utility function to pretty verbose logging statements based on the passed string and the application's config

Types

type ActuatorEnvProperties

type ActuatorEnvProperties struct {
	ActiveProfiles  []string                     `json:"activeProfiles"`
	PropertySources []ActuatorEnvPropertySources `json:"propertySources"`
}

type ActuatorEnvPropertySources

type ActuatorEnvPropertySources struct {
	Name       string                 `json:"name"`
	Properties map[string]interface{} `json:"properties"`
}

type ActuatorHealthProperties

type ActuatorHealthProperties struct {
	Status string `json:"status"`
}

type ActuatorInfoGitProperties

type ActuatorInfoGitProperties struct {
	Branch string `json:"branch"`
	Build  struct {
		Host string `json:"host"`
		User struct {
			Email string `json:"email"`
			Name  string `json:"name"`
		} `json:"user"`
		Version string `json:"version"`
	} `json:"build"`
	Closest struct {
		Tag struct {
			Commit struct {
				Count string `json:"count"`
			} `json:"commit"`
			Name string `json:"name"`
		} `json:"tag"`
	} `json:"closest"`
	Commit map[string]interface{} `json:"commit"`
	Dirty  string                 `json:"dirty"`
	Remote struct {
		Origin struct {
			URL string `json:"url"`
		} `json:"origin"`
	} `json:"remote"`
	Tags  string `json:"tags"`
	Total struct {
		Commit struct {
			Count string `json:"count"`
		} `json:"commit"`
	} `json:"total"`
}

type ActuatorInfoProperties

type ActuatorInfoProperties struct {
	Git   ActuatorInfoGitProperties `json:"git"`
	Title string                    `json:"title"`
	Build map[string]interface{}    `json:"build"`
}
type ActuatorLinks struct {
	Links map[string]interface{} `json:"_links"`
}

type ActuatorMetricsProperties

type ActuatorMetricsProperties struct {
	Names []string `json:"names"`
}

type Config

type Config struct {
	Verbose                bool
	ActuatorEndpointPrefix string
	SkipPrettyPrint        bool
	Tail                   bool
	Inventory              []Inventory
}

Config defines the utility's config

var CLIConfig Config

CLIConfig stores the parsed Config

type Inventory

type Inventory struct {
	Name                string
	BaseURL             string
	AuthorizationHeader string
	SkipVerifySSL       bool
	Tags                []string
}

Inventory defines properties related to single Spring Boot application

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳