model

package
v1.8.4 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2019 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

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

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

const definition

View Source
const (
	// 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"
)

const definitions

View Source
const (
	// Healthy indicates registry is healthy
	Healthy = "healthy"
	// Unhealthy indicates registry is unhealthy
	Unhealthy = "unhealthy"
	// Unknown indicates health status of registry is unknown
	Unknown = "unknown"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Credential

type Credential struct {
	// Type of the credential
	Type CredentialType `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 CredentialType

type CredentialType string

CredentialType represents the supported credential types e.g: u/p, OAuth token

type Filter

type Filter struct {
	Type  FilterType  `json:"type"`
	Value interface{} `json:"value"`
}

Filter holds the info of the filter

type FilterStyle

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

FilterStyle ...

type FilterType

type FilterType string

FilterType represents the type info of the filter.

type HealthStatus

type HealthStatus string

HealthStatus describes whether a target is healthy or not

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 Policy

type Policy struct {
	ID          int64  `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description"`
	Creator     string `json:"creator"`
	// source
	SrcRegistry *Registry `json:"src_registry"`
	// destination
	DestRegistry *Registry `json:"dest_registry"`
	// Only support two dest namespace modes:
	// Put all the src resources to the one single dest namespace
	// or keep namespaces same with the source ones (under this case,
	// the DestNamespace should be set to empty)
	DestNamespace string `json:"dest_namespace"`
	// Filters
	Filters []*Filter `json:"filters"`
	// Trigger
	Trigger *Trigger `json:"trigger"`
	// Settings
	// TODO: rename the property name
	Deletion bool `json:"deletion"`
	// If override the image tag
	Override bool `json:"override"`
	// Operations
	Enabled      bool      `json:"enabled"`
	CreationTime time.Time `json:"creation_time"`
	UpdateTime   time.Time `json:"update_time"`
}

Policy defines the structure of a replication policy

func (*Policy) Valid

func (p *Policy) Valid(v *validation.Validation)

Valid the policy

type PolicyQuery

type PolicyQuery struct {
	Name string
	// TODO: need to consider how to support listing the policies
	// of one namespace in both pull and push modes
	Namespace    string
	SrcRegistry  int64
	DestRegistry int64
	models.Pagination
}

PolicyQuery defines the query conditions for listing policies

type Registry

type Registry struct {
	ID          int64        `json:"id"`
	Name        string       `json:"name"`
	Description string       `json:"description"`
	Type        RegistryType `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                     RegistryType   `json:"type"`
	Description              string         `json:"description"`
	SupportedResourceTypes   []ResourceType `json:"-"`
	SupportedResourceFilters []*FilterStyle `json:"supported_resource_filters"`
	SupportedTriggers        []TriggerType  `json:"supported_triggers"`
}

RegistryInfo provides base info and capability declarations of the registry

type RegistryQuery

type RegistryQuery struct {
	// Name is name of the registry to query
	Name string
	// Pagination specifies the pagination
	Pagination *models.Pagination
}

RegistryQuery defines the query conditions for listing registries

type RegistryType

type RegistryType string

RegistryType indicates the type of registry

const (
	RegistryTypeHarbor         RegistryType = "harbor"
	RegistryTypeDockerHub      RegistryType = "docker-hub"
	RegistryTypeDockerRegistry RegistryType = "docker-registry"
	RegistryTypeHuawei         RegistryType = "huawei-SWR"

	FilterStyleTypeText  = "input"
	FilterStyleTypeRadio = "radio"
)

const definition

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         ResourceType           `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 whether the resource can be overridden
	Override bool `json:"override"`
}

Resource represents the general replicating content

type ResourceMetadata

type ResourceMetadata struct {
	Repository *Repository `json:"repository"`
	Vtags      []string    `json:"v_tags"`
	// TODO the labels should be put into tag and repository level?
	Labels []string `json:"labels"`
}

ResourceMetadata of resource

func (*ResourceMetadata) GetResourceName

func (r *ResourceMetadata) GetResourceName() string

GetResourceName returns the name of the resource TODO remove

type ResourceType

type ResourceType string

ResourceType represents the type of the resource

const (
	ResourceTypeImage ResourceType = "image"
	ResourceTypeChart ResourceType = "chart"
)

the resource type

func (ResourceType) Valid

func (r ResourceType) Valid() bool

Valid indicates whether the ResourceType is a valid value

type Trigger

type Trigger struct {
	Type     TriggerType      `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

type TriggerType

type TriggerType string

TriggerType represents the type of trigger.

Jump to

Keyboard shortcuts

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