client

package
v0.0.24 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2019 License: MIT Imports: 21 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetPayloadForCreateAgent added in v0.0.24

func GetPayloadForCreateAgent(name string) *strings.Reader

GetPayloadForCreateAgent returns a payload for creating an agent

func ParseJobPath added in v0.0.23

func ParseJobPath(jobName string) (path string)

ParseJobPath leads with slash

func PrepareCancelQueue added in v0.0.20

func PrepareCancelQueue(roundTripper *mhttp.MockRoundTripper, rootURL, user, passwd string)

PrepareCancelQueue only for test

func PrepareCheckUpdate added in v0.0.23

func PrepareCheckUpdate(roundTripper *mhttp.MockRoundTripper, rootURL, user, password string)

PrepareCheckUpdate only for test

func PrepareCommonPost added in v0.0.20

func PrepareCommonPost(request *http.Request, responseBody string, roundTripper *mhttp.MockRoundTripper, user, passwd, rootURL string) (
	response *http.Response)

PrepareCommonPost only for test

func PrepareCreateToken added in v0.0.21

func PrepareCreateToken(roundTripper *mhttp.MockRoundTripper, rootURL,
	user, passwd, newTokenName, targetUser string) (response *http.Response)

PrepareCreateToken only for test

func PrepareCreateUser added in v0.0.21

func PrepareCreateUser(roundTripper *mhttp.MockRoundTripper, rootURL,
	user, passwd, targetUserName string) (response *http.Response)

PrepareCreateUser only for test

func PrepareDownloadPlugin added in v0.0.23

func PrepareDownloadPlugin(roundTripper *mhttp.MockRoundTripper) (response *http.Response)

PrepareDownloadPlugin only for test

func PrepareEmptyItems added in v0.0.24

func PrepareEmptyItems(roundTripper *mhttp.MockRoundTripper, rootURL, name, kind, user, token string)

PrepareEmptyItems only for test

func PrepareFor500InstalledPluginList added in v0.0.20

func PrepareFor500InstalledPluginList(roundTripper *mhttp.MockRoundTripper, rootURL string, depth int) (
	request *http.Request, response *http.Response)

PrepareFor500InstalledPluginList only for test

func PrepareForBuildWithNoParams added in v0.0.21

func PrepareForBuildWithNoParams(roundTripper *mhttp.MockRoundTripper, rootURL, jobName, user, password string) (
	request *http.Request, response *http.Response)

PrepareForBuildWithNoParams only for test

func PrepareForBuildWithParams added in v0.0.21

func PrepareForBuildWithParams(roundTripper *mhttp.MockRoundTripper, rootURL, jobName, user, password string) (
	request *http.Request, response *http.Response)

PrepareForBuildWithParams only for test

func PrepareForChangeUpdateCenterSite added in v0.0.23

func PrepareForChangeUpdateCenterSite(roundTripper *mhttp.MockRoundTripper, rootURL, user, password, name, updateCenterURL string)

PrepareForChangeUpdateCenterSite only for test

func PrepareForComputerAgentSecretRequest added in v0.0.24

func PrepareForComputerAgentSecretRequest(roundTripper *mhttp.MockRoundTripper, rootURL, user, password, name, secret string)

PrepareForComputerAgentSecretRequest only for test

func PrepareForComputerCreateRequest added in v0.0.24

func PrepareForComputerCreateRequest(roundTripper *mhttp.MockRoundTripper, rootURL, user, password, name string)

PrepareForComputerCreateRequest only for test

func PrepareForComputerDeleteRequest added in v0.0.24

func PrepareForComputerDeleteRequest(roundTripper *mhttp.MockRoundTripper, rootURL, user, password, name string)

PrepareForComputerDeleteRequest only for test

func PrepareForComputerList added in v0.0.24

func PrepareForComputerList() string

PrepareForComputerList only for test

func PrepareForComputerListRequest added in v0.0.24

func PrepareForComputerListRequest(roundTripper *mhttp.MockRoundTripper, rootURL, user, password string)

PrepareForComputerListRequest only for test

func PrepareForComputerLogRequest added in v0.0.24

func PrepareForComputerLogRequest(roundTripper *mhttp.MockRoundTripper, rootURL, user, password, name string)

PrepareForComputerLogRequest only for test

func PrepareForComputerLogRequestWithCode added in v0.0.24

func PrepareForComputerLogRequestWithCode(roundTripper *mhttp.MockRoundTripper, rootURL, user, password,
	name string, statusCode int)

PrepareForComputerLogRequestWithCode only for test

func PrepareForCreateCredential added in v0.0.24

func PrepareForCreateCredential(roundTripper *mhttp.MockRoundTripper, rootURL, user, password, store, credential string)

PrepareForCreateCredential only for test

func PrepareForCreatePipelineJob added in v0.0.20

func PrepareForCreatePipelineJob(roundTripper *mhttp.MockRoundTripper, rootURL, user, password string, jobPayload CreateJobPayload)

PrepareForCreatePipelineJob only for test

func PrepareForCreateSecretCredential added in v0.0.24

func PrepareForCreateSecretCredential(roundTripper *mhttp.MockRoundTripper, rootURL, user, password,
	store string, cred StringCredentials)

PrepareForCreateSecretCredential only for test

func PrepareForCreateUsernamePasswordCredential added in v0.0.24

func PrepareForCreateUsernamePasswordCredential(roundTripper *mhttp.MockRoundTripper, rootURL, user, password,
	store string, cred UsernamePasswordCredential)

PrepareForCreateUsernamePasswordCredential only for test

func PrepareForCredentialListJSON added in v0.0.24

func PrepareForCredentialListJSON() string

PrepareForCredentialListJSON only for test

func PrepareForDeleteCredential added in v0.0.24

func PrepareForDeleteCredential(roundTripper *mhttp.MockRoundTripper, rootURL, user, password, store, id string)

PrepareForDeleteCredential only for test

