Documentation
¶
Index ¶
- func EnsurePeriod(start time.Time, end time.Time) error
- func FilterDeletedEndpoints(endpoints []datastore.Endpoint) []datastore.Endpoint
- func GetAuthFromRequest(r *http.Request) (*auth.Credential, error)
- func GetAuthUserFromContext(ctx context.Context) *auth.AuthenticatedUser
- func GetDeliveryAttemptFromContext(ctx context.Context) *datastore.DeliveryAttempt
- func GetDeliveryAttemptsFromContext(ctx context.Context) *[]datastore.DeliveryAttempt
- func GetEndpointFromContext(ctx context.Context) *datastore.Endpoint
- func GetEndpointIDFromContext(r *http.Request) string
- func GetEndpointIDsFromContext(ctx context.Context) []string
- func GetEndpointsFromContext(ctx context.Context) []datastore.Endpoint
- func GetEventDeliveryFromContext(ctx context.Context) *datastore.EventDelivery
- func GetEventFromContext(ctx context.Context) *datastore.Event
- func GetHostFromContext(ctx context.Context) string
- func GetOrganisationFromContext(ctx context.Context) *datastore.Organisation
- func GetOrganisationMemberFromContext(ctx context.Context) *datastore.OrganisationMember
- func GetPageableFromContext(ctx context.Context) datastore.Pageable
- func GetPaginationDataFromContext(ctx context.Context) *datastore.PaginationData
- func GetPortalLinkFromContext(ctx context.Context) *datastore.PortalLink
- func GetProjectFromContext(ctx context.Context) *datastore.Project
- func GetSourceIDFromContext(r *http.Request) string
- func GetUserFromContext(ctx context.Context) *datastore.User
- func SetDeliveryAttemptsInContext(ctx context.Context, attempts *[]datastore.DeliveryAttempt) context.Context
- func ShouldAuthRoute(r *http.Request) bool
- type AuthorizedLogin
- type CreateMiddleware
- type Middleware
- func (m *Middleware) ComputeDashboardMessages(ctx context.Context, projectID string, searchParams datastore.SearchParams, ...) (uint64, []datastore.EventInterval, error)
- func (m *Middleware) InstrumentPath(path string) func(http.Handler) http.Handler
- func (m *Middleware) InstrumentRequests() func(next http.Handler) http.Handler
- func (m *Middleware) JsonResponse(next http.Handler) http.Handler
- func (m *Middleware) LogHttpRequest() func(next http.Handler) http.Handler
- func (m *Middleware) Pagination(next http.Handler) http.Handler
- func (m *Middleware) RateLimitByProjectID() func(next http.Handler) http.Handler
- func (m *Middleware) RateLimitByProjectWithParams(requestLimit int, windowLength time.Duration) func(next http.Handler) http.Handler
- func (m *Middleware) RejectAppPortalKey() func(next http.Handler) http.Handler
- func (m *Middleware) RequireApp() func(next http.Handler) http.Handler
- func (m *Middleware) RequireAppBelongsToProject() func(next http.Handler) http.Handler
- func (m *Middleware) RequireAppEndpoint() func(next http.Handler) http.Handler
- func (m *Middleware) RequireAuth() func(next http.Handler) http.Handler
- func (m *Middleware) RequireAuthUserMetadata() func(next http.Handler) http.Handler
- func (m *Middleware) RequireAuthorizedUser() func(next http.Handler) http.Handler
- func (m *Middleware) RequireBaseUrl() func(next http.Handler) http.Handler
- func (m *Middleware) RequireDeliveryAttempt() func(next http.Handler) http.Handler
- func (m *Middleware) RequireEndpoint() func(next http.Handler) http.Handler
- func (m *Middleware) RequireEndpointBelongsToProject() func(next http.Handler) http.Handler
- func (m *Middleware) RequireEndpointID() func(next http.Handler) http.Handler
- func (m *Middleware) RequireEvent() func(next http.Handler) http.Handler
- func (m *Middleware) RequireEventDelivery() func(next http.Handler) http.Handler
- func (m *Middleware) RequireOrganisation() func(next http.Handler) http.Handler
- func (m *Middleware) RequireOrganisationMemberRole(roleType auth.RoleType) func(next http.Handler) http.Handler
- func (m *Middleware) RequireOrganisationMembership() func(next http.Handler) http.Handler
- func (m *Middleware) RequireOrganisationProjectMember() func(next http.Handler) http.Handler
- func (m *Middleware) RequirePermission(role auth.RoleType) func(next http.Handler) http.Handler
- func (m *Middleware) RequirePersonalAccessToken() func(next http.Handler) http.Handler
- func (m *Middleware) RequirePortalLink() func(next http.Handler) http.Handler
- func (m *Middleware) RequirePortalLinkEndpoint() func(next http.Handler) http.Handler
- func (m *Middleware) RequireProject() func(next http.Handler) http.Handler
- func (m *Middleware) RequireProjectAccess() func(next http.Handler) http.Handler
- func (m *Middleware) SetupCORS(next http.Handler) http.Handler
- func (m *Middleware) WriteRequestIDHeader(next http.Handler) http.Handler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FilterDeletedEndpoints ¶
func GetAuthFromRequest ¶
func GetAuthFromRequest(r *http.Request) (*auth.Credential, error)
func GetAuthUserFromContext ¶
func GetAuthUserFromContext(ctx context.Context) *auth.AuthenticatedUser
func GetDeliveryAttemptFromContext ¶
func GetDeliveryAttemptFromContext(ctx context.Context) *datastore.DeliveryAttempt
func GetDeliveryAttemptsFromContext ¶
func GetDeliveryAttemptsFromContext(ctx context.Context) *[]datastore.DeliveryAttempt
func GetEndpointFromContext ¶ added in v0.8.0
func GetEndpointIDFromContext ¶ added in v0.8.0
func GetEndpointIDsFromContext ¶ added in v0.8.0
func GetEndpointsFromContext ¶ added in v0.8.0
func GetEventDeliveryFromContext ¶
func GetEventDeliveryFromContext(ctx context.Context) *datastore.EventDelivery
func GetHostFromContext ¶
func GetOrganisationFromContext ¶
func GetOrganisationFromContext(ctx context.Context) *datastore.Organisation
func GetOrganisationMemberFromContext ¶
func GetOrganisationMemberFromContext(ctx context.Context) *datastore.OrganisationMember
func GetPaginationDataFromContext ¶
func GetPaginationDataFromContext(ctx context.Context) *datastore.PaginationData
func GetPortalLinkFromContext ¶ added in v0.8.0
func GetPortalLinkFromContext(ctx context.Context) *datastore.PortalLink
func GetProjectFromContext ¶ added in v0.8.0
func GetSourceIDFromContext ¶ added in v0.7.0
func ShouldAuthRoute ¶
Types ¶
type AuthorizedLogin ¶
type AuthorizedLogin struct {
Username string `json:"username,omitempty"`
Token string `json:"token"`
ExpiryTime time.Time `json:"expiry_time"`
}
func GetAuthLoginFromContext ¶
func GetAuthLoginFromContext(ctx context.Context) *AuthorizedLogin
type CreateMiddleware ¶
type CreateMiddleware struct {
EventRepo datastore.EventRepository
EventDeliveryRepo datastore.EventDeliveryRepository
EndpointRepo datastore.EndpointRepository
ProjectRepo datastore.ProjectRepository
ApiKeyRepo datastore.APIKeyRepository
SubRepo datastore.SubscriptionRepository
SourceRepo datastore.SourceRepository
OrgRepo datastore.OrganisationRepository
OrgMemberRepo datastore.OrganisationMemberRepository
OrgInviteRepo datastore.OrganisationInviteRepository
UserRepo datastore.UserRepository
ConfigRepo datastore.ConfigurationRepository
DeviceRepo datastore.DeviceRepository
PortalLinkRepo datastore.PortalLinkRepository
Cache cache.Cache
Logger log.StdLogger
Limiter limiter.RateLimiter
Tracer tracer.Tracer
}
type Middleware ¶
type Middleware struct {
// contains filtered or unexported fields
}
func NewMiddleware ¶
func NewMiddleware(cs *CreateMiddleware) *Middleware
func (*Middleware) ComputeDashboardMessages ¶
func (m *Middleware) ComputeDashboardMessages(ctx context.Context, projectID string, searchParams datastore.SearchParams, period datastore.Period) (uint64, []datastore.EventInterval, error)
func (*Middleware) InstrumentPath ¶
func (*Middleware) InstrumentRequests ¶
func (m *Middleware) InstrumentRequests() func(next http.Handler) http.Handler
func (*Middleware) JsonResponse ¶
func (m *Middleware) JsonResponse(next http.Handler) http.Handler
func (*Middleware) LogHttpRequest ¶
func (m *Middleware) LogHttpRequest() func(next http.Handler) http.Handler
func (*Middleware) Pagination ¶
func (m *Middleware) Pagination(next http.Handler) http.Handler
func (*Middleware) RateLimitByProjectID ¶ added in v0.8.0
func (m *Middleware) RateLimitByProjectID() func(next http.Handler) http.Handler
func (*Middleware) RateLimitByProjectWithParams ¶ added in v0.8.0
func (*Middleware) RejectAppPortalKey ¶ added in v0.7.0
func (m *Middleware) RejectAppPortalKey() func(next http.Handler) http.Handler
RejectAppPortalKey ensures that an app portal api key was not used for authentication
func (*Middleware) RequireApp ¶
func (m *Middleware) RequireApp() func(next http.Handler) http.Handler
func (*Middleware) RequireAppBelongsToProject ¶ added in v0.8.0
func (m *Middleware) RequireAppBelongsToProject() func(next http.Handler) http.Handler
func (*Middleware) RequireAppEndpoint ¶
func (m *Middleware) RequireAppEndpoint() func(next http.Handler) http.Handler
func (*Middleware) RequireAuth ¶
func (m *Middleware) RequireAuth() func(next http.Handler) http.Handler
func (*Middleware) RequireAuthUserMetadata ¶
func (m *Middleware) RequireAuthUserMetadata() func(next http.Handler) http.Handler
func (*Middleware) RequireAuthorizedUser ¶
func (m *Middleware) RequireAuthorizedUser() func(next http.Handler) http.Handler
func (*Middleware) RequireBaseUrl ¶
func (m *Middleware) RequireBaseUrl() func(next http.Handler) http.Handler
func (*Middleware) RequireDeliveryAttempt ¶
func (m *Middleware) RequireDeliveryAttempt() func(next http.Handler) http.Handler
func (*Middleware) RequireEndpoint ¶ added in v0.8.0
func (m *Middleware) RequireEndpoint() func(next http.Handler) http.Handler
func (*Middleware) RequireEndpointBelongsToProject ¶ added in v0.8.0
func (m *Middleware) RequireEndpointBelongsToProject() func(next http.Handler) http.Handler
func (*Middleware) RequireEndpointID ¶ added in v0.8.2
func (m *Middleware) RequireEndpointID() func(next http.Handler) http.Handler
func (*Middleware) RequireEvent ¶
func (m *Middleware) RequireEvent() func(next http.Handler) http.Handler
func (*Middleware) RequireEventDelivery ¶
func (m *Middleware) RequireEventDelivery() func(next http.Handler) http.Handler
func (*Middleware) RequireOrganisation ¶
func (m *Middleware) RequireOrganisation() func(next http.Handler) http.Handler
func (*Middleware) RequireOrganisationMemberRole ¶
func (*Middleware) RequireOrganisationMembership ¶
func (m *Middleware) RequireOrganisationMembership() func(next http.Handler) http.Handler
func (*Middleware) RequireOrganisationProjectMember ¶ added in v0.8.0
func (m *Middleware) RequireOrganisationProjectMember() func(next http.Handler) http.Handler
func (*Middleware) RequirePermission ¶
func (*Middleware) RequirePersonalAccessToken ¶ added in v0.8.2
func (m *Middleware) RequirePersonalAccessToken() func(next http.Handler) http.Handler
func (*Middleware) RequirePortalLink ¶ added in v0.8.0
func (m *Middleware) RequirePortalLink() func(next http.Handler) http.Handler
func (*Middleware) RequirePortalLinkEndpoint ¶ added in v0.8.0
func (m *Middleware) RequirePortalLinkEndpoint() func(next http.Handler) http.Handler
func (*Middleware) RequireProject ¶ added in v0.8.0
func (m *Middleware) RequireProject() func(next http.Handler) http.Handler
func (*Middleware) RequireProjectAccess ¶ added in v0.8.0
func (m *Middleware) RequireProjectAccess() func(next http.Handler) http.Handler
RequireProjectAccess checks if the given authentication creds can access the project. It handles PATs as well
func (*Middleware) WriteRequestIDHeader ¶
func (m *Middleware) WriteRequestIDHeader(next http.Handler) http.Handler
Click to show internal directories.
Click to hide internal directories.