converters

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 20, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package converters provides conversion functions between different data models

Package converters provides conversion functions between different types

Package converters provides conversion functions between different types

Package converters provides conversion functions between different types

Package converters provides conversion functions between different types

Package converters provides conversion functions between different types

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuditActionToString

func AuditActionToString(action models.AuditAction) string

AuditActionToString converts an AuditAction to a string

func AuditLogToModel

func AuditLogToModel(log interface{}) *models.AuditLog

AuditLogToModel converts a legacy AuditLog to a models.AuditLog

func AuthMethodSliceToStringSlice

func AuthMethodSliceToStringSlice(m []common.AuthMethod) []string

AuthMethodSliceToStringSlice converts a slice of AuthMethods to a slice of strings

func AuthMethodToString

func AuthMethodToString(m common.AuthMethod) string

AuthMethodToString converts an AuthMethod to a string

func CreateAuditLog

func CreateAuditLog(action models.AuditAction, resourceType, resource, description string) *models.AuditLog

CreateAuditLog creates a new audit log entry with common fields populated

func CreateLoginAuditLog

func CreateLoginAuditLog(username, status, ipAddress, userAgent string) *models.AuditLog

CreateLoginAuditLog creates a login audit log entry

func CreateLogoutAuditLog

func CreateLogoutAuditLog(userID, username, ipAddress, userAgent string) *models.AuditLog

CreateLogoutAuditLog creates a logout audit log entry

func CreatePasswordUpdateAuditLog

func CreatePasswordUpdateAuditLog(userID, action, ipAddress, userAgent string) *models.AuditLog

CreatePasswordUpdateAuditLog creates an audit log entry for password updates

func FilterToLegacyIncidentFilter

func FilterToLegacyIncidentFilter(filter map[string]interface{}) interface{}

FilterToLegacyIncidentFilter converts a generic filter map to a legacy IncidentFilter

func FilterToLegacyVulnerabilityFilter

func FilterToLegacyVulnerabilityFilter(filter map[string]interface{}) interface{}

FilterToLegacyVulnerabilityFilter converts a generic filter map to a legacy VulnerabilityFilter

func InterfaceSessionToModelSession

func InterfaceSessionToModelSession(session *interfaces.Session) *models.Session

InterfaceSessionToModelSession converts an interfaces.Session to a models.Session

func InterfaceUserToModelUser

func InterfaceUserToModelUser(user *interfaces.User) *models.User

InterfaceUserToModelUser converts an interfaces.User to a models.User

func LegacyIncidentStatusToModel

func LegacyIncidentStatusToModel(status interface{}) models.SecurityIncidentStatus

LegacyIncidentStatusToModel converts a legacy IncidentStatus to the new type

func LegacyIncidentToModel

func LegacyIncidentToModel(incident interface{}) *models.SecurityIncident

LegacyIncidentToModel converts a legacy SecurityIncident to the new type

func LegacyVulnerabilitySeverityToModel

func LegacyVulnerabilitySeverityToModel(severity interface{}) models.VulnerabilitySeverity

LegacyVulnerabilitySeverityToModel converts a legacy AuditSeverity to the new VulnerabilitySeverity type

func LegacyVulnerabilityStatusToModel

func LegacyVulnerabilityStatusToModel(status interface{}) models.VulnerabilityStatus

LegacyVulnerabilityStatusToModel converts a legacy VulnerabilityStatus to the new type

func LegacyVulnerabilityToModel

func LegacyVulnerabilityToModel(vulnerability interface{}) *models.Vulnerability

LegacyVulnerabilityToModel converts a legacy Vulnerability to the new type

func ModelSessionToInterfaceSession

func ModelSessionToInterfaceSession(session *models.Session) *interfaces.Session

ModelSessionToInterfaceSession converts a models.Session to an interfaces.Session

func ModelToAuditLog

func ModelToAuditLog(log *models.AuditLog) interface{}

ModelToAuditLog converts a models.AuditLog to a legacy AuditLog

func ModelToLegacyIncident

func ModelToLegacyIncident(incident *models.SecurityIncident) interface{}

ModelToLegacyIncident converts a new SecurityIncident to the legacy type

func ModelToLegacyIncidentStatus

func ModelToLegacyIncidentStatus(status models.SecurityIncidentStatus) interface{}

ModelToLegacyIncidentStatus converts a new SecurityIncidentStatus to the legacy type

func ModelToLegacyVulnerability

func ModelToLegacyVulnerability(vulnerability *models.Vulnerability) interface{}

ModelToLegacyVulnerability converts a new Vulnerability to the legacy type

func ModelToLegacyVulnerabilitySeverity

func ModelToLegacyVulnerabilitySeverity(severity models.VulnerabilitySeverity) interface{}

ModelToLegacyVulnerabilitySeverity converts a new VulnerabilitySeverity to the legacy AuditSeverity type

func ModelToLegacyVulnerabilityStatus

func ModelToLegacyVulnerabilityStatus(status models.VulnerabilityStatus) interface{}

