harbor

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2024 License: AGPL-3.0 Imports: 13 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.

README

// minimum docker push/pull permissions
[
  {
    "action":   "push",
    "resource": "repository",
  },
  {
    "action":   "pull",
    "resource": "repository",
  },
]
// harbor account ACL example
[
  {
    "action":   "push",
    "resource": "repository",
  },
  {
    "action":   "pull",
    "resource": "repository",
  },
  {
    "action":   "delete",
    "resource": "artifact",
  },
  {
    "action":   "create",
    "resource": "helm-chart-version",
  },
  {
    "action":   "delete",
    "resource": "helm-chart-version",
  },
  {
    "action":   "create",
    "resource": "tag",
  },
  {
    "action":   "delete",
    "resource": "tag",
  },
  {
    "action":   "create",
    "resource": "artifact-label",
  },
  {
    "action":   "list",
    "resource": "artifact",
  },
  {
    "action":   "list",
    "resource": "repository",
  },
]

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Args

type Args struct {
	HarborAdminUsername string
	HarborAdminPassword string
	HarborRegistryHost  string
	HarborApiVersion    string
}

type Client

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

func NewClient

func NewClient(args Args) (*Client, error)

func (*Client) CheckIfProjectExists

func (h *Client) CheckIfProjectExists(ctx context.Context, projectName string) (bool, error)

func (*Client) CheckIfUserAccountExists

func (h *Client) CheckIfUserAccountExists(ctx context.Context, userId int64) (bool, error)

func (*Client) CreateProject

func (h *Client) CreateProject(ctx context.Context, name string) (*Project, error)

func (*Client) CreateUserAccount

func (h *Client) CreateUserAccount(ctx context.Context, projectName, userName string, permissions []Permission) (*User, error)

func (*Client) CreateWebhook

func (h *Client) CreateWebhook(ctx context.Context, projectName string, webhookIn WebhookIn) (*Webhook, error)

func (*Client) DeleteProject

func (h *Client) DeleteProject(ctx context.Context, name string) error

func (*Client) DeleteUserAccount

func (h *Client) DeleteUserAccount(ctx context.Context, userId int64) error

func (*Client) DeleteWebhook

func (h *Client) DeleteWebhook(ctx context.Context, projectName string, webhookId int64) error

func (*Client) FindUserAccountByName

func (h *Client) FindUserAccountByName(ctx context.Context, projectName string, username string) (*User, error)

func (*Client) FindWebhookByName

func (h *Client) FindWebhookByName(ctx context.Context, projectName, hookName string) (webhook *Webhook, err error)

func (*Client) GetProject

func (h *Client) GetProject(ctx context.Context, name string) (*Project, error)

func (*Client) GetWebhook

func (h *Client) GetWebhook(ctx context.Context, projectName string, webhookId int64) (*Webhook, error)

func (*Client) NewAuthzRequest

func (h *Client) NewAuthzRequest(ctx context.Context, method, urlPath string, body io.Reader) (*http.Request, error)

func (*Client) SetProjectQuota

func (h *Client) SetProjectQuota(ctx context.Context, name string, storageSize int) error

func (*Client) UpdateUserAccount

func (h *Client) UpdateUserAccount(ctx context.Context, robotId int64, enabled bool) error

type Config

type Config interface {
	GetHarborConfig() (username string, password string, registryUrl string)
}

type Event

type Event string
const (
	DeleteArtifact    Event = "DELETE_ARTIFACT"
	PullArtifact      Event = "PULL_ARTIFACT"
	PushArtifact      Event = "PUSH_ARTIFACT"
	DeleteChart       Event = "DELETE_CHART"
	DownloadChart     Event = "DOWNLOAD_CHART"
	UploadChart       Event = "UPLOAD_CHART"
	QuotaExceed       Event = "QUOTA_EXCEED"
	QuotaWarning      Event = "QUOTA_WARNING"
	Replication       Event = "REPLICATION"
	ScanningFailed    Event = "SCANNING_FAILED"
	ScanningCompleted Event = "SCANNING_COMPLETED"
	ScanningStopped   Event = "SCANNING_STOPPED"
	TagRetention      Event = "TAG_RETENTION"
)

type Permission

type Permission string

+kubebuilder:validation:Enum=push-repository;pull-repository

const (
	PushRepository Permission = "push-repository"
	PullRepository Permission = "pull-repository"
)

type Project

type Project struct {
	Name     string `json:"name"`
	Location string `json:"location"`
}

type User

type User struct {
	Id       int    `json:"id"`
	Name     string `json:"name"`
	Password string `json:"-"`
}

type Webhook

type Webhook struct {
	Name     string `json:"name,omitempty"`
	Id       int64  `json:"id,omitempty"`
	Location string `json:"location,omitempty"`
}

type WebhookBody

type WebhookBody struct {
	Type      string `json:"type"`
	OccurAt   int    `json:"occur_at"`
	Operator  string `json:"operator"`
	EventData struct {
		Resources []struct {
			Digest      string `json:"digest"`
			Tag         string `json:"tag"`
			ResourceUrl string `json:"resource_url"`
		} `json:"resources"`
		Repository struct {
			DateCreated  int    `json:"date_created"`
			Name         string `json:"name"`
			Namespace    string `json:"namespace"`
			RepoFullName string `json:"repo_full_name"`
			RepoType     string `json:"repo_type"`
		} `json:"repository"`
	} `json:"event_data"`
}

WebhookBody : Generated by pasting webhook body, json: DO NOT EDIT by hand

type WebhookIn

type WebhookIn struct {
	Name        string
	Endpoint    string
	Events      []Event
	AuthzSecret string
}

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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