utils

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

Documentation

Index

Constants

View Source
const (
	// Connected status
	Connected = "connected"
	// PartialConnection status
	PartialConnection = "partial_connection"
	// ConnectionFailure status
	ConnectionFailure = "connection_failure"
	// NoConnection status
	NoConnection = "no_connection"
)
View Source
const (
	// V1 is the version 1 identifier
	V1 = "v1"

	// V2 is the version 2 identifier
	V2 = "v2"
)
View Source
const (
	// ALLOW_ADMIN_SCOPE indicates that a given permissions check allows for admins to access to that resource
	ALLOW_ADMIN_SCOPE = true // nolint
	// DISALLOW_ADMIN_SCOPE indicates that a given permissions check does not allow for admins to access to that resource
	DISALLOW_ADMIN_SCOPE = false // nolint
)
View Source
const AddApprovals = "AddApprovals"

AddApprovals is an action for adding approvals

View Source
const CLADesigneeRole = "cla-manager-designee"

CLADesigneeRole CLA manager designee role identifier

View Source
const CLAManagerRole = "cla-manager"

CLAManagerRole CLA manager role identifier

View Source
const CLAProjectManagerRole = "project-manager"

CLAProjectManagerRole CLA project manager role identifier

View Source
const CLASignatoryRole = "cla-signatory"

CLASignatoryRole CLA signatory role identifier

View Source
const ClaTypeCCLA = "ccla"

ClaTypeCCLA represents corporate CLA records (includes approval lists)

View Source
const ClaTypeECLA = "ecla"

ClaTypeECLA represents employee contributor CLA records (acknowledgements)

View Source
const ClaTypeICLA = "icla"

ClaTypeICLA represents individual contributor CLA records

View Source
const CompanyAdminRole = "company-admin"

CompanyAdminRole Company admin for user

View Source
const ContactRole = "contact"

ContactRole contact role for user

View Source
const CtxAuthUser = "authUser"

CtxAuthUser the key for the authenticated user in the context

View Source
const DomainApprovalCriteria = "domain"
View Source
const EasyCLA400BadRequest = "EasyCLA - 400 Bad Request"

EasyCLA400BadRequest common string for handler bad request error messages

View Source
const EasyCLA401Unauthorized = "EasyCLA - 401 Unauthorized"

EasyCLA401Unauthorized common string for handler unauthorized error messages

View Source
const EasyCLA403Forbidden = "EasyCLA - 403 Forbidden"

EasyCLA403Forbidden common string for handler forbidden error messages

View Source
const EasyCLA404NotFound = "EasyCLA - 404 Not Found"

EasyCLA404NotFound common string for handler not found error messages

View Source
const EasyCLA409Conflict = "EasyCLA - 409 Conflict"

EasyCLA409Conflict common string for handler conflict error messages

View Source
const EasyCLA500InternalServerError = "EasyCLA - 500 Internal Server Error"

EasyCLA500InternalServerError common string for handler internal server error messages

View Source
const EmailApprovalCriteria = "email"
View Source
const EmailCriteria = "Email Criteria"

EmailCriteria represents approvals based on email addresses

View Source
const EmailDomainCriteria = "Email Domain Criteria"

EmailDomainCriteria represents approval based on email domain

View Source
const EmailLabel = "Email Address"

EmailLabel represents LF/EasyCLA Email address

View Source
const FileTypeCSV = "csv"

FileTypeCSV is the csv file type

View Source
const FileTypePDF = "pdf"

FileTypePDF is the pdf file type

View Source
const GitHubBotName = "EasyCLA"

GitHubBotName is the name of the GitHub bot

View Source
const GitHubEmailLabel = "GitHub Email Address"

GitHubEmailLabel represents the GH Email label used for email

View Source
const GitHubOrgCriteria = "GitHub Org Criteria"

GitHubOrgCriteria represents approvals based on GitHub org membership

View Source
const GitHubRepositoryType = "GitHub"

GitHubRepositoryType representing the GitLab repository type

View Source
const GitHubType = "github"

GitHubType is the repository type identifier for github

View Source
const GitHubUserLabel = "GitHub Username"

GitHubUserLabel represents the GH username Label used for email

View Source
const GitHubUsernameCriteria = "GitHubUsername"

GitHubUsernameCriteria represents criteria based on GitHub username

View Source
const GitLab = "GitLab"

GitLab is the GitLab spelled out with the proper case

View Source
const GitLabDuplicateRepoFound = "Duplicate GitLab repositories were found"

GitLabDuplicateRepoFound is a string that indicates that duplicate GitLab repositories were found

View Source
const GitLabEmailLabel = "GitLab Email Address"

GitLabEmailLabel represents the GitLab Email label used for email

View Source
const GitLabLower = "gitlab"

GitLabLower is the GitLab spelled out in lower case

View Source
const GitLabRepoExists = "GitLab repository exists"

GitLabRepoExists is a string that indicates the GitLab repository already exists

View Source
const GitLabRepoNotFound = "GitLab repository not found"

GitLabRepoNotFound is a string that indicates the GitLab repository is not found

View Source
const GitLabRepositoryType = "GitLab"

GitLabRepositoryType representing the GitLab repository type

View Source
const GitLabUserLabel = "GitLab Username"

