Documentation ¶
Overview ¶
Package google provides facilities for listing images in gcr.io.
Index ¶
- Variables
- func NewEnvAuthenticator(ctx context.Context) (authn.Authenticator, error)
- func NewGcloudAuthenticator(ctx context.Context) (authn.Authenticator, error)
- func NewJSONKeyAuthenticator(serviceAccountJSON string) authn.Authenticator
- func NewTokenAuthenticator(serviceAccountJSON string, scope string) (authn.Authenticator, error)
- func NewTokenSourceAuthenticator(ts oauth2.TokenSource) authn.Authenticator
- func Walk(root name.Repository, walkFn WalkFunc, options ...Option) error
- type ManifestInfo
- type Option
- type Tags
- type WalkFunc
Constants ¶
This section is empty.
Variables ¶
var GetGcloudCmd = func(ctx context.Context) *exec.Cmd { return exec.CommandContext(ctx, "gcloud", "config", "config-helper", "--force-auth-refresh", "--format=json(credential)") }
GetGcloudCmd is exposed so we can test this.
var Keychain authn.Keychain = &googleKeychain{}
Keychain exports an instance of the google Keychain.
Functions ¶
func NewEnvAuthenticator ¶
func NewEnvAuthenticator(ctx context.Context) (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(ctx context.Context) (authn.Authenticator, error)
NewGcloudAuthenticator returns an oauth2.TokenSource that generates access tokens by shelling out to the gcloud sdk.
func NewJSONKeyAuthenticator ¶
func NewJSONKeyAuthenticator(serviceAccountJSON string) authn.Authenticator
NewJSONKeyAuthenticator returns a Basic authenticator which uses Service Account as a way of authenticating with Google Container Registry. More information: https://cloud.google.com/container-registry/docs/advanced-authentication#json_key_file
func NewTokenAuthenticator ¶
func NewTokenAuthenticator(serviceAccountJSON string, scope string) (authn.Authenticator, error)
NewTokenAuthenticator returns an oauth2.TokenSource that generates access tokens by using the Google SDK to produce JWT tokens from a Service Account. More information: https://godoc.org/golang.org/x/oauth2/google#JWTAccessTokenSourceFromJSON
func NewTokenSourceAuthenticator ¶ added in v0.2.0
func NewTokenSourceAuthenticator(ts oauth2.TokenSource) authn.Authenticator
NewTokenSourceAuthenticator converts an oauth2.TokenSource into an authn.Authenticator.
Types ¶
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) MarshalJSON ¶
func (m ManifestInfo) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler
func (*ManifestInfo) UnmarshalJSON ¶
func (m *ManifestInfo) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler
type Option ¶ added in v0.5.0
type Option func(*lister) error
Option is a functional option for List and Walk. TODO: Can we somehow reuse the remote options here?
func WithAuth ¶
func WithAuth(auth authn.Authenticator) Option
WithAuth is a functional option for overriding the default authenticator on a remote image
func WithAuthFromKeychain ¶
WithAuthFromKeychain is a functional option for overriding the default authenticator on a remote image using an authn.Keychain
func WithContext ¶ added in v0.1.4
WithContext is a functional option for overriding the default context.Context for HTTP request to list remote images
func WithTransport ¶
func WithTransport(t http.RoundTripper) Option
WithTransport is a functional option for overriding the default transport on a remote image
func WithUserAgent ¶ added in v0.4.0
WithUserAgent adds the given string to the User-Agent header for any HTTP requests. This header will also include "go-containerregistry/${version}".
If you want to completely overwrite the User-Agent header, use WithTransport.
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.
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?