apilib

package
v1.6.2 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2018 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package apilib These APIs provide services for manipulating Harbor project.

HarborLogout.go

HarborLogon.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessLog

type AccessLog struct {

	// The ID of the log entry.
	LogId int32 `json:"log_id,omitempty"`

	// Name of the repository in this log entry.
	RepoName string `json:"repo_name,omitempty"`

	// Tag of the repository in this log entry.
	RepoTag string `json:"repo_tag,omitempty"`

	// The operation against the repository in this log entry.
	Operation string `json:"operation,omitempty"`

	// The time when this operation is triggered.
	OpTime string `json:"op_time,omitempty"`
}

type AdminJob added in v1.6.0

type AdminJob struct {
	ID           int64  `json:"id,omitempty"`
	Name         string `json:"job_name,omitempty"`
	Kind         string `json:"job_kind,omitempty"`
	Status       string `json:"job_status,omitempty"`
	UUID         string `json:"uuid,omitempty"`
	Deleted      bool   `json:"deleted,omitempty"`
	CreationTime string `json:"creation_time,omitempty"`
	UpdateTime   string `json:"update_time,omitempty"`
}

AdminJob ...

type GCReq added in v1.6.0

type GCReq struct {
	Schedule *ScheduleParam `json:"schedule,omitempty"`
	Status   string         `json:"status,omitempty"`
	ID       int64          `json:"id,omitempty"`
}

GCReq holds request information for admin job

type HarborAPI

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

func NewHarborAPI

func NewHarborAPI() *HarborAPI

func NewHarborAPIWithBasePath

func NewHarborAPIWithBasePath(basePath string) *HarborAPI

func (HarborAPI) HarborLogin

func (a HarborAPI) HarborLogin(user UsrInfo) (int, error)

func (HarborAPI) HarborLogout

func (a HarborAPI) HarborLogout() (int, error)

func (HarborAPI) ProjectsPost

func (a HarborAPI) ProjectsPost(prjUsr UsrInfo, project Project) (int, error)

