Categorygithub.com/nikhilsbhat/gocd-sdk-go
modulepackage
0.2.0
Repository: https://github.com/nikhilsbhat/gocd-sdk-go.git
Documentation: pkg.go.dev

# README

GoCD Golang SDK

Go Report Card shields shields shields

Golang client library for GoCD API (Supports Most of the APIs).

Introduction

This Library could be helpful while building any tools around GoCD or while interacting with GoCD to perform certain daily activities.

This could include checking the health of all agents connected to GoCD or status of a job and many more.

Installation

Get the latest version of GoCD sdk using go get command. Example:

go get github.com/nikhilsbhat/gocd-sdk-go@latest

Get specific version of the same. Example:

go get github.com/nikhilsbhat/[email protected]

Usage

package main

import (
	"fmt"
	"log"

	"github.com/nikhilsbhat/gocd-sdk-go"
)

func main() {
	client := gocd.NewClient("http://localhost:8153/go", "admin", "admin", "info", nil)
	env, err := client.GetEnvironments()
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(env)
}

More examples can be found here.

Supported APIs

Below are the list of supported APIs:

  • Agents
    • Get All Agents
    • Get Specific Agent
    • Update Agent
    • Update Agents bulk
    • Delete Agent
    • Delete Agents bulk
    • Kill running tasks iin Agent
    • Agent job run history
  • ConfigRepo
    • Get All Config repo
    • Get Specific Config repo
    • Create Config repo
    • Update Config repo
    • Delete Config repo
    • Get Config repo status
    • Trigger config repo update
    • Preflight check of config repo configurations
    • Export pipeline config to config repo format
    • Definitions defined in config repo
  • Maintenance Mode
    • Enable Maintenance Mode
    • Disable Maintenance Mode
    • Get Maintenance Mode info
  • PipelineGroup
    • Get All pipeline groups
    • Get specific pipeline group
    • Update pipeline group
    • Create pipeline group
    • Delete pipeline group
  • Environment Config
    • Get All Environments
    • Get specific Environment
    • Create Environment
    • Update Environment
    • Patch Environment
    • Delete Environment
  • Backup-config
    • Get Backup Info
    • Create or Update Backup
    • Delete Backup Info
  • Backup
    • Schedule Backup
    • Get Backup
  • Pipeline
    • Get pipeline status
    • Pause Pipeline
    • UnPause Pipeline
    • UnLock Pipeline
    • Schedule Pipeline
    • Get Pipeline Schedules
    • Compare pipeline instances
  • Pipeline Instances
    • Get Pipeline Instance
    • Get Pipeline History
    • Comment on Pipeline
  • Pipeline Config
    • Get pipeline config
    • Edit pipeline config
    • Create a pipeline
    • Delete a pipeline
    • Extract template from pipeline
    • Validate pipeline config syntax
  • Stage Instances
    • Cancel stage
    • Get stage instance
    • Get stage history
    • Run failed jobs
    • Run selected jobs
  • Stages
    • Run stage
  • Jobs
    • Get job instance
    • Get job history
  • Feeds
    • Get All pipelines
    • Get Pipeline
    • Get Stage
    • Get Job
    • Get Material
    • Scheduled Jobs
  • Artifact Config
    • Get Artifact Config
    • Update Artifact Config
  • Artifact Store
    • Get Artifact Stores
    • Get Artifact Store
    • Create Artifact Stores
    • Update Artifact Stores
    • Delete Artifact Stores
  • Cluster Profiles
    • Get Cluster Profiles
    • Get Cluster Profile
    • Create Cluster Profile
    • Update Cluster Profile
    • Delete Cluster Profile
  • Elastic Agent Profiles
    • Get Elastic Agent Profiles
    • Get Elastic Agent Profile
    • Create Elastic Agent Profile
    • Update Elastic Agent Profile
    • Delete Elastic Agent Profile
    • Get Elastic Agent Profile Usage
  • Secret Configs
    • Get Secret Configs
    • Get Secret Config
    • Create Secret Config
    • Update Secret Config
    • Delete Secret Config
  • Package Repositories
    • Get Package repositories
    • Get Package Repository
    • Create Package Repository
    • Update Package Repository
    • Delete Package Repository
  • Package
    • Get Package Materials
    • Get Package Material
    • Create Package Material
    • Update Package Material
    • Delete Package Material
  • Materials
    • Get All Materials
    • Get Materials Usage
    • Get material modifications
  • Site URL
    • Get Site URL
    • Create or Update Site URL
  • Mail server config
    • Get Mail server config
    • Create or Update Mail server config
    • Update Mail server config
  • Default Job timeout
    • Get Default Job timeout
    • Update Default Job timeout
  • Plugin settings
    • Get Plugin settings
    • Create Plugin settings
    • Update Plugin settings
  • Plugin Info
    • Get all plugin info
    • Get plugin info
  • Auth Configs
    • Get All Auth configs
    • Get Specific Auth config
    • Create Auth config
    • Update Auth config
    • Delete Auth config
  • System Admin
    • Get All system admins
    • Update system Admin
    • Bulk update system admins
  • Role
    • Get all roles
    • Get all roles by type
    • Get Specific role
    • Create a GoCD role
    • Create a plugin role
    • Update a role
    • Delete a role
    • Bulk update roles
  • access-tokens
    • Get all tokens for current user
    • Get one token for current user
    • Create token for current user
    • Revoke token for current user
    • Get all tokens for all users
    • Get one token for any user
    • Revoke token for any user
  • current-user
    • Get current user
    • Update current user info
  • Local Users
    • Get all users
    • Get a user
    • Create a user
    • Update a user
    • Delete a user
    • Bulk delete users
    • Bulk enable/disable users
  • Notification Filter
    • Get all notification filters
    • Get a notification filter
    • Create a notification filter
    • Update a notification filter
    • Delete a notification filter
  • Server Health Messages
    • Get Server Health messages
  • Version
    • Get Version
  • Encryption
    • Encrypt plain text value
    • Decrypt encrypted text value
  • Permission
    • Show permissions one has

