evaluation

package
v0.0.0-...-f70214e Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const DeliveryIDKey ctxKeyDeliveryID = 0

Variables

View Source
var ErrReportNotFound = errors.New("report not found")

Functions

func GetDeliveryID

func GetDeliveryID(ctx context.Context) string

Types

type Dao

type Dao interface {
	GetItem(ctx context.Context, params *dynamodb.GetItemInput,
		optFns ...func(*dynamodb.Options)) (*dynamodb.GetItemOutput, error)
	PutItem(ctx context.Context, params *dynamodb.PutItemInput,
		optFns ...func(*dynamodb.Options)) (*dynamodb.PutItemOutput, error)
	Query(context.Context, *dynamodb.QueryInput, ...func(*dynamodb.Options)) (*dynamodb.QueryOutput, error)
}

type Manager

type Manager interface {
	NewReportBuilder(ctx context.Context, pr, reqID, deliveryID string) ReportBuilder
	GetReport(ctx context.Context, pr, deliveryID string) (*Report, error)
	StoreReport(ctx context.Context, builder ReportBuilder) error
	ListReports(ctx context.Context, pr string) ([]ReportMetadata, error)
}

func NewManager

func NewManager(dao Dao, policyVersion string, ttl time.Duration,
	metrics metrics.Emitter, table string) Manager

type MockManager

type MockManager struct {
	mock.Mock
}

MockManager is an autogenerated mock type for the Manager type

func NewMockManager

func NewMockManager(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockManager

NewMockManager creates a new instance of MockManager. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockManager) EXPECT

func (_m *MockManager) EXPECT() *MockManager_Expecter

func (*MockManager) GetReport

func (_m *MockManager) GetReport(ctx context.Context, pr string, deliveryID string) (*Report, error)

GetReport provides a mock function with given fields: ctx, pr, deliveryID

func (*MockManager) ListReports

func (_m *MockManager) ListReports(ctx context.Context, pr string) ([]ReportMetadata, error)

ListReports provides a mock function with given fields: ctx, pr

func (*MockManager) NewReportBuilder

func (_m *MockManager) NewReportBuilder(ctx context.Context, pr string, reqID string, deliveryID string) ReportBuilder

NewReportBuilder provides a mock function with given fields: ctx, pr, reqID, deliveryID

func (*MockManager) StoreReport

func (_m *MockManager) StoreReport(ctx context.Context, builder ReportBuilder) error

StoreReport provides a mock function with given fields: ctx, builder

type MockManager_Expecter

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

func (*MockManager_Expecter) GetReport

func (_e *MockManager_Expecter) GetReport(ctx interface{}, pr interface{}, deliveryID interface{}) *MockManager_GetReport_Call

GetReport is a helper method to define mock.On call

  • ctx context.Context
  • pr string
  • deliveryID string

func (*MockManager_Expecter) ListReports

func (_e *MockManager_Expecter) ListReports(ctx interface{}, pr interface{}) *MockManager_ListReports_Call

ListReports is a helper method to define mock.On call

  • ctx context.Context
  • pr string

func (*MockManager_Expecter) NewReportBuilder

func (_e *MockManager_Expecter) NewReportBuilder(ctx interface{}, pr interface{}, reqID interface{}, deliveryID interface{}) *MockManager_NewReportBuilder_Call

NewReportBuilder is a helper method to define mock.On call

  • ctx context.Context
  • pr string
  • reqID string
  • deliveryID string

func (*MockManager_Expecter) StoreReport

func (_e *MockManager_Expecter) StoreReport(ctx interface{}, builder interface{}) *MockManager_StoreReport_Call

StoreReport is a helper method to define mock.On call

  • ctx context.Context
  • builder ReportBuilder

type MockManager_GetReport_Call

type MockManager_GetReport_Call struct {
	*mock.Call
}

MockManager_GetReport_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetReport'

func (*MockManager_GetReport_Call) Return

func (*MockManager_GetReport_Call) Run

func (_c *MockManager_GetReport_Call) Run(run func(ctx context.Context, pr string, deliveryID string)) *MockManager_GetReport_Call

func (*MockManager_GetReport_Call) RunAndReturn

type MockManager_ListReports_Call

type MockManager_ListReports_Call struct {
	*mock.Call
}

MockManager_ListReports_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListReports'

func (*MockManager_ListReports_Call) Return

func (*MockManager_ListReports_Call) Run

func (*MockManager_ListReports_Call) RunAndReturn

type MockManager_NewReportBuilder_Call

type MockManager_NewReportBuilder_Call struct {
	*mock.Call
}

MockManager_NewReportBuilder_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'NewReportBuilder'

func (*MockManager_NewReportBuilder_Call) Return

func (*MockManager_NewReportBuilder_Call) Run

func (*MockManager_NewReportBuilder_Call) RunAndReturn

