google

package
v0.0.0-...-ec4d356 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2018 License: Apache-2.0 Imports: 18 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)")
}

Exposed so we can test this.

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

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

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"`
}

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"`
}

func List

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

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