55 lines
2.2 KiB
Go
55 lines
2.2 KiB
Go
package models
|
|
|
|
// SMBShare represents an SMB/CIFS share
|
|
type SMBShare struct {
|
|
ID string `json:"id"`
|
|
Name string `json:"name"`
|
|
Path string `json:"path"` // dataset mountpoint
|
|
Dataset string `json:"dataset"` // ZFS dataset name
|
|
Description string `json:"description"`
|
|
ReadOnly bool `json:"read_only"`
|
|
GuestOK bool `json:"guest_ok"`
|
|
ValidUsers []string `json:"valid_users"`
|
|
Enabled bool `json:"enabled"`
|
|
}
|
|
|
|
// NFSExport represents an NFS export
|
|
type NFSExport struct {
|
|
ID string `json:"id"`
|
|
Path string `json:"path"` // dataset mountpoint
|
|
Dataset string `json:"dataset"` // ZFS dataset name
|
|
Clients []string `json:"clients"` // allowed clients (CIDR or hostnames)
|
|
ReadOnly bool `json:"read_only"`
|
|
RootSquash bool `json:"root_squash"`
|
|
Enabled bool `json:"enabled"`
|
|
}
|
|
|
|
// ISCSITargetType represents the type of iSCSI target
|
|
type ISCSITargetType string
|
|
|
|
const (
|
|
ISCSITargetTypeDisk ISCSITargetType = "disk" // For ZVOL/block devices
|
|
ISCSITargetTypeTape ISCSITargetType = "tape" // For tape library passthrough
|
|
)
|
|
|
|
// ISCSITarget represents an iSCSI target
|
|
type ISCSITarget struct {
|
|
ID string `json:"id"`
|
|
IQN string `json:"iqn"` // iSCSI Qualified Name
|
|
Type ISCSITargetType `json:"type"` // "disk" or "tape"
|
|
LUNs []LUN `json:"luns"`
|
|
Initiators []string `json:"initiators"` // ACL list
|
|
Enabled bool `json:"enabled"`
|
|
}
|
|
|
|
// LUN represents a Logical Unit Number backed by various storage types
|
|
type LUN struct {
|
|
ID int `json:"id"` // LUN number
|
|
ZVOL string `json:"zvol"` // ZVOL name (for block backstore)
|
|
Device string `json:"device"` // Device path (e.g., /dev/st0 for tape, /dev/sdX for disk)
|
|
Size uint64 `json:"size"` // bytes (0 for unknown/tape devices)
|
|
Backend string `json:"backend"` // "zvol", "block", "pscsi", "fileio"
|
|
Backstore string `json:"backstore"` // Backstore type: "block", "pscsi", "fileio" (default: "block")
|
|
BackstoreName string `json:"backstore_name"` // Name used in targetcli
|
|
}
|