services

package
v0.0.0-...-b3f093e Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthorizeHasEASiRole

func AuthorizeHasEASiRole(ctx context.Context) (bool, error)

AuthorizeHasEASiRole authorizes that the user can use EASi

func AuthorizeRequireGRTJobCode

func AuthorizeRequireGRTJobCode(ctx context.Context) (bool, error)

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, error)

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

func AuthorizeUserIsIntakeRequester

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

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

func AuthorizeUserIsIntakeRequesterOrHasGRTJobCode

func AuthorizeUserIsIntakeRequesterOrHasGRTJobCode(ctx context.Context, existingIntake *models.SystemIntake) (bool, error)

AuthorizeUserIsIntakeRequesterOrHasGRTJobCode authorizes a user as being a member of the GRT (Governance Review Team) or being the owner of the system intake

func HasRole

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

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,
	authorize func(context context.Context, intake *models.SystemIntake) (bool, error),
	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),
	authorize func(c context.Context, i *models.SystemIntake) (bool, error),
	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),
	authorize func(context.Context) (bool, error),
) 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 NewFetchSystemIntakeByID

func NewFetchSystemIntakeByID(
	config Config,
	fetch func(c context.Context, id uuid.UUID) (*models.SystemIntake, error),
	authorize func(context.Context) (bool, error),
) func(c context.Context, u uuid.UUID) (*models.SystemIntake, error)

NewFetchSystemIntakeByID is a service to fetch the system intake by intake id

func NewFetchSystemIntakes

func NewFetchSystemIntakes(
	config Config,
	fetchByID func(c context.Context, euaID string) (models.SystemIntakes, error),
	fetchAll func(context.Context) (models.SystemIntakes, error),
	authorize func(c context.Context) (bool, error),
) func(context.Context) (models.SystemIntakes, error)

NewFetchSystemIntakes is a service to fetch multiple system intakes that are to be presented to the given requester

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),
	authorize func(c context.Context, b *models.BusinessCase) (bool, error),
	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

func NewUpdateDraftSystemIntake

func NewUpdateDraftSystemIntake(
	config Config,
	authorize func(context.Context, *models.SystemIntake) (bool, error),
	update func(context.Context, *models.SystemIntake) (*models.SystemIntake, error),
) func(context.Context, *models.SystemIntake, *models.SystemIntake) (*models.SystemIntake, error)

NewUpdateDraftSystemIntake returns a function that executes update of a system intake in Draft

func NewUpdateSystemIntake

func NewUpdateSystemIntake(
	config Config,
	fetch func(c context.Context, id uuid.UUID) (*models.SystemIntake, error),
	update func(c context.Context, intake *models.SystemIntake) (*models.SystemIntake, error),
	authorize func(context.Context, *models.SystemIntake) (bool, error),
) func(c context.Context, i *models.SystemIntake) (*models.SystemIntake, error)

NewUpdateSystemIntake is a service to update a system intake

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,
	authorize func(context.Context, *models.SystemIntake) (bool, error),
	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,
	authorize func(context.Context, *models.SystemIntake) (bool, error),
	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