Documentation
¶
Index ¶
- Constants
- Variables
- func APIKeyAuthMiddleware(apiKey string) gin.HandlerFunc
- func APIKeyOrTenantJWTAuthMiddleware(apiKey string, jwtKey string) gin.HandlerFunc
- func AbortWithError(c *gin.Context, code int, err error)
- func AbortWithValidationError(c *gin.Context, err error)
- func ErrorHandlerMiddleware() gin.HandlerFunc
- func GetRequestLatency(c *gin.Context) time.Duration
- func LatencyMiddleware() gin.HandlerFunc
- func LoggerMiddleware(logger *logging.Logger) gin.HandlerFunc
- func MetricsMiddleware() gin.HandlerFunc
- func NewRouter(cfg RouterConfig, logger *logging.Logger, redisClient *redis.Client, ...) http.Handler
- func RequireTenantMiddleware(entityStore models.EntityStore) gin.HandlerFunc
- func SetTenantIDMiddleware() gin.HandlerFunc
- func TenantJWTAuthMiddleware(apiKey string, jwtKey string) gin.HandlerFunc
- type APIService
- type AuthScope
- type CreateDestinationRequest
- type DeliveryResponse
- type DestinationHandlers
- func (h *DestinationHandlers) Create(c *gin.Context)
- func (h *DestinationHandlers) Delete(c *gin.Context)
- func (h *DestinationHandlers) Disable(c *gin.Context)
- func (h *DestinationHandlers) Enable(c *gin.Context)
- func (h *DestinationHandlers) List(c *gin.Context)
- func (h *DestinationHandlers) ListProviderMetadata(c *gin.Context)
- func (h *DestinationHandlers) Retrieve(c *gin.Context)
- func (h *DestinationHandlers) RetrieveProviderMetadata(c *gin.Context)
- func (h *DestinationHandlers) Update(c *gin.Context)
- type ErrorResponse
- type LogHandlers
- type PublishHandlers
- type PublishedEvent
- type RetryHandlers
- type RouteDefinition
- type RouteMode
- type RouterConfig
- type TenantHandlers
- type TopicHandlers
- type UpdateDestinationRequest
Constants ¶
View Source
const ( // Role values RoleAdmin = "admin" RoleTenant = "tenant" )
Variables ¶
View Source
var ( ErrMissingAuthHeader = errors.New("missing authorization header") ErrInvalidBearerToken = errors.New("invalid bearer token format") ErrTenantIDNotFound = errors.New("tenantID not found in context") )
View Source
var (
ErrDestinationDisabled = errors.New("destination is disabled")
)
View Source
var (
ErrInvalidToken = errors.New("invalid token")
)
View Source
var JWT = jsonwebtoken{}
Functions ¶
func APIKeyAuthMiddleware ¶
func APIKeyAuthMiddleware(apiKey string) gin.HandlerFunc
func APIKeyOrTenantJWTAuthMiddleware ¶
func APIKeyOrTenantJWTAuthMiddleware(apiKey string, jwtKey string) gin.HandlerFunc
func ErrorHandlerMiddleware ¶
func ErrorHandlerMiddleware() gin.HandlerFunc
func GetRequestLatency ¶
GetRequestLatency returns the request latency from the context
func LatencyMiddleware ¶
func LatencyMiddleware() gin.HandlerFunc
func LoggerMiddleware ¶
func LoggerMiddleware(logger *logging.Logger) gin.HandlerFunc
func MetricsMiddleware ¶
func MetricsMiddleware() gin.HandlerFunc
func NewRouter ¶
func NewRouter( cfg RouterConfig, logger *logging.Logger, redisClient *redis.Client, deliveryMQ *deliverymq.DeliveryMQ, entityStore models.EntityStore, logStore logstore.LogStore, publishmqEventHandler publishmq.EventHandler, telemetry telemetry.Telemetry, ) http.Handler
func RequireTenantMiddleware ¶
func RequireTenantMiddleware(entityStore models.EntityStore) gin.HandlerFunc
func SetTenantIDMiddleware ¶
func SetTenantIDMiddleware() gin.HandlerFunc
func TenantJWTAuthMiddleware ¶
func TenantJWTAuthMiddleware(apiKey string, jwtKey string) gin.HandlerFunc
Types ¶
type APIService ¶
type APIService struct {
// contains filtered or unexported fields
}
func NewService ¶
func (*APIService) Shutdown ¶
func (s *APIService) Shutdown(ctx context.Context)
type CreateDestinationRequest ¶
type CreateDestinationRequest struct { ID string `json:"id" binding:"-"` Type string `json:"type" binding:"required"` Topics models.Topics `json:"topics" binding:"required"` Config models.Config `json:"config" binding:"-"` Credentials models.Credentials `json:"credentials" binding:"-"` }
func (*CreateDestinationRequest) ToDestination ¶
func (r *CreateDestinationRequest) ToDestination(tenantID string) models.Destination
type DeliveryResponse ¶
type DestinationHandlers ¶
type DestinationHandlers struct {
// contains filtered or unexported fields
}
func NewDestinationHandlers ¶
func NewDestinationHandlers(logger *logging.Logger, telemetry telemetry.Telemetry, entityStore models.EntityStore, topics []string, registry destregistry.Registry) *DestinationHandlers
func (*DestinationHandlers) Create ¶
func (h *DestinationHandlers) Create(c *gin.Context)
func (*DestinationHandlers) Delete ¶
func (h *DestinationHandlers) Delete(c *gin.Context)
func (*DestinationHandlers) Disable ¶
func (h *DestinationHandlers) Disable(c *gin.Context)
func (*DestinationHandlers) Enable ¶
func (h *DestinationHandlers) Enable(c *gin.Context)
func (*DestinationHandlers) List ¶
func (h *DestinationHandlers) List(c *gin.Context)
func (*DestinationHandlers) ListProviderMetadata ¶
func (h *DestinationHandlers) ListProviderMetadata(c *gin.Context)
func (*DestinationHandlers) Retrieve ¶
func (h *DestinationHandlers) Retrieve(c *gin.Context)
func (*DestinationHandlers) RetrieveProviderMetadata ¶
func (h *DestinationHandlers) RetrieveProviderMetadata(c *gin.Context)
func (*DestinationHandlers) Update ¶
func (h *DestinationHandlers) Update(c *gin.Context)
type ErrorResponse ¶
type ErrorResponse struct { Err error `json:"-"` Code int `json:"-"` Message string `json:"message"` Data interface{} `json:"data,omitempty"` }
func NewErrBadRequest ¶
func NewErrBadRequest(err error) ErrorResponse
func NewErrInternalServer ¶
func NewErrInternalServer(err error) ErrorResponse
func NewErrNotFound ¶
func NewErrNotFound(resource string) ErrorResponse
func (ErrorResponse) Error ¶
func (e ErrorResponse) Error() string
func (*ErrorResponse) Parse ¶
func (e *ErrorResponse) Parse(err error)
type LogHandlers ¶
type LogHandlers struct {
// contains filtered or unexported fields
}
func NewLogHandlers ¶
func NewLogHandlers( logger *logging.Logger, logStore logstore.LogStore, ) *LogHandlers
func (*LogHandlers) ListDeliveryByEvent ¶
func (h *LogHandlers) ListDeliveryByEvent(c *gin.Context)
func (*LogHandlers) ListEvent ¶
func (h *LogHandlers) ListEvent(c *gin.Context)
func (*LogHandlers) ListEventByDestination ¶
func (h *LogHandlers) ListEventByDestination(c *gin.Context)
func (*LogHandlers) RetrieveEvent ¶
func (h *LogHandlers) RetrieveEvent(c *gin.Context)
func (*LogHandlers) RetrieveEventByDestination ¶
func (h *LogHandlers) RetrieveEventByDestination(c *gin.Context)
type PublishHandlers ¶
type PublishHandlers struct {
// contains filtered or unexported fields
}
func NewPublishHandlers ¶
func NewPublishHandlers( logger *logging.Logger, eventHandler publishmq.EventHandler, ) *PublishHandlers
func (*PublishHandlers) Ingest ¶
func (h *PublishHandlers) Ingest(c *gin.Context)
type PublishedEvent ¶
type PublishedEvent struct { ID string `json:"id"` TenantID string `json:"tenant_id" binding:"required"` DestinationID string `json:"destination_id"` Topic string `json:"topic"` EligibleForRetry *bool `json:"eligible_for_retry"` Time time.Time `json:"time"` Metadata map[string]string `json:"metadata"` Data map[string]interface{} `json:"data"` }
type RetryHandlers ¶
type RetryHandlers struct {
// contains filtered or unexported fields
}
func NewRetryHandlers ¶
func NewRetryHandlers(logger *logging.Logger, entityStore models.EntityStore, logStore logstore.LogStore, deliveryMQ *deliverymq.DeliveryMQ) *RetryHandlers
func (*RetryHandlers) Retry ¶
func (h *RetryHandlers) Retry(c *gin.Context)
type RouteDefinition ¶
type RouteDefinition struct { Method string Path string Handler gin.HandlerFunc AuthScope AuthScope Mode RouteMode AllowTenantFromJWT bool // Allow tenant ID to be sourced from JWT token instead of URL param Middlewares []gin.HandlerFunc }
type RouterConfig ¶
type RouterConfig struct { ServiceName string APIKey string JWTSecret string Topics []string Registry destregistry.Registry PortalConfig portal.PortalConfig GinMode string }
type TenantHandlers ¶
type TenantHandlers struct {
// contains filtered or unexported fields
}
func NewTenantHandlers ¶
func NewTenantHandlers( logger *logging.Logger, telemetry telemetry.Telemetry, jwtSecret string, entityStore models.EntityStore, ) *TenantHandlers
func (*TenantHandlers) Delete ¶
func (h *TenantHandlers) Delete(c *gin.Context)
func (*TenantHandlers) Retrieve ¶
func (h *TenantHandlers) Retrieve(c *gin.Context)
func (*TenantHandlers) RetrievePortal ¶
func (h *TenantHandlers) RetrievePortal(c *gin.Context)
func (*TenantHandlers) RetrieveToken ¶
func (h *TenantHandlers) RetrieveToken(c *gin.Context)
func (*TenantHandlers) Upsert ¶
func (h *TenantHandlers) Upsert(c *gin.Context)
type TopicHandlers ¶
type TopicHandlers struct {
// contains filtered or unexported fields
}
func NewTopicHandlers ¶
func NewTopicHandlers(logger *logging.Logger, topics []string) *TopicHandlers
func (*TopicHandlers) List ¶
func (h *TopicHandlers) List(c *gin.Context)
Source Files
¶
Click to show internal directories.
Click to hide internal directories.