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 ¶
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
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
const ( EncryptCommandName = "encrypt" EncryptCommandUsage = "Encrypt a value for use in GoCD configurations" )
List of command name and descriptions
const ( ListEnvironmentsCommandName = "list-environments" ListEnvironmentsCommandUsage = "List all environments" GetEnvironmentCommandName = "get-environment" GetEnvironmentCommandUsage = "Get 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
const ( ListScheduledJobsCommandName = "list-scheduled-jobs" ListScheduledJobsCommandUsage = "List Scheduled Jobs" )
List of command name and descriptions
const ( GenerateJSONSchemaCommandName = "generate-json-schema" GenerateJSONSchemaCommandUsage = "Generates a JSON schema based on the structs in this library" )
List of command name and descriptions
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
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
const ( ListPipelineGroupsCommandName = "list-pipeline-groups" ListPipelineGroupsCommandUsage = "List Pipeline Groups" )
List of command name and descriptions
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
const ( ListPluginsCommandName = "list-plugins" ListPluginsCommandUsage = "List all the Plugins" GetPluginCommandName = "get-plugin" GetPluginCommandUsage = "Get a Plugin" )
List of command name and descriptions
Variables ¶
var Schemas = map[string]interface{}{ "job": gocd.Job{}, "agent": gocd.Agent{}, "build-details": gocd.BuildDetails{}, "stage": gocd.Stage{}, }
Schemas is a collection of json structs to write to file as json schemas.
Functions ¶
func ActionWrapper ¶
func ActionWrapper(callback ActionWrapperFunc) interface{}
ActionWrapper handles the deferencing, and casting of the client object, and error handling.
func GetCliCommands ¶
GetCliCommands returns a list of all CLI Command structs
func NewCliClient ¶
NewCliClient creates a new gocd client for use by cli actions.
func NewFlagError ¶
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