google

package
v0.0.0-...-77f32e8 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2019 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package google provides facilities for listing images in gcr.io.

Index

Constants

This section is empty.

Variables

View Source
var GetGcloudCmd = func() *exec.Cmd {

	return exec.Command("gcloud", "config", "config-helper", "--force-auth-refresh", "--format=json(credential)")
}

GetGcloudCmd is exposed so we can test this.

View Source
var Keychain authn.Keychain = &googleKeychain{}

Keychain exports an instance of the google Keychain.

Functions

func NewEnvAuthenticator

func NewEnvAuthenticator() (authn.Authenticator, error)

NewEnvAuthenticator returns an authn.Authenticator that generates access tokens from the environment we're running in.

See: https://godoc.org/golang.org/x/oauth2/google#FindDefaultCredentials

func NewGcloudAuthenticator

func NewGcloudAuthenticator() (authn.Authenticator, error)

NewGcloudAuthenticator returns an oauth2.TokenSource that generates access tokens by shelling out to the gcloud sdk.

func Walk

func Walk(root name.Repository, walkFn WalkFunc, options ...ListerOption) error

Walk recursively descends repositories, calling walkFn.

Types

type ListerOption

type ListerOption func(*lister) error

ListerOption is a functional option for List and Walk. TODO: Can we somehow reuse the remote options here?

func WithAuth

func WithAuth(auth authn.Authenticator) ListerOption

WithAuth is a functional option for overriding the default authenticator on a remote image

func WithAuthFromKeychain

func WithAuthFromKeychain(keys authn.Keychain) ListerOption

WithAuthFromKeychain is a functional option for overriding the default authenticator on a remote image using an authn.Keychain

func WithTransport

func WithTransport(t http.RoundTripper) ListerOption

WithTransport is a functional option for overriding the default transport on a remote image

type ManifestInfo

type ManifestInfo struct {
	Size      uint64    `json:"imageSizeBytes"`
	MediaType string    `json:"mediaType"`
	Created   time.Time `json:"timeCreatedMs"`
	Uploaded  time.Time `json:"timeUploadedMs"`
	Tags      []string  `json:"tag"`
}

ManifestInfo is a Manifests entry is the output of List and Walk.

func (*ManifestInfo) UnmarshalJSON

func (m *ManifestInfo) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler

type Tags

type Tags struct {
	Children  []string                `json:"child"`
	Manifests map[string]ManifestInfo `json:"manifest"`
	Name      string                  `json:"name"`
	Tags      []string                `json:"tags"`
}

Tags is the result of List and Walk.

func List

func List(repo name.Repository, options ...ListerOption) (*Tags, error)

List calls /tags/list for the given repository.

type WalkFunc

type WalkFunc func(repo name.Repository, tags *Tags, err error) error

WalkFunc is the type of the function called for each repository visited by Walk. This implements a similar API to filepath.Walk.

The repo argument contains the argument to Walk as a prefix; that is, if Walk is called with "gcr.io/foo", which is a repository containing the repository "bar", the walk function will be called with argument "gcr.io/foo/bar". The tags and error arguments are the result of calling List on repo.

TODO: Do we want a SkipDir error, as in filepath.WalkFunc?

Jump to

Keyboard shortcuts

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