repositories

package
v0.0.0-...-0c3f707 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2024 License: MIT Imports: 34 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// ErrInvalidBranchProtectionName is returned when invalid protection option is supplied
	ErrInvalidBranchProtectionName = errors.New("invalid protection option")
)

Functions

func Configure

func Configure(api *operations.EasyclaAPI, service ServiceInterface, eventService events.Service)

Configure establishes the middleware handlers for the repository service

Types

type GitLabAddRepoModel

type GitLabAddRepoModel struct {
	ClaGroupID    string
	GroupName     string
	ExternalID    int64
	GroupFullPath string
	ProjectIDList []int64
}

GitLabAddRepoModel data model for GitLab add repository

type GitLabOrgRepo

type GitLabOrgRepo interface {
	AddGitLabOrganization(ctx context.Context, input *common.GitLabAddOrganization, enabled bool) (*v2Models.GitlabOrganization, error)
	GetGitLabOrganizationsByProjectSFID(ctx context.Context, projectSFID string) (*v2Models.GitlabOrganizations, error)
	GetGitLabOrganization(ctx context.Context, gitlabOrganizationID string) (*common.GitLabOrganization, error)
	GetGitLabOrganizationByName(ctx context.Context, gitLabOrganizationName string) (*common.GitLabOrganization, error)
	GetGitLabOrganizationByExternalID(ctx context.Context, gitLabGroupID int64) (*common.GitLabOrganization, error)
	GetGitLabOrganizationByFullPath(ctx context.Context, groupFullPath string) (*common.GitLabOrganization, error)
	UpdateGitLabOrganizationAuth(ctx context.Context, organizationID string, gitLabGroupID int, authExpiryTime int64, authInfo, groupName, groupFullPath, organizationURL string) error
	UpdateGitLabOrganization(ctx context.Context, input *common.GitLabAddOrganization, enabled bool) error
	DeleteGitLabOrganizationByFullPath(ctx context.Context, projectSFID, gitlabOrgFullPath string) error
}

GitLabOrgRepo redefine the interface here to avoid circular dependency issues

type Repository

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

Repository object/struct

func NewRepository

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

NewRepository creates a new instance of the GitLab repository service

func (*Repository) GitHubGetRepositoriesByCLAGroup

func (r *Repository) GitHubGetRepositoriesByCLAGroup(ctx context.Context, claGroupID string) ([]*repoModels.RepositoryDBModel, error)

GitHubGetRepositoriesByCLAGroup returns the database models for the specified CLA Group ID

func (*Repository) GitHubGetRepositoriesByCLAGroupDisabled

func (r *Repository) GitHubGetRepositoriesByCLAGroupDisabled(ctx context.Context, claGroupID string) ([]*repoModels.RepositoryDBModel, error)

GitHubGetRepositoriesByCLAGroupDisabled returns the database models for the specified CLA Group ID that are disabled

func (*Repository) GitHubGetRepositoriesByCLAGroupEnabled

func (r *Repository) GitHubGetRepositoriesByCLAGroupEnabled(ctx context.Context, claGroupID string) ([]*repoModels.RepositoryDBModel, error)

GitHubGetRepositoriesByCLAGroupEnabled returns the database models for the specified CLA Group ID that are enabled

func (*Repository) GitHubGetRepositoriesByOrganizationName

func (r *Repository) GitHubGetRepositoriesByOrganizationName(ctx context.Context, orgName string) ([]*repoModels.RepositoryDBModel, error)

GitHubGetRepositoriesByOrganizationName returns a list of GitHub repositories associated with the specified organization name

func (*Repository) GitHubGetRepositoriesByProjectSFID

func (r *Repository) GitHubGetRepositoriesByProjectSFID(ctx context.Context, projectSFID string) ([]*repoModels.RepositoryDBModel, error)

GitHubGetRepositoriesByProjectSFID returns a list of repositories associated with the specified project

func (*Repository) GitLabAddRepository

func (r *Repository) GitLabAddRepository(ctx context.Context, projectSFID string, input *repoModels.RepositoryDBModel) (*repoModels.RepositoryDBModel, error)

GitLabAddRepository creates a new entry in the repositories table using the specified input parameters

func (*Repository) GitLabDeleteRepositories

func (r *Repository) GitLabDeleteRepositories(ctx context.Context, gitLabGroupPath string) error

GitLabDeleteRepositories deletes the specified repositories under the GitLap group path

func (*Repository) GitLabDeleteRepositoryByExternalID

func (r *Repository) GitLabDeleteRepositoryByExternalID(ctx context.Context, gitLabExternalID int64) error

GitLabDeleteRepositoryByExternalID deletes the specified repository

func (*Repository) GitLabEnableCLAGroupRepositories

func (r *Repository) GitLabEnableCLAGroupRepositories(ctx context.Context, claGroupID string, enrollValue bool) error

