Documentation ¶
Index ¶
Constants ¶
View Source
const ( UserAgent = "harbor-registry-client" // DefaultHTTPClientTimeout is the default timeout for registry http client. DefaultHTTPClientTimeout = 30 * time.Minute )
const definition
Variables ¶
View Source
var ( // Cli is the global registry client instance, it targets to the backend docker registry Cli = func() Client { url, _ := config.RegistryURL() username, password := config.RegistryCredential() return NewClient(url, username, password, false, readonly.NewInterceptor()) }() )
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface { // Ping the base API endpoint "/v2/" Ping() (err error) // Catalog the repositories Catalog() (repositories []string, err error) // ListTags lists the tags under the specified repository ListTags(repository string) (tags []string, err error) // ManifestExist checks the existence of the manifest ManifestExist(repository, reference string) (exist bool, desc *distribution.Descriptor, err error) // PullManifest pulls the specified manifest PullManifest(repository, reference string, acceptedMediaTypes ...string) (manifest distribution.Manifest, digest string, err error) // PushManifest pushes the specified manifest PushManifest(repository, reference, mediaType string, payload []byte) (digest string, err error) // DeleteManifest deletes the specified manifest. The "reference" can be "tag" or "digest" DeleteManifest(repository, reference string) (err error) // BlobExist checks the existence of the specified blob BlobExist(repository, digest string) (exist bool, err error) // PullBlob pulls the specified blob. The caller must close the returned "blob" PullBlob(repository, digest string) (size int64, blob io.ReadCloser, err error) // PullBlobChunk pulls the specified blob, but by chunked PullBlobChunk(repository, digest string, blobSize, start, end int64) (size int64, blob io.ReadCloser, err error) // PushBlob pushes the specified blob PushBlob(repository, digest string, size int64, blob io.Reader) error // PushBlobChunk pushes the specified blob, but by chunked PushBlobChunk(repository, digest string, blobSize int64, chunk io.Reader, start, end int64, location string) (nextUploadLocation string, endRange int64, err error) // MountBlob mounts the blob from the source repository MountBlob(srcRepository, digest, dstRepository string) (err error) // DeleteBlob deletes the specified blob DeleteBlob(repository, digest string) (err error) // Copy the artifact from source repository to the destination. The "override" // is used to specify whether the destination artifact will be overridden if // its name is same with source but digest isn't Copy(srcRepository, srcReference, dstRepository, dstReference string, override bool) (err error) // Do send generic HTTP requests to the target registry service Do(req *http.Request) (*http.Response, error) }
Client defines the methods that a registry client should implements
func NewClient ¶
func NewClient(url, username, password string, insecure bool, interceptors ...interceptor.Interceptor) Client
NewClient creates a registry client with the default authorizer which determines the auth scheme of the registry automatically and calls the corresponding underlying authorizers(basic/bearer) to do the auth work. If a customized authorizer is needed, use "NewClientWithAuthorizer" instead
func NewClientWithAuthorizer ¶
func NewClientWithAuthorizer(url string, authorizer lib.Authorizer, insecure bool, interceptors ...interceptor.Interceptor) Client
NewClientWithAuthorizer creates a registry client with the provided authorizer
Click to show internal directories.
Click to hide internal directories.