ipam.go 565 B

123456789101112131415161718192021222324252627
  1. package models
  2. import (
  3. "net"
  4. "github.com/google/uuid"
  5. "gorm.io/gorm"
  6. )
  7. // Ipam represents an entry in the Ipam table
  8. type Ipam struct {
  9. gorm.Model
  10. // ID is a UUID for the APIContract
  11. ID uuid.UUID `gorm:"type:uuid;primaryKey" json:"id"`
  12. // ProjectID is the ID of the project that the config belongs to.
  13. // This should be a foreign key, but GORM doesnt play well with FKs.
  14. ProjectID int `json:"project_id"`
  15. CIDR net.IPNet `gorm:"type:cidr;column:cidr_range"`
  16. }
  17. // TableName overrides the table name
  18. func (Ipam) TableName() string {
  19. return "ipam"
  20. }