GitLabEnableCLAGroupRepositories enables the specified CLA Group repositories

func (*Repository) GitLabEnrollRepositoryByID

func (r *Repository) GitLabEnrollRepositoryByID(ctx context.Context, claGroupID string, repositoryExternalID int64, enrollValue bool) error

GitLabEnrollRepositoryByID enables the specified repository

func (*Repository) GitLabGetRepositoriesByNamePrefix

func (r *Repository) GitLabGetRepositoriesByNamePrefix(ctx context.Context, repositoryNamePrefix string) ([]*repoModels.RepositoryDBModel, error)

GitLabGetRepositoriesByNamePrefix returns a list of repositories matching the specified name prefix

func (*Repository) GitLabGetRepositoriesByOrganizationName

func (r *Repository) GitLabGetRepositoriesByOrganizationName(ctx context.Context, orgName string) ([]*repoModels.RepositoryDBModel, error)

GitLabGetRepositoriesByOrganizationName returns a list of GitLab repositories associated with the specified organization name

func (*Repository) GitLabGetRepository

func (r *Repository) GitLabGetRepository(ctx context.Context, repositoryID string) (*repoModels.RepositoryDBModel, error)

GitLabGetRepository returns the database model for the internal repository ID

func (*Repository) GitLabGetRepositoryByExternalID

func (r *Repository) GitLabGetRepositoryByExternalID(ctx context.Context, repositoryExternalID int64) (*repoModels.RepositoryDBModel, error)

GitLabGetRepositoryByExternalID returns the database model for the specified repository by external ID

func (*Repository) GitLabGetRepositoryByName

func (r *Repository) GitLabGetRepositoryByName(ctx context.Context, repositoryName string) (*repoModels.RepositoryDBModel, error)

GitLabGetRepositoryByName returns the database model for the specified repository

type RepositoryInterface

type RepositoryInterface interface {
	GitHubGetRepositoriesByCLAGroup(ctx context.Context, claGroupID string) ([]*repoModels.RepositoryDBModel, error)
	GitHubGetRepositoriesByCLAGroupEnabled(ctx context.Context, claGroupID string) ([]*repoModels.RepositoryDBModel, error)
	GitHubGetRepositoriesByCLAGroupDisabled(ctx context.Context, claGroupID string) ([]*repoModels.RepositoryDBModel, error)
	GitHubGetRepositoriesByProjectSFID(ctx context.Context, projectSFID string) ([]*repoModels.RepositoryDBModel, error)
	GitHubGetRepositoriesByOrganizationName(ctx context.Context, orgName string) ([]*repoModels.RepositoryDBModel, error)

	GitLabGetRepository(ctx context.Context, repositoryID string) (*repoModels.RepositoryDBModel, error)
	GitLabGetRepositoryByName(ctx context.Context, repositoryName string) (*repoModels.RepositoryDBModel, error)
	GitLabGetRepositoriesByOrganizationName(ctx context.Context, orgName string) ([]*repoModels.RepositoryDBModel, error)
	GitLabGetRepositoriesByNamePrefix(ctx context.Context, repositoryNamePrefix string) ([]*repoModels.RepositoryDBModel, error)
	GitLabGetRepositoryByExternalID(ctx context.Context, repositoryExternalID int64) (*repoModels.RepositoryDBModel, error)
	GitLabAddRepository(ctx context.Context, projectSFID string, input *repoModels.RepositoryDBModel) (*repoModels.RepositoryDBModel, error)
	GitLabEnrollRepositoryByID(ctx context.Context, claGroupID string, repositoryID int64, enrollValue bool) error
	GitLabEnableCLAGroupRepositories(ctx context.Context, claGroupID string, enrollValue bool) error
	GitLabDeleteRepositories(ctx context.Context, gitLabGroupPath string) error
	GitLabDeleteRepositoryByExternalID(ctx context.Context, gitLabExternalID int64) error
}

RepositoryInterface interface defines the functions for the GitLab repository data model

type Service

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

Service is the service model/structure

func (*Service) GitHubAddRepositories

func (s *Service) GitHubAddRepositories(ctx context.Context, projectSFID string, input *models.GithubRepositoryInput) ([]*v1Models.GithubRepository, error)

GitHubAddRepositories adds the specified GitHub repository to the specified project

func (*Service) GitHubDisableCLAGroupRepositories

func (s *Service) GitHubDisableCLAGroupRepositories(ctx context.Context, claGroupID string) error

GitHubDisableCLAGroupRepositories service function to disable CLA group repositories

func (*Service) GitHubDisableRepository

func (s *Service) GitHubDisableRepository(ctx context.Context, repositoryID string) error

GitHubDisableRepository service function

func (*Service) GitHubEnableRepository

