harbor

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2022 License: MPL-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	APIURLVersion1 = "/api"
	APIURLVersion2 = "/api/v2.0"
)

Variables

This section is empty.

Functions

func ErrorIs404

func ErrorIs404(err error) bool

Types

type APIError

type APIError struct {
	Code    int
	Message string
}

func (*APIError) Error

func (e *APIError) Error() string

type Chart added in v0.1.0

type Chart struct {
	Name          string    `json:"name"`
	TotalVersions int       `json:"total_versions"`
	LatestVersion string    `json:"latest_version"`
	Created       time.Time `json:"created"`
	Updated       time.Time `json:"updated"`
	Icon          string    `json:"icon"`
	Home          string    `json:"home"`
	Deprecated    bool      `json:"deprecated"`
}

type Client

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

func NewClient

func NewClient(baseURL string, username string, password string, tlsInsecureSkipVerify bool, userAgent string) *Client

func (*Client) DeleteChart added in v0.1.0

func (client *Client) DeleteChart(project string, chart string) error

func (*Client) DeleteCharts added in v0.1.0

func (client *Client) DeleteCharts(project string, charts []*Chart) error

func (*Client) DeleteLabel added in v0.3.2

func (client *Client) DeleteLabel(id string) error

func (*Client) DeleteProject

func (client *Client) DeleteProject(id string) error

func (*Client) DeleteRepositories added in v0.1.0

func (client *Client) DeleteRepositories(projectName string, repos []*Repository) error

func (*Client) DeleteRepository added in v0.1.0

func (client *Client) DeleteRepository(projectName string, repoName string) error

func (*Client) DeleteRobotAccount

func (client *Client) DeleteRobotAccount(id string) error

func (*Client) DeleteWebhook added in v0.3.1

func (client *Client) DeleteWebhook(id string) error

func (*Client) GetCharts added in v0.1.0

func (client *Client) GetCharts(id string) ([]*Chart, error)

func (*Client) GetLabel added in v0.3.2

func (client *Client) GetLabel(id string) (*Label, error)

func (*Client) GetProject

func (client *Client) GetProject(id string) (*Project, error)

func (*Client) GetRepositories added in v0.1.0

func (client *Client) GetRepositories(projectName string) ([]*Repository, error)

func (*Client) GetResource added in v0.3.0

func (client *Client) GetResource(id string) (interface{}, error)

func (*Client) GetRobotAccount

func (client *Client) GetRobotAccount(id string) (*RobotAccount, error)

func (*Client) GetWebhook added in v0.3.1

func (client *Client) GetWebhook(id string) (*Webhook, error)

func (*Client) NewLabel added in v0.3.2

func (client *Client) NewLabel(label *Label) (string, error)

func (*Client) NewProject

func (client *Client) NewProject(project *ProjectReq) (string, error)

func (*Client) NewRobotAccount

func (client *Client) NewRobotAccount(projectID string, robot *RobotAccountCreate) (*RobotAccountPostRep, string, error)

func (*Client) NewWebhook added in v0.3.1

func (client *Client) NewWebhook(projectID string, webhook *Webhook) (string, error)

func (*Client) UpdateLabel added in v0.3.2

func (client *Client) UpdateLabel(id string, label *Label) error

func (*Client) UpdateProject

func (client *Client) UpdateProject(id string, project *ProjectReq) error

func (*Client) UpdateRobotAccount

func (client *Client) UpdateRobotAccount(id string, robot *RobotAccountUpdate) error

func (*Client) UpdateWebhook added in v0.3.1

func (client *Client) UpdateWebhook(id string, webhook *Webhook) error

type Label added in v0.3.2

type Label struct {
	CreationTime string `json:"creation_time,omitempty"`
	UpdateTime   string `json:"update_time,omitempty"`
	Deleted      bool   `json:"deleted,omitempty"`
	ID           int64  `json:"id,omitempty"`

	Name        string `json:"name"`
	Description string `json:"description"`
	Color       string `json:"color"`
	Scope       string `json:"scope"`
	ProjectID   int64  `json:"project_id"`
}

type Project

