Documentation ¶
Index ¶
- func AddConfig(dal *DAL) gin.HandlerFunc
- func AuthRequired(d *DAL) gin.HandlerFunc
- func GetConfigByID(dal *DAL) gin.HandlerFunc
- func GetConfigs(dal *DAL) gin.HandlerFunc
- func GetRecords(dal *DAL) gin.HandlerFunc
- func HostLogin(dal *DAL) gin.HandlerFunc
- func HostRegister(dal *DAL) gin.HandlerFunc
- func NewRouter(dal *DAL) *gin.Engine
- func PingGet(dal *DAL) gin.HandlerFunc
- func UpdateConfigByID(dal *DAL) gin.HandlerFunc
- func ValidateToken(dal *DAL, hostID string, token string) (string, bool, error)
- type AuditEvent
- type DAL
- func (d *DAL) EmitMessage(messageType, funcName string, body map[string]interface{})
- func (d *DAL) GetAuditLogs(ctx *gin.Context, offset string, limit string, req interface{}) ([]pb.AuditLog, error)
- func (d *DAL) GetConfig(ctx *gin.Context, configID string, hostID string, req interface{}) (models.ConfigResponse, error)
- func (d *DAL) GetConfigs(ctx *gin.Context, offset string, limit string, req interface{}) ([]models.ConfigStore, error)
- func (d *DAL) InsertConfig(ctx *gin.Context, configIn models.ConfigIn, req interface{}) (string, bool, error)
- func (d *DAL) LoginHost(ctx *gin.Context, hostLoginIn models.HostLoginIn, req interface{}) (string, error)
- func (d *DAL) RegisterHost(ctx *gin.Context, hostRegisterIn models.HostRegisterIn, req interface{}) (string, string, error)
- func (d *DAL) UpdateConfigByID(ctx *gin.Context, configID string, updateConfigIn models.UpdateConfigIn, ...) (interface{}, error)
- type HTTPServer
- type HostCache
- type MongoQueryResult
- type Route
- type Routes
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddConfig ¶
func AddConfig(dal *DAL) gin.HandlerFunc
AddConfig - Create a new configuration and configuration value
func AuthRequired ¶
func AuthRequired(d *DAL) gin.HandlerFunc
AuthRequired is a simple middleware to check the session
func GetConfigByID ¶
func GetConfigByID(dal *DAL) gin.HandlerFunc
GetConfigByID - Retrieve a configuration by configuration ID
func GetConfigs ¶
func GetConfigs(dal *DAL) gin.HandlerFunc
GetConfigs - Get a paginated list of configurations
func GetRecords ¶
func GetRecords(dal *DAL) gin.HandlerFunc
GetRecords - Retrieves an audit log entry
func HostRegister ¶
func HostRegister(dal *DAL) gin.HandlerFunc
HostRegister - Register host for an API key
func UpdateConfigByID ¶
func UpdateConfigByID(dal *DAL) gin.HandlerFunc
UpdateConfigByID - Update a configuration by configuration ID
Types ¶
type AuditEvent ¶
type AuditEvent struct {
// contains filtered or unexported fields
}
AuditEvent audit event struct for sending messages of service events
func (*AuditEvent) ToByteSlice ¶
func (a *AuditEvent) ToByteSlice() ([]byte, error)
ToByteSlice - converts AuditEvent into a byte slice
type DAL ¶
type DAL struct { Cache *persistence.RedisStore `json:"cache"` Config *svcmodels.Config `json:"config"` Database db.DBIface `json:"database"` Context *context.Context `json:"context"` DocumentStore *mongo.Client `json:"document_store"` Logger *zap.SugaredLogger `json:"logger"` Producer *kafka.Producer `json:"producer"` APM *newrelic.Application `json:"apm"` Collection string `json:"collection,omitempty"` SessionKey string `json:"session_key"` CacheEnabled bool `json:"cache_enabled"` }
DAL Data Access Layer struct for maintaining and managing data store connections for Stilla
func NewDAL ¶
func NewDAL(ctx *context.Context, sugar *zap.SugaredLogger, apm *newrelic.Application, config *svcmodels.Config, dbConn db.Conn, docStore *mongo.Client, store *persistence.RedisStore, producer *kafka.Producer, collection, sessionKey string) *DAL
NewDAL returns a new DAL
func (*DAL) EmitMessage ¶
EmitMessage emits a message for the service. Currently only manages AuditEvents
func (*DAL) GetAuditLogs ¶
func (d *DAL) GetAuditLogs(ctx *gin.Context, offset string, limit string, req interface{}) ([]pb.AuditLog, error)
GetAuditLogs returns a pagination list of audit logs
func (*DAL) GetConfig ¶
func (d *DAL) GetConfig(ctx *gin.Context, configID string, hostID string, req interface{}) (models.ConfigResponse, error)
GetConfig returns a Config with the latest version of the ConfigVersion
func (*DAL) GetConfigs ¶
func (d *DAL) GetConfigs(ctx *gin.Context, offset string, limit string, req interface{}) ([]models.ConfigStore, error)
GetConfigs returns a paginated slice of Configs from the document store
func (*DAL) InsertConfig ¶
func (d *DAL) InsertConfig(ctx *gin.Context, configIn models.ConfigIn, req interface{}) (string, bool, error)
InsertConfig insert a configuration object into the document store. This creates a new ConfigVersion object. The ObjectID of the ConfigVersion is then used to update the Config object reference for ConfigVersion
func (*DAL) LoginHost ¶
func (d *DAL) LoginHost(ctx *gin.Context, hostLoginIn models.HostLoginIn, req interface{}) (string, error)
LoginHost uses the API Key of a host and validates it. Creates a new session if the key is valid
func (*DAL) RegisterHost ¶
func (d *DAL) RegisterHost(ctx *gin.Context, hostRegisterIn models.HostRegisterIn, req interface{}) (string, string, error)
RegisterHost registers a host and provides the requestor an API key
func (*DAL) UpdateConfigByID ¶
func (d *DAL) UpdateConfigByID(ctx *gin.Context, configID string, updateConfigIn models.UpdateConfigIn, req interface{}) (interface{}, error)
UpdateConfigByID Updates a configuration by the ID
type HTTPServer ¶
type HTTPServer struct { Context context.Context Engine *gin.Engine `json:"engine",yaml:"engine"` Logger *zap.SugaredLogger `json:"logger",yaml:"logger"` DomainName string `json:"domain_name",yaml:"domain_name"` Secure bool `json:"secure",yaml:"secure"` // contains filtered or unexported fields }
HTTPServer represents a web server
type HostCache ¶
type HostCache struct {
Hostname string `json:"hostname"`
}
HostCache cache for host
type MongoQueryResult ¶
type MongoQueryResult struct { Result interface{} `json:"result"` Error error `json:"error"` }
MongoQueryResult used to manage Mongo query results from channels