GitLabUserLabel represents the GitLab username Label used for email

View Source
const GithubBranchProtectionPatternAll = "**/**"

GithubBranchProtectionPatternAll is Github Branch Protection Pattern that matches all branches

View Source
const GithubOrgApprovalCriteria = "githubOrg"
View Source
const GithubRepoExists = "GitHub repository exists"

GithubRepoExists is a string that indicates the GitHub repository already exists

View Source
const GithubRepoNotFound = "GitHub repository not found"

GithubRepoNotFound is a string that indicates the GitHub repository is not found

View Source
const GithubUsernameApprovalCriteria = "githubUsername"
View Source
const GitlabOrgApprovalCriteria = "gitlabOrg"
View Source
const GitlabOrgCriteria = "Gitlab Org Criteria"

GitlabOrgCriteria represents approvals based on gitlab org group membership

View Source
const GitlabUsernameApprovalCriteria = "gitlabUsername"
View Source
const GitlabUsernameCriteria = "GitHubUsername"

GitlabUsernameCriteria represents criteria based on gitlab username

View Source
const LFProjectsLLC = "LF Projects, LLC"

LFProjectsLLC is the LF project LLC name of the super parent for many Salesforce Foundations/Project Groups

View Source
const Lead = "lead"

Lead representing type of user

View Source
const PresignedURLValidity = 15 * time.Minute

PresignedURLValidity is time for which s3 url will remain valid

View Source
const ProjectFundedSupportedByParent = "Supported by Parent Project"

ProjectFundedSupportedByParent is a constant that represents a SF project that is funded by the parent

View Source
const ProjectOrgScope = "project|organization"

ProjectOrgScope is the ACS project + organiztion scope

View Source
const ProjectScope = "project"

ProjectScope is the ACS project scope

View Source
const ProjectTypeProject = "Project"

ProjectTypeProject is a salesforce Project that is of Project type

View Source
const ProjectTypeProjectGroup = "Project Group"

ProjectTypeProjectGroup is the string that represents the Project Group type in a Project Service record

View Source
const ProjectUnfunded = "Unfunded"

ProjectUnfunded is a constant that represents a SF project that is unfunded

View Source
const RecordAdded = "INSERT"

RecordAdded dynami event on adding a record

View Source
const RecordDeleted = "REMOVE"

RecordDeleted dynamo event for deleting a record

View Source
const RecordModified = "MODIFY"

RecordModified dynamo event on modifying a record

View Source
const RemoveApprovals = "RemoveApprovals"

RemoveApprovals is an action for removing approvals

View Source
const SignatureQueryDefaultActive = "active"

SignatureQueryDefaultActive the signature query default active value - A flag to indicate how a default signature query should return data - show only 'active' signatures or 'all' signatures when no other query signed/approved params are provided

View Source
const SignatureQueryDefaultAll = "all"

SignatureQueryDefaultAll the signature query default active value - A flag to indicate how a default signature query should return data - show only 'active' signatures or 'all' signatures when no other query signed/approved params are provided

View Source
const SignatureReferenceTypeCompany = "company"

SignatureReferenceTypeCompany is the signature reference type for corporate signatures - signed by CLA Signatories, managed by CLA Managers

View Source
const SignatureReferenceTypeUser = "user"

SignatureReferenceTypeUser is the signature reference type for user signatures - individual and employee

View Source
const SignatureTypeCCLA = "ccla"

SignatureTypeCCLA is the ccla signature type in the DB

View Source
const SignatureTypeCLA = "cla"

SignatureTypeCLA is the cla signature type in the DB

View Source
const SortOrderAscending = "asc"

SortOrderAscending ascending sort order constant

View Source
const SortOrderDescending = "desc"

SortOrderDescending descending sort order constant

View Source
const String400 = "400"

String400 string version of 400 - http bad request

View Source
const String401 = "401"

String401 string version of 401 - http unauthorized

View Source
const String403 = "403"

String403 string version of 403 - http forbidden

View Source
const String404 = "404"

String404 string version of 404 - http not found

View Source
const String409 = "409"

String409 string version of 409 - http conflict

View Source
const String500 = "500"

String500 string version of 500 - http internal server error

View Source
const TheLinuxFoundation = "The Linux Foundation"

TheLinuxFoundation is the name of the super parent for many Salesforce Foundations/Project Groups

View Source
const UserLabel = "Username"

UserLabel represents the LF/EasyCLA username

View Source
const XREQUESTID = "x-request-id"

XREQUESTID is the client request id - used to trace a client request through the system/logs

View Source
const XREQUESTIDKey contextKey = "x-request-id"

Variables

This section is empty.

Functions

func AddNumberAttribute

func AddNumberAttribute(item map[string]*dynamodb.AttributeValue, key string, value int64)

AddNumberAttribute adds number attribute to dynamodb input map

func AddStringAttribute

func AddStringAttribute(item map[string]*dynamodb.AttributeValue, key string, value string)

AddStringAttribute adds string attribute to dynamodb input map

func ArrayStringPointer

func ArrayStringPointer(input []string) []*string

ArrayStringPointer converts Array string to Array string pointer

func Bool

func Bool(input bool) *bool

Bool function convert boolean to boolean pointer

func BoolValue

func BoolValue(input *bool) bool