Create a new project. Implementation Notes This endpoint is for user to create a new project. @param project New created project. @return void func (a HarborAPI) ProjectsPost (prjUsr UsrInfo, project Project) (int, error) {

func (HarborAPI) RepositoriesDelete

func (a HarborAPI) RepositoriesDelete(prjUsr UsrInfo, repoName string, tag string) (int, error)

Delete a repository or a tag in a repository. Delete a repository or a tag in a repository. This endpoint let user delete repositories and tags with repo name and tag.\n @param repoName The name of repository which will be deleted. @param tag Tag of a repository. @return void func (a HarborAPI) RepositoriesDelete(prjUsr UsrInfo, repoName string, tag string) (int, error) {

func (HarborAPI) SearchGet

func (a HarborAPI) SearchGet(q string) (Search, error)

Search for projects and repositories Implementation Notes The Search endpoint returns information about the projects and repositories offered at public status or related to the current logged in user. The response includes the project and repository list in a proper display order. @param q Search parameter for project and repository name. @return []Search func (a HarborAPI) SearchGet (q string) (Search, error) {

type JobStatus

type JobStatus struct {

	// The job ID.
	Id int64 `json:"id,omitempty"`

	// The status of the job.
	Status string `json:"status,omitempty"`

	// The repository handled by the job.
	Repository string `json:"repository,omitempty"`

	// The ID of the policy that triggered this job.
	PolicyId int64 `json:"policy_id,omitempty"`

	// The operation of the job.
	Operation string `json:"operation,omitempty"`

	// The repository's used tag list.
	Tags []Tags `json:"tags,omitempty"`

	// The creation time of the job.
	CreationTime string `json:"creation_time,omitempty"`

	// The update time of the job.
	UpdateTime string `json:"update_time,omitempty"`
}

type LdapConf

type LdapConf struct {
	LdapURL               string `json:"ldap_url"`
	LdapSearchDn          string `json:"ldap_search_dn"`
	LdapSearchPassword    string `json:"ldap_search_password"`
	LdapBaseDn            string `json:"ldap_base_dn"`
	LdapFilter            string `json:"ldap_filter"`
	LdapUID               string `json:"ldap_uid"`
	LdapScope             int    `json:"ldap_scope"`
	LdapConnectionTimeout int    `json:"ldap_connection_timeout"`
}

type LogQuery

type LogQuery struct {
	Username       string   `url:"username,omitempty"`
	Repository     string   `url:"repository,omitempty"`
	Tag            string   `url:"tag,omitempty"`
	Operation      []string `url:"operation,omitempty"`
	BeginTimestamp int64    `url:"begin_timestamp,omitempty"`
	EndTimestamp   int64    `url:"end_timestamp,omitempty"`
	Page           int64    `url:"page,omitempty"`
	PageSize       int64    `url:"page_size,omitempty"`
}

type Password

type Password struct {

	// The user's existing password.
	OldPassword string `json:"old_password,omitempty"`

	// New password for marking as to be updated.
	NewPassword string `json:"new_password,omitempty"`
}

type Project

type Project struct {

	// Project ID
	ProjectId int32 `json:"project_id,omitempty"`

	// The owner ID of the project always means the creator of the project.
	OwnerId int32 `json:"owner_id,omitempty"`

	// The name of the project.
	ProjectName string `json:"name,omitempty"`

	// The creation time of the project.
	CreationTime string `json:"creation_time,omitempty"`

	// The update time of the project.
	UpdateTime string `json:"update_time,omitempty"`

	// A deletion mark of the project (1 means it's deleted, 0 is not)
	Deleted bool `json:"deleted,omitempty"`

	// The owner name of the project.
	OwnerName string `json:"owner_name,omitempty"`

	// The metadata of the project.
	Metadata map[string]string `json:"metadata,omitempty"`

	// Correspond to the UI about whether the project's publicity is  updatable (for UI)
	Togglable bool `json:"togglable,omitempty"`

	// The role ID of the current user who triggered the API (for UI)
	CurrentUserRoleId int32 `json:"current_user_role_id,omitempty"`

	// The number of the repositories under this project.
	RepoCount int32 `json:"repo_count,omitempty"`
}

type ProjectQuery

type ProjectQuery struct {
	Name     string `url:"name,omitempty"`
	Owner    string `url:"owner,omitempty"`
	Public   bool   `url:"public,omitempty"`
	Member   string `url:"member,omitempty"`
	Role     int    `url:"role,omitempty"`
	Page     int64  `url:"page,omitempty"`
	PageSize int64  `url:"page_size,omitempty"`
}

type ProjectReq

type ProjectReq struct {
	// The name of the project.
	ProjectName string `json:"project_name,omitempty"`
	// The metadata of the project.
	Metadata map[string]string `json:"metadata,omitempty"`
}

type RepPolicy

type RepPolicy struct {

	// The policy ID.
	Id int64 `json:"id,omitempty"`

	// The project ID.
	ProjectId int64 `json:"project_id,omitempty"`

	// The project name.
	ProjectName string `json:"project_name,omitempty"`

	// The target ID.
	TargetId int64 `json:"target_id,omitempty"`

	// The policy name.
	Name string `json:"name,omitempty"`

	// The policy's enabled status.
	Enabled int32 `json:"enabled,omitempty"`

	// The description of the policy.
	Description string `json:"description,omitempty"`

	// The cron string for schedule job.
	CronStr string `json:"cron_str,omitempty"`

	// The start time of the policy.
	StartTime string `json:"start_time,omitempty"`

	// The create time of the policy.
	CreationTime string `json:"creation_time,omitempty"`

	// The update time of the policy.
	UpdateTime string `json:"update_time,omitempty"`

	Deleted int32 `json:"deleted,omitempty"`
}

type RepPolicyEnablementReq

type RepPolicyEnablementReq struct {

	// The policy enablement flag.
	Enabled int32 `json:"enabled,omitempty"`
}

type RepPolicyPost

type RepPolicyPost struct {

	// The project ID.
	ProjectId int64 `json:"project_id,omitempty"`

	// The target ID.
	TargetId int64 `json:"target_id,omitempty"`

	// The policy name.
	Name string `json:"name,omitempty"`
}

type RepPolicyUpdate

type RepPolicyUpdate struct {

	// The target ID.
	TargetId int64 `json:"target_id,omitempty"`

	// The policy name.
	Name string `json:"name,omitempty"`

	// The policy's enabled status.
	Enabled int32 `json:"enabled,omitempty"`

	// The description of the policy.
	Description string `json:"description,omitempty"`

	// The cron string for schedule job.
	CronStr string `json:"cron_str,omitempty"`
}

type RepTarget

type RepTarget struct {

	// The target ID.
	Id int64 `json:"id,omitempty"`

	// The target address URL string.
	Endpoint string `json:"endpoint,omitempty"`

	// The target name.
	Name string `json:"name,omitempty"`

	// The target server username.
	Username string `json:"username,omitempty"`

	// The target server password.
	Password string `json:"password,omitempty"`

	// Reserved field.
	Type_ int32 `json:"type,omitempty"`

	// The create time of the policy.
	CreationTime string `json:"creation_time,omitempty"`

	// The update time of the policy.
	UpdateTime string `json:"update_time,omitempty"`
}

type RepTargetPost

type RepTargetPost struct {

	// The target address URL string.
	Endpoint string `json:"endpoint,omitempty"`

	// The target name.
	Name string `json:"name,omitempty"`

	// The target server username.
	Username string `json:"username,omitempty"`

	// The target server password.
	Password string `json:"password,omitempty"`
}

type Repository

type Repository struct {

	// Repository ID
	Id string `json:"id,omitempty"`

	// Parent of the image.
	Parent string `json:"parent,omitempty"`

	// Repository create time.
	Created string `json:"created,omitempty"`

	// Duration days of the image.
	DurationDays string `json:"duration_days,omitempty"`

	// Author of the image.
	Author string `json:"author,omitempty"`

	// Architecture of the image.
	Architecture string `json:"architecture,omitempty"`

	// Docker version of the image.
	DockerVersion string `json:"docker_version,omitempty"`

	// OS of the image.
	Os string `json:"os,omitempty"`
}

type Role

type Role struct {

	// ID in table.
	RoleId int32 `json:"role_id,omitempty"`

	// Description of permissions for the role.
	RoleCode string `json:"role_code,omitempty"`

	// Name the the role.
	RoleName string `json:"role_name,omitempty"`

	RoleMask string `json:"role_mask,omitempty"`
}

type RoleParam

type RoleParam struct {

	// Role ID for updating project role member.
	Roles []int32 `json:"roles,omitempty"`

	// Username relevant to a project role member.
	Username string `json:"username,omitempty"`
}

type ScheduleParam added in v1.6.0

type ScheduleParam struct {
	Type    string `json:"type,omitempty"`
	Weekday int8   `json:"Weekday,omitempty"`
	Offtime int64  `json:"Offtime,omitempty"`
}

ScheduleParam ...

type Search struct {

	// Search results of the projects that matched the filter keywords.
	Projects []models.Project `json:"project,omitempty"`

	// Search results of the repositories that matched the filter keywords.
	Repositories []SearchRepository `json:"repository,omitempty"`
}

type SearchProject

type SearchProject struct {

	// The ID of project
	Id int64 `json:"id,omitempty"`

	// The name of the project
	Name string `json:"name,omitempty"`

	// The flag to indicate the publicity of the project (1 is public, 0 is non-public)
	Public int32 `json:"public,omitempty"`
}

type SearchRepository

type SearchRepository struct {

	// The ID of the project that the repository belongs to
	ProjectId int32 `json:"project_id,omitempty"`

	// The name of the project that the repository belongs to
	ProjectName string `json:"project_name,omitempty"`

	// The flag to indicate the publicity of the project that the repository belongs to
	ProjectPublic bool `json:"project_public,omitempty"`

	// The name of the repository
	RepositoryName string `json:"repository_name,omitempty"`
}

type StatisticMap

type StatisticMap struct {

	// The count of the private projects which the user is a member of.
	PrivateProjectCount int32 `json:"private_project_count,omitempty"`

	// The count of the private repositories belonging to the projects which the user is a member of.
	PrivateRepoCount int32 `json:"private_repo_count,omitempty"`

	// The count of the public projects.
	PublicProjectCount int32 `json:"public_project_count,omitempty"`

	// The count of the public repositories belonging to the public projects which the user is a member of.
	PublicRepoCount int32 `json:"public_repo_count,omitempty"`

	// The count of the total projects, only be seen when the is admin.
	TotalProjectCount int32 `json:"total_project_count,omitempty"`

	// The count of the total repositories, only be seen when the user is admin.
	TotalRepoCount int32 `json:"total_repo_count,omitempty"`
}

type Storage

type Storage struct {
	Total uint64 `json:"total"`
	Free  uint64 `json:"free"`
}

type SystemInfo

type SystemInfo struct {
	HarborStorage Storage `json:"storage"`
}

type Tags

type Tags struct {

	// The repository's used tag.
	Tag string `json:"tag,omitempty"`
}

type TopRepo

type TopRepo struct {

	// The name of the repo
	RepoName string `json:"repo_name,omitempty"`

	// The access count of the repo
	Count int32 `json:"count,omitempty"`
}

type User

type User struct {

	// The ID of the user.
	UserId int `json:"user_id,omitempty"`

	Username string `json:"username,omitempty"`

	Email string `json:"email,omitempty"`

	Password string `json:"password,omitempty"`

	Realname string `json:"realname,omitempty"`

	Comment string `json:"comment,omitempty"`

	Deleted bool `json:"deleted,omitempty"`

	RoleName string `json:"role_name,omitempty"`

	RoleId int32 `json:"role_id,omitempty"`

	HasAdminRole bool `json:"has_admin_role,omitempty"`

	ResetUuid string `json:"reset_uuid,omitempty"`

	Salt string `json:"Salt,omitempty"`

	CreationTime string `json:"creation_time,omitempty"`

	UpdateTime string `json:"update_time,omitempty"`
}

type UserProfile

type UserProfile struct {
	Email string `json:"email,omitempty"`

	Realname string `json:"realname,omitempty"`

	Comment string `json:"comment,omitempty"`
}

type UsrInfo

type UsrInfo struct {
	Name   string
	Passwd string
}

Jump to

Keyboard shortcuts

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