contexts

package
v0.1.60 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2025 License: GPL-3.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Download

func Download(token string, registry string) (string, error)

func Upload

func Upload(token string, registry string, data string) (string, error)

Types

type ClientContext

type ClientContext struct {
	Name        string
	Directory   string `json:"-"`
	APIURL      string
	Credentials *Credentials
	// contains filtered or unexported fields
}

func Import

func Import(cfg *Config, encrypted, key string) (*ClientContext, error)

func LoadActive

func LoadActive(cfg *Config) (*ClientContext, error)

func LoadByName

func LoadByName(name string, cfg *Config) (*ClientContext, error)

func NewContext

func NewContext(cfg *Config) (*ClientContext, error)

func (*ClientContext) Connect

func (c *ClientContext) Connect(ctx context.Context, retry bool) error

func (*ClientContext) Export

func (c *ClientContext) Export() (string, string, error)

func (*ClientContext) GetClientNoTimeout

func (c *ClientContext) GetClientNoTimeout() *http.Client

func (*ClientContext) GetHTTPClient

func (c *ClientContext) GetHTTPClient() *http.Client

func (*ClientContext) ImportCertificates

func (c *ClientContext) ImportCertificates(ctx context.Context, sshDir string) error

func (*ClientContext) Load

func (c *ClientContext) Load() error

func (*ClientContext) Save

func (c *ClientContext) Save() error

func (*ClientContext) WithAPIURL

func (c *ClientContext) WithAPIURL(url string) *ClientContext

func (*ClientContext) WithCredentials

func (c *ClientContext) WithCredentials(creds *Credentials) *ClientContext

func (*ClientContext) WithName

func (c *ClientContext) WithName(name string) *ClientContext

type Config

type Config struct {
	RootDir     string
	APITimeout  time.Duration
	MaxRetries  int
	RetryDelay  time.Duration
	UseInsecure bool
	InMemory    bool
}

func DefaultConfig

func DefaultConfig(rootDir string) *Config

type Credentials

type Credentials struct {
	PrivateKey *bytes.Buffer
	Cert       *bytes.Buffer
	Ca         *bytes.Buffer
	CertBundle string
	User       *authentication.User
}

func BundleToCredentials

func BundleToCredentials(bundle interface{}) (*Credentials, error)

type FileStorage

type FileStorage struct {
	// contains filtered or unexported fields
}

func NewFileStorage

func NewFileStorage(contextDir string) *FileStorage

func (*FileStorage) Delete

func (fs *FileStorage) Delete(name string) error

func (*FileStorage) GetActive

func (fs *FileStorage) GetActive() (string, error)

func (*FileStorage) List

func (fs *FileStorage) List() ([]string, error)

func (*FileStorage) Load

func (fs *FileStorage) Load(name string) (*ClientContext, error)

func (*FileStorage) Save

func (fs *FileStorage) Save(ctx *ClientContext) error

func (*FileStorage) SetActive

func (fs *FileStorage) SetActive(name string) error

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

func NewManager

func NewManager(cfg *Config) (*Manager, error)

func (*Manager) CreateContext

func (m *Manager) CreateContext(name, apiURL string, creds *Credentials) (*ClientContext, error)

func (*Manager) DeleteContext

func (m *Manager) DeleteContext(name string) error

func (*Manager) Download

func (m *Manager) Download(token string, registry string) (string, error)

func (*Manager) ExportContext

func (m *Manager) ExportContext(name string, api string) (string, string, error)

func (*Manager) GetActive

func (m *Manager) GetActive() (*ClientContext, error)

func (*Manager) GetContext

func (m *Manager) GetContext(name string) (*ClientContext, error)

func (*Manager) ImportContext

func (m *Manager) ImportContext(encrypted, key string) (*ClientContext, error)

func (*Manager) ListContexts

func (m *Manager) ListContexts() ([]string, error)

func (*Manager) SetActive

func (m *Manager) SetActive(name string) error

func (*Manager) Upload

func (m *Manager) Upload(token string, registry string, data string) (string, error)

type MemoryStorage

type MemoryStorage struct {
	// contains filtered or unexported fields
}

func NewMemoryStorage

func NewMemoryStorage() *MemoryStorage

func (*MemoryStorage) Delete

func (ms *MemoryStorage) Delete(name string) error

func (*MemoryStorage) GetActive

func (ms *MemoryStorage) GetActive() (string, error)

func (*MemoryStorage) List

func (ms *MemoryStorage) List() ([]string, error)

func (*MemoryStorage) Load

func (ms *MemoryStorage) Load(name string) (*ClientContext, error)

func (*MemoryStorage) Save

func (ms *MemoryStorage) Save(ctx *ClientContext) error

func (*MemoryStorage) SetActive

func (ms *MemoryStorage) SetActive(name string) error

type Storage

type Storage interface {
	Save(ctx *ClientContext) error
	Load(name string) (*ClientContext, error)
	GetActive() (string, error)
	SetActive(name string) error
	Delete(name string) error
	List() ([]string, error)
}

Jump to

Keyboard shortcuts

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