credential

package
v0.0.14 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2023 License: MIT Imports: 13 Imported by: 2

Documentation

Index

Constants

View Source
const (
	// SSHCrenditalStaplerClass is the Jenkins class
	SSHCrenditalStaplerClass = "com.cloudbees.jenkins.plugins.sshcredentials.impl.BasicSSHUserPrivateKey"
	// DirectSSHCrenditalStaplerClass is the Jenkins class
	DirectSSHCrenditalStaplerClass = "com.cloudbees.jenkins.plugins.sshcredentials.impl.BasicSSHUserPrivateKey$DirectEntryPrivateKeySource"
	// UsernamePassswordCredentialStaplerClass is the Jenkins class
	UsernamePassswordCredentialStaplerClass = "com.cloudbees.plugins.credentials.impl.UsernamePasswordCredentialsImpl"
	// SecretTextCredentialStaplerClass is the Jenkins class
	SecretTextCredentialStaplerClass = "org.jenkinsci.plugins.plaincredentials.impl.StringCredentialsImpl"
	// KubeconfigCredentialStaplerClass is the Jenkins class
	KubeconfigCredentialStaplerClass = "com.microsoft.jenkins.kubernetes.credentials.KubeconfigCredentials"
	// DirectKubeconfigCredentialStaperClass is the Jenkins class
	DirectKubeconfigCredentialStaperClass = "com.microsoft.jenkins.kubernetes.credentials.KubeconfigCredentials$DirectEntryKubeconfigSource"
	// GLOBALScope is the Jenkins class
	GLOBALScope = "GLOBAL"
)

Variables

This section is empty.

Functions

func PrepareForCreateCredential

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

PrepareForCreateCredential only for test

func PrepareForCreateCredentialInFolder added in v0.0.14

func PrepareForCreateCredentialInFolder(roundTripper *mhttp.MockRoundTripper, rootURL, user, password, folder string, payload io.Reader)

PrepareForCreateCredentialInFolder only for test

func PrepareForCreateSecretCredential

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

PrepareForCreateSecretCredential only for test

func PrepareForCreateUsernamePasswordCredential

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

PrepareForCreateUsernamePasswordCredential only for test

func PrepareForCredentialListJSON

func PrepareForCredentialListJSON() string

PrepareForCredentialListJSON only for test

func PrepareForDeleteCredential

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

PrepareForDeleteCredential only for test

func PrepareForDeleteCredentialInFolder added in v0.0.14

func PrepareForDeleteCredentialInFolder(roundTripper *mhttp.MockRoundTripper, rootURL, user, password, folder, id string)

PrepareForDeleteCredentialInFolder only for test

func PrepareForGetCredentialInFolder added in v0.0.14

func PrepareForGetCredentialInFolder(roundTripper *mhttp.MockRoundTripper, rootURL, user, password, folder, id string, payload io.Reader)

PrepareForGetCredentialInFolder only for test

func PrepareForGetCredentialList

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

PrepareForGetCredentialList only for test

func PrepareForUpdateCredentialInFolder added in v0.0.14

func PrepareForUpdateCredentialInFolder(roundTripper *mhttp.MockRoundTripper, rootURL, user, password, folder, id string, payload io.Reader)

PrepareForUpdateCredentialInFolder only for test

Types

type Credential

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

Credential of Jenkins

type CredentialsManager

type CredentialsManager struct {
	core.JenkinsCore
}

CredentialsManager hold the info of credentials client

func (*CredentialsManager) Create

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

Create create a credential in Jenkins

func (*CredentialsManager) CreateInFolder added in v0.0.14

func (c *CredentialsManager) CreateInFolder(folder string, cre interface{}) (err error)

CreateInFolder creates a credential in a folder

func (*CredentialsManager) CreateSecret

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

CreateSecret create token credential in Jenkins

func (*CredentialsManager) CreateUsernamePassword

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

CreateUsernamePassword create username and password credential in Jenkins

func (*CredentialsManager) Delete

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

Delete deletes a credential by id from a store

func (*CredentialsManager) DeleteInFolder added in v0.0.14

func (c *CredentialsManager) DeleteInFolder(folder, id string) (err error)

DeleteInFolder deletes a credential by id from a folder

func (*CredentialsManager) GetInFolder added in v0.0.14

func (c *CredentialsManager) GetInFolder(folder, id string) (cre Credential, err error)

GetInFolder gets a credential in a folder

func (*CredentialsManager) GetList

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

GetList returns the credential list

func (*CredentialsManager) UpdateInFolder added in v0.0.14

func (c *CredentialsManager) UpdateInFolder(folder, id string, cre interface{}) (err error)

UpdateInFolder updates a credential in a folder

type KubeConfigCredential added in v0.0.14

type KubeConfigCredential struct {
	Credential       `json:",inline"`
	KubeconfigSource KubeconfigSource `json:"kubeconfigSource"`
}

KubeConfigCredential represents a KubeConfig credentail

func NewKubeConfigCredential added in v0.0.14

func NewKubeConfigCredential(id, kubeconfig string) *KubeConfigCredential

NewKubeConfigCredential create a KubeConfig type of credential

type KubeconfigSource added in v0.0.14

type KubeconfigSource struct {
	StaplerClass string `json:"stapler-class"`
	Content      string `json:"content"`
}

KubeconfigSource represents the KubeConfig content

type List

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

List contains many credentials

type PrivateKeySource added in v0.0.14

type PrivateKeySource struct {
	StaplerClass string `json:"stapler-class"`
	PrivateKey   string `json:"privateKey"`
}

PrivateKeySource represents SSH private key

type SSHCredential added in v0.0.14

type SSHCredential struct {
	Credential `json:",inline"`
	Username   string           `json:"username"`
	Passphrase string           `json:"passphrase"`
	KeySource  PrivateKeySource `json:"privateKeySource"`
}

SSHCredential represents a SSH type of credential

func NewSSHCredential added in v0.0.14

func NewSSHCredential(id, username, passphrase, privateKey string) *SSHCredential

NewSSHCredential creates a SSH credential instance

type StringCredentials

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

StringCredentials hold a token

func NewSecretTextCredential added in v0.0.14

func NewSecretTextCredential(id, secret string) *StringCredentials

NewSecretTextCredential creates a secret text credential instance

type UsernamePasswordCredential

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

UsernamePasswordCredential hold the username and password

func NewUsernamePasswordCredential added in v0.0.14

func NewUsernamePasswordCredential(id, username, password string) *UsernamePasswordCredential

NewUsernamePasswordCredential creates a username password type of credential

Jump to

Keyboard shortcuts

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