func PrepareForDeleteUser added in v0.0.20

func PrepareForDeleteUser(roundTripper *mhttp.MockRoundTripper, rootURL, userName, user, passwd string) (
	response *http.Response)

PrepareForDeleteUser only for test

func PrepareForEditUserDesc added in v0.0.20

func PrepareForEditUserDesc(roundTripper *mhttp.MockRoundTripper, rootURL, userName, description, user, passwd string)

PrepareForEditUserDesc only for test

func PrepareForEmptyAvaiablePluginList added in v0.0.20

func PrepareForEmptyAvaiablePluginList(roundTripper *mhttp.MockRoundTripper, rootURL string) (
	request *http.Request, response *http.Response)

PrepareForEmptyAvaiablePluginList only for test

func PrepareForEmptyInstalledPluginList added in v0.0.20

func PrepareForEmptyInstalledPluginList(roundTripper *mhttp.MockRoundTripper, rootURL string, depth int) (
	request *http.Request, response *http.Response)

PrepareForEmptyInstalledPluginList only for test

func PrepareForGetBuild added in v0.0.23

func PrepareForGetBuild(roundTripper *mhttp.MockRoundTripper, rootURL, jobName string, buildID int, user, password string)

PrepareForGetBuild only for test

func PrepareForGetCredentialList added in v0.0.24

func PrepareForGetCredentialList(roundTripper *mhttp.MockRoundTripper, rootURL, user, password, store string)

PrepareForGetCredentialList only for test

func PrepareForGetIdentity added in v0.0.24

func PrepareForGetIdentity(roundTripper *mhttp.MockRoundTripper, rootURL, user, password string)

PrepareForGetIdentity only for test

func PrepareForGetIssuer added in v0.0.23

func PrepareForGetIssuer(roundTripper *mhttp.MockRoundTripper, rootURL, user, password string) (
	request *http.Request, response *http.Response)

PrepareForGetIssuer only for test

func PrepareForGetIssuerWith500 added in v0.0.23

func PrepareForGetIssuerWith500(roundTripper *mhttp.MockRoundTripper, rootURL, user, password string)

PrepareForGetIssuerWith500 only for test

func PrepareForGetJob added in v0.0.23

func PrepareForGetJob(roundTripper *mhttp.MockRoundTripper, rootURL, jobName, user, password string) (
	response *http.Response)

PrepareForGetJob only for test

func PrepareForGetJobInputActions added in v0.0.21

func PrepareForGetJobInputActions(roundTripper *mhttp.MockRoundTripper, rootURL, user, password, jobName string, buildID int) (
	request *http.Request, response *http.Response)

PrepareForGetJobInputActions only for test

func PrepareForGetJobWithParams added in v0.0.23

func PrepareForGetJobWithParams(roundTripper *mhttp.MockRoundTripper, rootURL, jobName, user, password string)

PrepareForGetJobWithParams only for test

func PrepareForInstallPlugin added in v0.0.20

func PrepareForInstallPlugin(roundTripper *mhttp.MockRoundTripper, rootURL, pluginName, user, passwd string)

PrepareForInstallPlugin only for test

func PrepareForInstallPluginWithCode added in v0.0.21

func PrepareForInstallPluginWithCode(roundTripper *mhttp.MockRoundTripper,
	statusCode int, rootURL, pluginName, user, passwd string) (response *http.Response)

PrepareForInstallPluginWithCode only for test

func PrepareForInstallPluginWithVersion added in v0.0.23

func PrepareForInstallPluginWithVersion(roundTripper *mhttp.MockRoundTripper, rootURL, pluginName, version, user, passwd string)

PrepareForInstallPluginWithVersion only for test

func PrepareForJobLog added in v0.0.23

func PrepareForJobLog(roundTripper *mhttp.MockRoundTripper, rootURL, jobName string, buildID int, user, password string)

PrepareForJobLog only for test

func PrepareForLaunchComputer added in v0.0.24

func PrepareForLaunchComputer(roundTripper *mhttp.MockRoundTripper, rootURL, user, password, name string)

PrepareForLaunchComputer only for test

func PrepareForManyAvaiablePlugin added in v0.0.20

func PrepareForManyAvaiablePlugin(roundTripper *mhttp.MockRoundTripper, rootURL string) (
	request *http.Request, response *http.Response)

PrepareForManyAvaiablePlugin only for test

func PrepareForManyInstalledPlugins added in v0.0.20

func PrepareForManyInstalledPlugins(roundTripper *mhttp.MockRoundTripper, rootURL string, depth int) (
	request *http.Request, response *http.Response)

PrepareForManyInstalledPlugins only for test

func PrepareForNoAvailablePlugins added in v0.0.20

func PrepareForNoAvailablePlugins(roundTripper *mhttp.MockRoundTripper, rootURL string) (
	requestCenter *http.Request, responseCenter *http.Response)

PrepareForNoAvailablePlugins only for the test case

func PrepareForOneAvaiablePlugin added in v0.0.20

func PrepareForOneAvaiablePlugin(roundTripper *mhttp.MockRoundTripper, rootURL string) (
	request *http.Request, response *http.Response)

PrepareForOneAvaiablePlugin only for test

func PrepareForOneInstalledPlugin added in v0.0.20

func PrepareForOneInstalledPlugin(roundTripper *mhttp.MockRoundTripper, rootURL string) (
	request *http.Request, response *http.Response)

PrepareForOneInstalledPlugin only for test

func PrepareForOneInstalledPluginWithPluginName added in v0.0.24

func PrepareForOneInstalledPluginWithPluginName(roundTripper *mhttp.MockRoundTripper, rootURL, pluginName string) (
	request *http.Request, response *http.Response)

PrepareForOneInstalledPluginWithPluginName only for test

func PrepareForOneInstalledPluginWithPluginNameAndVer added in v0.0.24

