crocker

package module
v0.0.0-...-f759222 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2017 License: MIT Imports: 5 Imported by: 2

README

GoDoc

crocker - Credential Helper Helper

This is a small helper library for integrating with the Docker Credential Helpers. It handles detecting if the right helper is installed and errors out if helpers aren't found.

Example code:

import "github.com/justone/crocker"

func main() {
    c, err := crocker.New()

    err := c.Store(...)
    creds, err := c.Get(...)
    list, err := c.list(...)
    err := c.Erase(...)
}

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ProgPrefix = "docker-credential-"

ProgPrefix is prefix that is prepended to all command names before checking for existence.

Functions

This section is empty.

Types

type Crocker

type Crocker struct {
	Prog client.ProgramFunc
}

Crocker is a helper to help with the docker credential helpers.

func New

func New() (*Crocker, error)

New creates a Crocker instance with the default strategy (StockStrategy).

func NewWithStrategy

func NewWithStrategy(strat Strategy) (*Crocker, error)

New creates a Crocker instance with the supplied strategy.

func (*Crocker) Erase

func (c *Crocker) Erase(serverURL string) error

Erase erases credentials using the detected helper.

func (*Crocker) Get

func (c *Crocker) Get(serverURL string) (*credentials.Credentials, error)

Get gets credentials using the detected helper.

func (*Crocker) List

func (c *Crocker) List() (map[string]string, error)

List lists credentials using the detected helper.

func (*Crocker) Store

func (c *Crocker) Store(creds *credentials.Credentials) error

Store stores credentials using the detected helper.

type MemThenStockStrategy

type MemThenStockStrategy struct{}

MemThenStockStrategy is a strategy for finding helpers.

func (MemThenStockStrategy) Helper

func (s MemThenStockStrategy) Helper() (string, error)

Helper in MemThenStockStrategy checks for the cachemem (in memory store) helper and then falls back to the StockStrategy.

type StockStrategy

type StockStrategy struct{}

StockStrategy is a strategy for finding helpers.

func (StockStrategy) Helper

func (s StockStrategy) Helper() (string, error)

Helper in StockStrategy checks for the existence of the appropriate platform helper. It only checks for the stock, upstream, helpers.

type Strategy

type Strategy interface {
	Helper() (string, error)
}

Stategy is an interface for finding the right credential helper.

Jump to

Keyboard shortcuts

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