registry

package
v0.0.0-...-4a518ae Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2017 License: BSD-3-Clause Imports: 5 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GetMostPushedToRepositoriesParameters

type GetMostPushedToRepositoriesParameters struct {
	MaxNumberOfElements  int
	RepositoriesToIgnore []string
	// contains filtered or unexported fields
}

GetMostPushedToRepositoriesParameters is the type that provides a wrapper for the parameters passed to the GetMostPushedToRepositories stats function. This type implements the StatsMethodParameters interface type.

func (*GetMostPushedToRepositoriesParameters) IsValid

IsValid check whether all fields in the GetMostPushedToRepositoriesParameters have a valid value. If not valid, false and a reason string is returned. This method is required by the StatsMethodParameters interface.

func (*GetMostPushedToRepositoriesParameters) SetStartDate

func (g *GetMostPushedToRepositoriesParameters) SetStartDate(startDate time.Time)

SetStartDate sets the startDate parameter in the parameters struct, in this case: GetMostPushedToRepositoriesParameters. This method is required by the StatsMethodParameters interface.

func (*GetMostPushedToRepositoriesParameters) StartDate

StartDate returns the startDate parameter of the parameters struct, in this case: GetMostPushedToRepositoriesParameters. This method is required by the StatsMethodParameters interface.

type GetMostPushingUsersParameters

type GetMostPushingUsersParameters struct {
	MaxNumberOfElements int
	UsersToIgnore       []string
	// contains filtered or unexported fields
}

GetMostPushingUsersParameters is the type that provides a wrapper for the parameters passed to the GetMostPushingUsers stats function. This type implements the StatsMethodParameters interface type.

func (*GetMostPushingUsersParameters) IsValid

func (g *GetMostPushingUsersParameters) IsValid() (bool, string)

IsValid check whether all fields in the GetMostPushingUsersParameters have a valid value. If not valid, false and a reason string is returned. This method is required by the StatsMethodParameters interface.

func (*GetMostPushingUsersParameters) SetStartDate

func (g *GetMostPushingUsersParameters) SetStartDate(startDate time.Time)

SetStartDate sets the startDate parameter in the parameters struct, in this case: GetMostPushingUsersParameters. This method is required by the StatsMethodParameters interface.

func (*GetMostPushingUsersParameters) StartDate

func (g *GetMostPushingUsersParameters) StartDate() time.Time

StartDate returns the startDate parameter of the parameters struct, in this case: GetMostPushingUsersParameters. This method is required by the StatsMethodParameters interface.

type GetPushesPerDaytimesParameters

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

GetPushesPerDaytimesParameters is the type that provides a wrapper for the parameters passed to the GetPushesPerDaytimes stats function. This type implements the StatsMethodParameters interface type.

func (*GetPushesPerDaytimesParameters) IsValid

func (g *GetPushesPerDaytimesParameters) IsValid() (bool, string)

IsValid check whether all fields in the GetPushesPerDaytimesParameters have a valid value. If not valid, false and a reason string is returned. This method is required by the StatsMethodParameters interface.

func (*GetPushesPerDaytimesParameters) SetStartDate

func (g *GetPushesPerDaytimesParameters) SetStartDate(startDate time.Time)

SetStartDate sets the startDate parameter in the parameters struct, in this case: GetPushesPerDaytimesParameters. This method is required by the StatsMethodParameters interface.

func (*GetPushesPerDaytimesParameters) StartDate

func (g *GetPushesPerDaytimesParameters) StartDate() time.Time

StartDate returns the startDate parameter of the parameters struct, in this case: GetPushesPerDaytimesParameters. This method is required by the StatsMethodParameters interface.

type Log

type Log struct {
	ID        int
	Timestamp time.Time
	User      *User
}

Log is a generic structure which represents a log on a image tag on the Harbor registry. This might be the log of a pull or a push action.

A log holds (apart from its ID) the time at which the logged action was performed and a reference to the user who performed the action.

Log structs are not held directly by any other data structure of the inhere designed registry, there is not reason to ever directly instantiate a log type. Instead use the concrete types that inherit from the Log struct and are useg in the Tag struct, such as Push and Pull.

type Project

type Project struct {
	ID           int
	Name         string
	CreationDate string
	Creator      *User
	Repositories map[string]*Repository
}

Project is the structure for a project on the Harbor registry. A registry can hold any number of unique projects. Each project can hold any number of unique repositories. Each project also has a creator which is a reference to a User and a date of creation.

Looking at a full qualified docker image name, the project name is the first name after the docker registry URL and before the next slash.

