-
Notifications
You must be signed in to change notification settings - Fork 4.7k
/
adaptor.go
34 lines (26 loc) · 1.27 KB
/
adaptor.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package registry
import (
"github.com/goharbor/harbor/src/replication/models"
)
// Adaptor defines the unified operations for all the supported registries such as Harbor or DockerHub.
// It's used to adapt the different interfaces provied by the different registry providers.
// Use external registry with restful api providing as example, these intrefaces may depends on the
// related restful apis like:
// /api/vx/repositories/{namespace}/{repositoryName}/tags/{name}
// /api/v0/accounts/{namespace}
type Adaptor interface {
// Return the unique kind identifier of the adaptor
Kind() string
// Get all the namespaces
GetNamespaces() []models.Namespace
// Get the namespace with the specified name
GetNamespace(name string) models.Namespace
// Get all the repositories under the specified namespace
GetRepositories(namespace string) []models.Repository
// Get the repository with the specified name under the specified namespace
GetRepository(name string, namespace string) models.Repository
// Get all the tags of the specified repository under the namespace
GetTags(repositoryName string, namespace string) []models.Tag
// Get the tag with the specified name of the repository under the namespace
GetTag(name string, repositoryName string, namespace string) models.Tag
}