func PrepareForOneInstalledPluginWithPluginNameAndVer(roundTripper *mhttp.MockRoundTripper, rootURL,
	pluginName, version string) (
	request *http.Request, response *http.Response)

PrepareForOneInstalledPluginWithPluginNameAndVer only for test

func PrepareForPipelineJob added in v0.0.20

func PrepareForPipelineJob(roundTripper *mhttp.MockRoundTripper, rootURL, user, passwd string) (
	request *http.Request, response *http.Response)

PrepareForPipelineJob only for test

func PrepareForRequest500UpdateCenter added in v0.0.20

func PrepareForRequest500UpdateCenter(roundTripper *mhttp.MockRoundTripper, rootURL string) (
	requestCenter *http.Request, responseCenter *http.Response)

PrepareForRequest500UpdateCenter only for the test case

func PrepareForRequestUpdateCenter added in v0.0.20

func PrepareForRequestUpdateCenter(roundTripper *mhttp.MockRoundTripper, rootURL string) (
	requestCenter *http.Request, responseCenter *http.Response)

PrepareForRequestUpdateCenter only for the test case

func PrepareForSASCApply added in v0.0.24

func PrepareForSASCApply(roundTripper *mhttp.MockRoundTripper, rootURL, user, password string)

PrepareForSASCApply only for test

func PrepareForSASCExport added in v0.0.24

func PrepareForSASCExport(roundTripper *mhttp.MockRoundTripper, rootURL, user, password string) (
	response *http.Response)

PrepareForSASCExport only for test

func PrepareForSASCExportWithCode added in v0.0.24

func PrepareForSASCExportWithCode(roundTripper *mhttp.MockRoundTripper, rootURL, user, password string, code int)

PrepareForSASCExportWithCode only for test

func PrepareForSASCReload added in v0.0.24

func PrepareForSASCReload(roundTripper *mhttp.MockRoundTripper, rootURL, user, password string)

PrepareForSASCReload only for test

func PrepareForSASCSchema added in v0.0.24

func PrepareForSASCSchema(roundTripper *mhttp.MockRoundTripper, rootURL, user, password string) (
	response *http.Response)

PrepareForSASCSchema only for test

func PrepareForSASCSchemaWithCode added in v0.0.24

func PrepareForSASCSchemaWithCode(roundTripper *mhttp.MockRoundTripper, rootURL, user, password string, code int)

PrepareForSASCSchemaWithCode only for test

func PrepareForSetMirrorCertificate added in v0.0.23

func PrepareForSetMirrorCertificate(roundTripper *mhttp.MockRoundTripper, rootURL, user, password string, enable bool)

PrepareForSetMirrorCertificate only for test

func PrepareForSubmitInput added in v0.0.21

func PrepareForSubmitInput(roundTripper *mhttp.MockRoundTripper, rootURL, jobPath, user, password string) (
	request *http.Request, response *http.Response)

PrepareForSubmitInput only for test

func PrepareForSubmitProcessInput added in v0.0.21

func PrepareForSubmitProcessInput(roundTripper *mhttp.MockRoundTripper, rootURL, jobPath, user, password string) (
	request *http.Request, response *http.Response)

PrepareForSubmitProcessInput only for test

func PrepareForUninstallPlugin added in v0.0.20

func PrepareForUninstallPlugin(roundTripper *mhttp.MockRoundTripper, rootURL, pluginName string) (
	request *http.Request, response *http.Response, requestCrumb *http.Request, responseCrumb *http.Response)

PrepareForUninstallPlugin only for test

func PrepareForUninstallPluginWith500 added in v0.0.20

func PrepareForUninstallPluginWith500(roundTripper *mhttp.MockRoundTripper, rootURL, pluginName string) (
	request *http.Request, response *http.Response, requestCrumb *http.Request, responseCrumb *http.Response)

PrepareForUninstallPluginWith500 only for test

func PrepareForUpdatePipelineJob added in v0.0.20

func PrepareForUpdatePipelineJob(roundTripper *mhttp.MockRoundTripper, rootURL, script, user, password string)

PrepareForUpdatePipelineJob only for test

func PrepareForUploadPlugin added in v0.0.20

func PrepareForUploadPlugin(roundTripper *mhttp.MockRoundTripper, rootURL string) (
	request *http.Request, response *http.Response, requestCrumb *http.Request, responseCrumb *http.Response)

PrepareForUploadPlugin only for test

func PrepareGetArtifacts added in v0.0.21

func PrepareGetArtifacts(roundTripper *mhttp.MockRoundTripper, rootURL, user, passwd,
	jobName string, buildID int) (response *http.Response)

PrepareGetArtifacts only for test

func PrepareGetEmptyArtifacts added in v0.0.21

func PrepareGetEmptyArtifacts(roundTripper *mhttp.MockRoundTripper, rootURL, user, passwd,
	jobName string, buildID int) (response *http.Response)

PrepareGetEmptyArtifacts only for test

func PrepareGetQueue added in v0.0.20

func PrepareGetQueue(roundTripper *mhttp.MockRoundTripper, rootURL, user, passwd string)

PrepareGetQueue only for test

func PrepareGetStatus added in v0.0.21

func PrepareGetStatus(roundTripper *mhttp.MockRoundTripper, rootURL, user, password string)

PrepareGetStatus only for test

func PrepareGetUser added in v0.0.21

func PrepareGetUser(roundTripper *mhttp.MockRoundTripper, rootURL, user, passwd string) (
	response *http.Response)

PrepareGetUser only for test

func PrepareOneItem added in v0.0.24

func PrepareOneItem(roundTripper *mhttp.MockRoundTripper, rootURL, name, kind, user, token string)

PrepareOneItem only for test

func PrepareOnePluginInfo added in v0.0.23

func PrepareOnePluginInfo(roundTripper *mhttp.MockRoundTripper, pluginName string)

PrepareOnePluginInfo only for test

func PrepareOnePluginWithDep added in v0.0.23

func PrepareOnePluginWithDep(roundTripper *mhttp.MockRoundTripper, pluginName string)

