Documentation ¶
Overview ¶
globalregistry package defines the abstractions over the registries and related resources.
Index ¶
- Variables
- func RegisterProviderImplementation(providerName string, constructor RegistryCreator, ...)
- type LdapMember
- type Project
- type ProjectAPI
- type ProjectMember
- type ProjectMemberCredentials
- type Registry
- type RegistryConfig
- type RegistryCreator
- type ReplicationAPI
- type ReplicationCapabilities
- type ReplicationDirection
- type ReplicationRule
- type ReplicationTrigger
- type Scanner
- type Storage
Constants ¶
This section is empty.
Variables ¶
var ( // ErrRecoverableError is an error value that indicates that the error // shall be logged to the user but the operation can continue. ErrRecoverableError error = errors.New("recoverable error") // ErrNotImplemented is an error value that indicates that a method is // not implemented by a registry provider. ErrNotImplemented error = errors.New("not implemented") // ErrAlreadyExists is an error value that indicates that the resource // to be created exists already. ErrAlreadyExists error = errors.New("already exists") )
Functions ¶
func RegisterProviderImplementation ¶
func RegisterProviderImplementation(providerName string, constructor RegistryCreator, repCap ReplicationCapabilities, )
RegisterProviderImplementation is used by the different Registry interface implementations to register the Register constructors. After a constructor function is registered, a new Registry can be created using the New function.
Types ¶
type LdapMember ¶
type LdapMember interface { ProjectMember GetDN() string }
LdapMember is a ProjectMember that is stored in Ldap and as such it has a distinguished name (DN).
type Project ¶
type Project interface { // GetName returns the name of the project. GetName() string // Delete removes the project from the registry. Delete() error // GetMembers returns the list of project members. GetMembers() ([]ProjectMember, error) // AssignMember method assigns a project member (user, group or robot) // to a project. When credentials are created by the registry provider, // they are returned. Otherwise, ProjectMemberCredentials is nil. AssignMember(ProjectMember) (*ProjectMemberCredentials, error) // UnassignMember removes a project member from the project. UnassignMember(ProjectMember) error // GetReplicationRules returns the list of replication rule concerning // the project of the registry. GetReplicationRules(*ReplicationTrigger, *ReplicationDirection) ([]ReplicationRule, error) // AssignReplicationRule assigns a replication rule to the project. AssignReplicationRule(RegistryConfig, ReplicationTrigger, ReplicationDirection) (ReplicationRule, error) // GetScanner returns the scanner assigned to the project. GetScanner() (Scanner, error) // AssignScanner assigns a scanner to the project. AssignScanner(Scanner) error // UnassignScanner removes a scanner from the project. UnassignScanner(Scanner) error Storage }
Project interface defines the methods that can be performed on a project of a registry.
type ProjectAPI ¶
type ProjectAPI interface { // List returns the list of the projects managed by the registry. List() ([]Project, error) // GetByName returns the project with the given name. If no project is // present with the given name (nil, nil) is returned. GetByName(name string) (Project, error) // Create creates a new project with the given name. Create(name string) (Project, error) }
ProjectAPI interface defines the methods of a registry which are related to the management of the projects.
type ProjectMember ¶
type ProjectMember interface { // GetName method returns with the name of the project member. GetName() string // GetType method returns with the type of the project member, e.g. // user, group, robot, etc. GetType() string // GetRole method returns with the role of the project member, e.g. // Maintainer, Administrator, etc. GetRole() string }
ProjectMember interface defines the methods that are common for all types of project members.
type ProjectMemberCredentials ¶
ProjectMemberCredentials contains the username and password of a member (typically of type robot) that is created during the AssignMember operation of a Project.
type Registry ¶
type Registry interface { RegistryConfig ReplicationAPI() ReplicationAPI ProjectAPI() ProjectAPI }
Registry is an abstraction over registries. It is an abstraction over the real, provider-specific registries and over the expected registry states defined by the api.Registry type.
type RegistryConfig ¶
type RegistryConfig interface { GetProvider() string GetUsername() string GetPassword() string GetAPIEndpoint() string GetName() string }
RegistryConfig interface describes a registry configuration that is needed to create a new provider-specific Registry via its constructor.
type RegistryCreator ¶
type RegistryCreator func(logr.Logger, RegistryConfig) (Registry, error)
RegistryCreator function type can be used to create a Registry interface.
type ReplicationAPI ¶
type ReplicationAPI interface { // List method returns the replication rules of a registry. List() ([]ReplicationRule, error) }
ReplicationAPI interface defines the methods of a registry which are related to the management of the replication rules.
type ReplicationCapabilities ¶
ReplicationCapabilities interface defines the methods that show the replication capabilities of a registry provider.
func GetReplicationCapability ¶
func GetReplicationCapability(provider string) ReplicationCapabilities
GetReplicationCapability function returns the ReplicationCapabilities of a registered registry provider.
type ReplicationDirection ¶
type ReplicationDirection int
ReplicationDirection shows the Project replication direction. In case of PullReplication, the registry of the project will pull the repositories from a remote registry. In case of PushReplication, the registry will push the repos.
const ( PullReplication ReplicationDirection = iota PushReplication )
func (ReplicationDirection) MarshalText ¶
func (rd ReplicationDirection) MarshalText() ([]byte, error)
MarshalText method implements the encoding.TextMarshaler interface.
func (ReplicationDirection) String ¶
func (rd ReplicationDirection) String() string
type ReplicationRule ¶
type ReplicationRule interface { // GetProjectName returns the name of the project that is subject to the // replication. GetProjectName() string // GetName returns the name of the replication rule. GetName() string // Trigger returns the event that starts the replication. Trigger() ReplicationTrigger // Direction returns the direction of the synchronization. Direction() ReplicationDirection // RemoteRegistry returns the remote registry which is subject to the // replication. RemoteRegistry() Registry // Delete method deletes the replication rule from the registry. Delete() error }
ReplicationRule interface declares the methods that can be used to manipulate the replication rule of a project.
type ReplicationTrigger ¶
type ReplicationTrigger int
ReplicationTrigger describes the trigger event that starts the synchronization mechanism of the project.
const ( ManualReplicationTrigger ReplicationTrigger = iota EventReplicationTrigger )
func (ReplicationTrigger) MarshalText ¶
func (rt ReplicationTrigger) MarshalText() ([]byte, error)
MarshalText method implements the encoding.TextMarshaler interface.
func (ReplicationTrigger) String ¶
func (rt ReplicationTrigger) String() string
type Scanner ¶
type Scanner interface { // GetName returns the name of the vulnerability scanner. GetName() string // GetURL returns the URL of the vulnerability scanner. GetURL() string }
Scanner interface contains the methods that can be used to inspect the parameters of an external vulnerability scanner.
type Storage ¶
type Storage interface { // GetUsedStorage returns the used storage in bytes. GetUsedStorage() (int, error) }
Storage interface contains the methods that we use for storage related operations. If the provider does not implement the GetUsedStorage, it shall return -1, ErrNotImplemented.