client

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2019 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package client contains client for Jenkins API

Package mock_client is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GroovyScriptExecutionFailed added in v0.2.0

type GroovyScriptExecutionFailed struct {
	ConfigurationType string
	Source            string
	Name              string
	Logs              string
}

GroovyScriptExecutionFailed is custom error type which indicates passed groovy script is invalid

func (GroovyScriptExecutionFailed) Error added in v0.2.0

type Jenkins

type Jenkins interface {
	GenerateToken(userName, tokenName string) (*UserToken, error)
	Info() (*gojenkins.ExecutorResponse, error)
	SafeRestart() error
	CreateNode(name string, numExecutors int, description string, remoteFS string, label string, options ...interface{}) (*gojenkins.Node, error)
	DeleteNode(name string) (bool, error)
	CreateFolder(name string, parents ...string) (*gojenkins.Folder, error)
	CreateJobInFolder(config string, jobName string, parentIDs ...string) (*gojenkins.Job, error)
	CreateJob(config string, options ...interface{}) (*gojenkins.Job, error)
	CreateOrUpdateJob(config, jobName string) (*gojenkins.Job, bool, error)
	RenameJob(job string, name string) *gojenkins.Job
	CopyJob(copyFrom string, newName string) (*gojenkins.Job, error)
	DeleteJob(name string) (bool, error)
	BuildJob(name string, options ...interface{}) (int64, error)
	GetNode(name string) (*gojenkins.Node, error)
	GetLabel(name string) (*gojenkins.Label, error)
	GetBuild(jobName string, number int64) (*gojenkins.Build, error)
	GetJob(id string, parentIDs ...string) (*gojenkins.Job, error)
	GetSubJob(parentID string, childID string) (*gojenkins.Job, error)
	GetFolder(id string, parents ...string) (*gojenkins.Folder, error)
	GetAllNodes() ([]*gojenkins.Node, error)
	GetAllBuildIds(job string) ([]gojenkins.JobBuild, error)
	GetAllJobNames() ([]gojenkins.InnerJob, error)
	GetAllJobs() ([]*gojenkins.Job, error)
	GetQueue() (*gojenkins.Queue, error)
	GetQueueUrl() string
	GetQueueItem(id int64) (*gojenkins.Task, error)
	GetArtifactData(id string) (*gojenkins.FingerPrintResponse, error)
	GetPlugins(depth int) (*gojenkins.Plugins, error)
	UninstallPlugin(name string) error
	HasPlugin(name string) (*gojenkins.Plugin, error)
	InstallPlugin(name string, version string) error
	ValidateFingerPrint(id string) (bool, error)
	GetView(name string) (*gojenkins.View, error)
	GetAllViews() ([]*gojenkins.View, error)
	CreateView(name string, viewType string) (*gojenkins.View, error)
	Poll() (int, error)
	ExecuteScript(groovyScript string) (logs string, err error)
	GetNodeSecret(name string) (string, error)
}

Jenkins defines Jenkins API

func New

func New(url, user, passwordOrToken string) (Jenkins, error)

New creates Jenkins API client

type JenkinsAPIConnectionSettings added in v0.3.1

type JenkinsAPIConnectionSettings struct {
	Hostname    string
	Port        int
	UseNodePort bool
}

JenkinsAPIConnectionSettings is struct that handle information about Jenkins API connection

func (JenkinsAPIConnectionSettings) BuildJenkinsAPIUrl added in v0.3.1

func (j JenkinsAPIConnectionSettings) BuildJenkinsAPIUrl(serviceName string, serviceNamespace string, servicePort int32, serviceNodePort int32) string

BuildJenkinsAPIUrl returns Jenkins API URL

func (JenkinsAPIConnectionSettings) Validate added in v0.3.1

func (j JenkinsAPIConnectionSettings) Validate() error

Validate validates jenkins API connection settings

type MockJenkins

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

MockJenkins is a mock of Jenkins interface

func NewMockJenkins

func NewMockJenkins(ctrl *gomock.Controller) *MockJenkins

NewMockJenkins creates a new mock instance

func (*MockJenkins) BuildJob

func (m *MockJenkins) BuildJob(name string, options ...interface{}) (int64, error)

BuildJob mocks base method

func (*MockJenkins) CopyJob

func (m *MockJenkins) CopyJob(copyFrom, newName string) (*gojenkins.Job, error)

CopyJob mocks base method

func (*MockJenkins) CreateFolder

func (m *MockJenkins) CreateFolder(name string, parents ...string) (*gojenkins.Folder, error)

CreateFolder mocks base method

func (*MockJenkins) CreateJob

func (m *MockJenkins) CreateJob(config string, options ...interface{}) (*gojenkins.Job, error)

CreateJob mocks base method

