services

package
v0.0.0-...-df38cda Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthorizeHasEASiRole

func AuthorizeHasEASiRole(ctx context.Context) bool

AuthorizeHasEASiRole authorizes that the user can use EASi

func AuthorizeRequireGRTJobCode

func AuthorizeRequireGRTJobCode(ctx context.Context) bool

AuthorizeRequireGRTJobCode authorizes a user as being a member of the GRT (Governance Review Team)

func AuthorizeUserIsBusinessCaseRequester

func AuthorizeUserIsBusinessCaseRequester(ctx context.Context, bizCase *models.BusinessCase) bool

AuthorizeUserIsBusinessCaseRequester authorizes a user as being the requester of the given Business Case

func AuthorizeUserIsIntakeRequester

func AuthorizeUserIsIntakeRequester(ctx context.Context, intake *models.SystemIntake) bool

AuthorizeUserIsIntakeRequester authorizes a user as being the requester of the given System Intake

func HasRole

func HasRole(ctx context.Context, role models.Role) bool

HasRole authorizes a user as having a given role

func NewArchiveSystemIntake

func NewArchiveSystemIntake(
	config Config,
	fetch func(c context.Context, id uuid.UUID) (*models.SystemIntake, error),
	update func(c context.Context, intake *models.SystemIntake) (*models.SystemIntake, error),
	closeBusinessCase func(context.Context, uuid.UUID) error,
	authorized func(context context.Context, intake *models.SystemIntake) bool,
	sendWithdrawEmail func(ctx context.Context, requestName string) error,
) func(context.Context, uuid.UUID) error

NewArchiveSystemIntake is a service to archive a system intake

func NewBackfill

func NewBackfill(
	config Config,
	fetchIntake func(ctx context.Context, id uuid.UUID) (*models.SystemIntake, error),
	fetchIntakeByLifecycleID func(ctx context.Context, lcid string) (*models.SystemIntake, error),
	createIntake func(c context.Context, intake *models.SystemIntake) (*models.SystemIntake, error),
	updateIntake func(ctx context.Context, intake *models.SystemIntake) (*models.SystemIntake, error),
	createNote func(c context.Context, note *models.SystemIntakeNote) (*models.SystemIntakeNote, error),
	authorize func(context.Context) (bool, error),
) func(context.Context, models.SystemIntake, []models.SystemIntakeNote) (bool, error)

NewBackfill imports historical data into EASi

func NewCloseBusinessCase

func NewCloseBusinessCase(
	config Config,
	fetch func(c context.Context, id uuid.UUID) (*models.BusinessCase, error),
	update func(context.Context, *models.BusinessCase) (*models.BusinessCase, error),
) func(context.Context, uuid.UUID) error

NewCloseBusinessCase is a service to close a businessCase

func NewCreateBusinessCase

func NewCreateBusinessCase(
	config Config,
	fetchIntake func(c context.Context, id uuid.UUID) (*models.SystemIntake, error),
	authorized func(c context.Context, i *models.SystemIntake) bool,
	createAction func(context.Context, *models.Action) (*models.Action, error),
	fetchUserInfo func(context.Context, string) (*models.UserInfo, error),
	createBizCase func(context.Context, *models.BusinessCase) (*models.BusinessCase, error),
	updateIntake func(context.Context, *models.SystemIntake) (*models.SystemIntake, error),
) func(c context.Context, b *models.BusinessCase) (*models.BusinessCase, error)

NewCreateBusinessCase is a service to create a business case

func NewFetchBusinessCaseByID

func NewFetchBusinessCaseByID(
	config Config,
	fetch func(c context.Context, id uuid.UUID) (*models.BusinessCase, error),
	authorized func(context.Context) bool,
) func(c context.Context, id uuid.UUID) (*models.BusinessCase, error)

NewFetchBusinessCaseByID is a service to fetch the business case by id

func NewFetchMetrics