e.g. for the image name "docker-registry.comany.com/coreapp/base:0.2.1" the project is "coreapp".

type Pull

type Pull struct {
	Log
}

Pull represents a pull action of a certain docker image from the Harbor registry. Pull inherits the fields of the generic structure "Log"

Each Tag can hold any number of pull logs.

type Push

type Push struct {
	Log
}

Push represents a push action of a certain docker image to the Harbor registry. Push inherits the fields of the generic structure "Log"

Each Tag can hold any number of push logs.

type PushesPerDaytimes

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

PushesPerDaytimes is a slice of pushesPerDaytime structs containing the hour of a day and the number of pushes to the registry within this hour.

func (*PushesPerDaytimes) GetOrderedBarChartValues

func (p *PushesPerDaytimes) GetOrderedBarChartValues() outputgen.BarChartableValuesOrdered

GetOrderedBarChartValues for the PushesPerDaytimes type converts a PushesPerDaytimes slice into a map that can be used by a chart generator. The output slice is guaranteed to be ordered. This method is a requirement of the outputgen.BarChartable interface.

func (*PushesPerDaytimes) SetTitle

func (p *PushesPerDaytimes) SetTitle(title string)

SetTitle sets the human-readable title of the statistics type. This method is a requirement of the outputgen.BarChartable interface.

func (*PushesPerDaytimes) Title

func (p *PushesPerDaytimes) Title() string

Title returns the human-readable title of the statistics type and will raise an error if the title is emtystring. This method is a requirement of the outputgen.BarChartable interface.

type PushesPerRepositories

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

PushesPerRepositories is a slice of pushesPerRepository structs containing the name of a repository and the number of pushes to it.

func (PushesPerRepositories) GetOrderedBarChartValues

func (p PushesPerRepositories) GetOrderedBarChartValues() outputgen.BarChartableValuesOrdered

GetOrderedBarChartValues for the PushesPerRepositories type converts a PushesPerRepositories slice into a map that can be used by a chart generator. The output slice is guaranteed to be ordered. This method is a requirement of the outputgen.BarChartable interface.

func (*PushesPerRepositories) SetTitle

func (p *PushesPerRepositories) SetTitle(title string)

SetTitle sets the human-readable title of the statistics type. This method is a requirement of the outputgen.BarChartable interface.

func (*PushesPerRepositories) Title

func (p *PushesPerRepositories) Title() string

Title returns the human-readable title of the statistics type and will raise an error if the title is emtystring. This method is a requirement of the outputgen.BarChartable interface.

type PushesPerUsers

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

PushesPerUsers is a slice of pushesPerUser structs containing the name of a user and the number of pushes performed by them.

func (PushesPerUsers) GetOrderedBarChartValues

func (p PushesPerUsers) GetOrderedBarChartValues() outputgen.BarChartableValuesOrdered

GetOrderedBarChartValues for the PushesPerUsers type converts a PushesPerUsers slice into a map that can be used by a chart generator. The output slice is guaranteed to be ordered. This method is a requirement of the outputgen.BarChartable interface.

func (*PushesPerUsers) SetTitle

func (p *PushesPerUsers) SetTitle(title string)

SetTitle sets the human-readable title of the statistics type. This method is a requirement of the outputgen.BarChartable interface.

func (*PushesPerUsers) Title

func (p *PushesPerUsers) Title() string

Title returns the human-readable title of the statistics type and will raise an error if the title is emtystring. This method is a requirement of the outputgen.BarChartable interface.

type Registry

type Registry struct {
	Projects map[int]*Project
}

Registry represents the structure for all the date on the Harbor docker registry. It contains all projects of the registry mapped to their IDs.

func (*Registry) GetMostPushedToRepositories

func (registry *Registry) GetMostPushedToRepositories(params *GetMostPushedToRepositoriesParameters) *PushesPerRepositories

GetMostPushedToRepositories generates a struct containing the <MaxNumberOfElements> most pushed-to repositories (since <StartDate>) according to the given CSV data.

Each struct within the list of structs in the data field of the returned PushesPerRepositories struct contains the name of the repository and the number of pushes that have been performed to it ever since <StartDate>. Repositories matching a name in the given list of repositoriesToIgnore will not be included in the returned structure. Check the GetMostPushedToRepositoriesParameters struct for parameters. This method is wrapped by GetMostPushedToRepositoriesWrapper.

func (*Registry) GetMostPushedToRepositoriesWrapper

func (registry *Registry) GetMostPushedToRepositoriesWrapper(paramsGeneric StatsMethodParameters) outputgen.BarChartable