func (*MockJenkins) CreateJobInFolder

func (m *MockJenkins) CreateJobInFolder(config, jobName string, parentIDs ...string) (*gojenkins.Job, error)

CreateJobInFolder mocks base method

func (*MockJenkins) CreateNode

func (m *MockJenkins) CreateNode(name string, numExecutors int, description, remoteFS, label string, options ...interface{}) (*gojenkins.Node, error)

CreateNode mocks base method

func (*MockJenkins) CreateOrUpdateJob

func (m *MockJenkins) CreateOrUpdateJob(config, jobName string) (*gojenkins.Job, bool, error)

CreateOrUpdateJob mocks base method

func (*MockJenkins) CreateView

func (m *MockJenkins) CreateView(name, viewType string) (*gojenkins.View, error)

CreateView mocks base method

func (*MockJenkins) DeleteJob

func (m *MockJenkins) DeleteJob(name string) (bool, error)

DeleteJob mocks base method

func (*MockJenkins) DeleteNode

func (m *MockJenkins) DeleteNode(name string) (bool, error)

DeleteNode mocks base method

func (*MockJenkins) EXPECT

func (m *MockJenkins) EXPECT() *MockJenkinsMockRecorder

EXPECT returns an object that allows the caller to indicate expected use

func (*MockJenkins) ExecuteScript added in v0.0.5

func (m *MockJenkins) ExecuteScript(groovyScript string) (string, error)

ExecuteScript mocks base method

func (*MockJenkins) GenerateToken

func (m *MockJenkins) GenerateToken(userName, tokenName string) (*UserToken, error)

GenerateToken mocks base method

func (*MockJenkins) GetAllBuildIds

func (m *MockJenkins) GetAllBuildIds(job string) ([]gojenkins.JobBuild, error)

GetAllBuildIds mocks base method

func (*MockJenkins) GetAllJobNames

func (m *MockJenkins) GetAllJobNames() ([]gojenkins.InnerJob, error)

GetAllJobNames mocks base method

func (*MockJenkins) GetAllJobs

func (m *MockJenkins) GetAllJobs() ([]*gojenkins.Job, error)

GetAllJobs mocks base method

func (*MockJenkins) GetAllNodes

func (m *MockJenkins) GetAllNodes() ([]*gojenkins.Node, error)

GetAllNodes mocks base method

func (*MockJenkins) GetAllViews

func (m *MockJenkins) GetAllViews() ([]*gojenkins.View, error)

GetAllViews mocks base method

func (*MockJenkins) GetArtifactData

func (m *MockJenkins) GetArtifactData(id string) (*gojenkins.FingerPrintResponse, error)

GetArtifactData mocks base method

func (*MockJenkins) GetBuild

func (m *MockJenkins) GetBuild(jobName string, number int64) (*gojenkins.Build, error)

GetBuild mocks base method

func (*MockJenkins) GetFolder

func (m *MockJenkins) GetFolder(id string, parents ...string) (*gojenkins.Folder, error)

GetFolder mocks base method

func (*MockJenkins) GetJob

func (m *MockJenkins) GetJob(id string, parentIDs ...string) (*gojenkins.Job, error)

GetJob mocks base method

func (*MockJenkins) GetLabel

func (m *MockJenkins) GetLabel(name string) (*gojenkins.Label, error)

GetLabel mocks base method

func (*MockJenkins) GetNode

func (m *MockJenkins) GetNode(name string) (*gojenkins.Node, error)

GetNode mocks base method

func (*MockJenkins) GetNodeSecret added in v0.2.0

func (m *MockJenkins) GetNodeSecret(name string) (string, error)

func (*MockJenkins) GetPlugins

func (m *MockJenkins) GetPlugins(depth int) (*gojenkins.Plugins, error)

GetPlugins mocks base method

func (*MockJenkins) GetQueue

func (m *MockJenkins) GetQueue() (*gojenkins.Queue, error)

GetQueue mocks base method

func (*MockJenkins) GetQueueItem

func (m *MockJenkins) GetQueueItem(id int64) (*gojenkins.Task, error)

GetQueueItem mocks base method

func (*MockJenkins) GetQueueUrl

func (m *MockJenkins) GetQueueUrl() string

GetQueueUrl mocks base method

func (*MockJenkins) GetSubJob

func (m *MockJenkins) GetSubJob(parentID, childID string) (*gojenkins.Job, error)

GetSubJob mocks base method

func (*MockJenkins) GetView

func (m *MockJenkins) GetView(name string) (*gojenkins.View, error)

GetView mocks base method

func (*MockJenkins) HasPlugin

func (m *MockJenkins) HasPlugin(name string) (*gojenkins.Plugin, error)

HasPlugin mocks base method

func (*MockJenkins) Info