BoolValue function convert boolean pointer to boolean

func ContextWithRequestAndUser

func ContextWithRequestAndUser(ctx context.Context, reqID string, authUser *auth.User) context.Context

ContextWithRequestAndUser returns a new context with the specified request ID and user

func ContextWithUser

func ContextWithUser(ctx context.Context, authUser *auth.User) context.Context

ContextWithUser returns a new context with the specified user

func CreateEventWrapper

func CreateEventWrapper(eventType string) *event.Event

CreateEventWrapper creates a new event with the specified event type

func CurrentSimpleDateTimeString

func CurrentSimpleDateTimeString() string

CurrentSimpleDateTimeString returns the current UTC time and current Time in the "2006-01-02T15:04:05Z" format

func CurrentTime

func CurrentTime() (time.Time, string)

CurrentTime returns the current UTC time and current Time in the RFC3339 format

func CurrentUserInACL

func CurrentUserInACL(authUser *auth.User, managers []v1Models.User) bool

CurrentUserInACL is a helper function to determine if the current logged in user is in the specified CLA Manager list

func DeleteFromS3

func DeleteFromS3(filename string) error

DeleteFromS3 deletes file from s3

func DocumentExists

func DocumentExists(key string) (bool, error)

func DownloadFromS3

func DownloadFromS3(filename string) ([]byte, error)

DownloadFromS3 downloads file from s3

func ErrorResponseBadRequest

func ErrorResponseBadRequest(reqID, msg string) *models.ErrorResponse

ErrorResponseBadRequest Helper function to generate a bad request error response

func ErrorResponseBadRequestWithError

func ErrorResponseBadRequestWithError(reqID, msg string, err error) *models.ErrorResponse

ErrorResponseBadRequestWithError Helper function to generate a bad request error response

func ErrorResponseConflict

func ErrorResponseConflict(reqID, msg string) *models.ErrorResponse

ErrorResponseConflict Helper function to generate a conflict error response

func ErrorResponseConflictWithError

func ErrorResponseConflictWithError(reqID, msg string, err error) *models.ErrorResponse

ErrorResponseConflictWithError Helper function to generate a conflict error message

func ErrorResponseForbidden

func ErrorResponseForbidden(reqID, msg string) *models.ErrorResponse

ErrorResponseForbidden Helper function to generate a forbidden error response

func ErrorResponseForbiddenWithError

func ErrorResponseForbiddenWithError(reqID, msg string, err error) *models.ErrorResponse

ErrorResponseForbiddenWithError Helper function to generate a forbidden error response

func ErrorResponseInternalServerError

func ErrorResponseInternalServerError(reqID, msg string) *models.ErrorResponse

ErrorResponseInternalServerError Helper function to generate an internal server error response

func ErrorResponseInternalServerErrorWithError

func ErrorResponseInternalServerErrorWithError(reqID, msg string, err error) *models.ErrorResponse

ErrorResponseInternalServerErrorWithError Helper function to generate an internal server error response

func ErrorResponseNotFound

func ErrorResponseNotFound(reqID, msg string) *models.ErrorResponse

ErrorResponseNotFound Helper function to generate a not found error response

func ErrorResponseNotFoundWithError

func ErrorResponseNotFoundWithError(reqID, msg string, err error) *models.ErrorResponse

ErrorResponseNotFoundWithError Helper function to generate a not found error response

func ErrorResponseUnauthorized

func ErrorResponseUnauthorized(reqID, msg string) *models.ErrorResponse

ErrorResponseUnauthorized Helper function to generate an unauthorized error response

func ErrorResponseUnauthorizedWithError

func ErrorResponseUnauthorizedWithError(reqID, msg string, err error) *models.ErrorResponse

ErrorResponseUnauthorizedWithError Helper function to generate an unauthorized error response

func FindInt64Duplicates

func FindInt64Duplicates(a, b []int64) []int64

FindInt64Duplicates returns true if the two lists include any duplicates, false otherwise. Returns the duplicates

func FmtDuration

func FmtDuration(d time.Duration) string

FmtDuration is a helper function to format a duration in the HH:MM:SS.sss format

func FormatTimeString

func FormatTimeString(timeStr string) string

FormatTimeString converts the time string into the "standard" RFC3339 format

func GetBestEmail

func GetBestEmail(userModel *models.User) string

GetBestEmail is a helper function to return the best email address for the user model

func GetBestUsername

func GetBestUsername(user *models.User) string

GetBestUsername gets best username of CLA User

func GetCorporateURL

func GetCorporateURL(isV2Project bool) string

GetCorporateURL returns the corporate URL based on the specified flag

func GetDownloadLink(filename string) (string, error)

GetDownloadLink provides presigned s3 url

func GetEmailHelpContent

func GetEmailHelpContent(showV2HelpLink bool) string

GetEmailHelpContent returns the standard email help paragraph details.

func GetEmailSignOffContent

func GetEmailSignOffContent() string

GetEmailSignOffContent returns the standard email sign-off details

func GetFirstAndLastName

func GetFirstAndLastName(firstAndLastName string) (string, string)

GetFirstAndLastName parses the user's name into first and last strings

func GetGithubEvent

func GetGithubEvent(xGithubEvent *string) string

GetGithubEvent helper function to get the github Event Type from the session

func GetGithubSignature

func GetGithubSignature(xGithubSignature *string) string

GetGithubSignature helper function to get the github Event Type from the session

func GetHTTPOKResponse

func GetHTTPOKResponse(ctx context.Context) events.APIGatewayProxyResponse

GetHTTPOKResponse : return Get HTTP Success Response

func GetNilSliceIfEmpty

func GetNilSliceIfEmpty(slice []string) []string

GetNilSliceIfEmpty returns a nil reference is the specified slice is empty, otherwise returns a reference to the original slice

func GetPathFromURL

func GetPathFromURL(s3URLHost string) (string, error)

GetPathFromURL helper function to extract the path from the S3 URL

func GetProjectParentSFID

func GetProjectParentSFID(project *models.ProjectOutputDetailed) string

GetProjectParentSFID returns the project parent SFID if available, otherwise returns empty string

func GetProperty

func GetProperty(property string) string

GetProperty is a common routine to bind and return the specified environment variable

func GetRequestID

func GetRequestID(reqID *string) string

GetRequestID helper function to get the request ID from the session

func GetUserEmailFromContext

func GetUserEmailFromContext(ctx context.Context) string

GetUserEmailFromContext returns the user's email from the context

func GetUserNameFromContext

func GetUserNameFromContext(ctx context.Context) string

GetUserNameFromContext returns the user's name from the context

func HostInSlice

func HostInSlice(a string, list []string) bool

HostInSlice returns true if the specified host value exists in the slice, otherwise returns false

func Int64

func Int64(v int64) *int64

Int64 returns a pointer to the int64 value passed in.

func Int64Value

func Int64Value(input *int64) int64

Int64Value function convert int64 pointer to string

func IsProjectCategory

func IsProjectCategory(project *models.ProjectOutputDetailed, parent *models.ProjectOutputDetailed) bool

IsProjectCategory determines if a given project is categorised as cla project sfid

func IsProjectHasRootParent

func IsProjectHasRootParent(project *models.ProjectOutputDetailed) bool

IsProjectHasRootParent determines if a given project has a root parent. A root parent is a parent that is empty parent or the parent is TLF or LFProjects

func IsProjectHaveChildren

func IsProjectHaveChildren(project *models.ProjectOutputDetailed) bool

IsProjectHaveChildren determines if a given project has children

func IsProjectHaveParent

func IsProjectHaveParent(project *models.ProjectOutputDetailed) bool

IsProjectHaveParent returns true if the specified project has a parent

func IsSalesForceID

func IsSalesForceID(id string) bool

IsSalesForceID returns true if the specified ID is a SalesForce formatted ID, otherwise returns false

func IsStandaloneProject

func IsStandaloneProject(project *models.ProjectOutputDetailed) bool

IsStandaloneProject determines if a given project is a standalone project. A standalone project is a project with no parent or the parent is TLF/LFProjects and does not have any children

func IsUUIDv4

func IsUUIDv4(id string) bool

IsUUIDv4 returns true if the specified ID is in the UUIDv4 format, otherwise returns false

func IsUserAdmin

func IsUserAdmin(user *auth.User) bool

IsUserAdmin helper function for determining if the user is an admin

func IsUserAuthorizedForAnyProjectOrganization

func IsUserAuthorizedForAnyProjectOrganization(ctx context.Context, user *auth.User, projectSFIDs []string, companySFID string, adminScopeAllowed bool) bool

IsUserAuthorizedForAnyProjectOrganization helper function for determining if the user is authorized for any of the specified projects with scope of project + organization

func IsUserAuthorizedForAnyProjects

func IsUserAuthorizedForAnyProjects(ctx context.Context, user *auth.User, projectSFIDs []string, adminScopeAllowed bool) bool

IsUserAuthorizedForAnyProjects helper function for determining if the user is authorized for any of the specified projects

func IsUserAuthorizedForOrganization

func IsUserAuthorizedForOrganization(ctx context.Context, user *auth.User, companySFID string, adminScopeAllowed bool) bool

IsUserAuthorizedForOrganization helper function for determining if the user is authorized for this company

func IsUserAuthorizedForProject

func IsUserAuthorizedForProject(ctx context.Context, user *auth.User, projectSFID string, adminScopeAllowed bool) bool

IsUserAuthorizedForProject helper function for determining if the user is authorized for this project

func IsUserAuthorizedForProjectOrganization

func IsUserAuthorizedForProjectOrganization(ctx context.Context, user *auth.User, projectSFID, companySFID string, adminScopeAllowed bool) bool

IsUserAuthorizedForProjectOrganization helper function for determining if the user is authorized for this project organization scope

func IsUserAuthorizedForProjectOrganizationTree

func IsUserAuthorizedForProjectOrganizationTree(ctx context.Context, user *auth.User, projectSFID, companySFID string, adminScopeAllowed bool) bool

IsUserAuthorizedForProjectOrganizationTree helper function for determining if the user is authorized for this project organization scope and nested projects/orgs

func IsUserAuthorizedForProjectTree

func IsUserAuthorizedForProjectTree(ctx context.Context, user *auth.User, projectSFID string, adminScopeAllowed bool) bool

IsUserAuthorizedForProjectTree helper function for determining if the user is authorized for this project hierarchy/tree

func NewContext

func NewContext() context.Context

NewContext returns a new context object with a new request ID

func NewContextFromParent

func NewContextFromParent(ctx context.Context) context.Context

NewContextFromParent returns a new context object with a new request ID based on the parent

func NewContextWithUser

func NewContextWithUser(authUser *auth.User) context.Context

NewContextWithUser returns a new context with a newly generated request ID and the specified user

func ParseDateTime

func ParseDateTime(dateTimeStr string) (time.Time, error)

ParseDateTime attempts to convert the string to one of our supported date time formats

func ParseString

func ParseString(regEx, val string) (paramsMap map[string]string)

ParseString parses a string and returns group values defined in the regex

func RemoveDuplicates

func RemoveDuplicates(list []string) []string

RemoveDuplicates removes any duplicate entries in the provided list and returns a new list

func RemoveItemsFromList

func RemoveItemsFromList(existingList, removeEntries []string) []string

RemoveItemsFromList given a list, removes the specified entries from that list

func RenderTemplate

func RenderTemplate(claGroupVersion, templateName, templateStr string, params interface{}) (string, error)

RenderTemplate renders the template for given template with given params

func SendEmail

func SendEmail(subject string, body string, recipients []string) error

SendEmail function send email. It uses emailSender interface.

func SetAuthUserProperties

func SetAuthUserProperties(authUser *auth.User, xUserName *string, xEmail *string)

SetAuthUserProperties adds username and email to auth user

func SetEmailSender

func SetEmailSender(es EmailSender)

SetEmailSender sets up default email sender

func SetS3Storage

func SetS3Storage(awsSession *session.Session, bucketName string)

SetS3Storage set default S3Storage

func SetSnsEmailSender

func SetSnsEmailSender(awsSession *session.Session, snsEventTopicARN string, senderEmailAddress string)

SetSnsEmailSender set sns as mechanism to send email

func SignedCLAFilename

func SignedCLAFilename(projectID string, claType string, identifier string, signatureID string) string

SignedCLAFilename provide s3 bucket url

func SignedClaGroupZipFilename

func SignedClaGroupZipFilename(projectID string, claType string) string

SignedClaGroupZipFilename provides s3 bucket url of zip of pdf

func SliceDifference

func SliceDifference(a, b []string) []string

SliceDifference returns the entries that are different between the two slices

func StringInSlice

func StringInSlice(a string, list []string) bool

StringInSlice returns true if the specified string value exists in the slice, otherwise returns false

func StringRef

func StringRef(input string) *string

StringRef function convert string to string reference

func StringValue

func StringValue(input *string) string

StringValue function convert string pointer to string

func TimeToString

func TimeToString(t time.Time) string

TimeToString returns time in the RFC3339 format

func ToEmailEvent

func ToEmailEvent(sender *string, recipients []string, subject *string, emailBody *string) *emailevent.EmailEvent

ToEmailEvent creates an email event model from the email details

func ToEmailTemplateEvent

func ToEmailTemplateEvent(sender *string, recipients []string, subject *string, emailBody *string, templateName string) *emailevent.EmailEvent

ToEmailTemplateEvent creates an email event model from the email details

func ToV1ErrorResponse

func ToV1ErrorResponse(err *models.ErrorResponse) *v1Models.ErrorResponse

ToV1ErrorResponse is a wrapper function to convert a v2 swagger error response to a v1 swagger error response

func TrimRemoveTrailingComma

func TrimRemoveTrailingComma(input string) string

TrimRemoveTrailingComma trims the whitespace on the specified string and removes the trailing comma

func TrimSpaceFromItems

func TrimSpaceFromItems(arr []string) []string

TrimSpaceFromItems is a helper function to trim space on array items

func UploadFileToS3

func UploadFileToS3(file *os.File, projectID string, claType string, identifier string, signatureID string) error

UploadFileToS3 uploads file to s3 storage at path contract-group/<project-ID>/<claType>/<identifier>/<signatureID>.pdf claType should be cla or ccla identifier can be user-id or company-id

func UploadToS3

func UploadToS3(body []byte, projectID string, claType string, identifier string, signatureID string) error

UploadToS3 uploads file to s3 storage at path contract-group/<project-ID>/<claType>/<identifier>/<signatureID>.pdf claType should be cla or ccla identifier can be user-id or company-id

func ValidCompanyName

func ValidCompanyName(name string) bool

ValidCompanyName is a routine to indicate if the regex is a valid company name

func ValidDomain

func ValidDomain(domain string, allowWildcard bool) (string, bool)

ValidDomain tests the specified domain string, returns true if domain is valid, returns false otherwise

func ValidEmail

func ValidEmail(email string) bool

ValidEmail tests the specified email string, returns true if email is valid, returns false otherwise

func ValidGitHubOrg

func ValidGitHubOrg(githubOrg string) (string, bool)

ValidGitHubOrg tests the specified GitHub Organization string, returns true if valid, returns false otherwise

func ValidGitHubUsername

func ValidGitHubUsername(githubUsername string) (string, bool)

ValidGitHubUsername tests the specified GitHub username string, returns true if valid, returns false otherwise

func ValidGitlabOrg

func ValidGitlabOrg(gitlabOrg string) (string, bool)

ValidGitlabOrg tests the specified Gitlab Organization string, returns true if valid, returns false otherwise

func ValidGitlabUsername

func ValidGitlabUsername(gitlabUsername string) (string, bool)

ValidGitlabUsername tests the specified Gitlab username string, returns true if valid, returns false otherwise

func ValidWebsite

func ValidWebsite(website string) bool

ValidWebsite is a routine to indicate if the website is a valid URL

func ValidateAutoEnabledClaGroupID

func ValidateAutoEnabledClaGroupID(autoEnabled bool, autoEnabledClaGroupID string) bool

ValidateAutoEnabledClaGroupID checks for validation if autoEnabled flag is on autoEnabledClaGroupID is enabled as well

func WatermarkPdf

func WatermarkPdf(pdf []byte, text string) ([]byte, error)

WatermarkPdf adds watermark text to the given pdf blob and returns back the new one

Types

type CLAGroupCCLANotConfigured

type CLAGroupCCLANotConfigured struct {
	CLAGroupID   string
	CLAGroupName string
	Err          error
}

CLAGroupCCLANotConfigured is an error model for CLA Group CCLA not configured

func (*CLAGroupCCLANotConfigured) Error

func (e *CLAGroupCCLANotConfigured) Error() string

Error is an error string function for CLA Group CCLA not configured

func (*CLAGroupCCLANotConfigured) Unwrap

func (e *CLAGroupCCLANotConfigured) Unwrap() error

Unwrap method returns its contained error

type CLAGroupICLANotConfigured

type CLAGroupICLANotConfigured struct {
	CLAGroupID   string
	CLAGroupName string
	Err          error
}

CLAGroupICLANotConfigured is an error model for CLA Group ICLA not configured

func (*CLAGroupICLANotConfigured) Error

func (e *CLAGroupICLANotConfigured) Error() string

Error is an error string function for CLA Group ICLA not configured

func (*CLAGroupICLANotConfigured) Unwrap

func (e *CLAGroupICLANotConfigured) Unwrap() error

Unwrap method returns its contained error

type CLAGroupNameConflict

type CLAGroupNameConflict struct {
	CLAGroupID   string
	CLAGroupName string
	Err          error
}

CLAGroupNameConflict is an error model for CLA Group name conflicts

func (*CLAGroupNameConflict) Error

func (e *CLAGroupNameConflict) Error() string

Error is an error string function for CLA Group not found errors

func (*CLAGroupNameConflict) Unwrap

func (e *CLAGroupNameConflict) Unwrap() error

Unwrap method returns its contained error

type CLAGroupNotFound

type CLAGroupNotFound struct {
	CLAGroupID string
	Err        error
}

CLAGroupNotFound is an error model for CLA Group not found errors

func (*CLAGroupNotFound) Error

func (e *CLAGroupNotFound) Error() string

Error is an error string function for CLA Group not found errors

func (*CLAGroupNotFound) Unwrap

func (e *CLAGroupNotFound) Unwrap() error

Unwrap method returns its contained error

type CLAManagerError

type CLAManagerError struct {
	Message string
	Err     error
}

CLAManagerError is an error model for when a CLA Manager error occurs

func (*CLAManagerError) Error

func (e *CLAManagerError) Error() string

Error is an error string function for the CLAManagerError model

func (*CLAManagerError) Unwrap

func (e *CLAManagerError) Unwrap() error

Unwrap method returns its contained error

type CompanyAdminNotFound

type CompanyAdminNotFound struct {
	CompanySFID string
	Err         error
}

CompanyAdminNotFound is an error model for Salesforce Project not found errors

func (*CompanyAdminNotFound) Error

func (e *CompanyAdminNotFound) Error() string

Error is an error string function for the CompanyAdminNotFound model

func (*CompanyAdminNotFound) Unwrap

func (e *CompanyAdminNotFound) Unwrap() error

Unwrap method returns its contained error

type CompanyNotFound

type CompanyNotFound struct {
	Message                  string
	CompanyID                string
	CompanySFID              string
	CompanyName              string
	CompanySigningEntityName string
	Err                      error
}

CompanyNotFound is an error model for company not found errors

func (*CompanyNotFound) Error

func (e *CompanyNotFound) Error() string

Error is an error string function for the CompanyNotFound model

func (*CompanyNotFound) Unwrap

func (e *CompanyNotFound) Unwrap() error

Unwrap method returns its contained error

type ConversionError

type ConversionError struct {
	FromType string
	ToType   string
	Err      error
}

ConversionError is an error model for representing conversion errors

func (*ConversionError) Error

func (e *ConversionError) Error() string

Error is an error string function for Salesforce Project not found errors

func (*ConversionError) Unwrap

func (e *ConversionError) Unwrap() error

Unwrap method returns its contained error

type DynamoUpdateExpression

type DynamoUpdateExpression struct {
	Expression                string
	ExpressionAttributeNames  map[string]*string
	ExpressionAttributeValues map[string]*dynamodb.AttributeValue
}

DynamoUpdateExpression helps build update expression

func NewDynamoUpdateExpression

func NewDynamoUpdateExpression() *DynamoUpdateExpression

NewDynamoUpdateExpression create DynamoUpdateExpression builder

