events

package
v1.0.12 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2020 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CreateUser event type
	CreateUser = "Create User"
	// UpdateUser event type
	UpdateUser = "Update User"
	// DeleteUser event type
	DeleteUser = "Delete User"

	// CreateTemplate event type
	CreateTemplate = "Create Template"

	// AddGithubOrgToWL event type
	AddGithubOrgToWL = "Add GH Org To WL"
	// DeleteGithubOrgFromWL event type
	DeleteGithubOrgFromWL = "Delete GH Org From WL"

	// CreateCCLAWhitelistRequest event type
	CreateCCLAWhitelistRequest = "Create CCLA WL Request"
	// DeleteCCLAWhitelistRequest event type
	DeleteCCLAWhitelistRequest = "Delete CCLA WL Request"

	// AddUserToCompanyACL event type
	AddUserToCompanyACL = "Add User To Company ACL"

	// DeletePendingInvite event type
	DeletePendingInvite = "Delete Pending Invite"
)

Variables

View Source
var (
	ErrUserIDRequired    = errors.New("UserID cannot be empty")    //nolint
	ErrEventTypeRequired = errors.New("EventType cannot be empty") //nolint
)

errors

Functions

func Configure

func Configure(api *operations.ClaAPI, service Service)

Configure setups handlers on api with service

Types

type DBUser added in v1.0.11

type DBUser struct {
	UserID             string   `json:"user_id"`
	UserExternalID     string   `json:"user_external_id"`
	LFEmail            string   `json:"lf_email"`
	Admin              bool     `json:"admin"`
	LFUsername         string   `json:"lf_username"`
	DateCreated        string   `json:"date_created"`
	DateModified       string   `json:"date_modified"`
	UserName           string   `json:"user_name"`
	Version            string   `json:"version"`
	UserEmails         []string `json:"user_emails"`
	UserGithubID       string   `json:"user_github_id"`
	UserCompanyID      string   `json:"user_company_id"`
	UserGithubUsername string   `json:"user_github_username"`
	Note               string   `json:"note"`
}

DBUser data model

type Event

type Event struct {
	EventID                string `dynamodbav:"event_id"`
	EventType              string `dynamodbav:"event_type"`
	UserID                 string `dynamodbav:"user_id"`
	UserName               string `dynamodbav:"user_name"`
	EventProjectID         string `dynamodbav:"event_project_id"`
	EventProjectExternalID string `dynamodbav:"event_project_external_id"`
	EventProjectName       string `dynamodbav:"event_project_name"`
	EventCompanyID         string `dynamodbav:"event_company_id"`
	EventCompanyName       string `dynamodbav:"event_company_name"`
	EventTime              string `dynamodbav:"event_time"`
	EventTimeEpoch         int64  `dynamodbav:"event_time_epoch"`
	EventData              string `dynamodbav:"event_data"`
}

Event data model

type MockRepository added in v1.0.8

type MockRepository interface {
	CreateEvent(event *models.Event) error
	SearchEvents(params *eventOps.SearchEventsParams, pageSize int64) (*models.EventList, error)
	GetProject(projectID string) (*models.Project, error)
	GetCompany(companyID string) (*models.Company, error)
	GetUserByUserName(userName string, fullMatch bool) (*models.User, error)
	GetRecentEvents(pageSize int64) (*models.EventList, error)
}

MockRepository interface defines methods of event mock repository

func NewMockRepository added in v1.0.8

func NewMockRepository(awsSession *session.Session, stage string) MockRepository

NewMockRepository creates a new instance of the mock event repository

type Repository

type Repository interface {
	CreateEvent(event *models.Event) error
	SearchEvents(params *eventOps.SearchEventsParams, pageSize int64) (*models.EventList, error)
	GetProject(projectID string) (*models.Project, error)
	GetCompany(companyID string) (*models.Company, error)
	GetUserByUserName(userName string, fullMatch bool) (*models.User, error)
	GetRecentEvents(pageSize int64) (*models.EventList, error)
}

Repository interface defines methods of event repository service

func NewRepository

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

NewRepository creates a new instance of the event repository

type Service

type Service interface {
	CreateEvent(event models.Event) error
	CreateAuditEvent(eventType string, claUser *user.CLAUser, projectID, companyID, data string, containsPII bool)
	CreateAuditEventWithUserID(eventType string, userID, projectID, companyID, data string, containsPII bool)
	SearchEvents(params *eventOps.SearchEventsParams) (*models.EventList, error)
	GetProject(projectID string) (*models.Project, error)
	GetCompany(companyID string) (*models.Company, error)
	GetRecentEvents(paramPageSize *int64) (*models.EventList, error)
}

Service interface defines methods of event service

func NewService

func NewService(repo Repository) Service

NewService creates new instance of event service

Jump to

Keyboard shortcuts

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