Documentation ¶
Index ¶
- Constants
- func CreateSuffixedGitlabGroupVars(groupVars map[string]gitlabclient.GroupVariable, suffixes []string) map[string]gitlabclient.GroupVariable
- type Access
- type Artifact
- type Client
- func (harborClient Client) EnsureProjectExists(project config.Project, overwriteRetentionPolicy bool) (ProjectID int, err error)
- func (harborClient Client) EnsureProjectMembersExists(project config.Project, projectID int) error
- func (harborClient Client) EnsureProjectRetentionsExists(project config.Project, projectID int) error
- func (harborClient Client) EnsureRegistryExists(registry config.Registry) (RegistryID int, err error)
- func (harborClient Client) EnsureUserGroupsExists(project config.Project, projectID int) error
- func (harborClient Client) GetArtifacts(projectName string, repositoryName string) ([]Artifact, error)
- func (harborClient Client) GetProjectID(projectName string) (int, error)
- func (harborClient Client) GetProjects() ([]Project, error)
- func (harborClient Client) GetRegistryID(registryName string) (int, error)
- func (harborClient Client) GetRepositories(projectName string) ([]Repository, error)
- func (harborClient Client) ManageProjectRobotAccounts(projectID int, harborProjectName string, defaultProject bool, ...) (map[string]gitlabclient.GroupVariable, error)
- func (harborClient Client) ManageQuota(project config.Project, projectID int) error
- func (harborClient Client) ManageSystemRobotAccount(harborProjects map[string]int, customerName string, robotAccountLevel string, ...) (map[string]gitlabclient.GroupVariable, error)
- func (harborClient Client) RemoveRedundantProjectMembers(project config.Project, projectID int) error
- type ConfigurationItem
- type DockerAuth
- type DockerAuthConfig
- type ExistingMember
- type Member
- type Permission
- type Project
- type RID
- type Registry
- type Repository
- type RobotAccount
- type RobotCredentials
- type SystemInfo
- type Tag
- type UserGroup
Constants ¶
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 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 ¶
EnsureProjectMembersExists creates members in the project if needed
func (Client) EnsureProjectRetentionsExists ¶
func (Client) EnsureRegistryExists ¶
func (harborClient Client) EnsureRegistryExists(registry config.Registry) (RegistryID int, err error)
EnsureRegistryExists creates a registry in Harbor
func (Client) EnsureUserGroupsExists ¶
EnsureUserGroupsExists creates a new user group if needed
func (Client) GetArtifacts ¶
func (Client) GetProjectID ¶
Look if project exists by projectname returns project.ID Returns -1 if project not found
func (Client) GetProjects ¶
GetProjects fetches all projects from Harbor
func (Client) GetRegistryID ¶
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 (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
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 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