func NewFetchMetrics(
	_ Config,
	fetchSystemIntakeMetrics func(context.Context, time.Time, time.Time) (models.SystemIntakeMetrics, error),
) func(c context.Context, st time.Time, et time.Time) (models.MetricsDigest, error)

NewFetchMetrics returns a service for fetching a metrics digest

func NewSaveAction

func NewSaveAction(
	createAction func(context.Context, *models.Action) (*models.Action, error),
	fetchUserInfo func(context.Context, string) (*models.UserInfo, error),
) func(context.Context, *models.Action) error

NewSaveAction adds fields to an action and saves it in the db

func NewTakeAction

func NewTakeAction(
	fetch func(context.Context, uuid.UUID) (*models.SystemIntake, error),
	actionTypeMap map[models.ActionType]ActionExecuter,
) func(context.Context, *models.Action) error

NewTakeAction is a service to create and execute an action

func NewUpdateBusinessCase

func NewUpdateBusinessCase(
	config Config,
	fetchBusinessCase func(c context.Context, id uuid.UUID) (*models.BusinessCase, error),
	authorized func(c context.Context, b *models.BusinessCase) bool,
	update func(c context.Context, businessCase *models.BusinessCase) (*models.BusinessCase, error),
	fetchIntake func(c context.Context, id uuid.UUID) (*models.SystemIntake, error),
	updateIntake func(context.Context, *models.SystemIntake) (*models.SystemIntake, error),
) func(c context.Context, b *models.BusinessCase) (*models.BusinessCase, error)

NewUpdateBusinessCase is a service to create a business case

Types

type ActionExecuter

type ActionExecuter func(context.Context, *models.SystemIntake, *models.Action) error

ActionExecuter is a function that can execute an action

func NewSubmitBusinessCase

func NewSubmitBusinessCase(
	config Config,
	authorized func(context.Context, *models.SystemIntake) bool,
	fetchOpenBusinessCase func(context.Context, uuid.UUID) (*models.BusinessCase, error),
	validateForSubmit func(businessCase *models.BusinessCase) error,
	saveAction func(context.Context, *models.Action) error,
	updateIntake func(context.Context, *models.SystemIntake) (*models.SystemIntake, error),
	updateBusinessCase func(context.Context, *models.BusinessCase) (*models.BusinessCase, error),
	emailRequester func(
		ctx context.Context,
		requesterEmail models.EmailAddress,
		requestName string,
		intakeID uuid.UUID,
		isResubmitted bool,
		isDraft bool,
	) error,
	emailReviewer func(
		ctx context.Context,
		intakeID uuid.UUID,
		requesterName string,
		requestName string,
		isResubmitted bool,
		isDraft bool,
	) error,
	submitToCEDAR func(ctx context.Context, bc models.BusinessCase) error,
) ActionExecuter

NewSubmitBusinessCase returns a function that executes submit of a business case

func NewSubmitSystemIntake

func NewSubmitSystemIntake(
	config Config,
	authorized func(context.Context, *models.SystemIntake) bool,
	update func(context.Context, *models.SystemIntake) (*models.SystemIntake, error),
	submitToCEDAR func(context.Context, *models.SystemIntake) (string, error),
	saveAction func(context.Context, *models.Action) error,
	emailRequester func(
		ctx context.Context,
		requesterEmailAddress models.EmailAddress,
		intakeID uuid.UUID,
		requestName string,
		isResubmitted bool,
	) error,
	emailReviewer func(
		ctx context.Context,
		intakeID uuid.UUID,
		requestName string,
		requesterName string,
		requesterComponent string,
		requestType models.SystemIntakeRequestType,
		processStage string,
		isResubmitted bool,
	) error,
) ActionExecuter

NewSubmitSystemIntake returns a function that executes submit of a system intake

type Config

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

Config holds common configured object for services

func NewConfig

func NewConfig(logger *zap.Logger, ldc *ld.LDClient) Config

NewConfig returns a Config for services

Jump to

Keyboard shortcuts

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