credential

package
v0.0.0-...-873fb03 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const AddNew = "Add a new"

Variables

This section is empty.

Functions

func NewProviderArr

func NewProviderArr(fields Fields) []string

Types

type CredDelete

type CredDelete interface {
	Delete(service string) error
}

type CredFinder

type CredFinder interface {
	Find(service string) (Detail, error)
}

type Credential

type Credential map[string]string

A Credential represents the key-value pairs for the Service (User/Pass, Github, Jenkins, etc).

type DeleteManager

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

func NewCredDelete

func NewCredDelete(homePath string, env renv.Finder) DeleteManager

func (DeleteManager) Delete

func (d DeleteManager) Delete(service string) error

type Detail

type Detail struct {
	Username   string     `json:"username"`
	Credential Credential `json:"credential"`
	Service    string     `json:"service"`
	Type       Type       `json:"type"`
}

Detail represents a credential information of the user.

type Field

type Field struct {
	Name string `json:"field"`
	Type string `json:"type"`
}

Field represents a credential field associated with your type.

type Fields

type Fields map[string][]Field

Fields are used to represents providers.json

func NewDefaultCredentials

func NewDefaultCredentials() Fields

type Finder

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

func NewFinder

func NewFinder(homePath string, env env.Finder) Finder

func (Finder) Find

func (f Finder) Find(provider string) (Detail, error)

type ListCredData

type ListCredData struct {
	Provider   string
	Credential string
	Env        string
}

type ListCredDatas

type ListCredDatas []ListCredData

type Pather

type Pather interface {
	ProviderPath() string
	CredentialsPath() string
}

type Reader

type Reader interface {
	ReadCredentialsFields(path string) (Fields, error)
	ReadCredentialsValue(path string) ([]ListCredData, error)
	ReadCredentialsValueInEnv(path string, env string) ([]ListCredData, error)
}

type ReaderPather

type ReaderPather interface {
	Reader
	Pather
}

type ReaderWriterPather

type ReaderWriterPather interface {
	Reader
	Writer
	Pather
}

type Resolver

type Resolver interface {
	Resolve(name string) (string, error)
}

type ResolverManager

type ResolverManager struct {
	CredFinder
	Setter
	prompt.InputPassword
}

func NewResolver

func NewResolver(cf CredFinder, cs Setter, passwordInput prompt.InputPassword) ResolverManager

NewResolver creates a credential resolver instance of Resolver interface

func (ResolverManager) Resolve

func (c ResolverManager) Resolve(name string) (string, error)

type SetManager

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

func NewSetter

func NewSetter(
	homePath string,
	env env.Finder,
	dir stream.DirCreater,
) SetManager

func (SetManager) Set

func (s SetManager) Set(cred Detail) error

type Setter

type Setter interface {
	Set(d Detail) error
}

type Settings

type Settings struct {
	HomeDir string
	// contains filtered or unexported fields
}

func NewSettings

func NewSettings(file stream.FileWriteReadExistLister, dir stream.DirLister, homeDir string) Settings

func (Settings) CredentialsPath

func (s Settings) CredentialsPath() string

func (Settings) ProviderPath

func (s Settings) ProviderPath() string

func (Settings) ReadCredentialsFields

func (s Settings) ReadCredentialsFields(path string) (Fields, error)

func (Settings) ReadCredentialsValue

func (s Settings) ReadCredentialsValue(path string) ([]ListCredData, error)

func (Settings) ReadCredentialsValueInEnv

func (s Settings) ReadCredentialsValueInEnv(path string, env string) ([]ListCredData, error)

func (Settings) WriteCredentialsFields

func (s Settings) WriteCredentialsFields(fields Fields, path string) error

func (Settings) WriteDefaultCredentialsFields

func (s Settings) WriteDefaultCredentialsFields(path string) error

WriteDefault is a non override version of WriteCredentialsFields used to create providers.json if user dont have it

type Type

type Type string

func (Type) String

func (t Type) String() string

type Writer

type Writer interface {
	WriteCredentialsFields(fields Fields, path string) error
	WriteDefaultCredentialsFields(path string) error
}

Jump to

Keyboard shortcuts

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