common

package
v0.0.0-...-0ccacba Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2018 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//LookupFile ...
	LookupFile = iota + 1
	//LookupKey ...
	LookupKey = iota + 1
	//LookupSubkey ...
	LookupSubkey = iota + 1
	//LookupDefaultValue ...
	LookupDefaultValue = iota + 1
)

Variables

View Source
var (
	//LogTrace ...
	LogTrace *log.Logger
	//LogDebug ...
	LogDebug *log.Logger
	//LogInfo ...
	LogInfo *log.Logger
	//LogWarning ...
	LogWarning *log.Logger
	//LogError ...
	LogError *log.Logger
)

Config - Contains struct for reading global configuration values

View Source
var GlobalConfig struct {
	ListenPort      int
	DevelopmentMode bool
}

GlobalConfig - Struct contains all Global Values used by the application

View Source
var RedisClient *redis.Client

RedisClient - System client to access Reds

Functions

func InitLogger

func InitLogger(
	traceHandle io.Writer,
	debugHandle io.Writer,
	infoHandle io.Writer,
	warningHandle io.Writer,
	errorHandle io.Writer)

InitLogger initializes different logging handlers

func RenderTemplate

func RenderTemplate(tmpfile string, pairs map[string]interface{}) (string, error)

RenderTemplate reads and parses the yaml file with the application resource values

Types

type AsyncResponsePayload

type AsyncResponsePayload struct {
	ID       string `json:"id,omitempty"`
	Location string `json:"location,omitempty"`
}

AsyncResponsePayload is the payload returned when initiated the asynchronous API call

type AsyncStatus

type AsyncStatus struct {
	Code int    `json:"code"`
	Text string `json:"text,omitempty"`
}

AsyncStatus represents the onboarding status with message

type EmptyResponse

type EmptyResponse struct {
}

EmptyResponse - Is a empty struct used when Search/List returns no rows.

func (*EmptyResponse) Render

func (res *EmptyResponse) Render(w http.ResponseWriter, r *http.Request) error

Render implements the chi Renderer interface, for EmptyResponse

type ErrResponse

type ErrResponse struct {
	Code     string `json:"code"`
	Message  string `json:"message,omitempty"`
	Detail   string `json:"detail,omitempty"`
	MoreInfo string `json:"moreInfo,omitempty"`
}

ErrResponse is the error schema based on intuit standard

type ErrResponsePayload

type ErrResponsePayload struct {
	HTTPStatusCode int `json:"-"` // http response status code

	Error []ErrResponse `json:"error"`
}

ErrResponsePayload is the generic API response structure for error return

func (*ErrResponsePayload) Render

Render implements the chi Renderer interface, it makes sure to set the correct Content-Type

type Error

type Error struct {
	Message string
	Code    int
}

Error - Error response on rest calls

type LookupList

type LookupList struct {
	Description string
	Lookup      map[string]map[string]string
}

LookupList describes cluster lookup list

type ResponseData

type ResponseData struct {
}

ResponseData contains the actual data for the perticular API. e.g. for iksm operation it has all the namespace info

type StatusResponsePayload

type StatusResponsePayload struct {
	Message string `json:"message,omitempty"`

	Status AsyncStatus `json:"status,omitempty"`
	AsyncResponsePayload
}

StatusResponsePayload is for asynchronous API status

func (*StatusResponsePayload) Render

Render implements the chi Renderer interface, it makes sure to set the correct Content-Type

type SyncStatus

type SyncStatus struct {
	Code int    `json:"code"`
	Text string `json:"text,omitempty"`
}

SyncStatus represents the onboarding status with message

Jump to

Keyboard shortcuts

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