ModelToLegacyVulnerabilityStatus converts a new VulnerabilityStatus to the legacy type

func ModelToSecurityIncident

func ModelToSecurityIncident(incident *models.SecurityIncident) interface{}

ModelToSecurityIncident converts a models.SecurityIncident to a legacy SecurityIncident

func ModelToSession

func ModelToSession(session *models.Session) interface{}

ModelToSession converts a models.Session to a legacy Session

func ModelToUser

func ModelToUser(user *models.User) interface{}

ModelToUser converts a models.User to a legacy User

func ModelToVulnerability

func ModelToVulnerability(vulnerability *models.Vulnerability) interface{}

ModelToVulnerability converts a models.Vulnerability to a legacy Vulnerability

func ModelUserToInterfaceUser

func ModelUserToInterfaceUser(user *models.User) *interfaces.User

ModelUserToInterfaceUser converts a models.User to an interfaces.User

func SecurityIncidentToModel

func SecurityIncidentToModel(incident interface{}) *models.SecurityIncident

SecurityIncidentToModel converts a legacy SecurityIncident to a models.SecurityIncident

func SessionToModel

func SessionToModel(session interface{}) *models.Session

SessionToModel converts a legacy Session to a models.Session

func StringSliceToAuthMethodSlice

func StringSliceToAuthMethodSlice(s []string) []common.AuthMethod

StringSliceToAuthMethodSlice converts a slice of strings to a slice of AuthMethods

func StringToAuditAction

func StringToAuditAction(action string) models.AuditAction

StringToAuditAction converts a string to an AuditAction

func StringToAuthMethod

func StringToAuthMethod(s string) common.AuthMethod

StringToAuthMethod converts a string to an AuthMethod

func UserToModel

func UserToModel(user interface{}) *models.User

UserToModel converts a legacy User to a models.User

func VulnerabilityToModel

func VulnerabilityToModel(vulnerability interface{}) *models.Vulnerability

VulnerabilityToModel converts a legacy Vulnerability to a models.Vulnerability

Types

type ModelConverter

type ModelConverter struct{}

ModelConverter implements various converter interfaces

func NewAuditLogConverter

func NewAuditLogConverter() *ModelConverter

NewAuditLogConverter creates a new audit log converter

func NewIncidentConverter

func NewIncidentConverter() *ModelConverter

NewIncidentConverter creates a new incident converter

func NewModelConverter

func NewModelConverter() *ModelConverter

NewModelConverter creates a new model converter

func NewSecurityConverter

func NewSecurityConverter() *ModelConverter

NewSecurityConverter creates a new security converter

func NewSessionConverter

func NewSessionConverter() *ModelConverter

NewSessionConverter creates a new session converter

func NewUserConverter

func NewUserConverter() *ModelConverter

NewUserConverter creates a new user converter

func NewVulnerabilityConverter

func NewVulnerabilityConverter() *ModelConverter

NewVulnerabilityConverter creates a new vulnerability converter

func (*ModelConverter) FromModelAuditLog

func (c *ModelConverter) FromModelAuditLog(log *models.AuditLog) (interface{}, error)

FromModelAuditLog converts a model audit log to a legacy audit log

func (*ModelConverter) FromModelIncident

func (c *ModelConverter) FromModelIncident(incident *models.SecurityIncident) (interface{}, error)

FromModelIncident converts a model incident to a legacy incident

func (*ModelConverter) FromModelSession

func (c *ModelConverter) FromModelSession(session *models.Session) (interface{}, error)

FromModelSession converts a model session to a legacy session

func (*ModelConverter) FromModelUser

func (c *ModelConverter) FromModelUser(user *models.User) (interface{}, error)

FromModelUser converts a model user to a legacy user

func (*ModelConverter) FromModelVulnerability

func (c *ModelConverter) FromModelVulnerability(vulnerability *models.Vulnerability) (interface{}, error)

FromModelVulnerability converts a model vulnerability to a legacy vulnerability

func (*ModelConverter) ToModelAuditLog

func (c *ModelConverter) ToModelAuditLog(legacyAuditLog interface{}) (*models.AuditLog, error)

ToModelAuditLog converts a legacy audit log to a model audit log

func (*ModelConverter) ToModelIncident

func (c *ModelConverter) ToModelIncident(legacyIncident interface{}) (*models.SecurityIncident, error)

ToModelIncident converts a legacy incident to a model incident

func (*ModelConverter) ToModelSession

func (c *ModelConverter) ToModelSession(legacySession interface{}) (*models.Session, error)

ToModelSession converts a legacy session to a model session

func (*ModelConverter) ToModelUser

func (c *ModelConverter) ToModelUser(legacyUser interface{}) (*models.User, error)

ToModelUser converts a legacy user to a model user

func (*ModelConverter) ToModelVulnerability

func (c *ModelConverter) ToModelVulnerability(legacyVulnerability interface{}) (*models.Vulnerability, error)

ToModelVulnerability converts a legacy vulnerability to a model vulnerability

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL