Documentation ¶
Index ¶
- Constants
- func ApplicationTestServername() auth.ApplicationServername
- func FmtBool(b bool) *bool
- func FmtCost(c *unit.Cents) *int64
- func FmtDate(date time.Time) *strfmt.Date
- func FmtDatePtr(date *time.Time) *strfmt.Date
- func FmtDatePtrToPop(date *strfmt.Date) time.Time
- func FmtDatePtrToPopPtr(date *strfmt.Date) *time.Time
- func FmtDateSlice(dates []time.Time) []strfmt.Date
- func FmtDateTime(dateTime time.Time) *strfmt.DateTime
- func FmtDateTimePtr(dateTime *time.Time) *strfmt.DateTime
- func FmtDateTimePtrToPop(date *strfmt.DateTime) time.Time
- func FmtDateTimePtrToPopPtr(date *strfmt.DateTime) *time.Time
- func FmtEmail(email string) *strfmt.Email
- func FmtEmailPtr(email *string) *strfmt.Email
- func FmtInt(i int) *int
- func FmtInt64(i int64) *int64
- func FmtInt64PtrToPopPtr(c *int64) *unit.Cents
- func FmtIntPtrToInt64(i *int) *int64
- func FmtMilliCentsPtr(c *unit.Millicents) *int64
- func FmtNullableStringToStringPtrNilToBlankString(n nullable.String) *string
- func FmtNullableStringToStringPtrNilToNil(n nullable.String) *string
- func FmtPoundPtr(weight *unit.Pound) *int64
- func FmtSSN(s string) *strfmt.SSN
- func FmtString(s string) *string
- func FmtStringPtr(s *string) *string
- func FmtStringPtrNonEmpty(s *string) *string
- func FmtURI(uri string) *strfmt.URI
- func FmtUUID(u uuid.UUID) *strfmt.UUID
- func FmtUUIDPtr(u *uuid.UUID) *strfmt.UUID
- func FmtUUIDPtrToPopPtr(u *strfmt.UUID) *uuid.UUID
- func FmtUUIDToPop(u strfmt.UUID) uuid.UUID
- func FmtUUIDValue(u uuid.UUID) strfmt.UUID
- func NewClientLogHandler(appCtx appcontext.AppContext) http.HandlerFunc
- func NewCookieUpdateResponder(request *http.Request, responder middleware.Responder, ...) middleware.Responder
- func NewFileHandler(fs afero.Fs, entrypoint string) http.HandlerFunc
- func NewHealthHandler(appCtx appcontext.AppContext, redisPool *redis.Pool, gitBranch string, ...) http.HandlerFunc
- func PoundPtrFromInt64Ptr(num *int64) *unit.Pound
- func ResponseForConflictErrors(logger *zap.Logger, err error) middleware.Responder
- func ResponseForCustomErrors(logger *zap.Logger, err error, httpStatus int) middleware.Responder
- func ResponseForError(logger *zap.Logger, err error) middleware.Responder
- func ResponseForVErrors(logger *zap.Logger, verrs *validate.Errors, err error) middleware.Responder
- func ServeCustomError(rw http.ResponseWriter, r *http.Request, err error)
- func StringFromEmail(email *strfmt.Email) *string
- func StringFromSSN(ssn *strfmt.SSN) *string
- type AuditableAppContextBasicHandler
- type BaseHandlerTestSuite
- func (suite *BaseHandlerTestSuite) AuthenticateAdminRequest(req *http.Request, user models.User) *http.Request
- func (suite *BaseHandlerTestSuite) AuthenticateOfficeRequest(req *http.Request, user models.OfficeUser) *http.Request
- func (suite *BaseHandlerTestSuite) AuthenticateRequest(req *http.Request, serviceMember models.ServiceMember) *http.Request
- func (suite *BaseHandlerTestSuite) AuthenticateUserRequest(req *http.Request, user models.User) *http.Request
- func (suite *BaseHandlerTestSuite) CheckErrorResponse(resp middleware.Responder, code int, name string)
- func (suite *BaseHandlerTestSuite) CheckNotErrorResponse(resp middleware.Responder)
- func (suite *BaseHandlerTestSuite) CheckResponseBadRequest(resp middleware.Responder)
- func (suite *BaseHandlerTestSuite) CheckResponseForbidden(resp middleware.Responder)
- func (suite *BaseHandlerTestSuite) CheckResponseInternalServerError(resp middleware.Responder)
- func (suite *BaseHandlerTestSuite) CheckResponseNotFound(resp middleware.Responder)
- func (suite *BaseHandlerTestSuite) CheckResponseTeapot(resp middleware.Responder)
- func (suite *BaseHandlerTestSuite) CheckResponseUnauthorized(resp middleware.Responder)
- func (suite *BaseHandlerTestSuite) CloseFile(file *runtime.File)
- func (suite *BaseHandlerTestSuite) EqualCentsPointers(expected *unit.Cents, actual *int64)
- func (suite *BaseHandlerTestSuite) EqualDate(expected time.Time, actual strfmt.Date)
- func (suite *BaseHandlerTestSuite) EqualDatePtr(expected *time.Time, actual *strfmt.Date)
- func (suite *BaseHandlerTestSuite) EqualDateTime(expected time.Time, actual strfmt.DateTime)
- func (suite *BaseHandlerTestSuite) EqualDateTimePtr(expected *time.Time, actual *strfmt.DateTime)
- func (suite *BaseHandlerTestSuite) EqualPoundPointers(expected *unit.Pound, actual *int64)
- func (suite *BaseHandlerTestSuite) EqualUUID(expected uuid.UUID, actual strfmt.UUID)
- func (suite *BaseHandlerTestSuite) EqualUUIDPointers(expected *uuid.UUID, actual *strfmt.UUID)
- func (suite *BaseHandlerTestSuite) Fixture(name string) *runtime.File
- func (suite *BaseHandlerTestSuite) HandlerConfig() *Config
- func (suite *BaseHandlerTestSuite) HasNoWebhookNotification(objectID uuid.UUID, traceID uuid.UUID)
- func (suite *BaseHandlerTestSuite) HasWebhookNotification(objectID uuid.UUID, traceID uuid.UUID)
- func (suite *BaseHandlerTestSuite) IsNotErrResponse(response middleware.Responder)
- func (suite *BaseHandlerTestSuite) SetTestFilesToClose(filesToClose []*runtime.File)
- func (suite *BaseHandlerTestSuite) TestFilesToClose() []*runtime.File
- func (suite *BaseHandlerTestSuite) TestNotificationSender() notifications.NotificationSender
- type ClientLogEntry
- type ClientLogMessage
- type ClientLogUpload
- type ClientLoggerStats
- type Config
- func (c *Config) AppContextFromRequest(r *http.Request) appcontext.AppContext
- func (c *Config) AppNames() auth.ApplicationServername
- func (c *Config) AuditableAppContextFromRequestBasicHandler(handler AuditableAppContextBasicHandler) http.Handler
- func (c *Config) AuditableAppContextFromRequestWithErrors(r *http.Request, ...) middleware.Responder
- func (c *Config) CookieSecret() string
- func (c *Config) DTODPlanner() route.Planner
- func (c *Config) FeatureFlagFetcher() services.FeatureFlagFetcher
- func (c *Config) FileStorer() storage.FileStorer
- func (c *Config) GetTraceIDFromRequest(r *http.Request) uuid.UUID
- func (c *Config) GexSender() services.GexSender
- func (c *Config) HHGPlanner() route.Planner
- func (c *Config) ICNSequencer() sequence.Sequencer
- func (c *Config) IWSPersonLookup() iws.PersonLookup
- func (c *Config) NotificationSender() notifications.NotificationSender
- func (c *Config) SendProductionInvoice() bool
- func (c *Config) SessionManagers() auth.AppSessionManagers
- func (c *Config) SetAppNames(appNames auth.ApplicationServername)
- func (c *Config) SetCookieSecret(cookieSecret string)
- func (c *Config) SetDTODPlanner(planner route.Planner)
- func (c *Config) SetFeatureFlagFetcher(fff services.FeatureFlagFetcher)
- func (c *Config) SetFileStorer(storer storage.FileStorer)
- func (c *Config) SetGexSender(sendGexRequest services.GexSender)
- func (c *Config) SetHHGPlanner(planner route.Planner)
- func (c *Config) SetICNSequencer(sequencer sequence.Sequencer)
- func (c *Config) SetIWSPersonLookup(rbs iws.PersonLookup)
- func (c *Config) SetNotificationSender(sender notifications.NotificationSender)
- func (c *Config) SetPlanner(planner route.Planner)
- func (c *Config) SetSendProductionInvoice(sendProductionInvoice bool)
- func (c *Config) SetUseSecureCookie(useSecureCookie bool)
- func (c *Config) UseSecureCookie() bool
- type CookieUpdateResponder
- type CustomFileSystem
- type ErrResponse
- type HandlerConfig
- type SpaHandler
- type ValidationErrorListResponse
- type ValidationErrorsResponse
Constants ¶
const ( // OfficeTestHost OfficeTestHost string = "office.example.com" // MilTestHost MilTestHost string = "mil.example.com" // OrdersTestHost OrdersTestHost string = "orders.example.com" // AdminTestHost AdminTestHost string = "admin.example.com" // PrimeTestHost PrimeTestHost string = "prime.example.com" )
const BadRequestErrMessage string = "Bad Request"
BadRequestErrMessage indicates that the request was malformed
const ConflictErrMessage string = "Conflict Error"
ConflictErrMessage indicates that there was a conflict with input values
const ForbiddenErrMessage string = "Forbidden"
ForbiddenErrMessage indicates the caller is forbidden
const InternalServerErrDetail string = "An internal server error has occurred"
InternalServerErrDetail provides a default detail string
const InternalServerErrMessage string = "Internal Server Error"
InternalServerErrMessage indicates that there was an internal server error
const MethodNotAllowedErrMessage string = "Method Not Allowed"
MethodNotAllowedErrMessage indicates that the particular http request method was not allowed
const NilErrMessage string = "Nil error passed"
NilErrMessage indicates an uninstantiated error was passed
const NotAcceptableErrMessage string = "Not Acceptable"
NotAcceptableErrMessage indicates the server does not accept the media type requested
const NotFoundMessage string = "Not Found Error"
NotFoundMessage indicates a resource was not found
const NotImplementedErrDetail string = "This feature is in development"
NotImplementedErrDetail indicates an endpoint has not been implemented
const NotImplementedErrMessage string = "Not Implemented"
NotImplementedErrMessage indicates an endpoint has not been implemented
const PreconditionErrMessage string = "Precondition Failed"
PreconditionErrMessage indicates that the IfMatch header (eTag) was stale
const SQLErrMessage string = "Unhandled data error encountered"
SQLErrMessage represents string value to represent generic sql error to avoid leaking implementation details
ServiceUnavailableErrMessage indicates the service is currently unavailable
UnauthorizedErrMessage indicates the caller is not authorized
const UnsupportedMediaTypeErrMessage string = "Unsupported Media Type"
UnsupportedMediaTypeErrMessage indicates the server does not accept the media type sent
const ValidationErrMessage string = "Validation Error"
ValidationErrMessage indicates that some fields were invalid
Variables ¶
This section is empty.
Functions ¶
func ApplicationTestServername ¶
func ApplicationTestServername() auth.ApplicationServername
ApplicationTestServername is a collection of the test servernames
func FmtDatePtr ¶
FmtDatePtr converts pop type to go-swagger type
func FmtDatePtrToPop ¶
FmtDatePtrToPopPtr converts go-swagger type to pop type
func FmtDatePtrToPopPtr ¶
FmtDatePtrToPopPtr converts go-swagger type to pop type
func FmtDateSlice ¶
FmtDateSlice converts []time.Time to []strfmt.Date
func FmtDateTime ¶
FmtDateTime converts pop type to go-swagger type
func FmtDateTimePtr ¶
FmtDateTimePtr converts pop type to go-swagger type
func FmtDateTimePtrToPop ¶
FmtDateTimePtrToPop converts go-swagger type time to pop time
func FmtDateTimePtrToPopPtr ¶
FmtDateTimePtrToPopPtr converts go-swagger type to pop type
func FmtEmailPtr ¶
FmtEmailPtr converts pop type to go-swagger type
func FmtInt64PtrToPopPtr ¶
FmtInt64PtrToPopPtr converts go-swagger type to pop type
func FmtIntPtrToInt64 ¶
FmtIntPtrToInt64 converts pop type to go-swagger type
func FmtMilliCentsPtr ¶
func FmtMilliCentsPtr(c *unit.Millicents) *int64
FmtMilliCentsPtr converts pop type to go-swagger type
func FmtNullableStringToStringPtrNilToBlankString ¶
FmtNullableStringToStringPtrNilToBlankString converts go-swagger nullable string type to a string pointer type. If the value is nil, it returns a pointer to an empty string. This can be useful for updating models so that the service object knows to blank out the field.
func FmtNullableStringToStringPtrNilToNil ¶
FmtNullableStringToStringPtrNilToNil converts go-swagger nullable string type to a string pointer type. If the value is nil, it returns nil. This can be useful for when we create a new model instance and don't want blank string values to be saved to the database.
func FmtPoundPtr ¶
FmtPoundPtr converts pop type to go-swagger type
func FmtStringPtr ¶
FmtStringPtr converts pop type to go-swagger type
func FmtStringPtrNonEmpty ¶
FmtStringPtrNonEmpty converts an empty string (after trimming) to a nil.
func FmtUUIDPtr ¶
FmtUUIDPtr converts pop type to go-swagger type
func FmtUUIDPtrToPopPtr ¶
FmtUUIDPtrToPopPtr converts go-swagger uuid type to pop type
func FmtUUIDToPop ¶
FmtUUIDToPop converts go-swagger uuid type to pop type
func FmtUUIDValue ¶
FmtUUIDValue converts pop UUID value type to go-swagger UUID value type
func NewClientLogHandler ¶
func NewClientLogHandler(appCtx appcontext.AppContext) http.HandlerFunc
NewClientLogHandler creates a handler for receiving client logs
func NewCookieUpdateResponder ¶
func NewCookieUpdateResponder(request *http.Request, responder middleware.Responder, sessionManager auth.SessionManager, session *auth.Session) middleware.Responder
NewCookieUpdateResponder constructs a wrapper for the responder which will update cookies
func NewFileHandler ¶
func NewFileHandler(fs afero.Fs, entrypoint string) http.HandlerFunc
NewFileHandler serves up a single file from a custom filesystem. Use the custom filesystem for ease of testing
func NewHealthHandler ¶
func NewHealthHandler(appCtx appcontext.AppContext, redisPool *redis.Pool, gitBranch string, gitCommit string) http.HandlerFunc
NewHealthHandler creates a http.HandlerFunc for a health endpoint. If redisPool is nil, redis health will not be checked
func PoundPtrFromInt64Ptr ¶
PoundPtrFromInt64Ptr converts go-swagger type to pop type
func ResponseForConflictErrors ¶
func ResponseForConflictErrors(logger *zap.Logger, err error) middleware.Responder
ResponseForConflictErrors checks for conflict errors
func ResponseForCustomErrors ¶
ResponseForCustomErrors checks for custom errors and returns a custom response body message
func ResponseForError ¶
func ResponseForError(logger *zap.Logger, err error) middleware.Responder
ResponseForError logs an error and returns the expected error type
func ResponseForVErrors ¶
func ResponseForVErrors(logger *zap.Logger, verrs *validate.Errors, err error) middleware.Responder
ResponseForVErrors checks for validation errors
func ServeCustomError ¶
func ServeCustomError(rw http.ResponseWriter, r *http.Request, err error)
ServeCustomError is called by a hook provided by openapi to handle errors generated by that package. We override it below so that we can populate the title, detail, instance into the payload to match Milmove's desired error format.
func StringFromEmail ¶
StringFromEmail converts pop type to go-swagger type
func StringFromSSN ¶
StringFromSSN converts pop type to go-swagger type
Types ¶
type AuditableAppContextBasicHandler ¶
type AuditableAppContextBasicHandler func(appCtx appcontext.AppContext, w http.ResponseWriter, r *http.Request) error
type BaseHandlerTestSuite ¶
type BaseHandlerTestSuite struct { *testingsuite.PopTestSuite // contains filtered or unexported fields }
BaseHandlerTestSuite abstracts the common methods needed for handler tests
func NewBaseHandlerTestSuite ¶
func NewBaseHandlerTestSuite(sender notifications.NotificationSender, packageName testingsuite.PackageName, opts ...testingsuite.PopTestSuiteOption) BaseHandlerTestSuite
NewBaseHandlerTestSuite returns a new BaseHandlerTestSuite
func (*BaseHandlerTestSuite) AuthenticateAdminRequest ¶
func (suite *BaseHandlerTestSuite) AuthenticateAdminRequest(req *http.Request, user models.User) *http.Request
AuthenticateAdminRequest authenticates Admin users
func (*BaseHandlerTestSuite) AuthenticateOfficeRequest ¶
func (suite *BaseHandlerTestSuite) AuthenticateOfficeRequest(req *http.Request, user models.OfficeUser) *http.Request
AuthenticateOfficeRequest authenticates Office users
func (*BaseHandlerTestSuite) AuthenticateRequest ¶
func (suite *BaseHandlerTestSuite) AuthenticateRequest(req *http.Request, serviceMember models.ServiceMember) *http.Request
AuthenticateRequest Request authenticated with a service member
func (*BaseHandlerTestSuite) AuthenticateUserRequest ¶
func (suite *BaseHandlerTestSuite) AuthenticateUserRequest(req *http.Request, user models.User) *http.Request
AuthenticateUserRequest only authenticated with a bare user - have no idea if they are a service member yet
func (*BaseHandlerTestSuite) CheckErrorResponse ¶
func (suite *BaseHandlerTestSuite) CheckErrorResponse(resp middleware.Responder, code int, name string)
CheckErrorResponse verifies error response is what is expected
func (*BaseHandlerTestSuite) CheckNotErrorResponse ¶
func (suite *BaseHandlerTestSuite) CheckNotErrorResponse(resp middleware.Responder)
CheckNotErrorResponse verifies there is no error response
func (*BaseHandlerTestSuite) CheckResponseBadRequest ¶
func (suite *BaseHandlerTestSuite) CheckResponseBadRequest(resp middleware.Responder)
CheckResponseBadRequest looks at BadRequest errors
func (*BaseHandlerTestSuite) CheckResponseForbidden ¶
func (suite *BaseHandlerTestSuite) CheckResponseForbidden(resp middleware.Responder)
CheckResponseForbidden looks at Forbidden errors
func (*BaseHandlerTestSuite) CheckResponseInternalServerError ¶
func (suite *BaseHandlerTestSuite) CheckResponseInternalServerError(resp middleware.Responder)
CheckResponseInternalServerError looks at InternalServerError errors
func (*BaseHandlerTestSuite) CheckResponseNotFound ¶
func (suite *BaseHandlerTestSuite) CheckResponseNotFound(resp middleware.Responder)
CheckResponseNotFound looks at NotFound errors
func (*BaseHandlerTestSuite) CheckResponseTeapot ¶
func (suite *BaseHandlerTestSuite) CheckResponseTeapot(resp middleware.Responder)
CheckResponseTeapot enforces that response come from a Teapot
func (*BaseHandlerTestSuite) CheckResponseUnauthorized ¶
func (suite *BaseHandlerTestSuite) CheckResponseUnauthorized(resp middleware.Responder)
CheckResponseUnauthorized looks at Unauthorized errors
func (*BaseHandlerTestSuite) CloseFile ¶
func (suite *BaseHandlerTestSuite) CloseFile(file *runtime.File)
CloseFile adds a single file to close at the end of tests to the list of files
func (*BaseHandlerTestSuite) EqualCentsPointers ¶
func (suite *BaseHandlerTestSuite) EqualCentsPointers(expected *unit.Cents, actual *int64)
EqualCentsPointers compares the unit.Cent from the model with the int64 from the payload If one is nil, both should be nil, else they should match in value
func (*BaseHandlerTestSuite) EqualDate ¶
func (suite *BaseHandlerTestSuite) EqualDate(expected time.Time, actual strfmt.Date)
EqualDate compares the time.Time from the model with the strfmt.Date from the payload
func (*BaseHandlerTestSuite) EqualDatePtr ¶
func (suite *BaseHandlerTestSuite) EqualDatePtr(expected *time.Time, actual *strfmt.Date)
EqualDatePtr compares the time.Time from the model with the strfmt.date from the payload If one is nil, both should be nil, else they should match in value This is to be strictly used for dates as it drops any time parameters in the comparison
func (*BaseHandlerTestSuite) EqualDateTime ¶
func (suite *BaseHandlerTestSuite) EqualDateTime(expected time.Time, actual strfmt.DateTime)
EqualDateTime compares the time.Time from the model with the strfmt.DateTime from the payload
func (*BaseHandlerTestSuite) EqualDateTimePtr ¶
func (suite *BaseHandlerTestSuite) EqualDateTimePtr(expected *time.Time, actual *strfmt.DateTime)
EqualDateTimePtr compares the time.Time from the model with the strfmt.date from the payload If one is nil, both should be nil, else they should match in value.
func (*BaseHandlerTestSuite) EqualPoundPointers ¶
func (suite *BaseHandlerTestSuite) EqualPoundPointers(expected *unit.Pound, actual *int64)
EqualPoundPointers compares the unit.Pound from the model with the int64 from the payload If one is nil, both should be nil, else they should match in value
func (*BaseHandlerTestSuite) EqualUUID ¶
func (suite *BaseHandlerTestSuite) EqualUUID(expected uuid.UUID, actual strfmt.UUID)
EqualUUID compares the uuid.UUID from the model with the strfmt.UUID from the payload
func (*BaseHandlerTestSuite) EqualUUIDPointers ¶
func (suite *BaseHandlerTestSuite) EqualUUIDPointers(expected *uuid.UUID, actual *strfmt.UUID)
EqualUUIDPointers compares the uuid.UUID from the model with the strfmt.UUID from the payload If one is nil, both should be nil, else they should match in value
func (*BaseHandlerTestSuite) Fixture ¶
func (suite *BaseHandlerTestSuite) Fixture(name string) *runtime.File
Fixture allows us to include a fixture like a PDF in the test
func (*BaseHandlerTestSuite) HandlerConfig ¶
func (suite *BaseHandlerTestSuite) HandlerConfig() *Config
HandlerConfig returns a mostly empty handler config for testing. NOTE: it returns the Config implementation, not the HandlerConfig interface, so overrides can be made to the config
func (*BaseHandlerTestSuite) HasNoWebhookNotification ¶
func (suite *BaseHandlerTestSuite) HasNoWebhookNotification(objectID uuid.UUID, traceID uuid.UUID)
HasNoWebhookNotification checks that there's no record on the WebhookNotifications table for the object and trace IDs
func (*BaseHandlerTestSuite) HasWebhookNotification ¶
func (suite *BaseHandlerTestSuite) HasWebhookNotification(objectID uuid.UUID, traceID uuid.UUID)
HasWebhookNotification checks that there's a record on the WebhookNotifications table for the object and trace IDs
func (*BaseHandlerTestSuite) IsNotErrResponse ¶
func (suite *BaseHandlerTestSuite) IsNotErrResponse(response middleware.Responder)
IsNotErrResponse enforces handler does not return an error response
func (*BaseHandlerTestSuite) SetTestFilesToClose ¶
func (suite *BaseHandlerTestSuite) SetTestFilesToClose(filesToClose []*runtime.File)
SetTestFilesToClose sets the list of files needed to close at the end of tests
func (*BaseHandlerTestSuite) TestFilesToClose ¶
func (suite *BaseHandlerTestSuite) TestFilesToClose() []*runtime.File
TestFilesToClose returns the list of files needed to close at the end of tests
func (*BaseHandlerTestSuite) TestNotificationSender ¶
func (suite *BaseHandlerTestSuite) TestNotificationSender() notifications.NotificationSender
TestNotificationSender returns the notification sender to use in the suite
type ClientLogEntry ¶
type ClientLogEntry struct { Level string `json:"level"` Args ClientLogMessage `json:"args"` }
type ClientLogMessage ¶
type ClientLogMessage []interface{}
type ClientLogUpload ¶
type ClientLogUpload struct { App string `json:"app"` LoggerStats ClientLoggerStats `json:"loggerStats"` LogEntries []ClientLogEntry `json:"logEntries"` }
type ClientLoggerStats ¶
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
A single Config is passed to each handler. This should be instantiated by NewHandlerConfig
func (*Config) AppContextFromRequest ¶
func (c *Config) AppContextFromRequest(r *http.Request) appcontext.AppContext
AppContextFromRequest builds an AppContext from the http request TODO: This should eventually go away and all handlers should use AuditableAppContextFromRequestWithErrors
func (*Config) AppNames ¶
func (c *Config) AppNames() auth.ApplicationServername
AppNames returns a struct of all the app names for the current environment
func (*Config) AuditableAppContextFromRequestBasicHandler ¶
func (c *Config) AuditableAppContextFromRequestBasicHandler( handler AuditableAppContextBasicHandler, ) http.Handler
AuditableAppContextFromRequestBasicHandler creates a transaction and sets local variables for use by the auditable trigger and also allows handlers to return errors.
func (*Config) AuditableAppContextFromRequestWithErrors ¶
func (c *Config) AuditableAppContextFromRequestWithErrors( r *http.Request, handler func(appCtx appcontext.AppContext) (middleware.Responder, error), ) middleware.Responder
AuditableAppContextFromRequestWithErrors creates a transaction and sets local variables for use by the auditable trigger and also allows handlers to return errors.
func (*Config) CookieSecret ¶
CookieSecret returns the secret key to use when signing cookies
func (*Config) DTODPlanner ¶
DTODPlanner returns the DTOD planner for the current context
func (*Config) FeatureFlagFetcher ¶
func (c *Config) FeatureFlagFetcher() services.FeatureFlagFetcher
FeatureFlagFetcher returns the feature flag fetching service
func (*Config) FileStorer ¶
func (c *Config) FileStorer() storage.FileStorer
FileStorer returns the storage to use in the current context
func (*Config) GetTraceIDFromRequest ¶
GetTraceIDFromRequest returns the request traceID. It returns the Nil UUID if no traceid is found
func (*Config) HHGPlanner ¶
HHGPlanner returns the HHG planner for the current context
func (*Config) ICNSequencer ¶
func (*Config) IWSPersonLookup ¶
func (c *Config) IWSPersonLookup() iws.PersonLookup
func (*Config) NotificationSender ¶
func (c *Config) NotificationSender() notifications.NotificationSender
NotificationSender returns the sender to use in the current context
func (*Config) SendProductionInvoice ¶
SendProductionInvoice is a flag to notify EDI invoice generation whether it should be sent as a test or production transaction
func (*Config) SessionManagers ¶
func (c *Config) SessionManagers() auth.AppSessionManagers
SessionManagers returns the auth AppSessionManagers
func (*Config) SetAppNames ¶
func (c *Config) SetAppNames(appNames auth.ApplicationServername)
SetAppNames is a simple setter for private field
func (*Config) SetCookieSecret ¶
SetCookieSecret is a simple setter for the cookieSeecret private Field
func (*Config) SetDTODPlanner ¶
SetDTODPlanner is a simple setter for the route.Planner private field
func (*Config) SetFeatureFlagFetcher ¶
func (c *Config) SetFeatureFlagFetcher(fff services.FeatureFlagFetcher)
SetFeatureFlagFetcher sets the feature flag fetcher
func (*Config) SetFileStorer ¶
func (c *Config) SetFileStorer(storer storage.FileStorer)
SetFileStorer is a simple setter for storage private field
func (*Config) SetGexSender ¶
func (*Config) SetHHGPlanner ¶
SetHHGPlanner is a simple setter for the route.Planner private field
func (*Config) SetICNSequencer ¶
func (*Config) SetIWSPersonLookup ¶
func (c *Config) SetIWSPersonLookup(rbs iws.PersonLookup)
func (*Config) SetNotificationSender ¶
func (c *Config) SetNotificationSender(sender notifications.NotificationSender)
SetNotificationSender is a simple setter for AWS SES private field
func (*Config) SetPlanner ¶
SetPlanner is a simple setter for the route.Planner private field
func (*Config) SetSendProductionInvoice ¶
Set UsageIndicator flag for use in EDI invoicing (ediinvoice pkg)
func (*Config) SetUseSecureCookie ¶
Sets flag for using Secure cookie
func (*Config) UseSecureCookie ¶
UseSecureCookie determines if the field "Secure" is set to true or false upon cookie creation
type CookieUpdateResponder ¶
type CookieUpdateResponder struct { Responder middleware.Responder // contains filtered or unexported fields }
CookieUpdateResponder wraps a swagger middleware.Responder in code which sets the session_cookie See: https://github.com/go-swagger/go-swagger/issues/748
func (*CookieUpdateResponder) WriteResponse ¶
func (cur *CookieUpdateResponder) WriteResponse(rw http.ResponseWriter, p runtime.Producer)
WriteResponse updates the session cookie before writing out the details of the response
type CustomFileSystem ¶
type CustomFileSystem struct {
// contains filtered or unexported fields
}
from https://www.alexedwards.net/blog/disable-http-fileserver-directory-listings
func NewCustomFileSystem ¶
func NewCustomFileSystem(fs http.FileSystem, indexPath string, logger *zap.Logger) CustomFileSystem
type ErrResponse ¶
ErrResponse collect errors and error codes
func (*ErrResponse) WriteResponse ¶
func (o *ErrResponse) WriteResponse(rw http.ResponseWriter, _ runtime.Producer)
WriteResponse to the client
type HandlerConfig ¶
type HandlerConfig interface { AppContextFromRequest(r *http.Request) appcontext.AppContext AuditableAppContextFromRequestWithErrors( *http.Request, func(appCtx appcontext.AppContext) (middleware.Responder, error), ) middleware.Responder AuditableAppContextFromRequestBasicHandler( handler AuditableAppContextBasicHandler, ) http.Handler FileStorer() storage.FileStorer NotificationSender() notifications.NotificationSender HHGPlanner() route.Planner DTODPlanner() route.Planner CookieSecret() string IWSPersonLookup() iws.PersonLookup SendProductionInvoice() bool UseSecureCookie() bool AppNames() auth.ApplicationServername SessionManagers() auth.AppSessionManagers GexSender() services.GexSender ICNSequencer() sequence.Sequencer GetTraceIDFromRequest(r *http.Request) uuid.UUID FeatureFlagFetcher() services.FeatureFlagFetcher }
HandlerConfig provides access to all the contextual references needed by individual handlers
func NewHandlerConfig ¶
func NewHandlerConfig( db *pop.Connection, logger *zap.Logger, cookieSecret string, hhgPlanner route.Planner, dtodPlanner route.Planner, storage storage.FileStorer, notificationSender notifications.NotificationSender, iwsPersonLookup iws.PersonLookup, sendProductionInvoice bool, senderToGex services.GexSender, icnSequencer sequence.Sequencer, useSecureCookie bool, appNames auth.ApplicationServername, sessionManagers auth.AppSessionManagers, featureFlagFetcher services.FeatureFlagFetcher, ) HandlerConfig
NewHandlerConfig returns a new HandlerConfig interface with its required private fields set.
type SpaHandler ¶
type SpaHandler struct {
// contains filtered or unexported fields
}
SpaHandler implements the http.Handler interface, so we can use it to respond to HTTP requests. The path to the static directory and path to the index file within that static directory are used to serve the SPA in the given static directory.
func NewSpaHandler ¶
func NewSpaHandler(staticPath string, indexPath string, cfs CustomFileSystem) SpaHandler
NewSpaHandler returns a new handler for a Single Page App
func (SpaHandler) ServeHTTP ¶
func (h SpaHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP inspects the URL path to locate a file within the static dir on the SPA handler. If a file is found, it will be served. If not, the file located at the index path on the SPA handler will be served. This is suitable behavior for serving an SPA (single page application).
type ValidationErrorListResponse ¶
ValidationErrorListResponse maps field names to a list of errors for the field
func NewValidationErrorListResponse ¶
func NewValidationErrorListResponse(verrs *validate.Errors) *ValidationErrorListResponse
NewValidationErrorListResponse returns a new validations error list response
type ValidationErrorsResponse ¶
ValidationErrorsResponse is a middleware.Responder for a set of validation errors
func NewValidationErrorsResponse ¶
func NewValidationErrorsResponse(verrs *validate.Errors) *ValidationErrorsResponse
NewValidationErrorsResponse returns a new validations errors response
func (*ValidationErrorsResponse) WriteResponse ¶
func (v *ValidationErrorsResponse) WriteResponse(rw http.ResponseWriter, _ runtime.Producer)
WriteResponse to the client