Info mocks base method

func (*MockJenkins) InstallPlugin

func (m *MockJenkins) InstallPlugin(name, version string) error

InstallPlugin mocks base method

func (*MockJenkins) Poll

func (m *MockJenkins) Poll() (int, error)

Poll mocks base method

func (*MockJenkins) RenameJob

func (m *MockJenkins) RenameJob(job, name string) *gojenkins.Job

RenameJob mocks base method

func (*MockJenkins) SafeRestart

func (m *MockJenkins) SafeRestart() error

SafeRestart mocks base method

func (*MockJenkins) UninstallPlugin

func (m *MockJenkins) UninstallPlugin(name string) error

UninstallPlugin mocks base method

func (*MockJenkins) ValidateFingerPrint

func (m *MockJenkins) ValidateFingerPrint(id string) (bool, error)

ValidateFingerPrint mocks base method

type MockJenkinsMockRecorder

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

MockJenkinsMockRecorder is the mock recorder for MockJenkins

func (*MockJenkinsMockRecorder) BuildJob

func (mr *MockJenkinsMockRecorder) BuildJob(name interface{}, options ...interface{}) *gomock.Call

BuildJob indicates an expected call of BuildJob

func (*MockJenkinsMockRecorder) CopyJob

func (mr *MockJenkinsMockRecorder) CopyJob(copyFrom, newName interface{}) *gomock.Call

CopyJob indicates an expected call of CopyJob

func (*MockJenkinsMockRecorder) CreateFolder

func (mr *MockJenkinsMockRecorder) CreateFolder(name interface{}, parents ...interface{}) *gomock.Call

CreateFolder indicates an expected call of CreateFolder

func (*MockJenkinsMockRecorder) CreateJob

func (mr *MockJenkinsMockRecorder) CreateJob(config interface{}, options ...interface{}) *gomock.Call

CreateJob indicates an expected call of CreateJob

func (*MockJenkinsMockRecorder) CreateJobInFolder

func (mr *MockJenkinsMockRecorder) CreateJobInFolder(config, jobName interface{}, parentIDs ...interface{}) *gomock.Call

CreateJobInFolder indicates an expected call of CreateJobInFolder

func (*MockJenkinsMockRecorder) CreateNode

func (mr *MockJenkinsMockRecorder) CreateNode(name, numExecutors, description, remoteFS, label interface{}, options ...interface{}) *gomock.Call

CreateNode indicates an expected call of CreateNode

func (*MockJenkinsMockRecorder) CreateOrUpdateJob

func (mr *MockJenkinsMockRecorder) CreateOrUpdateJob(config, jobName interface{}) *gomock.Call

CreateOrUpdateJob indicates an expected call of CreateOrUpdateJob

func (*MockJenkinsMockRecorder) CreateView

func (mr *MockJenkinsMockRecorder) CreateView(name, viewType interface{}) *gomock.Call

CreateView indicates an expected call of CreateView

func (*MockJenkinsMockRecorder) DeleteJob

func (mr *MockJenkinsMockRecorder) DeleteJob(name interface{}) *gomock.Call

DeleteJob indicates an expected call of DeleteJob

func (*MockJenkinsMockRecorder) DeleteNode

func (mr *MockJenkinsMockRecorder) DeleteNode(name interface{}) *gomock.Call

DeleteNode indicates an expected call of DeleteNode

func (*MockJenkinsMockRecorder) ExecuteScript added in v0.0.5

func (mr *MockJenkinsMockRecorder) ExecuteScript(groovyScript interface{}) *gomock.Call

ExecuteScript indicates an expected call of ExecuteScript

func (*MockJenkinsMockRecorder) GenerateToken

func (mr *MockJenkinsMockRecorder) GenerateToken(userName, tokenName interface{}) *gomock.Call

GenerateToken indicates an expected call of GenerateToken

func (*MockJenkinsMockRecorder) GetAllBuildIds

func (mr *MockJenkinsMockRecorder) GetAllBuildIds(job interface{}) *gomock.Call

GetAllBuildIds indicates an expected call of GetAllBuildIds

func (*MockJenkinsMockRecorder) GetAllJobNames

func (mr *MockJenkinsMockRecorder) GetAllJobNames() *gomock.Call

GetAllJobNames indicates an expected call of GetAllJobNames

func (*MockJenkinsMockRecorder) GetAllJobs

func (mr *MockJenkinsMockRecorder) GetAllJobs() *gomock.Call

GetAllJobs indicates an expected call of GetAllJobs

func (*MockJenkinsMockRecorder) GetAllNodes

func (mr *MockJenkinsMockRecorder) GetAllNodes() *gomock.Call

GetAllNodes indicates an expected call of GetAllNodes

func (*MockJenkinsMockRecorder) GetAllViews

