harbor

package
v0.0.0-...-689cd50 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2024 License: EUPL-1.2 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MethodGet    = "GET"
	MethodPost   = "POST"
	MethodPut    = "PUT"
	MethodDelete = "DELETE"
)

Http Methods

Variables

This section is empty.

Functions

func CreateSuffixedGitlabGroupVars

func CreateSuffixedGitlabGroupVars(groupVars map[string]gitlabclient.GroupVariable, suffixes []string) map[string]gitlabclient.GroupVariable

Types

type Access

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

Access specifies permissions for the RobotAccount

type Artifact

type Artifact struct {
	Name string
	Tags []Tag
}

type Client

type Client struct {
	FQDN     string // contains harborUrl; TODO change name
	Username string
	Password string
}

Client struct with api methods and accesstoken

func (Client) EnsureProjectExists

func (harborClient Client) EnsureProjectExists(project config.Project, overwriteRetentionPolicy bool) (ProjectID int, err error)

EnsureProjectExists creates or updates a project in Harbor

func (Client) EnsureProjectMembersExists

func (harborClient Client) EnsureProjectMembersExists(project config.Project, projectID int) error

EnsureProjectMembersExists creates members in the project if needed

func (Client) EnsureProjectRetentionsExists

func (harborClient Client) EnsureProjectRetentionsExists(project config.Project, projectID int) error

func (Client) EnsureRegistryExists

func (harborClient Client) EnsureRegistryExists(registry config.Registry) (RegistryID int, err error)

EnsureRegistryExists creates a registry in Harbor

func (Client) EnsureUserGroupsExists

func (harborClient Client) EnsureUserGroupsExists(project config.Project, projectID int) error

EnsureUserGroupsExists creates a new user group if needed

func (Client) GetArtifacts

func (harborClient Client) GetArtifacts(projectName string, repositoryName string) ([]Artifact, error)

func (Client) GetProjectID

func (harborClient Client) GetProjectID(projectName string) (int, error)

Look if project exists by projectname returns project.ID Returns -1 if project not found

func (Client) GetProjects

func (harborClient Client) GetProjects() ([]Project, error)

GetProjects fetches all projects from Harbor

func (Client) GetRegistryID

func (harborClient Client) GetRegistryID(registryName string) (int, error)

Look if registry exists by registryname returns registry.ID Returns 0 if registry not found

func (Client) GetRepositories

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

func (Client) ManageProjectRobotAccounts

func (harborClient Client) ManageProjectRobotAccounts(projectID int, harborProjectName string, defaultProject bool, createDockerAuthConfig bool) (map[string]gitlabclient.GroupVariable, error)

ManageProjectRobotAccounts creates new robot accounts on project level

func (Client) ManageQuota

func (harborClient Client) ManageQuota(project config.Project, projectID int) error

func (Client) ManageSystemRobotAccount

func (harborClient Client) ManageSystemRobotAccount(harborProjects map[string]int, customerName string, robotAccountLevel string, namePrefix string, dockerAuthConfigFile string, altHarborHostnames []string) (map[string]gitlabclient.GroupVariable, error)

ManageSystemRobotAccount creates a new robot account on system level

func (Client) RemoveRedundantProjectMembers

func (harborClient Client) RemoveRedundantProjectMembers(project config.Project, projectID int) error

RemoveRedundantProjectMembers removes members from project that do not exist in the project config anymore

type ConfigurationItem

type ConfigurationItem struct {
	Value    interface{} `json:"value"`
	Editable bool        `json:"editable"`
}

type DockerAuth

type DockerAuth struct {
	Password string `json:"auth"`
}

The DockerAuthConfig contains "auths", which is a map of {auth:"password"} in JSON, named "DockerAuth" var EmptyAuth = []byte(`{"auths":{"harbor1.nl":{"auth":"pass"},"harbor2.nl":{"auth":"pass"},"harbor3.nl":{"auth":"pass"}}}`)

type DockerAuthConfig

type DockerAuthConfig struct {
	Auths map[string]DockerAuth `json:"auths"`
}

type ExistingMember

type ExistingMember struct {
	ID         int    `json:"id"`
	EntityName string `json:"entity_name"`
	EntityType string `json:"entity_type"`
}

ExistingMember represents an existing member in Harbor

type Member

type Member struct {
	ID     int       `json:"id"`
	RoleID int       `json:"role_id"`
	Group  UserGroup `json:"member_group"`
}

Member defines a member in a Harbor project

type Permission

type Permission struct {
	Namespace string   `json:"namespace"`
	Kind      string   `json:"kind"`
	Access    []Access `json:"access"`
}

Permission defines a permission for the RobotAccount

type Project

type Project struct {
	Name string `json:"name"`
	ID   int    `json:"project_id"`
}

Project defines a project in Harbor

type RID

type RID struct {
	Retention_id string `json:"retention_id"`
}

type Registry

type Registry struct {
	Name string `json:"name"`
	ID   int    `json:"id"`
}

Registry defines a registry in Harbor

type Repository

type Repository struct {
	Name string
}

type RobotAccount

type RobotAccount struct {
	ID          int          `json:"id,omitempty"`
	Name        string       `json:"name"`
	Description string       `json:"description"`
	Level       string       `json:"level"`
	Permissions []Permission `json:"permissions,omitempty"`
	Access      []Access     `json:"access,omitempty"`
}

RobotAccount represents a RobotAccount in a Harbor project

type RobotCredentials

type RobotCredentials struct {
	Name   string `json:"name"`
	Token  string `json:"token"`
	Secret string `json:"secret"`
}

RobotCredentials has the username and token of the robot account; 'token' changed to 'secret' in 2.2.0.

type SystemInfo

type SystemInfo struct {
	AuthMode                    string `json:"auth_mode"`
	ExternalUrl                 string `json:"external_url"`
	HarborVersion               string `json:"harbor_version"`
	HasCaRoot                   bool   `json:"has_ca_root"`
	NotificationEnable          bool   `json:"notification_enable"`
	ProjectCreationRestriction  string `json:"project_creation_restriction"`
	ReadOnly                    bool   `json:"read_only"`
	RegistryStorageProviderName string `json:"registry_storage_provider_name"`
	RegistryUrl                 string `json:"registry_url"`
	SelfRegistration            bool   `json:"self_registration"`
	WithChartmuseum             bool   `json:"with_chartmuseum"`
	WithNotary                  bool   `json:"with_notary"`
}

SystemInfo represents Harbors system info

type Tag

type Tag struct {
	Name string
}

type UserGroup

type UserGroup struct {
	Name string `json:"group_name"`
	ID   int    `json:"id"`
	Type int    `json:"group_type"`
}

UserGroup defines a usergroup in Harbor

Jump to

Keyboard shortcuts

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