type MockManager_StoreReport_Call

type MockManager_StoreReport_Call struct {
	*mock.Call
}

MockManager_StoreReport_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'StoreReport'

func (*MockManager_StoreReport_Call) Return

func (*MockManager_StoreReport_Call) Run

func (*MockManager_StoreReport_Call) RunAndReturn

type MockReportBuilder

type MockReportBuilder struct {
	mock.Mock
}

MockReportBuilder is an autogenerated mock type for the ReportBuilder type

func NewMockReportBuilder

func NewMockReportBuilder(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockReportBuilder

NewMockReportBuilder creates a new instance of MockReportBuilder. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockReportBuilder) AddModuleResult

func (_m *MockReportBuilder) AddModuleResult(module string, result Result)

AddModuleResult provides a mock function with given fields: module, result

func (*MockReportBuilder) EXPECT

func (*MockReportBuilder) GetReport

func (_m *MockReportBuilder) GetReport() Report

GetReport provides a mock function with given fields:

func (*MockReportBuilder) SetInput

func (_m *MockReportBuilder) SetInput(_a0 *input.Model)

SetInput provides a mock function with given fields: _a0

func (*MockReportBuilder) SetOutcome

func (_m *MockReportBuilder) SetOutcome(result Result)

SetOutcome provides a mock function with given fields: result

type MockReportBuilder_AddModuleResult_Call

type MockReportBuilder_AddModuleResult_Call struct {
	*mock.Call
}

MockReportBuilder_AddModuleResult_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddModuleResult'

func (*MockReportBuilder_AddModuleResult_Call) Return

func (*MockReportBuilder_AddModuleResult_Call) Run

func (*MockReportBuilder_AddModuleResult_Call) RunAndReturn

type MockReportBuilder_Expecter

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

func (*MockReportBuilder_Expecter) AddModuleResult

func (_e *MockReportBuilder_Expecter) AddModuleResult(module interface{}, result interface{}) *MockReportBuilder_AddModuleResult_Call

AddModuleResult is a helper method to define mock.On call

  • module string
  • result Result

func (*MockReportBuilder_Expecter) GetReport

GetReport is a helper method to define mock.On call

func (*MockReportBuilder_Expecter) SetInput

func (_e *MockReportBuilder_Expecter) SetInput(_a0 interface{}) *MockReportBuilder_SetInput_Call

SetInput is a helper method to define mock.On call

  • _a0 *input.Model

func (*MockReportBuilder_Expecter) SetOutcome

func (_e *MockReportBuilder_Expecter) SetOutcome(result interface{}) *MockReportBuilder_SetOutcome_Call

SetOutcome is a helper method to define mock.On call

  • result Result

type MockReportBuilder_GetReport_Call

type MockReportBuilder_GetReport_Call struct {
	*mock.Call
}

MockReportBuilder_GetReport_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetReport'

func (*MockReportBuilder_GetReport_Call) Return

func (*MockReportBuilder_GetReport_Call) Run

func (*MockReportBuilder_GetReport_Call) RunAndReturn

type MockReportBuilder_SetInput_Call

type MockReportBuilder_SetInput_Call struct {
	*mock.Call
}

MockReportBuilder_SetInput_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetInput'

func (*MockReportBuilder_SetInput_Call) Return

func (*MockReportBuilder_SetInput_Call) Run

func (*MockReportBuilder_SetInput_Call) RunAndReturn

type MockReportBuilder_SetOutcome_Call

type MockReportBuilder_SetOutcome_Call struct {
	*mock.Call
}

MockReportBuilder_SetOutcome_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetOutcome'

func (*MockReportBuilder_SetOutcome_Call) Return

func (*MockReportBuilder_SetOutcome_Call) Run

func (*MockReportBuilder_SetOutcome_Call) RunAndReturn

type Report

type Report struct {
	ReportMetadata
	Breakdown map[string]Result `json:"breakdown"`
	Input     *input.Model      `json:"input"`
}

type ReportBuilder

type ReportBuilder interface {
	AddModuleResult(module string, result Result)
	SetInput(input *input.Model)
	SetOutcome(result Result)
	GetReport() Report
}

type ReportMetadata

type ReportMetadata struct {
	PR            string `json:"pr"`
	Title         string `json:"title"`
	Author        string `json:"author"`
	RequestID     string `json:"request_id"`
	DeliveryID    string `json:"delivery_id"`
	PolicyVersion string `json:"policy_version"`
	Outcome       Result `json:"outcome"`
	ExpireAt      int64  `json:"expire_at"`
	CreatedAt     int64  `json:"created_at"`
	Event         string `json:"event"`
	Action        string `json:"action"`
}

type Result

type Result struct {
	Result types.Result `json:"result"`
	Err    error        `json:"err"`
}

Jump to

Keyboard shortcuts

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