func (mr *MockJenkinsMockRecorder) GetAllViews() *gomock.Call

GetAllViews indicates an expected call of GetAllViews

func (*MockJenkinsMockRecorder) GetArtifactData

func (mr *MockJenkinsMockRecorder) GetArtifactData(id interface{}) *gomock.Call

GetArtifactData indicates an expected call of GetArtifactData

func (*MockJenkinsMockRecorder) GetBuild

func (mr *MockJenkinsMockRecorder) GetBuild(jobName, number interface{}) *gomock.Call

GetBuild indicates an expected call of GetBuild

func (*MockJenkinsMockRecorder) GetFolder

func (mr *MockJenkinsMockRecorder) GetFolder(id interface{}, parents ...interface{}) *gomock.Call

GetFolder indicates an expected call of GetFolder

func (*MockJenkinsMockRecorder) GetJob

func (mr *MockJenkinsMockRecorder) GetJob(id interface{}, parentIDs ...interface{}) *gomock.Call

GetJob indicates an expected call of GetJob

func (*MockJenkinsMockRecorder) GetLabel

func (mr *MockJenkinsMockRecorder) GetLabel(name interface{}) *gomock.Call

GetLabel indicates an expected call of GetLabel

func (*MockJenkinsMockRecorder) GetNode

func (mr *MockJenkinsMockRecorder) GetNode(name interface{}) *gomock.Call

GetNode indicates an expected call of GetNode

func (*MockJenkinsMockRecorder) GetNodeSecret added in v0.2.0

func (mr *MockJenkinsMockRecorder) GetNodeSecret(name string) *gomock.Call

func (*MockJenkinsMockRecorder) GetPlugins

func (mr *MockJenkinsMockRecorder) GetPlugins(depth interface{}) *gomock.Call

GetPlugins indicates an expected call of GetPlugins

func (*MockJenkinsMockRecorder) GetQueue

func (mr *MockJenkinsMockRecorder) GetQueue() *gomock.Call

GetQueue indicates an expected call of GetQueue

func (*MockJenkinsMockRecorder) GetQueueItem

func (mr *MockJenkinsMockRecorder) GetQueueItem(id interface{}) *gomock.Call

GetQueueItem indicates an expected call of GetQueueItem

func (*MockJenkinsMockRecorder) GetQueueUrl

func (mr *MockJenkinsMockRecorder) GetQueueUrl() *gomock.Call

GetQueueUrl indicates an expected call of GetQueueUrl

func (*MockJenkinsMockRecorder) GetSubJob

func (mr *MockJenkinsMockRecorder) GetSubJob(parentID, childID interface{}) *gomock.Call

GetSubJob indicates an expected call of GetSubJob

func (*MockJenkinsMockRecorder) GetView

func (mr *MockJenkinsMockRecorder) GetView(name interface{}) *gomock.Call

GetView indicates an expected call of GetView

func (*MockJenkinsMockRecorder) HasPlugin

func (mr *MockJenkinsMockRecorder) HasPlugin(name interface{}) *gomock.Call

HasPlugin indicates an expected call of HasPlugin

func (*MockJenkinsMockRecorder) Info

func (mr *MockJenkinsMockRecorder) Info() *gomock.Call

Info indicates an expected call of Info

func (*MockJenkinsMockRecorder) InstallPlugin

func (mr *MockJenkinsMockRecorder) InstallPlugin(name, version interface{}) *gomock.Call

InstallPlugin indicates an expected call of InstallPlugin

func (*MockJenkinsMockRecorder) Poll

func (mr *MockJenkinsMockRecorder) Poll() *gomock.Call

Poll indicates an expected call of Poll

func (*MockJenkinsMockRecorder) RenameJob

func (mr *MockJenkinsMockRecorder) RenameJob(job, name interface{}) *gomock.Call

RenameJob indicates an expected call of RenameJob

func (*MockJenkinsMockRecorder) SafeRestart

func (mr *MockJenkinsMockRecorder) SafeRestart() *gomock.Call

SafeRestart indicates an expected call of SafeRestart

func (*MockJenkinsMockRecorder) UninstallPlugin

func (mr *MockJenkinsMockRecorder) UninstallPlugin(name interface{}) *gomock.Call

UninstallPlugin indicates an expected call of UninstallPlugin

func (*MockJenkinsMockRecorder) ValidateFingerPrint

func (mr *MockJenkinsMockRecorder) ValidateFingerPrint(id interface{}) *gomock.Call

ValidateFingerPrint indicates an expected call of ValidateFingerPrint

type UserToken

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

UserToken defines user token for Jenkins API communication

func (*UserToken) GetToken

func (token *UserToken) GetToken() string

GetToken returns user token

Jump to

Keyboard shortcuts

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