client

package
v1.2.12 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package client provides Docker registry client API

Index

Constants

View Source
const MaxConcurrentRequests = 256

MaxConcurrentRequests is a hard limit for simultaneous registry requests

Variables

View Source
var DefaultConcurrentRequests = 16

DefaultConcurrentRequests will be used if no explicit ConcurrentRequests configured

View Source
var DefaultRetryDelay = 2 * time.Second

DefaultRetryDelay will be used if no explicit RetryDelay configured

Functions

This section is empty.

Types

type Config

type Config struct {
	// ConcurrentRequests defines how much requests to registry we could run concurrently
	ConcurrentRequests int
	// WaitBetween defines how much we will wait between batches of requests
	WaitBetween time.Duration
	// RetryRequests defines how much retries we will do to the failed HTTP request
	RetryRequests int
	// RetryDelay defines how much we will wait between failed HTTP request and retry
	RetryDelay time.Duration
	// TraceRequests sets if we will print out registry HTTP request traces
	TraceRequests bool
	// IsInsecure sets if we want to communicate registry over plain HTTP instead of HTTPS
	IsInsecure bool
}

Config has configuration parameters for RegistryClient creation

type RegistryClient

type RegistryClient struct {

	// Config has general configuration of the registry client instance
	Config Config
	// Token is an authentication token obtained after registry login
	Token auth.Token
	// RepoTokens are per-repo tokens (make sense for "Bearer" authentication only)
	RepoTokens map[string]auth.Token
	// contains filtered or unexported fields
}

RegistryClient is an abstraction to wrap logic of working with Docker registry incl. connection, authentification, authorization, obtaining information etc...

func New

func New(registry string, config Config) (*RegistryClient, error)

New creates and validates new RegistryClient instance

func (*RegistryClient) IsLoggedIn

func (cli *RegistryClient) IsLoggedIn() bool

IsLoggedIn indicates if we are logged in to registry or not

func (*RegistryClient) Login

func (cli *RegistryClient) Login(username, password string) error

Login logs in to the registry (returns error, if failed)

func (*RegistryClient) Ping

func (cli *RegistryClient) Ping() error

Ping checks basic connectivity to the registry

func (*RegistryClient) Tag

func (cli *RegistryClient) Tag(repoPath, tagName string, tagManifest manifest.Manifest) (*tag.Tag, error)

Tag gets information about specified repository tag

func (*RegistryClient) TagData added in v1.2.5

func (cli *RegistryClient) TagData(repoPath string) ([]string, map[string]manifest.Manifest, error)

TagData gets list of all tag names and all additional data for the repository path specified

func (*RegistryClient) URL

func (cli *RegistryClient) URL() string

URL formats a valid URL for the V2 registry

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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