gerrits

package
v0.0.0-...-5643740 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: MIT Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultHTTPTimeout = 10 * time.Second
	LongHTTPTimeout    = 45 * time.Second
)

constants

Variables

View Source
var (
	ErrGerritNotFound = errors.New("gerrit not found")
	HugePageSize      = int64(10000)
)

errors

Functions

func Configure

func Configure(api *operations.ClaAPI, service Service, projectService ProjectService, eventService events.Service)

Configure the gerrit api

Types

type AccountsConfigInfo

type AccountsConfigInfo struct {
	Visibility         string `json:"visibility"`
	DefaultDisplayName string `json:"default_display_name"`
}

AccountsConfigInfo entity contains information about Gerrit configuration from the accounts section. https://gerrit.linuxfoundation.org/infra/Documentation/rest-api-config.html#accounts-config-info

type AuthInfo

type AuthInfo struct {
	Type                     string                     `json:"type"`
	UseContributorAgreements bool                       `json:"use_contributor_agreements"`
	ContributorAgreements    []ContributorAgreementInfo `json:"contributor_agreements"`
	EditableAccountFields    []string                   `json:"editable_account_fields"`
	LoginURL                 string                     `json:"login_url"`
	LoginText                string                     `json:"login_text"`
	SwitchAccountURL         string                     `json:"switch_account_url"`
	RegisterURL              string                     `json:"register_url"`
	RegisterText             string                     `json:"register_text"`
	EditFullNameURL          string                     `json:"edit_full_name_url"`
	HTTPPasswordURL          string                     `json:"http_password_url"`
	GitBasicAuthPolicy       string                     `json:"git_bacic_auth_policy"`
}

AuthInfo entity contains information about the authentication configuration of the Gerrit server. https://gerrit.linuxfoundation.org/infra/Documentation/rest-api-config.html#auth-info

type ChangeInfo

type ChangeInfo struct {
	AllowBlame  bool   `json:"allow_blame"`
	LargeChange int    `json:"large_change"`
	ReplyLabel  string `json:"reply_label"`
}

ChangeInfo entity contains information about Gerrit configuration from the change section.- https://gerrit.linuxfoundation.org/infra/Documentation/rest-api-config.html#change-config-info

type ContributorAgreementInfo

type ContributorAgreementInfo struct {
	Name            string    `json:"name"`
	Description     string    `json:"description"`
	URL             string    `json:"url"`
	AutoVerifyGroup GroupInfo `json:"auto_verify_group"`
}

ContributorAgreementInfo entity contains information about a contributor agreement. https://gerrit.linuxfoundation.org/infra/Documentation/rest-api-accounts.html#contributor-agreement-info

type DownloadInfo

type DownloadInfo struct {
	Schemes  DownloadSchemesInfo `json:"schemes"`
	Archives []string            `json:"archives"`
}

DownloadInfo entity contains information about supported download options. - https://gerrit.linuxfoundation.org/infra/Documentation/rest-api-config.html#download-info

type DownloadSchemesInfo

type DownloadSchemesInfo struct {
	URL             string `json:"url"`
	IsAuthRequired  bool   `json:"is_auth_required"`
	IsAuthSupported bool   `json:"is_auth_supported"`
}

DownloadSchemesInfo entity contains information about a supported download scheme and its commands. https://gerrit.linuxfoundation.org/infra/Documentation/rest-api-config.html#download-scheme-info

type Gerrit

type Gerrit struct {
	DateCreated   string `json:"date_created,omitempty"`
	DateModified  string `json:"date_modified,omitempty"`
	GerritID      string `json:"gerrit_id,omitempty"`
	GerritName    string `json:"gerrit_name,omitempty"`
	GerritURL     string `json:"gerrit_url,omitempty"`
	GroupIDCcla   string `json:"group_id_ccla,omitempty"`
	GroupIDIcla   string `json:"group_id_icla,omitempty"`
	GroupNameCcla string `json:"group_name_ccla,omitempty"`
	GroupNameIcla string `json:"group_name_icla,omitempty"`
	ProjectSFID   string `json:"project_sfid,omitempty"`
	ProjectID     string `json:"project_id,omitempty"`
	Version       string `json:"version,omitempty"`
}

Gerrit represent gerrit instances table

type GerritInfo

type GerritInfo struct {
	AllProjectsName string `json:"all_projects_name"`
	AllUsersName    string `json:"all_users_name"`
	DocURL          string `json:"doc_url"`
	ReportBugURL    string `json:"report_bug_url"`
	DocSearch       bool   `json:"doc_search"`
	EditPGPKeys     bool   `json:"edit_pgp_keys"`
}

GerritInfo entity contains information about Gerrit configuration from the gerrit section. https://gerrit.linuxfoundation.org/infra/Documentation/rest-api-config.html#gerrit-info

type GerritRepoInfo

type GerritRepoInfo struct {
	ID          string    `json:"id"`
	Description string    `json:"description"`
	State       string    `json:"state"`
	WebLinks    []WebLink `json:"web_links"`
}

GerritRepoInfo a simplified gerrit repo information data model

type GroupInfo

type GroupInfo struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	URL         string `json:"url"`
	Options     string `json:"options"`
	Description string `json:"description"`
	GroupID     string `json:"group_id"`
	Owner       string `json:"owner"`
	OwnerID     string `json:"owner_id"`
	CreatedOn   string `json:"created_on"`
}

