model

package
v0.0.0-...-8bb7586 Latest Latest
Warning

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

Go to latest
Published: May 23, 2024 License: Apache-2.0 Imports: 4 Imported by: 2

Documentation

Index

Constants

View Source
const (
	FilterTypeResource = "resource"
	FilterTypeName     = "name"
	FilterTypeTag      = "tag"
	FilterTypeLabel    = "label"

	TriggerTypeManual     = "manual"
	TriggerTypeScheduled  = "scheduled"
	TriggerTypeEventBased = "event_based"

	// Matches [pattern] for tag (default)
	Matches = "matches"
	// Excludes [pattern] for tag
	Excludes = "excludes"
)

const definition

View Source
const (
	RegistryTypeHarbor           = "harbor"
	RegistryTypeDockerHub        = "docker-hub"
	RegistryTypeDockerRegistry   = "docker-registry"
	RegistryTypeHuawei           = "huawei-SWR"
	RegistryTypeGoogleGcr        = "google-gcr"
	RegistryTypeAwsEcr           = "aws-ecr"
	RegistryTypeAzureAcr         = "azure-acr"
	RegistryTypeAliAcr           = "ali-acr"
	RegistryTypeJfrogArtifactory = "jfrog-artifactory"
	RegistryTypeQuay             = "quay"
	RegistryTypeGitLab           = "gitlab"
	RegistryTypeDTR              = "dtr"
	RegistryTypeTencentTcr       = "tencent-tcr"
	RegistryTypeGithubCR         = "github-ghcr"
	RegistryTypeVolcCR           = "volcengine-cr"

	RegistryTypeHelmHub     = "helm-hub"
	RegistryTypeArtifactHub = "artifact-hub"

	FilterStyleTypeText  = "input"
	FilterStyleTypeRadio = "radio"
	FilterStyleTypeList  = "list"

	// CredentialTypeBasic indicates credential by user name, password
	CredentialTypeBasic = "basic"
	// CredentialTypeOAuth indicates credential by OAuth token
	CredentialTypeOAuth = "oauth"
	// CredentialTypeSecret is only used by the communication of Harbor internal components
	CredentialTypeSecret = "secret"

	// EndpointPatternTypeStandard ...
	EndpointPatternTypeStandard = "EndpointPatternTypeStandard"
	// EndpointPatternTypeFix ...
	EndpointPatternTypeFix = "EndpointPatternTypeFix"
	// EndpointPatternTypeList ...
	EndpointPatternTypeList = "EndpointPatternTypeList"

	// AccessKeyTypeStandard ...
	AccessKeyTypeStandard = "AccessKeyTypeStandard"
	// AccessKeyTypeFix ...
	AccessKeyTypeFix = "AccessKeyTypeFix"

	// AccessSecretTypeStandard ...
	AccessSecretTypeStandard = "AccessSecretTypePass"
	// AccessSecretTypeFile ...
	AccessSecretTypeFile = "AccessSecretTypeFile"

	// Healthy indicates registry is healthy
	Healthy = "healthy"
	// Unhealthy indicates registry is unhealthy
	Unhealthy = "unhealthy"

	RepositoryPathComponentTypeOnlyTwo    = "ONLY_TWO"
	RepositoryPathComponentTypeAtLeastTwo = "AT_LEAST_TWO"
)

const definition

View Source
const (
	ResourceTypeArtifact = "artifact"
	ResourceTypeImage    = "image"
)

the resource type

Variables

This section is empty.

Functions

This section is empty.

Types

type AdapterPattern

type AdapterPattern struct {
	EndpointPattern   *EndpointPattern   `json:"endpoint_pattern"`
	CredentialPattern *CredentialPattern `json:"credential_pattern"`
}

AdapterPattern provides base info and capability declarations of the registry

func NewDefaultAdapterPattern

func NewDefaultAdapterPattern() *AdapterPattern

NewDefaultAdapterPattern ...

type Artifact

type Artifact struct {
	Type       string   `json:"type"`
	Digest     string   `json:"digest"`
	Labels     []string `json:"labels"`
	Tags       []string `json:"tags"`
	IsAcc      bool     `json:"-"` // indicate whether it is an accessory artifact
	ParentTags []string `json:"-"` // the tags belong to the artifact which the accessory is attached.
}

Artifact is the individual unit that can be replicated

type Credential

type Credential struct {
	// Type of the credential
	Type string `json:"type"`
	// The key of the access account, for OAuth token, it can be empty
	AccessKey string `json:"access_key"`
	// The secret or password for the key
	AccessSecret string `json:"access_secret"`
}

Credential keeps the access key and/or secret for the related registry

type CredentialPattern