PrepareOnePluginWithDep only for test

func PrepareOnePluginWithOptionalDep added in v0.0.23

func PrepareOnePluginWithOptionalDep(roundTripper *mhttp.MockRoundTripper, pluginName string)

PrepareOnePluginWithOptionalDep only for test

func PrepareRestart added in v0.0.21

func PrepareRestart(roundTripper *mhttp.MockRoundTripper, rootURL, user, password string, statusCode int)

PrepareRestart only for test

func PrepareShowTrend added in v0.0.21

func PrepareShowTrend(roundTripper *mhttp.MockRoundTripper, keyword string) (
	response *http.Response)

PrepareShowTrend only for test

func SetLanguage added in v0.0.22

func SetLanguage(lan string)

SetLanguage set the language

func SetLogger added in v0.0.23

func SetLogger(zapLogger *zap.Logger)

SetLogger set a global logger

Types

type AgentLabel added in v0.0.18

type AgentLabel struct {
	Name string
}

AgentLabel represents the label of Jenkins agent

type Artifact added in v0.0.21

type Artifact struct {
	ID   string
	Name string
	Path string
	URL  string
	Size int64
}

Artifact represents the artifacts from Jenkins build

type ArtifactClient added in v0.0.21

type ArtifactClient struct {
	JenkinsCore
}

ArtifactClient is client for getting the artifacts

func (*ArtifactClient) List added in v0.0.21

func (q *ArtifactClient) List(jobName string, buildID int) (artifacts []Artifact, err error)

List get the list of artifacts from a build

type AvailablePlugin added in v0.0.18

type AvailablePlugin struct {
	Plugin

	// for the available list
	Name      string
	Installed bool
	Website   string
	Title     string
}

AvailablePlugin represetns a available plugin

type AvailablePluginList added in v0.0.18

type AvailablePluginList struct {
	Data   []AvailablePlugin
	Status string
}

AvailablePluginList represents a list of available plugins

type CASCManager added in v0.0.24

type CASCManager struct {
	JenkinsCore
}

CASCManager is the client of configuration as code

func (*CASCManager) Apply added in v0.0.24

func (c *CASCManager) Apply() (err error)

Apply apply the config of configuration-as-code

func (*CASCManager) Export added in v0.0.24

func (c *CASCManager) Export() (config string, err error)

Export exports the config of configuration-as-code

func (*CASCManager) Reload added in v0.0.24

func (c *CASCManager) Reload() (err error)

Reload reload the config of configuration-as-code

func (*CASCManager) Schema added in v0.0.24

func (c *CASCManager) Schema() (schema string, err error)

Schema get the schema of configuration-as-code

type Cause

type Cause struct {
	UpstreamURL      string
	UpstreamProject  string
	UpstreamBuild    int
	ShortDescription string
}

Cause represent the reason why job is triggered

type CauseAction

type CauseAction struct {
	Causes []Cause
}

CauseAction is the collection of causes

type CenterPlugin added in v0.0.20

type CenterPlugin struct {
	CompatibleWithInstalledVersion bool
	Excerpt                        string
	Installed                      InstalledPlugin
	MinimumJavaVersion             string
	Name                           string
	RequiredCore                   string
	SourceID                       string
	Title                          string
	URL                            string
	Version                        string
	Wiki                           string
}

CenterPlugin represents the all plugin from UpdateCenter

type CenterSite

type CenterSite struct {
	AvailablesPlugins  []CenterPlugin `json:"availables"`
	ConnectionCheckURL string         `json:"connectionCheckUrl"`
	DataTimestamp      int64          `json:"dataTimestamp"`
	HasUpdates         bool           `json:"hasUpdates"`
	ID                 string         `json:"id"`
	UpdatePlugins      []CenterPlugin `json:"updates"`
	URL                string         `json:"url"`
}

CenterSite represents the site of update center

type Computer added in v0.0.24

type Computer struct {
	AssignedLabels      []ComputerLabel
	Description         string
	DisplayName         string
	Idle                bool
	JnlpAgent           bool
	LaunchSupported     bool
	ManualLaunchAllowed bool
	NumExecutors        int
	Offline             bool
	OfflineCause        OfflineCause
	OfflineCauseReason  string
	TemporarilyOffline  bool
}

Computer is the agent of Jenkins

type ComputerClient added in v0.0.24

type ComputerClient struct {
	JenkinsCore
}

ComputerClient is client for operate computers

func (*ComputerClient) Create added in v0.0.24

func (c *ComputerClient) Create(name string) (err error)

Create creates a computer by name

func (*ComputerClient) Delete added in v0.0.24

func (c *ComputerClient) Delete(name string) (err error)

Delete removes a agent from Jenkins

func (*ComputerClient) GetLog added in v0.0.24

func (c *ComputerClient) GetLog(name string) (log string, err error)

GetLog fetch the log a computer

func (*ComputerClient) GetSecret added in v0.0.24

func (c *ComputerClient) GetSecret(name string) (secret string, err error)

GetSecret returns the secret of an agent

func (*ComputerClient) Launch added in v0.0.24

func (c *ComputerClient) Launch(name string) (err error)

Launch starts up a agent

func (*ComputerClient) List added in v0.0.24

func (c *ComputerClient) List() (computers ComputerList, err error)

List get the computer list

type ComputerLabel added in v0.0.24

type ComputerLabel struct {
	Name string
}

ComputerLabel represents the label of a computer

type ComputerList added in v0.0.24

type ComputerList struct {
	Computer       []Computer
	TotalExecutors int
	// contains filtered or unexported fields
}

ComputerList represents the list of computer from API

type CoreClient added in v0.0.18

type CoreClient struct {
	JenkinsCore
}

CoreClient hold the client of Jenkins core

func (*CoreClient) GetIdentity added in v0.0.24

func (q *CoreClient) GetIdentity() (identity JenkinsIdentity, err error)

