docker-credential-helpers: github.com/docker/docker-credential-helpers/client Index | Examples | Files

package client

import "github.com/docker/docker-credential-helpers/client"

Index

Examples

Package Files

client.go command.go

func Erase Uses

func Erase(program ProgramFunc, serverURL string) error

Erase executes a program to remove the server credentials from the native store.

Code:

p := NewShellProgramFunc("docker-credential-secretservice")

if err := Erase(p, "https://example.com"); err != nil {
    fmt.Println(err)
}

func Get Uses

func Get(program ProgramFunc, serverURL string) (*credentials.Credentials, error)

Get executes an external program to get the credentials from a native store.

Code:

p := NewShellProgramFunc("docker-credential-secretservice")

creds, err := Get(p, "https://example.com")
if err != nil {
    fmt.Println(err)
}

fmt.Printf("Got credentials for user `%s` in `%s`\n", creds.Username, creds.ServerURL)

func List Uses

func List(program ProgramFunc) (map[string]string, error)

List executes a program to list server credentials in the native store.

func Store Uses

func Store(program ProgramFunc, creds *credentials.Credentials) error

Store uses an external program to save credentials.

Code:

p := NewShellProgramFunc("docker-credential-secretservice")

c := &credentials.Credentials{
    ServerURL: "https://example.com",
    Username:  "calavera",
    Secret:    "my super secret token",
}

if err := Store(p, c); err != nil {
    fmt.Println(err)
}

type Program Uses

type Program interface {
    Output() ([]byte, error)
    Input(in io.Reader)
}

Program is an interface to execute external programs.

type ProgramFunc Uses

type ProgramFunc func(args ...string) Program

ProgramFunc is a type of function that initializes programs based on arguments.

func NewShellProgramFunc Uses

func NewShellProgramFunc(name string) ProgramFunc

NewShellProgramFunc creates programs that are executed in a Shell.

func NewShellProgramFuncWithEnv Uses

func NewShellProgramFuncWithEnv(name string, env *map[string]string) ProgramFunc

NewShellProgramFuncWithEnv creates programs that are executed in a Shell with environment variables

type Shell Uses

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

Shell invokes shell commands to talk with a remote credentials helper.

func (*Shell) Input Uses

func (s *Shell) Input(in io.Reader)

Input sets the input to send to a remote credentials helper.

func (*Shell) Output Uses

func (s *Shell) Output() ([]byte, error)

Output returns responses from the remote credentials helper.

Package client imports 8 packages (graph) and is imported by 260 packages. Updated 2019-10-26. Refresh now. Tools for package owners.