GroupInfo entity contains information about a group. This can be a Gerrit internal group, or an external group that is known to Gerrit. https://gerrit.linuxfoundation.org/infra/Documentation/rest-api-groups.html#group-info

type IndexConfigInfo

type IndexConfigInfo struct {
}

IndexConfigInfo data model

type LDAPGroup

type LDAPGroup struct {
	Title string `json:"title"`
}

LDAPGroup model

type LFGroup

type LFGroup struct {
	LfBaseURL     string
	ClientID      string
	ClientSecret  string
	RefreshToken  string
	EventsService events.Service
}

LFGroup contains access information of lf LDAP group

func (*LFGroup) AddUserToGroup

func (lfg *LFGroup) AddUserToGroup(ctx context.Context, authUser *auth.User, claGroupID, groupName, userName string) error

AddUserToGroup adds the specified user to the group

func (*LFGroup) GetGroup

func (lfg *LFGroup) GetGroup(ctx context.Context, groupID string) (*LDAPGroup, error)

GetGroup returns LF LDAP group

func (*LFGroup) GetUsersOfGroup

func (lfg *LFGroup) GetUsersOfGroup(ctx context.Context, authUser *auth.User, claGroupID, groupName string) (*v2Models.GerritGroupResponse, error)

GetUsersOfGroup returns a list of members from a group

func (*LFGroup) RemoveUserFromGroup

func (lfg *LFGroup) RemoveUserFromGroup(ctx context.Context, authUser *auth.User, claGroupID, groupName, userName string) error

RemoveUserFromGroup removes the specified user from the group

type PluginConfigInfo

type PluginConfigInfo struct {
}

PluginConfigInfo data model

type ProjectService

type ProjectService interface {
	GetCLAGroupByID(ctx context.Context, claGroupID string) (*models.ClaGroup, error)
}

ProjectService contains Project methods

type ReceiveInfo

type ReceiveInfo struct {
}

ReceiveInfo data model

type Repository

type Repository interface {
	AddGerrit(ctx context.Context, input *models.Gerrit) (*models.Gerrit, error)
	GetGerrit(ctx context.Context, gerritID string) (*models.Gerrit, error)
	GetGerritsByID(ctx context.Context, ID string, IDType string) (*models.GerritList, error)
	GetGerritsByProjectSFID(ctx context.Context, projectSFID string) (*models.GerritList, error)
	GetClaGroupGerrits(ctx context.Context, claGroupID string) (*models.GerritList, error)
	ExistsByName(ctx context.Context, gerritName string) ([]*models.Gerrit, error)
	DeleteGerrit(ctx context.Context, gerritID string) error
}

Repository defines functions of V3Repositories

func NewRepository

func NewRepository(awsSession *session.Session, stage string) Repository

NewRepository create new Repository

type ServerInfo

type ServerInfo struct {
	Accounts     AccountsConfigInfo `json:"accounts"`
	Auth         AuthInfo           `json:"auth"`
	Change       ChangeInfo         `json:"change"`
	Download     DownloadInfo       `json:"download"`
	Gerrit       GerritInfo         `json:"gerrit"`
	Index        IndexConfigInfo    `json:"index"`
	Plugin       PluginConfigInfo   `json:"plugin"`
	Receive      ReceiveInfo        `json:"receive"`
	SSHD         SshdInfo           `json:"sshd"`
	Suggest      SuggestInfo        `json:"suggest"`
	User         UserConfigInfo     `json:"user"`
	DefaultTheme string             `json:"default_theme"`
}

ServerInfo is the response model returned from the server config query

type Service

type Service interface {
	AddGerrit(ctx context.Context, claGroupID string, projectSFID string, input *models.AddGerritInput, claGroupModel *models.ClaGroup) (*models.Gerrit, error)
	GetGerrit(ctx context.Context, gerritID string) (*models.Gerrit, error)
	GetGerritsByProjectSFID(ctx context.Context, projectSFID string) (*models.GerritList, error)
	GetClaGroupGerrits(ctx context.Context, claGroupID string) (*models.GerritList, error)
	GetGerritRepos(ctx context.Context, gerritName string) (*models.GerritRepoList, error)
	DeleteClaGroupGerrits(ctx context.Context, claGroupID string) (int, error)
	DeleteGerrit(ctx context.Context, gerritID string) error
	GetUsersOfGroup(ctx context.Context, authUser *auth.User, claGroupID, claType string) (*v2Models.GerritGroupResponse, error)
	AddUserToGroup(ctx context.Context, authUser *auth.User, claGroupID, userName, claType string) error
	AddUsersToGroup(ctx context.Context, authUser *auth.User, claGroupID string, userNameList []string, claType string) error
	RemoveUserFromGroup(ctx context.Context, authUser *auth.User, claGroupID, userName, claType string) error
	RemoveUsersFromGroup(ctx context.Context, authUser *auth.User, claGroupID string, userNameList []string, claType string) error
}

Service handles gerrit Repository service

func NewService

func NewService(repo Repository, lfg *LFGroup) Service

NewService creates a new gerrit service

type SshdInfo

type SshdInfo struct {
}

SshdInfo data model

type SuggestInfo

type SuggestInfo struct {
}

SuggestInfo data model

type UserConfigInfo

type UserConfigInfo struct {
}

UserConfigInfo data model

type WebLink struct {
	Name string `json:"name"`
	URL  string `json:"url"`
}

WebLink contains the name and url

Jump to

Keyboard shortcuts

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