Documentation
¶
Index ¶
- type API
- type ClairVulnerabilityDetail
- type ClairVulnerabilityStatus
- type Client
- func (c *Client) BaseURL() string
- func (c *Client) CreateRobotAccount(name string, pushAccess bool, project Project) (*CreateRobotResponse, error)
- func (c *Client) DeleteRobotAccount(project Project, robotID int) error
- func (c *Client) GetRobotAccounts(project Project) ([]Robot, error)
- func (c *Client) ListProjects() ([]Project, error)
- func (c *Client) SystemInfo() (*SystemInfoResponse, error)
- type CreateRobotRequest
- type CreateRobotRequestAccess
- type CreateRobotResponse
- type Project
- type ProjectMetadata
- type Robot
- type SystemInfoResponse
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 (*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 ¶
DeleteRobotAccount deletes the specified robot account
func (*Client) GetRobotAccounts ¶
GetRobotAccounts returns all robot accounts for the given project
func (*Client) ListProjects ¶
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 ¶
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