type Project struct {
	UpdateTime         string  `json:"update_time"`
	OwnerName          string  `json:"owner_name"`
	Name               string  `json:"name"`
	Deleted            bool    `json:"deleted"`
	OwnerID            int32   `json:"owner_id"`
	RepoCount          int     `json:"repo_count"`
	CreationTime       string  `json:"creation_time"`
	Togglable          bool    `json:"togglable"`
	ProjectID          int32   `json:"project_id"`
	CurrentUserRoleIDs []int32 `json:"current_user_role_ids"`
	ChartCount         int     `json:"chart_count"`
	// CVEWhitelist `json:"cve_whitelist"`
	Metadata ProjectMetadata `json:"metadata"`
}

type ProjectMetadata

type ProjectMetadata struct {
	EnableContentTrust   string `json:"enable_content_trust,omitempty"`
	AutoScan             bool   `json:"auto_scan,string"`
	Severity             string `json:"severity,omitempty"`
	ReuseSysCveWhitelist string `json:"reuse_sys_cve_whitelist,omitempty"`
	Public               bool   `json:"public,string"`
	PreventVul           string `json:"prevent_vul,omitempty"`
}

type ProjectReq

type ProjectReq struct {
	CountLimit  int64  `json:"count_limit,omitempty"`
	ProjectName string `json:"project_name,omitempty"`
	// CVEWhitelist `json:"cve_whitelist"`
	StorageLimit int64           `json:"storage_limit,omitempty"`
	Metadata     ProjectMetadata `json:"metadata,omitempty"`
}

type Repository added in v0.1.0

type Repository struct {
	ID           int           `json:"id"`
	Name         string        `json:"name"`
	ProjectID    int           `json:"project_id"`
	Description  string        `json:"description"`
	PullCount    int           `json:"pull_count"`
	StarCount    int           `json:"star_count"`
	TagsCount    int           `json:"tags_count"`
	Labels       []interface{} `json:"labels"`
	CreationTime time.Time     `json:"creation_time"`
	UpdateTime   time.Time     `json:"update_time"`
}

type RobotAccount

type RobotAccount struct {
	Description  string `json:"description"`
	UpdateTime   string `json:"update_time"`
	CreationTime string `json:"creation_time"`
	ExpiresAt    int    `json:"expires_at"`
	Disabled     bool   `json:"disabled"`
	ProjectID    int    `json:"project_id"`
	ID           int    `json:"id"`
	Name         string `json:"name"`
}

type RobotAccountAccess

type RobotAccountAccess struct {
	Action   string `json:"action,omitempty"`
	Resource string `json:"resource,omitempty"`
}

type RobotAccountCreate

type RobotAccountCreate struct {
	Access      []RobotAccountAccess `json:"access,omitempty"`
	Name        string               `json:"name,omitempty"`
	Description string               `json:"description,omitempty"`
	ExpiresAt   int64                `json:"expires_at,omitempty"`
}

type RobotAccountPostRep

type RobotAccountPostRep struct {
	Token string `json:"token"`
	Name  string `json:"name"`
}

type RobotAccountUpdate

type RobotAccountUpdate struct {
	Disabled bool `json:"disabled,omitempty"`
}

type Webhook added in v0.3.1

type Webhook struct {
	UpdateTime   string             `json:"update_time,omitempty"`
	Description  string             `json:"description,omitempty"`
	Creator      string             `json:"creator,omitempty"`
	CreationTime string             `json:"creation_time,omitempty"`
	Enabled      bool               `json:"enabled"`
	EventTypes   []string           `json:"event_types"`
	ProjectID    int                `json:"project_id,omitempty"`
	ID           int64              `json:"id,omitempty"`
	Name         string             `json:"name,omitempty"`
	Targets      []WebhookTargetObj `json:"targets"`
}

type WebhookTargetObj added in v0.3.1

type WebhookTargetObj struct {
	Type           string `json:"type"`
	AuthHeader     string `json:"auth_header"`
	SkipCertVerify bool   `json:"skip_cert_verify"`
	Address        string `json:"address"`
}

Jump to

Keyboard shortcuts

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