common

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 28, 2016 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Ec2Service

func Ec2Service() *ec2.EC2

Ec2Service is a aws EC2 client.

func ElbService

func ElbService() *elb.ELB

ElbService is a aws Elb client.

func IsNetworkAccessible

func IsNetworkAccessible(instance *ec2.Instance) bool

IsNetworkAccessible check whether the EC2 instance is reachable or not.

func NewTableWriter

func NewTableWriter(writer io.Writer) *tablewriter.Table

NewTableWriter create tablewriter.Table instance.

func ShowError

func ShowError(err error)

ShowError handle some kinds of error object to put error log.

Types

type FilterInterface

type FilterInterface interface {
	VpcFilter() (*ec2.Filter, error)
	InstancesFilter() (*ec2.DescribeInstancesInput, error)
	VpcFilterExist() bool
}

FilterInterface define interface of filter objects.

type InstanceFilter

type InstanceFilter struct {
	VpcID   string
	VpcName string
}

InstanceFilter is a filter condition about EC2s.

func (*InstanceFilter) InstancesFilter

func (filter *InstanceFilter) InstancesFilter() (*ec2.DescribeInstancesInput, error)

InstancesFilter create ec2.DescribeInstancesInput instance.

func (*InstanceFilter) VpcFilter

func (filter *InstanceFilter) VpcFilter() (*ec2.Filter, error)

VpcFilter create ec2.Filter instance.

func (*InstanceFilter) VpcFilterExist

func (filter *InstanceFilter) VpcFilterExist() bool

VpcFilterExist check whether the filter contains vpc condition or not.

type LogLevel

type LogLevel uint8

LogLevel define log level.

const (
	// PanicLevel is a log level on critical case.
	PanicLevel LogLevel = iota

	// FatalLevel is a log level on fatal case.
	FatalLevel

	// ErrorLevel is a log level on error case.
	ErrorLevel

	// WarnLevel is a log level on warn case.
	WarnLevel

	// InfoLevel is a log level on info logging.
	InfoLevel

	// DebugLevel is a log level on debug logging.
	DebugLevel
)

type Logger

type Logger struct {
	LogLevel  LogLevel
	Output    io.Writer
	Formatter *TextFormatter
	// contains filtered or unexported fields
}

Logger define a logger struct.

func GetLogger

func GetLogger() *Logger

GetLogger return Logger instance.

func (*Logger) Debug

func (log *Logger) Debug(format string, args ...interface{})

Debug puts debug level message to log.

func (*Logger) Error

func (log *Logger) Error(format string, args ...interface{})

Error puts error message to log.

func (*Logger) Fatal

func (log *Logger) Fatal(format string, args ...interface{})

Fatal puts fatal message to log.

func (*Logger) Info

func (log *Logger) Info(format string, args ...interface{})

Info puts info level message to log.

func (*Logger) Panic

func (log *Logger) Panic(format string, args ...interface{})

Panic puts panic message to log.

func (*Logger) Print

func (log *Logger) Print(format string, args ...interface{})

Print is a alias to Info.

func (*Logger) SetColored

func (log *Logger) SetColored(flag bool)

SetColored configure colorize log message or not.

func (*Logger) Warn

func (log *Logger) Warn(format string, args ...interface{})

Warn puts warn level message to log.

func (*Logger) Warning

func (log *Logger) Warning(format string, args ...interface{})

Warning is a alias to Warn.

type TextFormatter

type TextFormatter struct {
	Colored bool
}

TextFormatter define log formatter.

func (*TextFormatter) Format

func (f *TextFormatter) Format(level LogLevel, message string) ([]byte, error)

Format return formatted string.

type VpcNotFoundError

type VpcNotFoundError struct {
	Cause string
}

VpcNotFoundError describe a error that Vpc not found.

func (*VpcNotFoundError) Error

func (err *VpcNotFoundError) Error() string

Error return error message

Jump to

Keyboard shortcuts

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