func (s *Service) GitHubEnableRepository(ctx context.Context, repositoryID string) error

GitHubEnableRepository service function

func (*Service) GitHubGetProtectedBranch

func (s *Service) GitHubGetProtectedBranch(ctx context.Context, projectSFID, repositoryID, branchName string) (*v2Models.GithubRepositoryBranchProtection, error)

GitHubGetProtectedBranch service function

func (*Service) GitHubGetRepository

func (s *Service) GitHubGetRepository(ctx context.Context, repositoryID string) (*v1Models.GithubRepository, error)

GitHubGetRepository service function

func (*Service) GitHubGetRepositoryByExternalID

func (s *Service) GitHubGetRepositoryByExternalID(ctx context.Context, repositoryExternalID string) (*v1Models.GithubRepository, error)

GitHubGetRepositoryByExternalID service function

func (*Service) GitHubGetRepositoryByName

func (s *Service) GitHubGetRepositoryByName(ctx context.Context, repositoryName string) (*v1Models.GithubRepository, error)

GitHubGetRepositoryByName service function

func (*Service) GitHubListProjectRepositories

func (s *Service) GitHubListProjectRepositories(ctx context.Context, projectSFID string) (*v1Models.GithubListRepositories, error)

GitHubListProjectRepositories service function

func (*Service) GitHubUpdateProtectedBranch

func (s *Service) GitHubUpdateProtectedBranch(ctx context.Context, projectSFID, repositoryID string, input *v2Models.GithubRepositoryBranchProtectionInput) (*v2Models.GithubRepositoryBranchProtection, error)

GitHubUpdateProtectedBranch service function

func (*Service) GitLabAddRepositories

func (s *Service) GitLabAddRepositories(ctx context.Context, projectSFID string, input *GitLabAddRepoModel) (*v2Models.GitlabRepositoriesList, error)

GitLabAddRepositories add a lst of GitLab repositories to the collection - default is not enabled/used/active by a CLA Group

func (*Service) GitLabAddRepositoriesByApp

func (s *Service) GitLabAddRepositoriesByApp(ctx context.Context, gitLabOrgModel *v2GitLabOrg.GitLabOrganization) ([]*v2Models.GitlabRepository, error)

GitLabAddRepositoriesByApp adds the GitLab repositories based on the application credentials

func (*Service) GitLabAddRepositoriesWithEnabledFlag

func (s *Service) GitLabAddRepositoriesWithEnabledFlag(ctx context.Context, projectSFID string, input *GitLabAddRepoModel, enabled bool) (*v2Models.GitlabRepositoriesList, error)

GitLabAddRepositoriesWithEnabledFlag add a lst of GitLab repositories to the collection

func (*Service) GitLabDeleteRepositories

func (s *Service) GitLabDeleteRepositories(ctx context.Context, gitLabGroupPath string) error

GitLabDeleteRepositories deletes the repositories under the specified path

func (*Service) GitLabDeleteRepositoryByExternalID

func (s *Service) GitLabDeleteRepositoryByExternalID(ctx context.Context, gitLabExternalID int64) error

GitLabDeleteRepositoryByExternalID deletes the specified repository

func (*Service) GitLabEnrollCLAGroupRepositories

func (s *Service) GitLabEnrollCLAGroupRepositories(ctx context.Context, claGroupID string, enrollValue bool) error

GitLabEnrollCLAGroupRepositories service function

func (*Service) GitLabEnrollRepositories

func (s *Service) GitLabEnrollRepositories(ctx context.Context, claGroupID string, repositoryIDList []int64, enrollValue bool) error

GitLabEnrollRepositories assigns repos to a CLA Group

func (*Service) GitLabEnrollRepository

func (s *Service) GitLabEnrollRepository(ctx context.Context, claGroupID string, repositoryExternalID int64, enrollValue bool) error

GitLabEnrollRepository service function enrolls a single GitLab repository to the specified CLA Group

func (*Service) GitLabGetRepositoriesByCLAGroup

func (s *Service) GitLabGetRepositoriesByCLAGroup(ctx context.Context, claGroupID string, enabled bool) (*v2Models.GitlabRepositoriesList, error)

GitLabGetRepositoriesByCLAGroup service function

func (*Service) GitLabGetRepositoriesByNamePrefix

func (s *Service) GitLabGetRepositoriesByNamePrefix(ctx context.Context, repositoryNamePrefix string) (*v2Models.GitlabRepositoriesList, error)

GitLabGetRepositoriesByNamePrefix returns a list of repositories that match the name prefix

func (*Service) GitLabGetRepositoriesByOrganizationName

func (s *Service) GitLabGetRepositoriesByOrganizationName(ctx context.Context, orgName string) (*v2Models.GitlabRepositoriesList, error)

GitLabGetRepositoriesByOrganizationName returns the list of repositories associated with the Organization/Group name

