dynamo_events

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: 44 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Insert = "INSERT"
	Modify = "MODIFY"
	Remove = "REMOVE"
)

constants

View Source
const (
	CLASignatureType  = "cla"
	CCLASignatureType = "ccla"

	ICLASignatureType = "icla"
	ECLASignatureType = "ecla"
	AddCLAManager     = "add"
	DeleteCLAManager  = "delete"
)

constants

Variables

View Source
var (
	// ErrAutoEnabledOff indicates the flag is disabled on github org
	ErrAutoEnabledOff = errors.New("autoEnabled is off")
	// ErrCantDetermineAutoEnableClaGroup indicates the cla group can't be determined for github org
	ErrCantDetermineAutoEnableClaGroup = errors.New("can't determine autoEnable cla-group")
)
View Source
var ErrNoExternalID = errors.New("company External ID does not exist")

ErrNoExternalID when company does not have externalID

Functions

func DetermineClaGroupID

func DetermineClaGroupID(f logrus.Fields, gitHubOrg *models.GithubOrganization, repos *models.GithubListRepositories) (string, error)

DetermineClaGroupID checks if AutoEnabledClaGroupID is set then returns it (high precedence) otherwise tries to determine the autoEnabled claGroupID by guessing from existing repos

Types

type AutoEnableService

type AutoEnableService interface {
	CreateAutoEnabledRepository(repo *github.Repository) (*models.GithubRepository, error)
	AutoEnabledForGithubOrg(f logrus.Fields, gitHubOrg github_organizations.GithubOrganization, notify bool) error
	NotifyCLAManagerForRepos(claGroupID string, repos []*models.GithubRepository) error
}

AutoEnableService holds logic about handling autoEnabled field for github Org and Repos

func NewAutoEnableService

func NewAutoEnableService(repositoryService repositories.Service,
	githubRepo repositories.RepositoryInterface,
	githubOrgRepo github_organizations.RepositoryInterface,
	claRepository projects_cla_groups.Repository,
	claService service2.Service,
) AutoEnableService

NewAutoEnableService creates a new AutoEnableService

type Event

type Event struct {
	EventID         string `json:"event_id"`
	EventProjectID  string `json:"event_project_id"`
	EventCompanyID  string `json:"event_company_id"`
	EventCLAGroupID string `json:"event_cla_group_id"`
}

Event data model

type EventHandlerFunc

type EventHandlerFunc func(event events.DynamoDBEventRecord) error

EventHandlerFunc is type for dynamoDB event handler function

type ProjectClaGroup

type ProjectClaGroup struct {
	ProjectSFID       string `json:"project_sfid"`
	ClaGroupID        string `json:"cla_group_id"`
	FoundationSFID    string `json:"foundation_sfid"`
	RepositoriesCount int64  `json:"repositories_count"`
}

ProjectClaGroup is database model for projects_cla_group table

type Service

type Service interface {
	ProcessEvents(event events.DynamoDBEvent)
}

Service implements DynamoDB stream event handler service

func NewService

func NewService(stage string,
	signatureRepo signatures.SignatureRepository,
	companyRepo company.IRepository,
	companyService v2Company.Service,
	pcgRepo projects_cla_groups.Repository,
	eventsRepo claevent.Repository,
	projectRepo repository.ProjectRepository,
	gitLabOrgRepo gitlab_organizations.RepositoryInterface,
	v2Repository v2Repositories.RepositoryInterface,
	projService service2.Service,
	githubOrgService github_organizations.ServiceInterface,
	repositoryService repositories.Service,
	gerritService gerrits.Service,
	claManagerRequestsRepo cla_manager.IRepository,
	approvalListRequestsRepo approval_list.IRepository,
	gitLabApp *gitlab_api.App,
	gitlabOrgService gitlab_organizations.ServiceInterface) Service

NewService creates DynamoDB stream event handler service

type Signature

type Signature struct {
	SignatureID                   string   `json:"signature_id"`
	DateCreated                   string   `json:"date_created"`
	DateModified                  string   `json:"date_modified"`
	SignatureApproved             bool     `json:"signature_approved"`
	SignatureSigned               bool     `json:"signature_signed"`
	SignatureDocumentMajorVersion string   `json:"signature_document_major_version"`
	SignatureDocumentMinorVersion string   `json:"signature_document_minor_version"`
	SignatureReferenceID          string   `json:"signature_reference_id"`
	SignatureReferenceName        string   `json:"signature_reference_name"`
	SignatureReferenceNameLower   string   `json:"signature_reference_name_lower"`
	SignatureProjectID            string   `json:"signature_project_id"`
	SignatureReferenceType        string   `json:"signature_reference_type"`
	SignatureType                 string   `json:"signature_type"`
	SignatureUserCompanyID        string   `json:"signature_user_ccla_company_id"`
	EmailWhitelist                []string `json:"email_whitelist"`
	DomainWhitelist               []string `json:"domain_whitelist"`
	GitHubWhitelist               []string `json:"github_whitelist"`
	GitHubOrgWhitelist            []string `json:"github_org_whitelist"`
	SignatureACL                  []string `json:"signature_acl"`
	SigtypeSignedApprovedID       string   `json:"sigtype_signed_approved_id"`
	UserGithubUsername            string   `json:"user_github_username"`
	UserLFUsername                string   `json:"user_lf_username"`
	UserName                      string   `json:"user_name"`
	UserEmail                     string   `json:"user_email"`
	SignedOn                      string   `json:"signed_on"`
}

Signature database model

Jump to

Keyboard shortcuts

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