GetMostPushedToRepositoriesWrapper is a wrapper method of the GetMostPushedToRepositories methods. In contrast to the concrete GetMostPushedToRepositories method, it accept interface types which will then be converted to concrete types and pasded to the concrete method.

Wrappers are a workaround to make statistical methods of the registry type generically accessible. The wrappers are accessed in the configreader module when configuration is mapped to the methods here. It would not be possibls to access the concrete methods (like GetMostPushedToRepositories) without knowing the concrete parameter and output types.

func (*Registry) GetMostPushingUsers

func (registry *Registry) GetMostPushingUsers(params *GetMostPushingUsersParameters) *PushesPerUsers

GetMostPushingUsers generates a struct containing the top <MaxNumberOfElements> users who have performed the most pushes to any repository (since <StartDate>) according to the given CSV data. Each struct within the list of structs in the data field of the returned PushesPerUsers struct contains the name of the user and the number of pushes that have been performed by them ever since <StartDate>. Users matching a name in the given list of usersToIgnore will not be included in the returned structure. Check the GetMostPushingUsersParameters struct for parameters. This method is wrapped by GetMostPushingUsersWrapper.

func (*Registry) GetMostPushingUsersWrapper

func (registry *Registry) GetMostPushingUsersWrapper(paramsGeneric StatsMethodParameters) outputgen.BarChartable

GetMostPushingUsersWrapper is a wrapper method of the GetMostPushingUsers methods. In contrast to the concrete GetMostPushingUsers method, it accept interface types which will then be converted to concrete types and pasded to the concrete method.

Wrappers are a workaround to make statistical methods of the registry type generically accessible. The wrappers are accessed in the configreader module when configuration is mapped to the methods here. It would not be possibls to access the concrete methods (like GetMostPushingUsers) without knowing the concrete parameter and output types.

func (*Registry) GetPushesPerDaytimes

func (registry *Registry) GetPushesPerDaytimes(params *GetPushesPerDaytimesParameters) *PushesPerDaytimes

GetPushesPerDaytimes generates a struct containing the number of pushed performed for a given hour of the day accumulated over the timeperiod since <StartDate> according to the given CSV data.

Each struct within the list of structs in the data field of the returned PushesPerDaytimes struct contains the hour of a day and the number of pushes that have been performed within this hour accumulated ever since <StartDate>.

Check the GetPushesPerDaytimesParameters struct for parameters. This method is wrapped by GetPushesPerDaytimesWrapper.

func (*Registry) GetPushesPerDaytimesWrapper

func (registry *Registry) GetPushesPerDaytimesWrapper(paramsGeneric StatsMethodParameters) outputgen.BarChartable

GetPushesPerDaytimesWrapper is a wrapper method of the GetPushesPerDaytimes methods. In contrast to the concrete GetPushesPerDaytimes method, it accept interface types which will then be converted to concrete types and pasded to the concrete method.

Wrappers are a workaround to make statistical methods of the registry type generically accessible. The wrappers are accessed in the configreader module when configuration is mapped to the methods here. It would not be possibls to access the concrete methods (like GetPushesPerDaytimes) without knowing the concrete parameter and output types.

type Repository

type Repository struct {
	ID   int
	Name string
	Tags map[string]*Tag
}

Repository is the structure for a repository inside a project on the registry. A project can hold any number of unique repositories. Each repository hold any number of unique tags.

Looking at a full qualified docker image name, the repository name is the name after the docker registry URL and project name and before the colon.

e.g. for the image name "docker-registry.comany.com/coreapp/base:0.2.1" the repository is "base".

type StatsMethodParameters

type StatsMethodParameters interface {
	SetStartDate(time.Time)
	StartDate() time.Time
	IsValid() (bool, string)
}

StatsMethodParameters is an interface type that needs to be implemented by every type that is to be used as a method/function parameter of a StatsMethod i.e. a method that is used to process registry data to generate statistical output.

type Tag

type Tag struct {
	Name   string
	Pulls  map[int]*Pull
	Pushes map[int]*Push
}

Tag is the structure for a image tag inside a repository of a project on the registry. A repository can hold any number of unique tags. A tag can hold any number of Pulls and Pushes.

Looking at a full qualified docker image name, the tag name is the name after the colon.

e.g. for the image name "docker-registry.comany.com/coreapp/base:0.2.1" the tag is "0.2.1".

type User

type User struct {
	ID   int
	Name string
}

User represnets a user of the Harbor registry. A user is identified by a unique name and a unique ID.

Jump to

Keyboard shortcuts

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