GetIdentity returns the identity of a Jenkins

func (*CoreClient) Restart added in v0.0.18

func (q *CoreClient) Restart() (err error)

Restart will send the restart request

type CreateJobPayload added in v0.0.22

type CreateJobPayload struct {
	Name string `json:"name"`
	Mode string `json:"mode"`
	From string `json:"from"`
}

CreateJobPayload the payload for creating a job

type Credential added in v0.0.24

type Credential struct {
	Description string `json:"description"`
	DisplayName string
	Fingerprint interface{}
	FullName    string
	ID          string `json:"id"`
	TypeName    string
	Class       string `json:"$class"`
	Scope       string `json:"scope"`
}

Credential of Jenkins

type CredentialList added in v0.0.24

type CredentialList struct {
	Description     string
	DisplayName     string
	FullDisplayName string
	FullName        string
	Global          bool
	URLName         string
	Credentials     []Credential
}

CredentialList contains many credentials

type CredentialsManager added in v0.0.24

type CredentialsManager struct {
	JenkinsCore
}

CredentialsManager hold the info of credentials client

func (*CredentialsManager) Create added in v0.0.24

func (c *CredentialsManager) Create(store, credential string) (err error)

Create create a credential in Jenkins

func (*CredentialsManager) CreateSecret added in v0.0.24

func (c *CredentialsManager) CreateSecret(store string, cred StringCredentials) (err error)

CreateSecret create token credential in Jenkins

func (*CredentialsManager) CreateUsernamePassword added in v0.0.24

func (c *CredentialsManager) CreateUsernamePassword(store string, cred UsernamePasswordCredential) (err error)

CreateUsernamePassword create username and password credential in Jenkins

func (*CredentialsManager) Delete added in v0.0.24

func (c *CredentialsManager) Delete(store, id string) (err error)

Delete removes a credential by id from a store

func (*CredentialsManager) GetList added in v0.0.24

func (c *CredentialsManager) GetList(store string) (credentialList CredentialList, err error)

GetList returns the credential list

type DefaultParameterValue added in v0.0.18

type DefaultParameterValue struct {
	Description string
	Value       interface{}
}

DefaultParameterValue represents the default value for param

type InstallStates added in v0.0.18

type InstallStates struct {
	Data   InstallStatesData
	Status string
}

InstallStates is the installation states

type InstallStatesData added in v0.0.18

type InstallStatesData struct {
	Jobs  InstallStatesJob
	State string
}

InstallStatesData is the installation state data

type InstallStatesJob added in v0.0.18

type InstallStatesJob struct {
	InstallStatus   string
	Name            string
	RequiresRestart string
	Title           string
	Version         string
}

InstallStatesJob is the installation state job

type InstallationJob added in v0.0.18

type InstallationJob struct {
	UpdateCenterJob

	Name   string
	Status InstallationJobStatus
}

InstallationJob represents the installation job

type InstallationJobStatus added in v0.0.18

type InstallationJobStatus struct {
	Success bool
	Type    string
}

InstallationJobStatus represents the installation job status

type InstalledPlugin added in v0.0.18

type InstalledPlugin struct {
	Plugin

	Enable             bool
	ShortName          string
	LongName           string
	Version            string
	URL                string
	HasUpdate          bool
	Pinned             bool
	RequiredCoreVesion string
	MinimumJavaVersion string
	SupportDynamicLoad string
	BackVersion        string
	Dependencies       []PluginDependency
}

InstalledPlugin represent the installed plugin from Jenkins

type InstalledPluginList added in v0.0.18

type InstalledPluginList struct {
	Plugins []InstalledPlugin
}

InstalledPluginList represent a list of plugins

type JenkinsCore

type JenkinsCore struct {
	JenkinsCrumb
	URL                string
	InsecureSkipVerify bool
	UserName           string
	Token              string
	Proxy              string
	ProxyAuth          string

	Debug        bool
	Output       io.Writer
	RoundTripper http.RoundTripper
}

JenkinsCore core information of Jenkins

func (*JenkinsCore) AuthHandle

func (j *JenkinsCore) AuthHandle(request *http.Request) (err error)

AuthHandle takes care of the auth

func (*JenkinsCore) CrumbHandle

func (j *JenkinsCore) CrumbHandle(request *http.Request) error

CrumbHandle handle crum with http request

func (*JenkinsCore) ErrorHandle added in v0.0.20

func (j *JenkinsCore) ErrorHandle(statusCode int, data []byte) (err error)

ErrorHandle handles the error cases

func (*JenkinsCore) GetClient added in v0.0.10

func (j *JenkinsCore) GetClient() (client *http.Client)

GetClient get the default http Jenkins client

func (*JenkinsCore) GetCrumb

func (j *JenkinsCore) GetCrumb() (crumbIssuer *JenkinsCrumb, err error)

GetCrumb get the crumb from Jenkins

func (*JenkinsCore) PermissionError added in v0.0.21

func (j *JenkinsCore) PermissionError(statusCode int) (err error)

PermissionError handles the no permission

func (*JenkinsCore) ProxyHandle added in v0.0.18

func (j *JenkinsCore) ProxyHandle(request *http.Request)

ProxyHandle takes care of the proxy setting

func (*JenkinsCore) Request added in v0.0.20

func (j *JenkinsCore) Request(method, api string, headers map[string]string, payload io.Reader) (
	statusCode int, data []byte, err error)

Request make a common request

func (*JenkinsCore) RequestWithData added in v0.0.20

func (j *JenkinsCore) RequestWithData(method, api string, headers map[string]string,
	payload io.Reader, successCode int, obj interface{}) (err error)

RequestWithData requests the api and parse the data into an interface

func (*JenkinsCore) RequestWithResponse added in v0.0.21

func (j *JenkinsCore) RequestWithResponse(method, api string, headers map[string]string, payload io.Reader) (
	response *http.Response, err error)

RequestWithResponse make a common request

