mirror of
https://github.com/mudler/luet.git
synced 2025-09-23 20:18:30 +00:00
🔧 Update modules
This commit is contained in:
55
vendor/github.com/google/go-containerregistry/pkg/crane/options.go
generated
vendored
55
vendor/github.com/google/go-containerregistry/pkg/crane/options.go
generated
vendored
@@ -24,15 +24,24 @@ import (
|
||||
"github.com/google/go-containerregistry/pkg/v1/remote"
|
||||
)
|
||||
|
||||
type options struct {
|
||||
name []name.Option
|
||||
remote []remote.Option
|
||||
platform *v1.Platform
|
||||
// Options hold the options that crane uses when calling other packages.
|
||||
type Options struct {
|
||||
Name []name.Option
|
||||
Remote []remote.Option
|
||||
Platform *v1.Platform
|
||||
}
|
||||
|
||||
func makeOptions(opts ...Option) options {
|
||||
opt := options{
|
||||
remote: []remote.Option{
|
||||
// GetOptions exposes the underlying []remote.Option, []name.Option, and
|
||||
// platform, based on the passed Option. Generally, you shouldn't need to use
|
||||
// this unless you've painted yourself into a dependency corner as we have
|
||||
// with the crane and gcrane cli packages.
|
||||
func GetOptions(opts ...Option) Options {
|
||||
return makeOptions(opts...)
|
||||
}
|
||||
|
||||
func makeOptions(opts ...Option) Options {
|
||||
opt := Options{
|
||||
Remote: []remote.Option{
|
||||
remote.WithAuthFromKeychain(authn.DefaultKeychain),
|
||||
},
|
||||
}
|
||||
@@ -43,28 +52,28 @@ func makeOptions(opts ...Option) options {
|
||||
}
|
||||
|
||||
// Option is a functional option for crane.
|
||||
type Option func(*options)
|
||||
type Option func(*Options)
|
||||
|
||||
// WithTransport is a functional option for overriding the default transport
|
||||
// for remote operations.
|
||||
func WithTransport(t http.RoundTripper) Option {
|
||||
return func(o *options) {
|
||||
o.remote = append(o.remote, remote.WithTransport(t))
|
||||
return func(o *Options) {
|
||||
o.Remote = append(o.Remote, remote.WithTransport(t))
|
||||
}
|
||||
}
|
||||
|
||||
// Insecure is an Option that allows image references to be fetched without TLS.
|
||||
func Insecure(o *options) {
|
||||
o.name = append(o.name, name.Insecure)
|
||||
func Insecure(o *Options) {
|
||||
o.Name = append(o.Name, name.Insecure)
|
||||
}
|
||||
|
||||
// WithPlatform is an Option to specify the platform.
|
||||
func WithPlatform(platform *v1.Platform) Option {
|
||||
return func(o *options) {
|
||||
return func(o *Options) {
|
||||
if platform != nil {
|
||||
o.remote = append(o.remote, remote.WithPlatform(*platform))
|
||||
o.Remote = append(o.Remote, remote.WithPlatform(*platform))
|
||||
}
|
||||
o.platform = platform
|
||||
o.Platform = platform
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,9 +83,9 @@ func WithPlatform(platform *v1.Platform) Option {
|
||||
//
|
||||
// By default, crane will use authn.DefaultKeychain.
|
||||
func WithAuthFromKeychain(keys authn.Keychain) Option {
|
||||
return func(o *options) {
|
||||
return func(o *Options) {
|
||||
// Replace the default keychain at position 0.
|
||||
o.remote[0] = remote.WithAuthFromKeychain(keys)
|
||||
o.Remote[0] = remote.WithAuthFromKeychain(keys)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,23 +94,23 @@ func WithAuthFromKeychain(keys authn.Keychain) Option {
|
||||
//
|
||||
// By default, crane will use authn.DefaultKeychain.
|
||||
func WithAuth(auth authn.Authenticator) Option {
|
||||
return func(o *options) {
|
||||
return func(o *Options) {
|
||||
// Replace the default keychain at position 0.
|
||||
o.remote[0] = remote.WithAuth(auth)
|
||||
o.Remote[0] = remote.WithAuth(auth)
|
||||
}
|
||||
}
|
||||
|
||||
// WithUserAgent adds the given string to the User-Agent header for any HTTP
|
||||
// requests.
|
||||
func WithUserAgent(ua string) Option {
|
||||
return func(o *options) {
|
||||
o.remote = append(o.remote, remote.WithUserAgent(ua))
|
||||
return func(o *Options) {
|
||||
o.Remote = append(o.Remote, remote.WithUserAgent(ua))
|
||||
}
|
||||
}
|
||||
|
||||
// WithContext is a functional option for setting the context.
|
||||
func WithContext(ctx context.Context) Option {
|
||||
return func(o *options) {
|
||||
o.remote = append(o.remote, remote.WithContext(ctx))
|
||||
return func(o *Options) {
|
||||
o.Remote = append(o.Remote, remote.WithContext(ctx))
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user