feat: add comprehensive database models and type definitions
- Define Certificate model with full X.509 attributes - Add CertificateAuthority model for CA management - Implement CertificateRequest model for CSR handling - Add CertificateRevocationList model for CRL support - Define User and Organization models for access control - Include comprehensive certificate type definitions (web, client, email, etc.) - Add status enums for certificates, requests, and organizations - Configure GORM relationships and constraints
This commit is contained in:
110
models/types.go
Normal file
110
models/types.go
Normal file
@@ -0,0 +1,110 @@
|
||||
package models
|
||||
|
||||
// CertificateType represents the type of certificate
|
||||
type CertificateType string
|
||||
|
||||
const (
|
||||
// Web certificates for HTTPS/TLS
|
||||
CertificateTypeWeb CertificateType = "web"
|
||||
CertificateTypeServer CertificateType = "server"
|
||||
|
||||
// Client certificates for authentication
|
||||
CertificateTypeClient CertificateType = "client"
|
||||
CertificateTypeUser CertificateType = "user"
|
||||
|
||||
// Email certificates for S/MIME
|
||||
CertificateTypeEmail CertificateType = "email"
|
||||
|
||||
// Code signing certificates
|
||||
CertificateTypeCode CertificateType = "code"
|
||||
|
||||
// Certificate Authority certificates
|
||||
CertificateTypeCA CertificateType = "ca"
|
||||
|
||||
// IoT and embedded device certificates
|
||||
CertificateTypeIoT CertificateType = "iot"
|
||||
CertificateTypeDevice CertificateType = "device"
|
||||
CertificateTypeSensor CertificateType = "sensor"
|
||||
|
||||
// VPN certificates
|
||||
CertificateTypeVPN CertificateType = "vpn"
|
||||
CertificateTypeOpenVPN CertificateType = "openvpn"
|
||||
CertificateTypeWireGuard CertificateType = "wireguard"
|
||||
|
||||
// Database certificates
|
||||
CertificateTypeDatabase CertificateType = "database"
|
||||
CertificateTypeMySQL CertificateType = "mysql"
|
||||
CertificateTypePostgreSQL CertificateType = "postgresql"
|
||||
CertificateTypeMongoDB CertificateType = "mongodb"
|
||||
|
||||
// API and service certificates
|
||||
CertificateTypeAPI CertificateType = "api"
|
||||
CertificateTypeService CertificateType = "service"
|
||||
CertificateTypeMicroservice CertificateType = "microservice"
|
||||
|
||||
// Container and orchestration certificates
|
||||
CertificateTypeDocker CertificateType = "docker"
|
||||
CertificateTypeKubernetes CertificateType = "kubernetes"
|
||||
CertificateTypeContainer CertificateType = "container"
|
||||
|
||||
// Cloud and infrastructure certificates
|
||||
CertificateTypeCloud CertificateType = "cloud"
|
||||
CertificateTypeAWS CertificateType = "aws"
|
||||
CertificateTypeAzure CertificateType = "azure"
|
||||
CertificateTypeGCP CertificateType = "gcp"
|
||||
|
||||
// Network and security certificates
|
||||
CertificateTypeNetwork CertificateType = "network"
|
||||
CertificateTypeFirewall CertificateType = "firewall"
|
||||
CertificateTypeProxy CertificateType = "proxy"
|
||||
CertificateTypeLoadBalancer CertificateType = "loadbalancer"
|
||||
|
||||
// Mobile and application certificates
|
||||
CertificateTypeMobile CertificateType = "mobile"
|
||||
CertificateTypeAndroid CertificateType = "android"
|
||||
CertificateTypeiOS CertificateType = "ios"
|
||||
CertificateTypeApp CertificateType = "app"
|
||||
|
||||
// Document and file signing
|
||||
CertificateTypeDocument CertificateType = "document"
|
||||
CertificateTypePDF CertificateType = "pdf"
|
||||
CertificateTypeOffice CertificateType = "office"
|
||||
|
||||
// Time stamping certificates
|
||||
CertificateTypeTimestamp CertificateType = "timestamp"
|
||||
|
||||
// OCSP responder certificates
|
||||
CertificateTypeOCSP CertificateType = "ocsp"
|
||||
|
||||
// Custom and specialized certificates
|
||||
CertificateTypeCustom CertificateType = "custom"
|
||||
CertificateTypeSpecial CertificateType = "special"
|
||||
)
|
||||
|
||||
// CertificateStatus represents the status of a certificate
|
||||
type CertificateStatus string
|
||||
|
||||
const (
|
||||
CertificateStatusActive CertificateStatus = "active"
|
||||
CertificateStatusRevoked CertificateStatus = "revoked"
|
||||
CertificateStatusExpired CertificateStatus = "expired"
|
||||
CertificateStatusPending CertificateStatus = "pending"
|
||||
)
|
||||
|
||||
// RequestStatus represents the status of a certificate request
|
||||
type RequestStatus string
|
||||
|
||||
const (
|
||||
RequestStatusPending RequestStatus = "pending"
|
||||
RequestStatusApproved RequestStatus = "approved"
|
||||
RequestStatusRejected RequestStatus = "rejected"
|
||||
RequestStatusCancelled RequestStatus = "cancelled"
|
||||
)
|
||||
|
||||
// OrganizationStatus represents the status of an organization
|
||||
type OrganizationStatus string
|
||||
|
||||
const (
|
||||
OrganizationStatusActive OrganizationStatus = "active"
|
||||
OrganizationStatusInactive OrganizationStatus = "inactive"
|
||||
)
|
Reference in New Issue
Block a user