Skip to content

nikhilsbhat/gocd-sdk-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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/gocd-sdk-go@v0.0.2

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.