base

package
v0.0.0-...-b0545c0 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2025 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Adapter

type Adapter struct {
	*native.Adapter
	Registry *model.Registry
	Client   *Client
	// contains filtered or unexported fields
}

Adapter is the base adapter for Harbor

func New

func New(registry *model.Registry) (*Adapter, error)

New creates an instance of the base adapter

func (*Adapter) GetAPIVersion

func (a *Adapter) GetAPIVersion() string

GetAPIVersion returns the supported API version of the Harbor instance that the adapter is created for

func (*Adapter) Info

func (a *Adapter) Info() (*model.RegistryInfo, error)

Info provides the information of the Harbor registry instance

func (*Adapter) ListProjects

func (a *Adapter) ListProjects(filters []*model.Filter) ([]*Project, error)

ListProjects lists projects

func (*Adapter) PrepareForPush

func (a *Adapter) PrepareForPush(resources []*model.Resource) error

PrepareForPush creates projects

type Client

type Client struct {
	URL        string
	APIVersion string
	C          *common_http.Client
}

Client is the base client that provides common methods for all versions of Harbor clients

func NewClient

func NewClient(url string, c *common_http.Client) (*Client, error)

NewClient returns an instance of the base client

func (*Client) BasePath

func (c *Client) BasePath() string

BasePath returns the API base path that contains version part

func (*Client) CreateProject

func (c *Client) CreateProject(name string, metadata map[string]interface{}) error

CreateProject creates project

func (*Client) GetAPIVersion

func (c *Client) GetAPIVersion() (string, error)

GetAPIVersion returns the supported API version

func (*Client) GetProject

func (c *Client) GetProject(name string) (*Project, error)

GetProject gets the specific project

func (*Client) GetURL

func (c *Client) GetURL() string

GetURL returns the URL of the registry that the client is for

func (*Client) ListLabels

func (c *Client) ListLabels() ([]string, error)

ListLabels lists system level labels

func (*Client) ListProjects

func (c *Client) ListProjects(name string) ([]*Project, error)

ListProjects lists projects

func (*Client) ListProjectsWithQuery

func (c *Client) ListProjectsWithQuery(q string, withDetail bool) ([]*Project, error)

ListProjectsWithQuery lists projects with query

type Project

type Project struct {
	ID         int64                  `json:"project_id"`
	Name       string                 `json:"name"`
	Metadata   map[string]interface{} `json:"metadata"`
	RegistryID int64                  `json:"registry_id"`
}

Project model

Jump to

Keyboard shortcuts

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