Documentation
¶
Index ¶
- Variables
- func ExtractProjectIDFromRepoID(repoID string) (int, error)
- func FetchPaginatedData[T any](fetchPage func(page int) ([]T, *gitlab.Response, error)) ([]T, error)
- func NewGitLabOauth2Integrations(db shared.DB, gitlabOauth2TokenRepository shared.GitLabOauth2TokenRepository) map[string]*GitlabOauth2Config
- func NewGitlabBatchClient(clients []shared.GitlabClientFacade) *gitlabBatchClient
- type GitlabIntegration
- func (g *GitlabIntegration) AutoSetup(ctx shared.Context) error
- func (g *GitlabIntegration) CreateIssue(ctx context.Context, asset models.Asset, assetVersionName string, ...) error
- func (g *GitlabIntegration) CreateLabels(ctx context.Context, asset models.Asset) error
- func (g *GitlabIntegration) Delete(ctx shared.Context) error
- func (g *GitlabIntegration) GetClientBasedOnAsset(asset models.Asset) (shared.GitlabClientFacade, int, error)
- func (g *GitlabIntegration) GetGroup(ctx context.Context, userID string, providerID string, groupID string) (models.Project, error)
- func (g *GitlabIntegration) GetID() shared.IntegrationID
- func (g *GitlabIntegration) GetRoleInGroup(ctx context.Context, userID string, providerID string, groupID string) (shared.Role, error)
- func (g *GitlabIntegration) GetRoleInProject(ctx context.Context, userID string, providerID string, projectID string) (shared.Role, error)
- func (g *GitlabIntegration) GetUsers(org models.Org) []dtos.UserDTO
- func (g *GitlabIntegration) HandleEvent(event any) error
- func (g *GitlabIntegration) HandleWebhook(ctx shared.Context) error
- func (g *GitlabIntegration) HasAccessToExternalEntityProvider(ctx shared.Context, externalEntityProviderID string) (bool, error)
- func (g *GitlabIntegration) ListGroups(ctx context.Context, userID string, providerID string) ([]models.Project, []shared.Role, error)
- func (g *GitlabIntegration) ListOrgs(ctx shared.Context) ([]models.Org, error)
- func (g *GitlabIntegration) ListProjects(ctx context.Context, userID string, providerID string, groupID string) ([]models.Asset, []shared.Role, error)
- func (g *GitlabIntegration) ListRepositories(ctx shared.Context) ([]dtos.GitRepository, error)
- func (g *GitlabIntegration) TestAndSave(ctx shared.Context) error
- func (g *GitlabIntegration) UpdateIssue(ctx context.Context, asset models.Asset, assetVersionSlug string, ...) error
- func (g *GitlabIntegration) UpdateLabels(ctx context.Context, asset models.Asset, labelsToUpdate []commonint.Label) error
- func (g *GitlabIntegration) WantsToHandleWebhook(ctx shared.Context) bool
- type GitlabOauth2Config
- type SimpleGitlabClientFactory
- func (factory SimpleGitlabClientFactory) FromAccessToken(accessToken string, baseURL string) (shared.GitlabClientFacade, error)
- func (factory SimpleGitlabClientFactory) FromIntegration(integration models.GitLabIntegration) (shared.GitlabClientFacade, error)
- func (factory SimpleGitlabClientFactory) FromIntegrationUUID(id uuid.UUID) (shared.GitlabClientFacade, error)
- func (factory SimpleGitlabClientFactory) FromOauth2Token(token models.GitLabOauth2Token, enableClientCache bool) (shared.GitlabClientFacade, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNoGitlabIntegration = fmt.Errorf("no gitlab app installations found")
Functions ¶
func FetchPaginatedData ¶
func FetchPaginatedData[T any]( fetchPage func(page int) ([]T, *gitlab.Response, error), ) ([]T, error)
Generic function to fetch paginated data with rate limiting and concurrency
func NewGitLabOauth2Integrations ¶
func NewGitLabOauth2Integrations(db shared.DB, gitlabOauth2TokenRepository shared.GitLabOauth2TokenRepository) map[string]*GitlabOauth2Config
func NewGitlabBatchClient ¶
func NewGitlabBatchClient(clients []shared.GitlabClientFacade) *gitlabBatchClient
groups multiple gitlab clients - since an org can have multiple installations
Types ¶
type GitlabIntegration ¶
type GitlabIntegration struct {
utils.FireAndForgetSynchronizer
// contains filtered or unexported fields
}
func NewGitlabIntegration ¶
func NewGitlabIntegration( oauth2GitlabIntegration map[string]*GitlabOauth2Config, casbinRBACProvider shared.RBACProvider, clientFactory shared.GitlabClientFactory, gitlabIntegrationRepository shared.GitlabIntegrationRepository, aggregatedVulnRepository shared.VulnRepository, dependencyVulnRepository shared.DependencyVulnRepository, vulnEventRepository shared.VulnEventRepository, externalUserRepository shared.ExternalUserRepository, assetRepository shared.AssetRepository, assetVersionRepository shared.AssetVersionRepository, projectRepository shared.ProjectRepository, componentRepository shared.ComponentRepository, firstPartyVulnRepository shared.FirstPartyVulnRepository, gitlabOauth2TokenRepository shared.GitLabOauth2TokenRepository, licenseRiskRepository shared.LicenseRiskRepository, orgRepository shared.OrganizationRepository, statisticsService shared.StatisticsService, synchronizer utils.FireAndForgetSynchronizer, ) *GitlabIntegration
func (*GitlabIntegration) AutoSetup ¶
func (g *GitlabIntegration) AutoSetup(ctx shared.Context) error
func (*GitlabIntegration) CreateIssue ¶
func (*GitlabIntegration) CreateLabels ¶
func (*GitlabIntegration) GetClientBasedOnAsset ¶
func (g *GitlabIntegration) GetClientBasedOnAsset(asset models.Asset) (shared.GitlabClientFacade, int, error)
func (*GitlabIntegration) GetID ¶
func (g *GitlabIntegration) GetID() shared.IntegrationID
func (*GitlabIntegration) GetRoleInGroup ¶
func (*GitlabIntegration) GetRoleInProject ¶
func (*GitlabIntegration) GetUsers ¶
func (g *GitlabIntegration) GetUsers(org models.Org) []dtos.UserDTO
func (*GitlabIntegration) HandleEvent ¶
func (g *GitlabIntegration) HandleEvent(event any) error
func (*GitlabIntegration) HandleWebhook ¶
func (g *GitlabIntegration) HandleWebhook(ctx shared.Context) error
func (*GitlabIntegration) HasAccessToExternalEntityProvider ¶
func (*GitlabIntegration) ListGroups ¶
func (*GitlabIntegration) ListProjects ¶
func (*GitlabIntegration) ListRepositories ¶
func (g *GitlabIntegration) ListRepositories(ctx shared.Context) ([]dtos.GitRepository, error)
func (*GitlabIntegration) TestAndSave ¶
func (g *GitlabIntegration) TestAndSave(ctx shared.Context) error
func (*GitlabIntegration) UpdateIssue ¶
func (*GitlabIntegration) UpdateLabels ¶
func (*GitlabIntegration) WantsToHandleWebhook ¶
func (g *GitlabIntegration) WantsToHandleWebhook(ctx shared.Context) bool
type GitlabOauth2Config ¶
type GitlabOauth2Config struct {
ProviderID string
GitlabBaseURL string
GitlabOauth2TokenRepository shared.GitLabOauth2TokenRepository
Oauth2Conf *oauth2.Config
DevGuardBotUserID int // the user id of the devguard bot user, used to create issues
DevGuardBotUserAccessToken string // the access token of the devguard bot user, used to create issues
AdminToken *string
}
func NewGitLabOauth2Config ¶
func NewGitLabOauth2Config(id, gitlabBaseURL, gitlabOauth2ClientID, gitlabOauth2ClientSecret, gitlabOauth2Scopes string, botUserID int, botUserAccessToken string, adminToken *string, gitlabOauth2TokenRepository shared.GitLabOauth2TokenRepository) *GitlabOauth2Config
func (*GitlabOauth2Config) GetBaseURL ¶
func (c *GitlabOauth2Config) GetBaseURL() string
func (*GitlabOauth2Config) GetProviderID ¶
func (c *GitlabOauth2Config) GetProviderID() string
func (*GitlabOauth2Config) Oauth2Callback ¶
func (c *GitlabOauth2Config) Oauth2Callback(ctx shared.Context) error
func (*GitlabOauth2Config) Oauth2Login ¶
func (c *GitlabOauth2Config) Oauth2Login(ctx shared.Context) error
type SimpleGitlabClientFactory ¶
type SimpleGitlabClientFactory struct {
// contains filtered or unexported fields
}
func NewGitlabClientFactory ¶
func NewGitlabClientFactory(gitlabIntegrationRepository shared.GitlabIntegrationRepository, oauth2GitlabIntegration map[string]*GitlabOauth2Config) SimpleGitlabClientFactory
func (SimpleGitlabClientFactory) FromAccessToken ¶
func (factory SimpleGitlabClientFactory) FromAccessToken(accessToken string, baseURL string) (shared.GitlabClientFacade, error)
func (SimpleGitlabClientFactory) FromIntegration ¶
func (factory SimpleGitlabClientFactory) FromIntegration(integration models.GitLabIntegration) (shared.GitlabClientFacade, error)
func (SimpleGitlabClientFactory) FromIntegrationUUID ¶
func (factory SimpleGitlabClientFactory) FromIntegrationUUID(id uuid.UUID) (shared.GitlabClientFacade, error)
func (SimpleGitlabClientFactory) FromOauth2Token ¶
func (factory SimpleGitlabClientFactory) FromOauth2Token(token models.GitLabOauth2Token, enableClientCache bool) (shared.GitlabClientFacade, error)
Click to show internal directories.
Click to hide internal directories.