Enhancements

If any of the API's are missed, feel free to raise the PR or create issues for the same.

# Packages

No description provided by the author
No description provided by the author

# Functions

No description provided by the author
No description provided by the author
No description provided by the author
GetPipelineName parses pipeline url to fetch the pipeline name.
No description provided by the author
NewClient returns new instance of httpClient when invoked.
No description provided by the author

# Constants

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
nolint:gosec.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Structs

No description provided by the author
Agent holds information of a particular agent.
AgentJobHistory holds information of pipeline run history of all GoCD agents.
Agents holds information of all agent of GoCD.
AgentsConfig holds information of all agent of GoCD.
ArtifactInfo holds the latest information of the artifacts.
ArtifactStoresConfig holds information of all config-repos present in GoCD.
ArtifactStoresConfigs holds information of the specified artifact-stores/cluster-profiles/agent-profiles.
Attribute holds information of material type present in GoCD.
Auth holds information of authorisations configurations used for GoCd.
AuthConfigs holds information of multiple authorization configurations.
AuthorizationConfig of a pipeline group.
BackupConfig holds information of the backup configured.
BackupStats holds information about the backup that was taken.
No description provided by the author
CommonConfig holds information of the specified artifact store.
ConfigRepo holds information of the specified config-repo.
ConfigRepoConfig holds information of all config-repos present in GoCD.
No description provided by the author
ConfigRepos holds information of all config-repos present in GoCD.
ElasticProfileUsage holds information on elastic agent profile being used by a pipeline/stage/job.
Encrypted holds the encrypted value of the passed plain text.
EntityPermissions is the list of the permission level one has over various entities in GoCD.
Environment holds information of a specific environment present in GoCD.
EnvironmentInfo holds information of all environments present in GoCD.
Environments holds information of all environments present in GoCD.
EnvVars holds information of environment variables present in GoCD.
Job holds information of Scheduled Job.
JobRunHistory holds information of pipeline run history of a specific GoCD agent.
MailServerConfig holds information required for GoCD mail-server configuration.
Maintenance holds latest information available in server about maintenance mode.
Material holds information of a particular material type present in GoCD.
MaterialConfig holds information materials defined under Material.
Materials holds information of all material type present in GoCD.
MaterialUsage holds information of pipelines using a specific material.
Operations holds information of the operations to be performed on GoCD agent.
Package holds information of the specified packages of the package repository.
PackageRepositories holds information of all package repositories present in GoCD.
PackageRepository holds information of the specified package repository.
Packages holds information of all packages present in GoCD.
Pagination holds information which is helpful in paginating the results of job run history.
PatchEnvironment holds information that is handy while patching GoCD environment.
Permission holds information of permissions that the invoked user has in GoCD.
Pipeline holds information of a specific pipeline instance.
PipelineApprovalConfig holds information on pipeline approval config.
PipelineArtifact holds information on artifacts defined in pipeline.
No description provided by the author
PipelineConfig holds configuration information of a specific pipeline.
PipelineCreateOptions holds information of Pipeline Create Options.
PipelineEnvironmentVariables holds information of all Environment variable defined in pipeline.
PipelineExport holds information of the pipeline that is exported to a specific config repo format.
No description provided by the author
PipelineGroup holds information of a specific pipeline group instance.
No description provided by the author
PipelineGroups holds information on the various pipeline groups present in GoCD.
PipelineGroupsConfig holds information on the various pipeline groups present in GoCD.
PipelineHistory holds information of the pipeline history that also helps in paginating the responses.
PipelineJobConfig holds information of pipeline job.
No description provided by the author
No description provided by the author
PipelineObject holds information required to comment/get/history of pipeline or instance of the same.
PipelineOrigin holds the information on the source of pipeline present on GoCD.
PipelineRunHistory holds information of pipeline run history.
Pipelines holds information of the pipelines present in GoCD.
PipelineSchedules holds information of pipeline schedules.
PipelineSchedulesGroups holds information of pipeline schedules group.
PipelineSchedulesHistory holds information of pipeline schedule history.
PipelinesInfo holds information of list of pipelines.
PipelineSize holds information of the pipeline size.
PipelineStageConfig holds information of pipeline stage.
PipelineState holds information of the latest state of pipeline.
No description provided by the author
PipelineTaskConfig holds information of the tasks defined in jobs of GoCD pipeline.
PipelineTemplateConfig holds pipeline template config.
PipelineTimerConfig holds information of GoCD pipeline timers, when to trigger pipeline.
PipelineTracingToolConfig holds information of tracing tool for issue tracking.
Plugin holds information of a specific plugins present in GoCd.
PluginAttributes holds information all available attributes of a given plugin.
PluginConfiguration holds information of the various plugin properties.
PluginSettingAttribute holds plugin configuration information.
PluginSettings holds information of plugin settings of GoCD.
PluginsInfo holds information of all plugins present in GoCd.
PluginsInfos holds information of all plugins present in GoCd.
PluginStatus holds the status information of the plugin.
ProfilesConfig holds information of all config-repos present in GoCD.
ProfilesConfigs holds information of the specified artifact-stores/cluster-profiles/agent-profiles.
PurgeSettings holds the latest information on the purge setting configuration of GoCD.
Role holds information of a specific role in GoCd.
RoleAttribute holds information of a specific attribute of a role in GoCd.
RolesConfig holds information of all role configs present in GoCd.
RolesConfigs holds information of all role configs present in GoCd.
Schedule holds config of the pipeline that needs to be scheduled.
ScheduledJobs holds information of Scheduled Jobs.
SecretsConfig holds information of a specified secret config present in GoCD.
SecretsConfigs holds information of all secret configs present in GoCD.
ServerHealth holds information of GoCD server health.
ServerVersion holds version information GoCd server.
SiteURLConfig holds information of the site url of GoCD.
Stage holds information of GoCd stage.
SystemAdmins holds information of the system admins present.
TaskAttributeConfig holds information of tasks.
User holds information of the users present in GoCD.
UserRole holds information of the user role present in GoCD.
Users holds information of all users present in GoCD.
VersionInfo holds version information of GoCD server.
No description provided by the author

# Interfaces

GoCd implements methods to get various information from GoCD.

# Type aliases

Groups implements methods that help in fetching several other information from PipelineGroup.