image

package
Version: v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2021 License: Apache-2.0 Imports: 22 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// DefaultServerHostName is the default registry server hostname
	DefaultServerHostName = "registry-1.docker.io"
	// DefaultServer is the default registry server
	DefaultServer = "https://" + DefaultServerHostName
	// DefaultHostname is the default built-in hostname
	DefaultHostname = "docker.io"

	// LegacyDefaultDomain is ...
	LegacyDefaultDomain = "index.docker.io"
	// LegacyV1Server is FQDN of legacy v1 server
	LegacyV1Server = "https://index.docker.io/v1"
	// LegacyV2Server is FQDN of legacy v2 server
	LegacyV2Server = "https://index.docker.io/v2"
)

Variables

View Source
var Logger = log.Log.WithName("image-client")

Functions

This section is empty.

Types

type APIRepositories

type APIRepositories struct {
	Repositories []string `json:"repositories"`
}

API

type APIRepository

type APIRepository struct {
	Name string   `json:"name"`
	Tags []string `json:"tags"`
}

type APIRepositoryList

type APIRepositoryList []APIRepository

func (*APIRepositoryList) AddRepository

func (l *APIRepositoryList) AddRepository(repo APIRepository)

func (APIRepositoryList) GetRepository

func (l APIRepositoryList) GetRepository(name string) *APIRepository

type Image

type Image struct {
	ServerURL string

	Host         string
	Name         string
	FamiliarName string
	Tag          string
	Digest       string

	// username:password string encrypted by base64
	BasicAuth string
	Token     auth.Token

	HttpClient http.Client
}

func NewImage

func NewImage(uri, registryServer, basicAuth string, ca []byte) (*Image, error)

NewImage creates new image client

func (*Image) Catalog

func (r *Image) Catalog() *APIRepositories

Catalog gets repository list

func (*Image) DeleteManifest

func (r *Image) DeleteManifest(manifest *ImageManifest) error

DeleteManifest deletes manifest in the registry

func (*Image) ExistBlob

func (r *Image) ExistBlob() (bool, error)

ExistBlob checks if blob exists. If exist, return true

func (*Image) GetImageNameWithHost

func (r *Image) GetImageNameWithHost() string

func (*Image) GetManifest

func (r *Image) GetManifest() (*ImageManifest, error)

GetManifest gets manifests of image in the registry

func (*Image) GetToken

func (r *Image) GetToken(scope string) (auth.Token, error)

func (*Image) NormalizeNamed

func (r *Image) NormalizeNamed(image string) (reference.Named, error)

NormalizeNamed normalize image for default server

func (*Image) PullBlob

func (r *Image) PullBlob() (io.ReadCloser, int64, error)

func (*Image) PushBlob

func (r *Image) PushBlob(blob []byte, size int64) (string, string, error)

PushBlob pushes blob returns location, uuid, error

func (*Image) PutManifest

func (r *Image) PutManifest(manifest *ImageManifest) error

func (*Image) SetImage

func (r *Image) SetImage(image string) error

SetImage sets image from "[<server>/]<imageName>[:<tag>|@<digest>]" form argument

func (*Image) SetServerURL

func (r *Image) SetServerURL(url string)

SetServerURL sets registry server URL

func (*Image) Tags

func (r *Image) Tags() *APIRepository

type ImageManifest

type ImageManifest struct {
	Digest        string
	ContentLength int64
	Manifest      distribution.Manifest
}

type Manifest

type Manifest struct {
	Digest        string
	ContentLength int64

	// *schema1.Manifest or *schema2.Manifest
	Schema interface{}
}

Jump to

Keyboard shortcuts

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