func (*Service) GitLabGetRepositoriesByProjectSFID

func (s *Service) GitLabGetRepositoriesByProjectSFID(ctx context.Context, projectSFID string) (*v2Models.GitlabRepositoriesList, error)

GitLabGetRepositoriesByProjectSFID service function

func (*Service) GitLabGetRepository

func (s *Service) GitLabGetRepository(ctx context.Context, repositoryID string) (*v2Models.GitlabRepository, error)

GitLabGetRepository service function

func (*Service) GitLabGetRepositoryByExternalID

func (s *Service) GitLabGetRepositoryByExternalID(ctx context.Context, repositoryExternalID int64) (*v2Models.GitlabRepository, error)

GitLabGetRepositoryByExternalID service function

func (*Service) GitLabGetRepositoryByName

func (s *Service) GitLabGetRepositoryByName(ctx context.Context, repositoryName string) (*v2Models.GitlabRepository, error)

GitLabGetRepositoryByName service function

type ServiceInterface

type ServiceInterface interface {
	GitHubAddRepositories(ctx context.Context, projectSFID string, input *models.GithubRepositoryInput) ([]*v1Models.GithubRepository, error)
	GitHubEnableRepository(ctx context.Context, repositoryID string) error
	GitHubDisableRepository(ctx context.Context, repositoryID string) error
	GitHubListProjectRepositories(ctx context.Context, projectSFID string) (*v1Models.GithubListRepositories, error)
	GitHubGetRepository(ctx context.Context, repositoryID string) (*v1Models.GithubRepository, error)
	GitHubGetRepositoryByName(ctx context.Context, repositoryName string) (*v1Models.GithubRepository, error)
	GitHubGetRepositoryByExternalID(ctx context.Context, repositoryExternalID string) (*v1Models.GithubRepository, error)
	GitHubDisableCLAGroupRepositories(ctx context.Context, claGroupID string) error
	GitHubGetProtectedBranch(ctx context.Context, projectSFID, repositoryID, branchName string) (*v2Models.GithubRepositoryBranchProtection, error)
	GitHubUpdateProtectedBranch(ctx context.Context, projectSFID, repositoryID string, input *v2Models.GithubRepositoryBranchProtectionInput) (*v2Models.GithubRepositoryBranchProtection, error)

	GitLabGetRepository(ctx context.Context, repositoryID string) (*v2Models.GitlabRepository, error)
	GitLabGetRepositoryByName(ctx context.Context, repositoryName string) (*v2Models.GitlabRepository, error)
	GitLabGetRepositoryByExternalID(ctx context.Context, repositoryExternalID int64) (*v2Models.GitlabRepository, error)
	GitLabGetRepositoriesByProjectSFID(ctx context.Context, projectSFID string) (*v2Models.GitlabRepositoriesList, error)
	GitLabGetRepositoriesByCLAGroup(ctx context.Context, claGroupID string, enabled bool) (*v2Models.GitlabRepositoriesList, error)
	GitLabGetRepositoriesByOrganizationName(ctx context.Context, orgName string) (*v2Models.GitlabRepositoriesList, error)
	GitLabGetRepositoriesByNamePrefix(ctx context.Context, repositoryNamePrefix string) (*v2Models.GitlabRepositoriesList, error)
	GitLabAddRepositories(ctx context.Context, projectSFID string, input *GitLabAddRepoModel) (*v2Models.GitlabRepositoriesList, error)
	GitLabAddRepositoriesWithEnabledFlag(ctx context.Context, projectSFID string, input *GitLabAddRepoModel, enabled bool) (*v2Models.GitlabRepositoriesList, error)
	GitLabAddRepositoriesByApp(ctx context.Context, gitLabOrgModel *common.GitLabOrganization) ([]*v2Models.GitlabRepository, error)
	GitLabEnrollRepositories(ctx context.Context, claGroupID string, repositoryIDList []int64, enrollValue bool) error
	GitLabEnrollRepository(ctx context.Context, claGroupID string, repositoryExternalID int64, enrollValue bool) error
	GitLabEnrollCLAGroupRepositories(ctx context.Context, claGroupID string, enrollValue bool) error
	GitLabDeleteRepositories(ctx context.Context, gitLabGroupPath string) error
	GitLabDeleteRepositoryByExternalID(ctx context.Context, gitLabExternalID int64) error
}

ServiceInterface contains functions of the repositories service

func NewService

func NewService(gitV1Repository *v1Repositories.Repository, gitV2Repository RepositoryInterface, pcgRepo projects_cla_groups.Repository, ghOrgRepo github_organizations.RepositoryInterface, glOrgRepo GitLabOrgRepo, eventService events.Service) ServiceInterface

NewService creates a new githubOrganizations service

Jump to

Keyboard shortcuts

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