Documentation
¶
Index ¶
- Constants
- Variables
- func GetDefaultRegistryOptions() []name.Option
- func NewReferenceError(reference string, err error) error
- func NewRegistryError(reference, code, message string, err error) error
- type Client
- func (c *Client) BearerToken(ctx context.Context, reference string) (string, error)
- func (c *Client) BlobURL(reference string, digest v1.Hash) (string, error)
- func (c *Client) Model(ctx context.Context, reference string) (types.ModelArtifact, error)
- func (c *Client) NewTarget(tag string) (*Target, error)
- type ClientOption
- type Error
- type ReferenceError
- type Target
Constants ¶
const (
DefaultUserAgent = "model-distribution"
)
Variables ¶
var ( ErrInvalidReference = errors.New("invalid model reference") ErrModelNotFound = errors.New("model not found") )
var (
DefaultTransport = remote.DefaultTransport
)
Functions ¶
func GetDefaultRegistryOptions ¶
GetDefaultRegistryOptions returns name.Option slice with custom default registry and insecure flag if the corresponding environment variables are set. Environment variables are read once at first call and cached for consistency. Returns a copy of the options to prevent race conditions from slice modifications. - DEFAULT_REGISTRY: Override the default registry (index.docker.io) - INSECURE_REGISTRY: Set to "true" to allow HTTP connections
func NewReferenceError ¶
NewReferenceError creates a new ReferenceError
func NewRegistryError ¶
NewRegistryError creates a new Error
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func FromClient ¶ added in v1.0.6
func FromClient(base *Client, opts ...ClientOption) *Client
FromClient creates a new Client by copying an existing client's configuration and applying optional modifications via ClientOption functions.
func NewClient ¶
func NewClient(opts ...ClientOption) *Client
func (*Client) BearerToken ¶
type ClientOption ¶
type ClientOption func(*Client)
func WithAuth ¶ added in v1.0.6
func WithAuth(auth authn.Authenticator) ClientOption
WithAuth sets a custom authenticator.
func WithAuthConfig ¶
func WithAuthConfig(username, password string) ClientOption
func WithTransport ¶
func WithTransport(transport http.RoundTripper) ClientOption
func WithUserAgent ¶
func WithUserAgent(userAgent string) ClientOption
type Error ¶
type Error struct {
Reference string
// Code should be one of error codes defined in the distribution spec
// (see https://github.com/opencontainers/distribution-spec/blob/583e014d15418d839d67f68152bc2c83821770e0/spec.md#error-codes)
Code string
Message string
Err error
}
Error represents an error returned by an OCI registry
type ReferenceError ¶
ReferenceError represents an error related to an invalid model reference
func (*ReferenceError) Error ¶
func (e *ReferenceError) Error() string
func (*ReferenceError) Is ¶
func (e *ReferenceError) Is(target error) bool
Is implements error matching for ReferenceError
func (*ReferenceError) Unwrap ¶
func (e *ReferenceError) Unwrap() error