cli

package
v0.0.0-...-e2cef0b Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package cli provides a gocd cli tool wrapping the gocd package.

Usage:

gocd --help

export GOCD_PASSWORD=mysecret
gocd -server https://goserver:8154/go -username user list-agents

Index

Constants

View Source
const (
	ListAgentsCommandName    = "list-agents"
	ListAgentsCommandUsage   = "List GoCD build agents."
	GetAgentCommandName      = "get-agent"
	GetAgentCommandUsage     = "Get Agent by UUID"
	UpdateAgentCommandName   = "update-agent"
	UpdateAgentCommandUsage  = "Update Agent"
	DeleteAgentCommandName   = "delete-agent"
	DeleteAgentCommandUsage  = "Delete Agent"
	UpdateAgentsCommandName  = "update-agents"
	UpdateAgentsCommandUsage = "Bulk Update Agents"
	DeleteAgentsCommandName  = "delete-agents"
	DeleteAgentsCommandUsage = "Bulk Delete Agents"
)

List of command name and descriptions

View Source
const (
	GetConfigurationCommandName  = "get-configuration"
	GetConfigurationCommandUsage = "" /* 218-byte string literal not displayed */
	GetVersionCommandName        = "get-version"
	GetVersionCommandUsage       = "Return the Version for the GoCD Server"
)

List of command name and descriptions

View Source
const (
	EncryptCommandName  = "encrypt"
	EncryptCommandUsage = "Encrypt a value for use in GoCD configurations"
)

List of command name and descriptions

View Source
const (
	ListEnvironmentsCommandName                = "list-environments"
	ListEnvironmentsCommandUsage               = "List all environments"
	GetEnvironmentCommandName                  = "get-environment"
	GetEnvironmentCommandUsage                 = "Get an environment by name"
	PatchEnvironmentCommandName                = "patch-environment"
	PatchEnvironmentCommandUsage               = "Patch an environment by name"
	AddPipelinesToEnvironmentCommandName       = "add-pipelines-to-environment"
	AddPipelinesToEnvironmentCommandUsage      = "Add one or more pipelines to an environment"
	RemovePipelinesFromEnvironmentCommandName  = "remove-pipelines-from-environment"
	RemovePipelinesFromEnvironmentCommandUsage = "Remove one or more pipelines from an environment"
)

List of command name and descriptions

View Source
const (
	ListScheduledJobsCommandName  = "list-scheduled-jobs"
	ListScheduledJobsCommandUsage = "List Scheduled Jobs"
)

List of command name and descriptions

View Source
const (
	GetPipelineHistoryCommandName   = "get-pipeline-history"
	GetPipelineCommandName          = "get-pipeline"
	GetPipelineHistoryCommandUsage  = "Get Pipeline History"
	GetPipelineCommandUsage         = "Get Pipeline"
	ReleasePipelineLockCommandName  = "release-pipeline-lock"
	ReleasePipelineLockCommandUsage = "Release Pipeline Lock"
	UnpausePipelineCommandName      = "unpause-pipeline"
	UnpausePipelineCommandUsage     = "Unpause Pipeline"
	PausePipelineCommandName        = "pause-pipeline"
	PausePipelineCommandUsage       = "Pause Pipeline"
	GetPipelineStatusCommandName    = "get-pipeline-status"
	GetPipelineStatusCommandUsage   = "Get Pipeline Status"
)

List of command name and descriptions

View Source
const (
	CreatePipelineConfigCommandName  = "create-pipeline-config"
	CreatePipelineConfigCommandUsage = "Create Pipeline config"
	UpdatePipelineConfigCommandName  = "update-pipeline-config"
	UpdatePipelineConfigCommandUsage = "Update Pipeline config"
	DeletePipelineConfigCommandName  = "delete-pipeline-config"
	DeletePipelineConfigCommandUsage = "Remove Pipeline. This will not delete the pipeline history, which will be stored in the database"
	GetPipelineConfigCommandName     = "get-pipeline-config"
	GetPipelineConfigCommandUsage    = "Get a Pipeline Configuration"
)

List of command name and descriptions

View Source
const (
	ListPipelineGroupsCommandName  = "list-pipeline-groups"
	ListPipelineGroupsCommandUsage = "List Pipeline Groups"
)

List of command name and descriptions

View Source
const (
	ListPipelineTemplatesCommandName   = "list-pipeline-templates"
	ListPipelineTemplatesCommandUsage  = "List Pipeline Templates"
	GetPipelineTemplateCommandName     = "get-pipeline-template"
	GetPipelineTemplateCommandUsage    = "Get Pipeline Templates"
	CreatePipelineTemplateCommandName  = "create-pipeline-template"
	CreatePipelineTemplateCommandUsage = "Create Pipeline Templates"
	UpdatePipelineTemplateCommandName  = "update-pipeline-template"
	UpdatePipelineTemplateCommandUsage = "Update Pipeline template"
	DeletePipelineTemplateCommandName  = "delete-pipeline-template"
	DeletePipelineTemplateCommandUsage = "Delete Pipeline template"
)

List of command name and descriptions

View Source
const (
	ListPluginsCommandName  = "list-plugins"
	ListPluginsCommandUsage = "List all the Plugins"
	GetPluginCommandName    = "get-plugin"
	GetPluginCommandUsage   = "Get a Plugin"
)

List of command name and descriptions

Variables

This section is empty.

Functions

func ActionWrapper

func ActionWrapper(callback ActionWrapperFunc) interface{}

ActionWrapper handles the deferencing, and casting of the client object, and error handling.

func GetCliCommands

func GetCliCommands() []cli.Command

GetCliCommands returns a list of all CLI Command structs

func NewCliClient

func NewCliClient(c *cli.Context) (cl *gocd.Client, err error)

NewCliClient creates a new gocd client for use by cli actions.

func NewFlagError

func NewFlagError(flag string) (err error)

NewFlagError creates an error when a flag is missing.

Types

type ActionWrapperFunc

type ActionWrapperFunc func(client *gocd.Client, c *cli.Context) (interface{}, *gocd.APIResponse, error)

ActionWrapperFunc describes the callback provided to ActionWrapper

type JSONCliError

type JSONCliError struct {
	ReqType string
	// contains filtered or unexported fields
}

JSONCliError describes an error which outputs JSON on the CLI.

func NewCliError

func NewCliError(reqType string, hr *gocd.APIResponse, err error) (jerr JSONCliError)

NewCliError creates an error which can be returned from a cli action

func (JSONCliError) Error

func (e JSONCliError) Error() string

Error encodes the error as a JSON string

func (JSONCliError) ExitCode

func (e JSONCliError) ExitCode() int

ExitCode returns the cli statusin the event of an error

Jump to

Keyboard shortcuts

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