func (*JenkinsCore) RequestWithResponseHeader added in v0.0.21

func (j *JenkinsCore) RequestWithResponseHeader(method, api string, headers map[string]string, payload io.Reader, obj interface{}) (
	response *http.Response, err error)

RequestWithResponseHeader make a common request

func (*JenkinsCore) RequestWithoutData added in v0.0.20

func (j *JenkinsCore) RequestWithoutData(method, api string, headers map[string]string,
	payload io.Reader, successCode int) (statusCode int, err error)

RequestWithoutData requests the api without handling data

type JenkinsCrumb

type JenkinsCrumb struct {
	CrumbRequestField string
	Crumb             string
}

JenkinsCrumb crumb for Jenkins

type JenkinsIdentity added in v0.0.24

type JenkinsIdentity struct {
	Fingerprint   string
	PublicKey     string
	SystemMessage string
}

JenkinsIdentity belongs to a Jenkins

type JenkinsInputParametersRequest added in v0.0.21

type JenkinsInputParametersRequest struct {
	Parameter []ParameterDefinition `json:"parameter"`
}

JenkinsInputParametersRequest represents the parameters for the Jenkins input request

type JenkinsItem added in v0.0.24

type JenkinsItem struct {
	Name        string
	DisplayName string
	URL         string
	Description string
	Type        string

	/** comes from Job */
	Buildable bool
	Building  bool
	InQueue   bool

	/** comes from ParameterizedJob */
	Parameterized bool
	Disabled      bool
}

JenkinsItem represents the item of Jenkins

type JenkinsStatus added in v0.0.18

type JenkinsStatus struct {
	AssignedLabels  []AgentLabel
	Description     string
	Jobs            []Job
	Mode            string
	NodeDescription string
	NodeName        string
	NumExecutors    int
	PrimaryView     View
	QuietingDown    bool
	SlaveAgentPort  int
	UseCrumbs       bool
	UseSecurity     bool
	Views           []View
	Version         string
}

JenkinsStatus holds the status of Jenkins

type JenkinsStatusClient added in v0.0.18

type JenkinsStatusClient struct {
	JenkinsCore
}

JenkinsStatusClient use to connect with Jenkins status

func (*JenkinsStatusClient) Get added in v0.0.18

func (q *JenkinsStatusClient) Get() (status *JenkinsStatus, err error)

Get returns status of Jenkins

type Job added in v0.0.10

type Job struct {
	Type            string `json:"_class"`
	Builds          []JobBuild
	Color           string
	ConcurrentBuild bool
	Name            string
	NextBuildNumber int
	URL             string
	Buildable       bool

	Property []ParametersDefinitionProperty
}

Job represents a job

type JobBuild added in v0.0.10

type JobBuild struct {
	SimpleJobBuild
	Building          bool
	Description       string
	DisplayName       string
	Duration          int64
	EstimatedDuration int64
	FullDisplayName   string
	ID                string
	KeepLog           bool
	QueueID           int
	Result            string
	Timestamp         int64
	PreviousBuild     SimpleJobBuild
	NextBuild         SimpleJobBuild
}

JobBuild represents a job build

type JobCategory added in v0.0.18

type JobCategory struct {
	Description string
	ID          string
	Items       []JobCategoryItem
	MinToShow   int
	Name        string
	Order       int
}

JobCategory represents a job category

type JobCategoryItem added in v0.0.18

type JobCategoryItem struct {
	Description string
	DisplayName string
	Order       int
	Class       string
}

JobCategoryItem represents a job category item

type JobClient added in v0.0.10

type JobClient struct {
	JenkinsCore
}

JobClient is client for operate jobs

func (*JobClient) Build added in v0.0.10

func (q *JobClient) Build(jobName string) (err error)

Build trigger a job

func (*JobClient) BuildWithParams added in v0.0.18

func (q *JobClient) BuildWithParams(jobName string, parameters []ParameterDefinition) (err error)

BuildWithParams build a job which has params

func (*JobClient) Create added in v0.0.18

func (q *JobClient) Create(jobPayload CreateJobPayload) (err error)

Create can create a job

func (*JobClient) Delete added in v0.0.18

func (q *JobClient) Delete(jobName string) (err error)

Delete will delete a job by name

func (*JobClient) GetBuild added in v0.0.18

func (q *JobClient) GetBuild(jobName string, id int) (job *JobBuild, err error)

GetBuild get build information of a job

func (*JobClient) GetHistory added in v0.0.10

func (q *JobClient) GetHistory(name string) (builds []*JobBuild, err error)

GetHistory returns the build history of a job

func (*JobClient) GetJob added in v0.0.10

func (q *JobClient) GetJob(name string) (job *Job, err error)

GetJob returns the job info

func (*JobClient) GetJobInputActions added in v0.0.21

func (q *JobClient) GetJobInputActions(jobName string, buildID int) (actions []JobInputItem, err error)

GetJobInputActions returns the all pending actions

func (*JobClient) GetJobTypeCategories added in v0.0.18

func (q *JobClient) GetJobTypeCategories() (jobCategories []JobCategory, err error)

GetJobTypeCategories returns all categories of jobs

func (*JobClient) GetPipeline added in v0.0.18

func (q *JobClient) GetPipeline(name string) (pipeline *Pipeline, err error)

GetPipeline return the pipeline object

func (*JobClient) JobInputSubmit added in v0.0.21

func (q *JobClient) JobInputSubmit(jobName, inputID string, buildID int, abort bool, params map[string]string) (err error)

JobInputSubmit submit the pending input request

func (*JobClient) Log added in v0.0.10

func (q *JobClient) Log(jobName string, history int, start int64) (jobLog JobLog, err error)

Log get the log of a job

func (*JobClient) Search added in v0.0.10

func (q *JobClient) Search(name, kind string, start, limit int) (items []JenkinsItem, err error)

Search find a set of jobs by name

func (*JobClient) StopJob added in v0.0.18

