Documentation ¶
Index ¶
- Constants
- Variables
- func GetDeliveryID(ctx context.Context) string
- type Dao
- type Manager
- type MockManager
- func (_m *MockManager) EXPECT() *MockManager_Expecter
- func (_m *MockManager) GetReport(ctx context.Context, pr string, deliveryID string) (*Report, error)
- func (_m *MockManager) ListReports(ctx context.Context, pr string) ([]ReportMetadata, error)
- func (_m *MockManager) NewReportBuilder(ctx context.Context, pr string, reqID string, deliveryID string) ReportBuilder
- func (_m *MockManager) StoreReport(ctx context.Context, builder ReportBuilder) error
- type MockManager_Expecter
- func (_e *MockManager_Expecter) GetReport(ctx interface{}, pr interface{}, deliveryID interface{}) *MockManager_GetReport_Call
- func (_e *MockManager_Expecter) ListReports(ctx interface{}, pr interface{}) *MockManager_ListReports_Call
- func (_e *MockManager_Expecter) NewReportBuilder(ctx interface{}, pr interface{}, reqID interface{}, deliveryID interface{}) *MockManager_NewReportBuilder_Call
- func (_e *MockManager_Expecter) StoreReport(ctx interface{}, builder interface{}) *MockManager_StoreReport_Call
- type MockManager_GetReport_Call
- func (_c *MockManager_GetReport_Call) Return(_a0 *Report, _a1 error) *MockManager_GetReport_Call
- func (_c *MockManager_GetReport_Call) Run(run func(ctx context.Context, pr string, deliveryID string)) *MockManager_GetReport_Call
- func (_c *MockManager_GetReport_Call) RunAndReturn(run func(context.Context, string, string) (*Report, error)) *MockManager_GetReport_Call
- type MockManager_ListReports_Call
- func (_c *MockManager_ListReports_Call) Return(_a0 []ReportMetadata, _a1 error) *MockManager_ListReports_Call
- func (_c *MockManager_ListReports_Call) Run(run func(ctx context.Context, pr string)) *MockManager_ListReports_Call
- func (_c *MockManager_ListReports_Call) RunAndReturn(run func(context.Context, string) ([]ReportMetadata, error)) *MockManager_ListReports_Call
- type MockManager_NewReportBuilder_Call
- func (_c *MockManager_NewReportBuilder_Call) Return(_a0 ReportBuilder) *MockManager_NewReportBuilder_Call
- func (_c *MockManager_NewReportBuilder_Call) Run(run func(ctx context.Context, pr string, reqID string, deliveryID string)) *MockManager_NewReportBuilder_Call
- func (_c *MockManager_NewReportBuilder_Call) RunAndReturn(run func(context.Context, string, string, string) ReportBuilder) *MockManager_NewReportBuilder_Call
- type MockManager_StoreReport_Call
- func (_c *MockManager_StoreReport_Call) Return(_a0 error) *MockManager_StoreReport_Call
- func (_c *MockManager_StoreReport_Call) Run(run func(ctx context.Context, builder ReportBuilder)) *MockManager_StoreReport_Call
- func (_c *MockManager_StoreReport_Call) RunAndReturn(run func(context.Context, ReportBuilder) error) *MockManager_StoreReport_Call
- type MockReportBuilder
- type MockReportBuilder_AddModuleResult_Call
- func (_c *MockReportBuilder_AddModuleResult_Call) Return() *MockReportBuilder_AddModuleResult_Call
- func (_c *MockReportBuilder_AddModuleResult_Call) Run(run func(module string, result Result)) *MockReportBuilder_AddModuleResult_Call
- func (_c *MockReportBuilder_AddModuleResult_Call) RunAndReturn(run func(string, Result)) *MockReportBuilder_AddModuleResult_Call
- type MockReportBuilder_Expecter
- func (_e *MockReportBuilder_Expecter) AddModuleResult(module interface{}, result interface{}) *MockReportBuilder_AddModuleResult_Call
- func (_e *MockReportBuilder_Expecter) GetReport() *MockReportBuilder_GetReport_Call
- func (_e *MockReportBuilder_Expecter) SetInput(_a0 interface{}) *MockReportBuilder_SetInput_Call
- func (_e *MockReportBuilder_Expecter) SetOutcome(result interface{}) *MockReportBuilder_SetOutcome_Call
- type MockReportBuilder_GetReport_Call
- func (_c *MockReportBuilder_GetReport_Call) Return(_a0 Report) *MockReportBuilder_GetReport_Call
- func (_c *MockReportBuilder_GetReport_Call) Run(run func()) *MockReportBuilder_GetReport_Call
- func (_c *MockReportBuilder_GetReport_Call) RunAndReturn(run func() Report) *MockReportBuilder_GetReport_Call
- type MockReportBuilder_SetInput_Call
- func (_c *MockReportBuilder_SetInput_Call) Return() *MockReportBuilder_SetInput_Call
- func (_c *MockReportBuilder_SetInput_Call) Run(run func(_a0 *input.Model)) *MockReportBuilder_SetInput_Call
- func (_c *MockReportBuilder_SetInput_Call) RunAndReturn(run func(*input.Model)) *MockReportBuilder_SetInput_Call
- type MockReportBuilder_SetOutcome_Call
- func (_c *MockReportBuilder_SetOutcome_Call) Return() *MockReportBuilder_SetOutcome_Call
- func (_c *MockReportBuilder_SetOutcome_Call) Run(run func(result Result)) *MockReportBuilder_SetOutcome_Call
- func (_c *MockReportBuilder_SetOutcome_Call) RunAndReturn(run func(Result)) *MockReportBuilder_SetOutcome_Call
- type Report
- type ReportBuilder
- type ReportMetadata
- type Result
Constants ¶
const DeliveryIDKey ctxKeyDeliveryID = 0
Variables ¶
var ErrReportNotFound = errors.New("report not found")
Functions ¶
func GetDeliveryID ¶
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) }
type MockManager ¶
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 ¶
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 (_c *MockManager_GetReport_Call) Return(_a0 *Report, _a1 error) *MockManager_GetReport_Call
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 ¶
func (_c *MockManager_GetReport_Call) RunAndReturn(run func(context.Context, string, string) (*Report, error)) *MockManager_GetReport_Call
type MockManager_ListReports_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 (_c *MockManager_ListReports_Call) Return(_a0 []ReportMetadata, _a1 error) *MockManager_ListReports_Call
func (*MockManager_ListReports_Call) Run ¶
func (_c *MockManager_ListReports_Call) Run(run func(ctx context.Context, pr string)) *MockManager_ListReports_Call
func (*MockManager_ListReports_Call) RunAndReturn ¶
func (_c *MockManager_ListReports_Call) RunAndReturn(run func(context.Context, string) ([]ReportMetadata, error)) *MockManager_ListReports_Call
type MockManager_NewReportBuilder_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 (_c *MockManager_NewReportBuilder_Call) Return(_a0 ReportBuilder) *MockManager_NewReportBuilder_Call
func (*MockManager_NewReportBuilder_Call) Run ¶
func (_c *MockManager_NewReportBuilder_Call) Run(run func(ctx context.Context, pr string, reqID string, deliveryID string)) *MockManager_NewReportBuilder_Call
func (*MockManager_NewReportBuilder_Call) RunAndReturn ¶
func (_c *MockManager_NewReportBuilder_Call) RunAndReturn(run func(context.Context, string, string, string) ReportBuilder) *MockManager_NewReportBuilder_Call
type MockManager_StoreReport_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 (_c *MockManager_StoreReport_Call) Return(_a0 error) *MockManager_StoreReport_Call
func (*MockManager_StoreReport_Call) Run ¶
func (_c *MockManager_StoreReport_Call) Run(run func(ctx context.Context, builder ReportBuilder)) *MockManager_StoreReport_Call
func (*MockManager_StoreReport_Call) RunAndReturn ¶
func (_c *MockManager_StoreReport_Call) RunAndReturn(run func(context.Context, ReportBuilder) error) *MockManager_StoreReport_Call
type MockReportBuilder ¶
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 (_m *MockReportBuilder) EXPECT() *MockReportBuilder_Expecter
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 ¶
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 (_c *MockReportBuilder_AddModuleResult_Call) Return() *MockReportBuilder_AddModuleResult_Call
func (*MockReportBuilder_AddModuleResult_Call) Run ¶
func (_c *MockReportBuilder_AddModuleResult_Call) Run(run func(module string, result Result)) *MockReportBuilder_AddModuleResult_Call
func (*MockReportBuilder_AddModuleResult_Call) RunAndReturn ¶
func (_c *MockReportBuilder_AddModuleResult_Call) RunAndReturn(run func(string, Result)) *MockReportBuilder_AddModuleResult_Call
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 ¶
func (_e *MockReportBuilder_Expecter) GetReport() *MockReportBuilder_GetReport_Call
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 ¶
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 (_c *MockReportBuilder_GetReport_Call) Return(_a0 Report) *MockReportBuilder_GetReport_Call
func (*MockReportBuilder_GetReport_Call) Run ¶
func (_c *MockReportBuilder_GetReport_Call) Run(run func()) *MockReportBuilder_GetReport_Call
func (*MockReportBuilder_GetReport_Call) RunAndReturn ¶
func (_c *MockReportBuilder_GetReport_Call) RunAndReturn(run func() Report) *MockReportBuilder_GetReport_Call
type MockReportBuilder_SetInput_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 (_c *MockReportBuilder_SetInput_Call) Return() *MockReportBuilder_SetInput_Call
func (*MockReportBuilder_SetInput_Call) Run ¶
func (_c *MockReportBuilder_SetInput_Call) Run(run func(_a0 *input.Model)) *MockReportBuilder_SetInput_Call
func (*MockReportBuilder_SetInput_Call) RunAndReturn ¶
func (_c *MockReportBuilder_SetInput_Call) RunAndReturn(run func(*input.Model)) *MockReportBuilder_SetInput_Call
type MockReportBuilder_SetOutcome_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 (_c *MockReportBuilder_SetOutcome_Call) Return() *MockReportBuilder_SetOutcome_Call
func (*MockReportBuilder_SetOutcome_Call) Run ¶
func (_c *MockReportBuilder_SetOutcome_Call) Run(run func(result Result)) *MockReportBuilder_SetOutcome_Call
func (*MockReportBuilder_SetOutcome_Call) RunAndReturn ¶
func (_c *MockReportBuilder_SetOutcome_Call) RunAndReturn(run func(Result)) *MockReportBuilder_SetOutcome_Call
type Report ¶
type Report struct { ReportMetadata Breakdown map[string]Result `json:"breakdown"` Input *input.Model `json:"input"` }
type ReportBuilder ¶
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"` }