func (*DynamoUpdateExpression) AddAttributeName

func (d *DynamoUpdateExpression) AddAttributeName(name, columName string, condition bool)

AddAttributeName adds the attribute if condition satisfied

func (*DynamoUpdateExpression) AddAttributeValue

func (d *DynamoUpdateExpression) AddAttributeValue(name string, val *dynamodb.AttributeValue, condition bool)

AddAttributeValue adds the attribute value if condition satisfied

func (*DynamoUpdateExpression) AddUpdateExpression

func (d *DynamoUpdateExpression) AddUpdateExpression(columnUpdateExp string, condition bool)

AddUpdateExpression the update expression if condition satisfied

type EmailSender

type EmailSender interface {
	SendEmail(subject string, body string, recipients []string) error
}

EmailSender contains method to send email

func GetEmailSender

func GetEmailSender() EmailSender

GetEmailSender returns back the current email sender

type EnrollError

type EnrollError struct {
	Type    string
	Message string
	Err     error
}

EnrollError is an error model for representing enroll/un-enroll errors

func (*EnrollError) Error

func (e *EnrollError) Error() string

Error is an error string function for enroll/un-enroll error

func (*EnrollError) Unwrap

func (e *EnrollError) Unwrap() error

Unwrap method returns its contained error

type EnrollValidationError

type EnrollValidationError struct {
	Type    string
	Message string
	Err     error
}

EnrollValidationError is an error model for representing enroll/un-enroll validation errors

func (*EnrollValidationError) Error

func (e *EnrollValidationError) Error() string

Error is an error string function for enroll/un-enroll validation error

func (*EnrollValidationError) Unwrap

func (e *EnrollValidationError) Unwrap() error

Unwrap method returns its contained error

type GitHubOrgNotFound

type GitHubOrgNotFound struct {
	ProjectSFID      string
	OrganizationName string
	Err              error
}

GitHubOrgNotFound is an error model for GitHub Organization not found errors

func (*GitHubOrgNotFound) Error

func (e *GitHubOrgNotFound) Error() string

Error is an error string function for project CLA Group not found errors

func (*GitHubOrgNotFound) Unwrap

func (e *GitHubOrgNotFound) Unwrap() error

Unwrap method returns its contained error

type GitHubRepositoryExists

type GitHubRepositoryExists struct {
	Message        string
	RepositoryName string
	Err            error
}

GitHubRepositoryExists is an error model for when a GitHub repository already exists

func (*GitHubRepositoryExists) Error

func (e *GitHubRepositoryExists) Error() string

Error is an error string function for the GitHubRepositoryExists model

func (*GitHubRepositoryExists) Unwrap

func (e *GitHubRepositoryExists) Unwrap() error

Unwrap method returns its contained error

type GitHubRepositoryNotFound

type GitHubRepositoryNotFound struct {
	Message        string
	RepositoryName string
	Err            error
}

GitHubRepositoryNotFound is an error model for a GitHub repository not found

func (*GitHubRepositoryNotFound) Error

func (e *GitHubRepositoryNotFound) Error() string

Error is an error string function for the GitHubRepositoryNotFound model

func (*GitHubRepositoryNotFound) Unwrap

func (e *GitHubRepositoryNotFound) Unwrap() error

Unwrap method returns its contained error

type GitLabDuplicateRepositoriesFound

type GitLabDuplicateRepositoriesFound struct {
	Message              string
	RepositoryName       string
	RepositoryExternalID int64
	Err                  error
}

GitLabDuplicateRepositoriesFound is an error model for a GitLab duplicate repositories found

func (*GitLabDuplicateRepositoriesFound) Error

Error is an error string function for the GitLabDuplicateRepositoriesFound model

func (*GitLabDuplicateRepositoriesFound) Unwrap

Unwrap method returns its contained error

type GitLabRepositoryExists

type GitLabRepositoryExists struct {
	Message        string
	RepositoryName string
	Err            error
}

GitLabRepositoryExists is an error model for when a GitHub repository already exists

func (*GitLabRepositoryExists) Error

func (e *GitLabRepositoryExists) Error() string

Error is an error string function for the GitLabRepositoryExists model

func (*GitLabRepositoryExists) Unwrap

func (e *GitLabRepositoryExists) Unwrap() error

Unwrap method returns its contained error

type GitLabRepositoryNotFound

type GitLabRepositoryNotFound struct {
	Message              string
	OrganizationName     string
	RepositoryName       string
	RepositoryExternalID int64
	ProjectSFID          string
	CLAGroupID           string
	Err                  error
}

GitLabRepositoryNotFound is an error model for a GitLab repository not found

func (*GitLabRepositoryNotFound) Error

func (e *GitLabRepositoryNotFound) Error() string

Error is an error string function for the GitHubRepositoryNotFound model

func (*GitLabRepositoryNotFound) Unwrap

func (e *GitLabRepositoryNotFound) Unwrap() error

Unwrap method returns its contained error

type InvalidCLAType

type InvalidCLAType struct {
	CLAType string
	Err     error
}

InvalidCLAType is an error model for invalid CLA types, usually the CLA type is one of: utils.{ClaTypeICLA,ClaTypeECLA,ClaTypeCCLA}

func (*InvalidCLAType) Error