func (q *JobClient) StopJob(jobName string, num int) (err error)

StopJob stops a job build

func (*JobClient) UpdatePipeline added in v0.0.18

func (q *JobClient) UpdatePipeline(name, script string) (err error)

UpdatePipeline updates the pipeline script

type JobInputItem added in v0.0.21

type JobInputItem struct {
	ID                  string
	AbortURL            string
	Message             string
	ProceedText         string
	ProceedURL          string
	RedirectApprovalURL string
	Inputs              []ParameterDefinition
}

JobInputItem represents a job input action

type JobLog added in v0.0.10

type JobLog struct {
	HasMore   bool
	NextStart int64
	Text      string
}

JobLog holds the log text

type JobQueue

type JobQueue struct {
	Items []QueueItem
}

JobQueue represent the job queue

type OfflineCause added in v0.0.24

type OfflineCause struct {
	Timestamp   int64
	Description string
}

OfflineCause is the cause of computer offline

type ParameterDefinition added in v0.0.18

type ParameterDefinition struct {
	Description           string
	Name                  string `json:"name"`
	Type                  string
	Value                 string `json:"value"`
	DefaultParameterValue DefaultParameterValue
}

ParameterDefinition holds the parameter definition

type ParametersDefinitionProperty added in v0.0.18

type ParametersDefinitionProperty struct {
	ParameterDefinitions []ParameterDefinition
}

ParametersDefinitionProperty holds the param definition property

type Pipeline added in v0.0.18

type Pipeline struct {
	Script  string
	Sandbox bool
}

Pipeline represents a pipeline

type Plugin

type Plugin struct {
	Active       bool
	Enabled      bool
	Bundled      bool
	Downgradable bool
	Deleted      bool
}

Plugin represents a plugin of Jenkins

type PluginAPI added in v0.0.18

type PluginAPI struct {
	SkipDependency bool
	SkipOptional   bool
	UseMirror      bool
	ShowProgress   bool
	MirrorURL      string

	RoundTripper http.RoundTripper
	// contains filtered or unexported fields
}

PluginAPI represents a plugin API

func (*PluginAPI) DownloadPlugins added in v0.0.18

func (d *PluginAPI) DownloadPlugins(names []string)

DownloadPlugins will download those plugins from update center

func (*PluginAPI) ShowTrend added in v0.0.18

func (d *PluginAPI) ShowTrend(name string) (trend string, err error)

ShowTrend show the trend of plugins

type PluginDependency added in v0.0.18

type PluginDependency struct {
	Name      string `json:"name"`
	Implied   bool   `json:"implied"`
	Optional  bool   `json:"optional"`
	Title     string `json:"title"`
	Version   string `json:"version"`
	ShortName string `json:"shortName"`
}

PluginDependency represents a plugin dependency

type PluginInfo added in v0.0.18

type PluginInfo struct {
	BuildDate         string             `json:"buildDate"`
	Dependencies      []PluginDependency `json:"dependencies"`
	Excerpt           string             `json:"excerpt"`
	FirstRelease      string             `json:"firstRelease"`
	Gav               string             `json:"gav"`
	Name              string             `json:"name"`
	PreviousTimestamp string             `json:"previousTimestamp"`
	PreviousVersion   string             `json:"previousVersion"`
	ReleaseTimestamp  string             `json:"releaseTimestamp"`
	RequireCore       string             `json:"RequireCore"`
	Title             string             `json:"title"`
	URL               string             `json:"url"`
	Version           string             `json:"version"`

	Stats PluginInfoStats
}

PluginInfo hold the info of a plugin

type PluginInfoStats added in v0.0.18

type PluginInfoStats struct {
	CurrentInstalls                   int
	Installations                     []PluginInstallationInfo
	InstallationsPerVersion           []PluginInstallationInfo
	InstallationsPercentage           []PluginInstallationInfo
	InstallationsPercentagePerVersion []PluginInstallationInfo
	Trend                             int
}

PluginInfoStats is the plugin info stats

type PluginInstallationInfo added in v0.0.18

type PluginInstallationInfo struct {
	Timestamp  int64
	Total      int
	Version    string
	Percentage float64
}

PluginInstallationInfo represents the plugin installation info

type PluginManager

type PluginManager struct {
	JenkinsCore

	UseMirror    bool
	MirrorURL    string
	ShowProgress bool
}

PluginManager is the client of plugin manager

func (*PluginManager) CheckUpdate

func (p *PluginManager) CheckUpdate(handle func(*http.Response)) (err error)

CheckUpdate fetch the latest plugins from update center site

func (*PluginManager) FindInstalledPlugin added in v0.0.24

func (p *PluginManager) FindInstalledPlugin(name string) (targetPlugin *InstalledPlugin, err error)

FindInstalledPlugin find the exist plugin by name

func (*PluginManager) GetAvailablePlugins added in v0.0.18

func (p *PluginManager) GetAvailablePlugins() (pluginList *AvailablePluginList, err error)

GetAvailablePlugins get the aviable plugins from Jenkins

func (*PluginManager) GetPlugins

func (p *PluginManager) GetPlugins(depth int) (pluginList *InstalledPluginList, err error)

GetPlugins get installed plugins

func (*PluginManager) InstallPlugin

func (p *PluginManager) InstallPlugin(names []string) (err error)

InstallPlugin install a plugin by name

func (*PluginManager) UninstallPlugin

func (p *PluginManager) UninstallPlugin(name string) (err error)

UninstallPlugin uninstall a plugin by name

func (*PluginManager) Upload added in v0.0.18

func (p *PluginManager) Upload(pluginFile string) (err error)

Upload will upload a file from local filesystem into Jenkins

type QueueClient

type QueueClient struct {
	JenkinsCore
}

QueueClient is the client of queue

func (*QueueClient) Cancel added in v0.0.20

func (q *QueueClient) Cancel(id int) (err error)

Cancel will cancel a job from the queue

func (*QueueClient) Get

