util

package
v2.0.0-beta.1+incompat... Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2018 License: Apache-2.0 Imports: 27 Imported by: 11

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BindParams

func BindParams(params map[string]string, object interface{}) error

bind params uses json serializing and reflect package that is underneath to avoid direct access to map for getting appropriate field values.

func FillCloudAccountCredentials

func FillCloudAccountCredentials(ctx context.Context, cloudAccount *model.CloudAccount, config *steps.Config) error

TODO(stgleb): move getting cloud account outside of this function Gets cloud account from storage and fills config object with those credentials

func FindOutboundIP

func FindOutboundIP() (string, error)

func GetLogger

func GetLogger(w io.Writer) (log *logrus.Logger)

func GetRandomNode

func GetRandomNode(nodeMap map[string]*node.Node) *node.Node

func GetWriter

func GetWriter(name string) (io.WriteCloser, error)

func MakeFileName

func MakeFileName(taskID string) string

func MakeKeyName

func MakeKeyName(name string, isUser bool) string

func MakeNodeName added in v1.0.0

func MakeNodeName(clusterName string, nodeId string, isMaster bool) string

func MakeRole

func MakeRole(isMaster bool) string

func RandomString

func RandomString(n int) string

RandomString generates random string with reservoir sampling algorithm https://en.wikipedia.org/wiki/Reservoir_sampling

Types

type CloudAccountValidator

type CloudAccountValidator interface {
	ValidateCredentials(cloudAccount *model.CloudAccount) error
}

type CloudAccountValidatorImpl

type CloudAccountValidatorImpl struct {
	// contains filtered or unexported fields
}

func NewCloudAccountValidator

func NewCloudAccountValidator() *CloudAccountValidatorImpl

func (*CloudAccountValidatorImpl) ValidateCredentials

func (validator *CloudAccountValidatorImpl) ValidateCredentials(cloudAccount *model.CloudAccount) error

type CountdownLatch

type CountdownLatch struct {
	// contains filtered or unexported fields
}

func NewCountdownLatch

func NewCountdownLatch(ctx context.Context, count int) *CountdownLatch

func (*CountdownLatch) CountDown

func (c *CountdownLatch) CountDown()

CountDown decrements the counter

func (*CountdownLatch) Wait

func (c *CountdownLatch) Wait()

Wait until count down to zero or if context is done

Jump to

Keyboard shortcuts

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