func (e *InvalidCLAType) Error() string

Error is an error string function for CLA Group not found errors

func (*InvalidCLAType) Unwrap

func (e *InvalidCLAType) Unwrap() error

Unwrap method returns its contained error

type InvalidRepositoryTypeError

type InvalidRepositoryTypeError struct {
	RepositoryType string
	RepositoryName string
	Err            error
}

InvalidRepositoryTypeError is an error model for an invalid repository type

func (*InvalidRepositoryTypeError) Error

Error is an error string function for the InvalidRepositoryTypeError model

func (*InvalidRepositoryTypeError) Unwrap

func (e *InvalidRepositoryTypeError) Unwrap() error

Unwrap method returns its contained error

type MockEmailSender

type MockEmailSender struct{}

MockEmailSender useful when working with tests

func (*MockEmailSender) SendEmail

func (m *MockEmailSender) SendEmail(subject string, body string, recipients []string) error

SendEmail does nothing

type ProjectCLAGroupMappingNotFound

type ProjectCLAGroupMappingNotFound struct {
	ProjectSFID string
	CLAGroupID  string
	Err         error
}

ProjectCLAGroupMappingNotFound is an error model for project CLA Group not found errors

func (*ProjectCLAGroupMappingNotFound) Error

Error is an error string function for project CLA Group not found errors

func (*ProjectCLAGroupMappingNotFound) Unwrap

Unwrap method returns its contained error

type ProjectConflict

type ProjectConflict struct {
	Message  string
	ProjectA ProjectSummary
	ProjectB ProjectSummary
	Err      error
}

ProjectConflict is an error model for project conflict

func (*ProjectConflict) Error

func (e *ProjectConflict) Error() string

Error is an error string function for CLA Group not found errors

func (*ProjectConflict) Unwrap

func (e *ProjectConflict) Unwrap() error

Unwrap method returns its contained error

type ProjectSummary

type ProjectSummary struct {
	ID   string
	Name string
}

ProjectSummary is a quick data model for the project name and ID

type S3Client

type S3Client struct {
	BucketName string
	// contains filtered or unexported fields
}

S3Client struct provide methods to interact with s3

func (*S3Client) Delete

func (s3c *S3Client) Delete(filename string) error

Delete file from s3

func (*S3Client) Download

func (s3c *S3Client) Download(filename string) ([]byte, error)

Download file from s3

func (*S3Client) GetPresignedURL

func (s3c *S3Client) GetPresignedURL(filename string) (string, error)

GetPresignedURL provided presigned url for download

func (*S3Client) KeyExists

func (s3c *S3Client) KeyExists(key string) (bool, error)

KeyExists checks if key exists in s3

func (*S3Client) Upload

func (s3c *S3Client) Upload(fileContent []byte, projectID string, claType string, identifier string, signatureID string) error

Upload file to s3 storage at path contract-group/<project-ID>/<claType>/<identifier>/<signatureID>.pdf claType should be cla or ccla identifier can be user-id or company-id

func (*S3Client) UploadFile

func (s3c *S3Client) UploadFile(file *os.File, projectID string, claType string, identifier string, signatureID string) error

type S3Storage

type S3Storage interface {
	Upload(fileContent []byte, projectID string, claType string, identifier string, signatureID string) error
	UploadFile(file *os.File, projectID string, claType string, identifier string, signatureID string) error
	Download(filename string) ([]byte, error)
	Delete(filename string) error
	GetPresignedURL(filename string) (string, error)
	KeyExists(key string) (bool, error)
}

S3Storage provides methods to handle s3 storage

type SFProjectNotFound

type SFProjectNotFound struct {
	ProjectSFID string
	Err         error
}

SFProjectNotFound is an error model for Salesforce Project not found errors

func (*SFProjectNotFound) Error

func (e *SFProjectNotFound) Error() string

Error is an error string function for Salesforce Project not found errors

func (*SFProjectNotFound) Unwrap

func (e *SFProjectNotFound) Unwrap() error

Unwrap method returns its contained error

type Service

type Service interface {
}

Service interface defines methods of event service

func NewService

func NewService() Service

NewService creates new instance of event service

type StringSet

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

StringSet contains string set

func NewStringSet

func NewStringSet() *StringSet

NewStringSet return new StringSet

func NewStringSetFromStringArray

func NewStringSetFromStringArray(in []string) *StringSet

NewStringSetFromStringArray create string set from string array

func (*StringSet) Add

func (ss *StringSet) Add(v string)

Add adds the string to string set

func (*StringSet) Include

func (ss *StringSet) Include(k string) bool

Include check is string is present in set or not

func (*StringSet) Length

func (ss *StringSet) Length() int

Length is the length of string set

func (*StringSet) List

func (ss *StringSet) List() []string

List returns list of strings in StringSet

type UserNotFound

type UserNotFound struct {
	Message   string
	UserLFID  string
	UserName  string
	UserEmail string
	Err       error
}

UserNotFound is an error model for users not found errors

func (*UserNotFound) Error

func (e *UserNotFound) Error() string

Error is an error string function for the CompanyNotFound model

func (*UserNotFound) Unwrap

func (e *UserNotFound) Unwrap() error

Unwrap method returns its contained error

Jump to

Keyboard shortcuts

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