func (q *QueueClient) Get() (status *JobQueue, err error)

Get returns the job queue

type QueueItem

type QueueItem struct {
	Blocked                    bool
	Buildable                  bool
	ID                         int
	Params                     string
	Pending                    bool
	Stuck                      bool
	URL                        string
	Why                        string
	BuildableStartMilliseconds int64
	InQueueSince               int64
	Actions                    []CauseAction
}

QueueItem is the item of job queue

type RequestMatcher added in v0.0.20

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

RequestMatcher to match the http request

func NewRequestMatcher added in v0.0.20

func NewRequestMatcher(request *http.Request) *RequestMatcher

NewRequestMatcher create a request matcher will match request method and request path

func NewVerboseRequestMatcher added in v0.0.20

func NewVerboseRequestMatcher(request *http.Request) *RequestMatcher

NewVerboseRequestMatcher create a verbose request matcher will match request method and request path

func (*RequestMatcher) Matches added in v0.0.20

func (request *RequestMatcher) Matches(x interface{}) bool

Matches returns a matcher with given function

func (*RequestMatcher) String added in v0.0.20

func (request *RequestMatcher) String() string

String returns the text of current object

func (*RequestMatcher) WithBody added in v0.0.21

func (request *RequestMatcher) WithBody() *RequestMatcher

WithBody returns a matcher with body

func (*RequestMatcher) WithQuery added in v0.0.20

func (request *RequestMatcher) WithQuery() *RequestMatcher

WithQuery returns a matcher with query

type SimpleJobBuild added in v0.0.18

type SimpleJobBuild struct {
	Number int
	URL    string
}

SimpleJobBuild represents a simple job build

type StringCredentials added in v0.0.24

type StringCredentials struct {
	Credential `json:",inline"`
	Secret     string `json:"secret"`
}

StringCredentials hold a token

type Token added in v0.0.18

type Token struct {
	Status string
	Data   TokenData
}

Token is the token of user

type TokenData added in v0.0.18

type TokenData struct {
	TokenName  string
	TokenUUID  string
	TokenValue string
}

TokenData represents the token

type UpdateCenter

type UpdateCenter struct {
	Availables                   []Plugin
	Jobs                         []InstallationJob
	RestartRequiredForCompletion bool
	Sites                        []CenterSite
}

UpdateCenter represents the update center of Jenkins

type UpdateCenterJob

type UpdateCenterJob struct {
	ErrorMessage string
	ID           int `json:"id"`
	Type         string
}

UpdateCenterJob represents the job for updateCenter which execute a task

type UpdateCenterManager

type UpdateCenterManager struct {
	JenkinsCore

	MirrorSite string

	LTS     bool
	Version string
	Output  string

	ShowProgress bool
}

UpdateCenterManager manages the UpdateCenter

func (*UpdateCenterManager) ChangeUpdateCenterSite added in v0.0.23

func (u *UpdateCenterManager) ChangeUpdateCenterSite(name, updateCenterURL string) (err error)

ChangeUpdateCenterSite updates the update center address

func (*UpdateCenterManager) DownloadJenkins added in v0.0.20

func (u *UpdateCenterManager) DownloadJenkins() (err error)

DownloadJenkins download Jenkins

func (*UpdateCenterManager) GetJenkinsWarURL added in v0.0.23

func (u *UpdateCenterManager) GetJenkinsWarURL() (warURL string)

GetJenkinsWarURL returns a URL of Jenkins war file

func (*UpdateCenterManager) GetSite added in v0.0.20

func (u *UpdateCenterManager) GetSite() (site *CenterSite, err error)

GetSite is get Available Plugins and Updated Plugins from UpdateCenter

func (*UpdateCenterManager) SetMirrorCertificate added in v0.0.23

func (u *UpdateCenterManager) SetMirrorCertificate(enable bool) (err error)

SetMirrorCertificate take the mirror certificate file or not

func (*UpdateCenterManager) Status

func (u *UpdateCenterManager) Status() (status *UpdateCenter, err error)

Status returns the status of Jenkins

func (*UpdateCenterManager) Upgrade added in v0.0.19

func (u *UpdateCenterManager) Upgrade() (err error)

Upgrade the Jenkins core

type User added in v0.0.18

type User struct {
	AbsoluteURL string `json:"absoluteUrl"`
	Description string
	FullName    string `json:"fullname"`
	ID          string
}

User for Jenkins

type UserClient added in v0.0.18

type UserClient struct {
	JenkinsCore
}

UserClient for connect the user

func (*UserClient) Create added in v0.0.18

func (q *UserClient) Create(username, password string) (user *UserForCreate, err error)

Create will create a user in Jenkins

func (*UserClient) CreateToken added in v0.0.18

func (q *UserClient) CreateToken(targetUser, newTokenName string) (status *Token, err error)

CreateToken create a token in Jenkins

func (*UserClient) Delete added in v0.0.18

func (q *UserClient) Delete(username string) (err error)

Delete will remove a user from Jenkins

func (*UserClient) EditDesc added in v0.0.18

func (q *UserClient) EditDesc(description string) (err error)

EditDesc update the description of a user

func (*UserClient) Get added in v0.0.18

func (q *UserClient) Get() (status *User, err error)

Get returns a user's detail

type UserForCreate added in v0.0.18

type UserForCreate struct {
	User      `json:",inline"`
	Username  string `json:"username"`
	Password1 string `json:"password1"`
	Password2 string `json:"password2"`
	Email     string `json:"email"`
}

UserForCreate is the data for creatig a user

type UsernamePasswordCredential added in v0.0.24

type UsernamePasswordCredential struct {
	Credential `json:",inline"`
	Username   string `json:"username"`
	Password   string `json:"password"`
}

UsernamePasswordCredential hold the username and password

type View added in v0.0.18

type View struct {
	Name string
	URL  string
}

View represents the view of Jenkins

Jump to

Keyboard shortcuts

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