targets

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package targets is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HasCredential added in v0.2.0

func HasCredential(target Target, id string) bool

HasCredential returns true if the given ID is found on the target

Types

type Base

type Base struct {
	DeleteUnsynced bool              `mapstructure:"delete_unsynced"`
	TagUnsynced    bool              `mapstructure:"tag_unsynced"`
	Name           string            `mapstructure:"name"`
	Tags           map[string]string `mapstructure:"tags"`
}

Base contains attributes which are common to all targets

func (*Base) BaseToString

func (targetBase *Base) BaseToString() string

BaseToString prints out the target fields common to all types of targets

func (*Base) BaseValidateConfiguration

func (targetBase *Base) BaseValidateConfiguration() error

BaseValidateConfiguration validates the target's base attributes

func (*Base) GetName

func (targetBase *Base) GetName() string

GetName returns the target's name

func (*Base) GetTags

func (targetBase *Base) GetTags() map[string]string

GetTags returns the target's tags

func (*Base) ShouldDeleteUnsynced added in v0.2.0

func (targetBase *Base) ShouldDeleteUnsynced() bool

ShouldDeleteUnsynced returns true if the unsynced credentials should be deleted from the target

func (*Base) ShouldTagUnsynced added in v0.2.0

func (targetBase *Base) ShouldTagUnsynced() bool

ShouldTagUnsynced returns true if the unsynced credentials should be tagged accordingly on the target

type Configuration

type Configuration struct {
	JenkinsTargets []*JenkinsTarget `mapstructure:"jenkins"`
}

Configuration contains all configured targets

func (*Configuration) AllTargets

func (config *Configuration) AllTargets() []Target

AllTargets returns all configured targets

func (*Configuration) ValidateConfiguration

func (config *Configuration) ValidateConfiguration() error

ValidateConfiguration verifies that all targets are correctly configured

type JenkinsGithubAppCredentials added in v0.5.0

type JenkinsGithubAppCredentials struct {
	XMLName     xml.Name `xml:"org.jenkinsci.plugins.github__branch__source.GitHubAppCredentials"`
	ID          string   `xml:"id"`
	Description string   `xml:"description,omitempty"`
	AppID       int      `xml:"appID"`
	PrivateKey  string   `xml:"privateKey"`
	APIURI      string   `xml:"apiUri,omitempty"`
	Owner       string   `xml:"owner,omitempty"`
}

JenkinsGithubAppCredentials is the Jenkins Github plugin's credentials configuration.

   It must be serializable to the following XML:
	<org.jenkinsci.plugins.github__branch__source.GitHubAppCredentials plugin="github-branch-source@2.8.2">
		<id>github-app-dev</id>
		<description>The GitHub app for Jenkins</description>
		<appID>73157</appID>
		<privateKey>{some_private_key}</privateKey>
		<apiUri>https://api.github.com</apiUri>
		<owner>coveo</owner>
	</org.jenkinsci.plugins.github__branch__source.GitHubAppCredentials>

type JenkinsTarget

type JenkinsTarget struct {
	Base `mapstructure:",squash"`

	CredentialsID      *string `mapstructure:"credentials_id"`
	URL                string
	InsecureConnection bool `mapstructure:"insecure_connection"`
	// contains filtered or unexported fields
}

JenkinsTarget represents a Jenkins instance

func (*JenkinsTarget) DeleteCredentials added in v0.2.0

func (jenkins *JenkinsTarget) DeleteCredentials(id string) error

DeleteCredentials deletes the credentials with the given ID on the target

func (*JenkinsTarget) GetExistingCredentials added in v0.2.0

func (jenkins *JenkinsTarget) GetExistingCredentials() []string

GetExistingCredentials returns a list of all credential IDs on the target

func (*JenkinsTarget) Initialize

func (jenkins *JenkinsTarget) Initialize(allCredentials []credentials.Credentials) (err error)

Initialize executes all necessary operations to prepare the Jenkins target for sync

func (*JenkinsTarget) ToString

func (jenkins *JenkinsTarget) ToString() string

ToString prints out a description of the Jenkins instance

func (*JenkinsTarget) UpdateCredentials

func (jenkins *JenkinsTarget) UpdateCredentials(cred credentials.Credentials) error

UpdateCredentials syncs the given credentials to the Jenkins instance

func (*JenkinsTarget) ValidateConfiguration

func (jenkins *JenkinsTarget) ValidateConfiguration() error

ValidateConfiguration verifies that Jenkins configuration is valid

type MockTarget added in v0.2.0

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

MockTarget is a mock of Target interface

func NewMockTarget added in v0.2.0

func NewMockTarget(ctrl *gomock.Controller) *MockTarget

NewMockTarget creates a new mock instance

func (*MockTarget) BaseValidateConfiguration added in v0.2.0

func (m *MockTarget) BaseValidateConfiguration() error

BaseValidateConfiguration mocks base method

func (*MockTarget) DeleteCredentials added in v0.2.0

func (m *MockTarget) DeleteCredentials(id string) error

DeleteCredentials mocks base method

func (*MockTarget) EXPECT added in v0.2.0

func (m *MockTarget) EXPECT() *MockTargetMockRecorder

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

func (*MockTarget) GetExistingCredentials added in v0.2.0

func (m *MockTarget) GetExistingCredentials() []string

GetExistingCredentials mocks base method

func (*MockTarget) GetName added in v0.2.0

func (m *MockTarget) GetName() string

GetName mocks base method

func (*MockTarget) GetTags added in v0.2.0

func (m *MockTarget) GetTags() map[string]string

GetTags mocks base method

func (*MockTarget) Initialize added in v0.2.0

