harbor

package
v1.3.4 Latest Latest
Warning

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

Go to latest
Published: May 28, 2020 License: Apache-2.0 Imports: 16 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API interface {
	ListProjects() ([]Project, error)
	GetRobotAccounts(project Project) ([]Robot, error)
	CreateRobotAccount(name string, pushAccess bool, project Project) (*CreateRobotResponse, error)
	DeleteRobotAccount(project Project, robotID int) error
	BaseURL() string
}

API is the interface that is implemented by the client and repository type

type ClairVulnerabilityDetail

type ClairVulnerabilityDetail struct {
	Namespace  string `json:"namespace"`
	LastUpdate int    `json:"last_update"`
}

ClairVulnerabilityDetail contains the last update per namespace

type ClairVulnerabilityStatus

type ClairVulnerabilityStatus struct {
	OverallLastUpdate int                        `json:"overall_last_update"`
	Details           []ClairVulnerabilityDetail `json:"details"`
}

ClairVulnerabilityStatus contains the vulnerability details

type Client

type Client struct {
	APIBaseURL *url.URL
	Username   string
	Password   string
	UserAgent  string
	HTTPClient *http.Client
	// contains filtered or unexported fields
}

Client implements the harbor.API interface. Each func call issues a HTTP requsts to harbor

func New

func New(baseurl, username, password string, skipVerifyTLS bool) (*Client, error)

New constructs a new harbor API client

func (*Client) BaseURL

func (c *Client) BaseURL() string

BaseURL returns the base url for accessing harbor

func (*Client) CreateRobotAccount

func (c *Client) CreateRobotAccount(name string, pushAccess bool, project Project) (*CreateRobotResponse, error)

CreateRobotAccount creates a robot account and return the name and token

func (*Client) DeleteRobotAccount

func (c *Client) DeleteRobotAccount(project Project, robotID int) error

DeleteRobotAccount deletes the specified robot account

func (*Client) GetRobotAccounts

func (c *Client) GetRobotAccounts(project Project) ([]Robot, error)

GetRobotAccounts returns all robot accounts for the given project

func (*Client) ListProjects

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

ListProjects returns all projects

func (*Client) SystemInfo

func (c *Client) SystemInfo() (*SystemInfoResponse, error)

SystemInfo calls /systeminfo and returns the response

type CreateRobotRequest

type CreateRobotRequest struct {
	Name   string                     `json:"name"`
	Access []CreateRobotRequestAccess `json:"access"`
}

CreateRobotRequest is the request payload for creating a robot account

type CreateRobotRequestAccess

type CreateRobotRequestAccess struct {
	Resource string `json:"resource"`
	Action   string `json:"action"`
}

CreateRobotRequestAccess defines the permissions for the robot account

type CreateRobotResponse

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

CreateRobotResponse is the API response from a creating a robot

type Project

type Project struct {
	ID        int             `json:"project_id"`
	Name      string          `json:"name"`
	OwnerName string          `json:"owner_name"`
	Metadata  ProjectMetadata `json:"metadata"`
}

Project is the harbor API response

type ProjectMetadata

type ProjectMetadata struct {
	Public             string `json:"public"`
	EnableContentTrust string `json:"enable_content_trust"`
	PreventVul         string `json:"prevent_vul"`
	Severity           string `json:"severity"`
	AutoScan           string `json:"auto_scal"`
}

ProjectMetadata contains the metadata of the project

type Robot

type Robot struct {
	ID        int `json:"id"`
	ProjectID int `json:"project_id"`
	Disabled  bool

	Name         string `json:"name"`
	Description  string `json:"description"`
	ExpiresAt    int64  `json:"expires_at"`
	CreationTime string `json:"creation_time"`
	UpdateTime   string `json:"update_time"`
}

Robot is the API response from Harbor

type SystemInfoResponse

type SystemInfoResponse struct {
	WithNotary                 bool                     `json:"with_notary"`
	WithClair                  bool                     `json:"with_clair"`
	WithAdmiral                bool                     `json:"with_admiral"`
	AdmiralEndpoint            string                   `json:"admiral_endpoint"`
	RegistryURL                string                   `json:"registry_url"`
	ExternalURL                string                   `json:"external_url"`
	AuthMode                   string                   `json:"auth_mode"`
	ProjectCreationRestriction string                   `json:"project_creation_restriction"`
	SelfRegistration           bool                     `json:"self_registration"`
	HasCARoot                  bool                     `json:"has_ca_root"`
	HarborVersion              string                   `json:"harbor_version"`
	NextScalAll                bool                     `json:"next_scan_all"`
	ClairVulnerabilityStatus   ClairVulnerabilityStatus `json:"clair_vulnerability_status"`
}

SystemInfoResponse is the harbor response of a /systeminfo call

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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