util

package
v1.2.71 Latest Latest
Warning

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

Go to latest
Published: May 22, 2018 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AddonAuthConfigFile       = "addonAuth.yaml"
	JenkinsAuthConfigFile     = "jenkinsAuth.yaml"
	IssuesAuthConfigFile      = "issuesAuth.yaml"
	ChatAuthConfigFile        = "chatAuth.yaml"
	GitAuthConfigFile         = "gitAuth.yaml"
	ChartmuseumAuthConfigFile = "chartmuseumAuth.yaml"
)
View Source
const (
	DefaultErrorExitCode = 1

	DefaultWritePermissions = 0760
)
View Source
const (
	APPSERVER = "appserver"
	LIBERTY   = "liberty"
)

Variables

View Source
var ErrExit = fmt.Errorf("exit")

ErrExit may be passed to CheckError to instruct it to output nothing but exit with status code 1.

Functions

func BehaviorOnFatal

func BehaviorOnFatal(f func(string, int))

BehaviorOnFatal allows you to override the default behavior when a fatal error occurs, which is to call os.Exit(code). You can pass 'panic' as a function here if you prefer the panic() over os.Exit(1).

func CheckErr

func CheckErr(err error)

CheckErr prints a user friendly error to STDERR and exits with a non-zero exit code. Unrecognized errors will be printed with an "error: " prefix.

This method is generic to the command in use and may be used by non-Kubectl commands.

func ColorNameValues added in v1.0.2

func ColorNameValues() []string

ColorNameValues returns all the color names sorted

func DefaultBehaviorOnFatal

func DefaultBehaviorOnFatal()

DefaultBehaviorOnFatal allows you to undo any previous override. Useful in tests.

func EmailToK8sId added in v1.2.63

func EmailToK8sId(email string) string

func GetColor added in v1.0.2

func GetColor(optionName string, colorNames []string) (*color.Color, error)

GetColor returns the color for the list of colour names and option name

func HomeDir

func HomeDir() string

func PomFlavour added in v1.2.6

func PomFlavour(path string) (string, error)

func StandardErrorMessage

func StandardErrorMessage(err error) (string, bool)

StandardErrorMessage translates common errors into a human readable message, or returns false if the error is not one of the recognized types. It may also log extended information to glog.

This method is generic to the command in use and may be used by non-Kubectl commands.

func UsageError

func UsageError(cmd *cobra.Command, format string, args ...interface{}) error

Types

type Factory

type Factory interface {
	CreateJenkinsClient() (*gojenkins.Jenkins, error)

	GetJenkinsURL() (string, error)

	CreateAuthConfigService(fileName string) (auth.AuthConfigService, error)

	CreateGitAuthConfigService() (auth.AuthConfigService, error)

	CreateGitAuthConfigServiceDryRun(dryRun bool) (auth.AuthConfigService, error)

	CreateJenkinsAuthConfigService() (auth.AuthConfigService, error)

	CreateChartmuseumAuthConfigService() (auth.AuthConfigService, error)

	CreateIssueTrackerAuthConfigService(secrets *corev1.SecretList) (auth.AuthConfigService, error)

	CreateChatAuthConfigService(secrets *corev1.SecretList) (auth.AuthConfigService, error)

	CreateAddonAuthConfigService(secrets *corev1.SecretList) (auth.AuthConfigService, error)

	CreateClient() (*kubernetes.Clientset, string, error)

	CreateJXClient() (*versioned.Clientset, string, error)

	CreateApiExtensionsClient() (*apiextensionsclientset.Clientset, error)

	CreateMetricsClient() (*metricsclient.Clientset, error)

	CreateTable(out io.Writer) table.Table

	SetBatch(batch bool)

	LoadPipelineSecrets(kind string, serviceKind string) (*corev1.SecretList, error)

	ImpersonateUser(user string) Factory
}

func NewFactory

func NewFactory() Factory

NewFactory creates a factory with the default Kubernetes resources defined if optionalClientConfig is nil, then flags will be bound to a new clientcmd.ClientConfig. if optionalClientConfig is not nil, then this factory will make use of it.

type UserDetailService added in v1.2.63

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

func NewUserDetailService added in v1.2.63

func NewUserDetailService(jxClient *versioned.Clientset, namespace string) UserDetailService

func (*UserDetailService) CreateOrUpdateUser added in v1.2.63

func (this *UserDetailService) CreateOrUpdateUser(u *v1.UserDetails) error

func (*UserDetailService) FindByEmail added in v1.2.63

func (this *UserDetailService) FindByEmail(email string) *v1.UserDetails

Jump to

Keyboard shortcuts

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