func (m *MockTarget) Initialize(arg0 []credentials.Credentials) error

Initialize mocks base method

func (*MockTarget) ShouldDeleteUnsynced added in v0.2.0

func (m *MockTarget) ShouldDeleteUnsynced() bool

ShouldDeleteUnsynced mocks base method

func (*MockTarget) ShouldTagUnsynced added in v0.2.0

func (m *MockTarget) ShouldTagUnsynced() bool

ShouldTagUnsynced mocks base method

func (*MockTarget) ToString added in v0.2.0

func (m *MockTarget) ToString() string

ToString mocks base method

func (*MockTarget) UpdateCredentials added in v0.2.0

func (m *MockTarget) UpdateCredentials(arg0 credentials.Credentials) error

UpdateCredentials mocks base method

func (*MockTarget) ValidateConfiguration added in v0.2.0

func (m *MockTarget) ValidateConfiguration() error

ValidateConfiguration mocks base method

type MockTargetCollection added in v0.2.0

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

MockTargetCollection is a mock of TargetCollection interface

func NewMockTargetCollection added in v0.2.0

func NewMockTargetCollection(ctrl *gomock.Controller) *MockTargetCollection

NewMockTargetCollection creates a new mock instance

func (*MockTargetCollection) AllTargets added in v0.2.0

func (m *MockTargetCollection) AllTargets() []Target

AllTargets mocks base method

func (*MockTargetCollection) EXPECT added in v0.2.0

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

func (*MockTargetCollection) ValidateConfiguration added in v0.2.0

func (m *MockTargetCollection) ValidateConfiguration() error

ValidateConfiguration mocks base method

type MockTargetCollectionMockRecorder added in v0.2.0

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

MockTargetCollectionMockRecorder is the mock recorder for MockTargetCollection

func (*MockTargetCollectionMockRecorder) AllTargets added in v0.2.0

func (mr *MockTargetCollectionMockRecorder) AllTargets() *gomock.Call

AllTargets indicates an expected call of AllTargets

func (*MockTargetCollectionMockRecorder) ValidateConfiguration added in v0.2.0

func (mr *MockTargetCollectionMockRecorder) ValidateConfiguration() *gomock.Call

ValidateConfiguration indicates an expected call of ValidateConfiguration

type MockTargetMockRecorder added in v0.2.0

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

MockTargetMockRecorder is the mock recorder for MockTarget

func (*MockTargetMockRecorder) BaseValidateConfiguration added in v0.2.0

func (mr *MockTargetMockRecorder) BaseValidateConfiguration() *gomock.Call

BaseValidateConfiguration indicates an expected call of BaseValidateConfiguration

func (*MockTargetMockRecorder) DeleteCredentials added in v0.2.0

func (mr *MockTargetMockRecorder) DeleteCredentials(id interface{}) *gomock.Call

DeleteCredentials indicates an expected call of DeleteCredentials

func (*MockTargetMockRecorder) GetExistingCredentials added in v0.2.0

func (mr *MockTargetMockRecorder) GetExistingCredentials() *gomock.Call

GetExistingCredentials indicates an expected call of GetExistingCredentials

func (*MockTargetMockRecorder) GetName added in v0.2.0

func (mr *MockTargetMockRecorder) GetName() *gomock.Call

GetName indicates an expected call of GetName

func (*MockTargetMockRecorder) GetTags added in v0.2.0

func (mr *MockTargetMockRecorder) GetTags() *gomock.Call

GetTags indicates an expected call of GetTags

func (*MockTargetMockRecorder) Initialize added in v0.2.0

func (mr *MockTargetMockRecorder) Initialize(arg0 interface{}) *gomock.Call

Initialize indicates an expected call of Initialize

func (*MockTargetMockRecorder) ShouldDeleteUnsynced added in v0.2.0

func (mr *MockTargetMockRecorder) ShouldDeleteUnsynced() *gomock.Call

ShouldDeleteUnsynced indicates an expected call of ShouldDeleteUnsynced

func (*MockTargetMockRecorder) ShouldTagUnsynced added in v0.2.0

func (mr *MockTargetMockRecorder) ShouldTagUnsynced() *gomock.Call

ShouldTagUnsynced indicates an expected call of ShouldTagUnsynced

func (*MockTargetMockRecorder) ToString added in v0.2.0

func (mr *MockTargetMockRecorder) ToString() *gomock.Call

ToString indicates an expected call of ToString

func (*MockTargetMockRecorder) UpdateCredentials added in v0.2.0

func (mr *MockTargetMockRecorder) UpdateCredentials(arg0 interface{}) *gomock.Call

UpdateCredentials indicates an expected call of UpdateCredentials

func (*MockTargetMockRecorder) ValidateConfiguration added in v0.2.0

func (mr *MockTargetMockRecorder) ValidateConfiguration() *gomock.Call

ValidateConfiguration indicates an expected call of ValidateConfiguration

type Target

type Target interface {
	// Base
	BaseValidateConfiguration() error
	GetName() string
	GetTags() map[string]string
	ShouldDeleteUnsynced() bool
	ShouldTagUnsynced() bool // Not implemented

	// To implement
	GetExistingCredentials() []string
	Initialize([]credentials.Credentials) error
	ToString() string
	DeleteCredentials(id string) error
	UpdateCredentials(credentials.Credentials) error
	ValidateConfiguration() error
}

Target represents an endpoint where credentials can be synced

type TargetCollection added in v0.2.0

type TargetCollection interface {
	AllTargets() []Target
	ValidateConfiguration() error
}

TargetCollection represents a collection of targets to which credentials can be synced

Jump to

Keyboard shortcuts

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