type CredentialPattern struct {
	AccessKeyType    string `json:"access_key_type"`
	AccessKeyData    string `json:"access_key_data"`
	AccessSecretType string `json:"access_secret_type"`
	AccessSecretData string `json:"access_secret_data"`
}

CredentialPattern ...

func NewDefaultCredentialPattern

func NewDefaultCredentialPattern() *CredentialPattern

NewDefaultCredentialPattern ...

type Endpoint

type Endpoint struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

Endpoint ...

type EndpointPattern

type EndpointPattern struct {
	EndpointType string      `json:"endpoint_type"`
	Endpoints    []*Endpoint `json:"endpoints"`
}

EndpointPattern ...

func NewDefaultEndpointPattern

func NewDefaultEndpointPattern() *EndpointPattern

NewDefaultEndpointPattern ...

type Filter

type Filter struct {
	Type       string      `json:"type"`
	Value      interface{} `json:"value"`
	Decoration string      `json:"decoration,omitempty"`
}

Filter holds the info of the filter

func (*Filter) Validate

func (f *Filter) Validate() error

type FilterStyle

type FilterStyle struct {
	Type   string   `json:"type"`
	Style  string   `json:"style"`
	Values []string `json:"values,omitempty"`
}

FilterStyle ...

type Namespace

type Namespace struct {
	Name     string                 `json:"name"`
	Metadata map[string]interface{} `json:"metadata"`
}

Namespace represents the full path of resource isolation unit; if the namespace has hierarchical structure, e.g organization->team, it should be converted to organization.team

func (*Namespace) GetStringMetadata

func (n *Namespace) GetStringMetadata(key string, defaultValue string) string

GetStringMetadata get a string value metadata from the namespace, if not found, return the default value.

type NamespaceQuery

type NamespaceQuery struct {
	Name string
}

NamespaceQuery defines the query condition for listing namespaces

type Registry

type Registry struct {
	ID          int64  `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description"`
	Type        string `json:"type"`
	URL         string `json:"url"`
	// TokenServiceURL is only used for local harbor instance to
	// avoid the requests passing through the external proxy for now
	TokenServiceURL string      `json:"token_service_url"`
	Credential      *Credential `json:"credential"`
	Insecure        bool        `json:"insecure"`
	Status          string      `json:"status"`
	CreationTime    time.Time   `json:"creation_time"`
	UpdateTime      time.Time   `json:"update_time"`
}

Registry keeps the related info of registry Data required for the secure access way is not contained here. DAO layer is not considered here

type RegistryInfo

type RegistryInfo struct {
	Type                                 string         `json:"type"`
	Description                          string         `json:"description"`
	SupportedResourceTypes               []string       `json:"-"`
	SupportedResourceFilters             []*FilterStyle `json:"supported_resource_filters"`
	SupportedTriggers                    []string       `json:"supported_triggers"`
	SupportedRepositoryPathComponentType string         `json:"supported_repository_path_component_type"` // how many path components are allowed in the repository name
	SupportedCopyByChunk                 bool           `json:"supported_copy_by_chunk,omitempty"`
}

RegistryInfo provides base info and capability declarations of the registry

type Repository

type Repository struct {
	Name     string                 `json:"name"`
	Metadata map[string]interface{} `json:"metadata"`
}

Repository info of the resource

type Resource

type Resource struct {
	Type         string                 `json:"type"`
	Metadata     *ResourceMetadata      `json:"metadata"`
	Registry     *Registry              `json:"registry"`
	ExtendedInfo map[string]interface{} `json:"extended_info"`
	// Indicate if the resource is a deleted resource
	Deleted bool `json:"deleted"`
	// indicate the resource is a tag deletion
	IsDeleteTag bool `json:"is_delete_tag"`
	// indicate whether the resource can be overridden
	Override bool `json:"override"`
	// Skip is a flag for resource which satisfies replication rules but should
	// be skipped because of other limits like when dest project's type is proxy cache.
	Skip bool `json:"-"`
}

Resource represents the general replicating content

type ResourceMetadata

type ResourceMetadata struct {
	Repository *Repository `json:"repository"`
	Artifacts  []*Artifact `json:"artifacts"`
	Vtags      []string    `json:"v_tags"` // deprecated, use Artifacts instead
}

ResourceMetadata of resource

func (*ResourceMetadata) String

func (r *ResourceMetadata) String() string

type Trigger

type Trigger struct {
	Type     string           `json:"type"`
	Settings *TriggerSettings `json:"trigger_settings"`
}

Trigger holds info for a trigger

type TriggerSettings

type TriggerSettings struct {
	Cron string `json:"cron"`
}

TriggerSettings is the setting about the trigger

Jump to

Keyboard shortcuts

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