Documentation
¶
Index ¶
- func BuildCredentialsParams(v Version, name, providerType string, attributes map[string]any) map[string]any
- func Int64Ptr(v int64) *int64
- func IntPtr(i int) *int
- func ParseSize(s string) (int64, error)
- func StringPtr(v string) *string
- type AliasType
- type App
- type AppActiveWorkloads
- type AppActiveWorkloadsResponse
- type AppAvailableVersion
- type AppAvailableVersionResponse
- type AppContainerDetails
- type AppContainerDetailsResponse
- type AppContainerLogEntry
- type AppContainerLogEntryResponse
- type AppImage
- type AppImageResponse
- type AppNetworkStats
- type AppRegistryResponse
- type AppResponse
- type AppService
- func (s *AppService) AvailableSpace(ctx context.Context) (int64, error)
- func (s *AppService) CreateApp(ctx context.Context, opts CreateAppOpts) (*App, error)
- func (s *AppService) CreateRegistry(ctx context.Context, opts CreateRegistryOpts) (*Registry, error)
- func (s *AppService) DeleteApp(ctx context.Context, name string) error
- func (s *AppService) DeleteRegistry(ctx context.Context, id int64) error
- func (s *AppService) GetApp(ctx context.Context, name string) (*App, error)
- func (s *AppService) GetAppWithConfig(ctx context.Context, name string) (*App, error)
- func (s *AppService) GetRegistry(ctx context.Context, id int64) (*Registry, error)
- func (s *AppService) ListApps(ctx context.Context) ([]App, error)
- func (s *AppService) ListImages(ctx context.Context) ([]AppImage, error)
- func (s *AppService) ListRegistries(ctx context.Context) ([]Registry, error)
- func (s *AppService) RedeployApp(ctx context.Context, name string) error
- func (s *AppService) StartApp(ctx context.Context, name string) error
- func (s *AppService) StopApp(ctx context.Context, name string) error
- func (s *AppService) SubscribeContainerLogs(ctx context.Context, opts ContainerLogOpts) (*Subscription[AppContainerLogEntry], error)
- func (s *AppService) SubscribeStats(ctx context.Context) (*Subscription[[]AppStats], error)
- func (s *AppService) UpdateApp(ctx context.Context, name string, opts UpdateAppOpts) (*App, error)
- func (s *AppService) UpdateRegistry(ctx context.Context, id int64, opts UpdateRegistryOpts) (*Registry, error)
- func (s *AppService) UpgradeApp(ctx context.Context, name string) error
- func (s *AppService) UpgradeSummary(ctx context.Context, name string) (*AppUpgradeSummary, error)
- type AppServiceAPI
- type AppStats
- type AppStatsBlkioResponse
- type AppStatsNetworkResponse
- type AppStatsResponse
- type AppUpgradeSummary
- type AppUpgradeSummaryResponse
- type AppUsedPort
- type AppUsedPortResponse
- type AsyncCaller
- type BwLimit
- type CDROMDevice
- type Caller
- type CloudSyncCredential
- type CloudSyncCredentialProvider
- type CloudSyncCredentialResponse
- type CloudSyncService
- func (s *CloudSyncService) CreateCredential(ctx context.Context, opts CreateCredentialOpts) (*CloudSyncCredential, error)
- func (s *CloudSyncService) CreateTask(ctx context.Context, opts CreateCloudSyncTaskOpts) (*CloudSyncTask, error)
- func (s *CloudSyncService) DeleteCredential(ctx context.Context, id int64) error
- func (s *CloudSyncService) DeleteTask(ctx context.Context, id int64) error
- func (s *CloudSyncService) GetCredential(ctx context.Context, id int64) (*CloudSyncCredential, error)
- func (s *CloudSyncService) GetTask(ctx context.Context, id int64) (*CloudSyncTask, error)
- func (s *CloudSyncService) ListCredentials(ctx context.Context) ([]CloudSyncCredential, error)
- func (s *CloudSyncService) ListTasks(ctx context.Context) ([]CloudSyncTask, error)
- func (s *CloudSyncService) Sync(ctx context.Context, id int64) error
- func (s *CloudSyncService) UpdateCredential(ctx context.Context, id int64, opts UpdateCredentialOpts) (*CloudSyncCredential, error)
- func (s *CloudSyncService) UpdateTask(ctx context.Context, id int64, opts UpdateCloudSyncTaskOpts) (*CloudSyncTask, error)
- type CloudSyncServiceAPI
- type CloudSyncTask
- type CloudSyncTaskCredentialRef
- type CloudSyncTaskResponse
- type ContainerLogOpts
- type ContainerState
- type CreateAppOpts
- type CreateCloudSyncTaskOpts
- type CreateCredentialOpts
- type CreateCronJobOpts
- type CreateDatasetOpts
- type CreateRegistryOpts
- type CreateSnapshotOpts
- type CreateVMDeviceOpts
- type CreateVMOpts
- type CreateVirtInstanceOpts
- type CreateZvolOpts
- type CronJob
- type CronJobResponse
- type CronService
- func (s *CronService) Create(ctx context.Context, opts CreateCronJobOpts) (*CronJob, error)
- func (s *CronService) Delete(ctx context.Context, id int64) error
- func (s *CronService) Get(ctx context.Context, id int64) (*CronJob, error)
- func (s *CronService) List(ctx context.Context) ([]CronJob, error)
- func (s *CronService) Run(ctx context.Context, id int64, skipDisabled bool) error
- func (s *CronService) Update(ctx context.Context, id int64, opts UpdateCronJobOpts) (*CronJob, error)
- type CronServiceAPI
- type Dataset
- type DatasetCreateResponse
- type DatasetResponse
- type DatasetService
- func (s *DatasetService) CreateDataset(ctx context.Context, opts CreateDatasetOpts) (*Dataset, error)
- func (s *DatasetService) CreateZvol(ctx context.Context, opts CreateZvolOpts) (*Zvol, error)
- func (s *DatasetService) DeleteDataset(ctx context.Context, id string, recursive bool) error
- func (s *DatasetService) DeleteZvol(ctx context.Context, id string) error
- func (s *DatasetService) GetDataset(ctx context.Context, id string) (*Dataset, error)
- func (s *DatasetService) GetZvol(ctx context.Context, id string) (*Zvol, error)
- func (s *DatasetService) ListDatasets(ctx context.Context) ([]Dataset, error)
- func (s *DatasetService) ListPools(ctx context.Context) ([]Pool, error)
- func (s *DatasetService) UpdateDataset(ctx context.Context, id string, opts UpdateDatasetOpts) (*Dataset, error)
- func (s *DatasetService) UpdateZvol(ctx context.Context, id string, opts UpdateZvolOpts) (*Zvol, error)
- type DatasetServiceAPI
- type DeviceType
- type DiskDevice
- type DisplayDevice
- type DockerAddressPool
- type DockerAddressPoolResponse
- type DockerConfig
- type DockerConfigResponse
- type DockerService
- type DockerServiceAPI
- type DockerState
- type DockerStatus
- type DockerStatusResponse
- type FileCaller
- type FilesystemService
- func (s *FilesystemService) Client() FileCaller
- func (s *FilesystemService) SetPermissions(ctx context.Context, opts SetPermOpts) error
- func (s *FilesystemService) Stat(ctx context.Context, path string) (*StatResult, error)
- func (s *FilesystemService) WriteFile(ctx context.Context, path string, params WriteFileParams) error
- type FilesystemServiceAPI
- type Flavor
- type InterfaceAlias
- type InterfaceAliasResponse
- type InterfaceResponse
- type InterfaceService
- type InterfaceServiceAPI
- type InterfaceState
- type InterfaceStateResponse
- type InterfaceType
- type JobStatus
- type LinkState
- type MockAppService
- func (m *MockAppService) AvailableSpace(ctx context.Context) (int64, error)
- func (m *MockAppService) CreateApp(ctx context.Context, opts CreateAppOpts) (*App, error)
- func (m *MockAppService) CreateRegistry(ctx context.Context, opts CreateRegistryOpts) (*Registry, error)
- func (m *MockAppService) DeleteApp(ctx context.Context, name string) error
- func (m *MockAppService) DeleteRegistry(ctx context.Context, id int64) error
- func (m *MockAppService) GetApp(ctx context.Context, name string) (*App, error)
- func (m *MockAppService) GetAppWithConfig(ctx context.Context, name string) (*App, error)
- func (m *MockAppService) GetRegistry(ctx context.Context, id int64) (*Registry, error)
- func (m *MockAppService) ListApps(ctx context.Context) ([]App, error)
- func (m *MockAppService) ListImages(ctx context.Context) ([]AppImage, error)
- func (m *MockAppService) ListRegistries(ctx context.Context) ([]Registry, error)
- func (m *MockAppService) RedeployApp(ctx context.Context, name string) error
- func (m *MockAppService) StartApp(ctx context.Context, name string) error
- func (m *MockAppService) StopApp(ctx context.Context, name string) error
- func (m *MockAppService) SubscribeContainerLogs(ctx context.Context, opts ContainerLogOpts) (*Subscription[AppContainerLogEntry], error)
- func (m *MockAppService) SubscribeStats(ctx context.Context) (*Subscription[[]AppStats], error)
- func (m *MockAppService) UpdateApp(ctx context.Context, name string, opts UpdateAppOpts) (*App, error)
- func (m *MockAppService) UpdateRegistry(ctx context.Context, id int64, opts UpdateRegistryOpts) (*Registry, error)
- func (m *MockAppService) UpgradeApp(ctx context.Context, name string) error
- func (m *MockAppService) UpgradeSummary(ctx context.Context, name string) (*AppUpgradeSummary, error)
- type MockCloudSyncService
- func (m *MockCloudSyncService) CreateCredential(ctx context.Context, opts CreateCredentialOpts) (*CloudSyncCredential, error)
- func (m *MockCloudSyncService) CreateTask(ctx context.Context, opts CreateCloudSyncTaskOpts) (*CloudSyncTask, error)
- func (m *MockCloudSyncService) DeleteCredential(ctx context.Context, id int64) error
- func (m *MockCloudSyncService) DeleteTask(ctx context.Context, id int64) error
- func (m *MockCloudSyncService) GetCredential(ctx context.Context, id int64) (*CloudSyncCredential, error)
- func (m *MockCloudSyncService) GetTask(ctx context.Context, id int64) (*CloudSyncTask, error)
- func (m *MockCloudSyncService) ListCredentials(ctx context.Context) ([]CloudSyncCredential, error)
- func (m *MockCloudSyncService) ListTasks(ctx context.Context) ([]CloudSyncTask, error)
- func (m *MockCloudSyncService) Sync(ctx context.Context, id int64) error
- func (m *MockCloudSyncService) UpdateCredential(ctx context.Context, id int64, opts UpdateCredentialOpts) (*CloudSyncCredential, error)
- func (m *MockCloudSyncService) UpdateTask(ctx context.Context, id int64, opts UpdateCloudSyncTaskOpts) (*CloudSyncTask, error)
- type MockCronService
- func (m *MockCronService) Create(ctx context.Context, opts CreateCronJobOpts) (*CronJob, error)
- func (m *MockCronService) Delete(ctx context.Context, id int64) error
- func (m *MockCronService) Get(ctx context.Context, id int64) (*CronJob, error)
- func (m *MockCronService) List(ctx context.Context) ([]CronJob, error)
- func (m *MockCronService) Run(ctx context.Context, id int64, skipDisabled bool) error
- func (m *MockCronService) Update(ctx context.Context, id int64, opts UpdateCronJobOpts) (*CronJob, error)
- type MockDatasetService
- func (m *MockDatasetService) CreateDataset(ctx context.Context, opts CreateDatasetOpts) (*Dataset, error)
- func (m *MockDatasetService) CreateZvol(ctx context.Context, opts CreateZvolOpts) (*Zvol, error)
- func (m *MockDatasetService) DeleteDataset(ctx context.Context, id string, recursive bool) error
- func (m *MockDatasetService) DeleteZvol(ctx context.Context, id string) error
- func (m *MockDatasetService) GetDataset(ctx context.Context, id string) (*Dataset, error)
- func (m *MockDatasetService) GetZvol(ctx context.Context, id string) (*Zvol, error)
- func (m *MockDatasetService) ListDatasets(ctx context.Context) ([]Dataset, error)
- func (m *MockDatasetService) ListPools(ctx context.Context) ([]Pool, error)
- func (m *MockDatasetService) UpdateDataset(ctx context.Context, id string, opts UpdateDatasetOpts) (*Dataset, error)
- func (m *MockDatasetService) UpdateZvol(ctx context.Context, id string, opts UpdateZvolOpts) (*Zvol, error)
- type MockDockerService
- type MockFilesystemService
- func (m *MockFilesystemService) Client() FileCaller
- func (m *MockFilesystemService) SetPermissions(ctx context.Context, opts SetPermOpts) error
- func (m *MockFilesystemService) Stat(ctx context.Context, path string) (*StatResult, error)
- func (m *MockFilesystemService) WriteFile(ctx context.Context, path string, params WriteFileParams) error
- type MockInterfaceService
- type MockNetworkService
- type MockReportingService
- func (m *MockReportingService) GetData(ctx context.Context, params ReportingGetDataParams) ([]ReportingData, error)
- func (m *MockReportingService) ListGraphs(ctx context.Context) ([]ReportingGraph, error)
- func (m *MockReportingService) SubscribeRealtime(ctx context.Context) (*Subscription[RealtimeUpdate], error)
- type MockSnapshotService
- func (m *MockSnapshotService) Clone(ctx context.Context, snapshot, datasetDst string) error
- func (m *MockSnapshotService) Create(ctx context.Context, opts CreateSnapshotOpts) (*Snapshot, error)
- func (m *MockSnapshotService) Delete(ctx context.Context, id string) error
- func (m *MockSnapshotService) Get(ctx context.Context, id string) (*Snapshot, error)
- func (m *MockSnapshotService) Hold(ctx context.Context, id string) error
- func (m *MockSnapshotService) List(ctx context.Context) ([]Snapshot, error)
- func (m *MockSnapshotService) Query(ctx context.Context, filters [][]any) ([]Snapshot, error)
- func (m *MockSnapshotService) Release(ctx context.Context, id string) error
- func (m *MockSnapshotService) Rollback(ctx context.Context, id string) error
- type MockSystemService
- type MockVMService
- func (m *MockVMService) CreateDevice(ctx context.Context, opts CreateVMDeviceOpts) (*VMDevice, error)
- func (m *MockVMService) CreateVM(ctx context.Context, opts CreateVMOpts) (*VM, error)
- func (m *MockVMService) DeleteDevice(ctx context.Context, id int64) error
- func (m *MockVMService) DeleteVM(ctx context.Context, id int64) error
- func (m *MockVMService) GetDevice(ctx context.Context, id int64) (*VMDevice, error)
- func (m *MockVMService) GetVM(ctx context.Context, id int64) (*VM, error)
- func (m *MockVMService) ListDevices(ctx context.Context, vmID int64) ([]VMDevice, error)
- func (m *MockVMService) StartVM(ctx context.Context, id int64) error
- func (m *MockVMService) StopVM(ctx context.Context, id int64, opts StopVMOpts) error
- func (m *MockVMService) UpdateDevice(ctx context.Context, id int64, opts UpdateVMDeviceOpts) (*VMDevice, error)
- func (m *MockVMService) UpdateVM(ctx context.Context, id int64, opts UpdateVMOpts) (*VM, error)
- type MockVirtService
- func (m *MockVirtService) AddDevice(ctx context.Context, instanceID string, opts VirtDeviceOpts) error
- func (m *MockVirtService) CreateInstance(ctx context.Context, opts CreateVirtInstanceOpts) (*VirtInstance, error)
- func (m *MockVirtService) DeleteDevice(ctx context.Context, instanceID string, deviceName string) error
- func (m *MockVirtService) DeleteInstance(ctx context.Context, name string) error
- func (m *MockVirtService) GetGlobalConfig(ctx context.Context) (*VirtGlobalConfig, error)
- func (m *MockVirtService) GetInstance(ctx context.Context, name string) (*VirtInstance, error)
- func (m *MockVirtService) ListDevices(ctx context.Context, instanceID string) ([]VirtDevice, error)
- func (m *MockVirtService) ListInstances(ctx context.Context, filters [][]any) ([]VirtInstance, error)
- func (m *MockVirtService) StartInstance(ctx context.Context, name string) error
- func (m *MockVirtService) StopInstance(ctx context.Context, name string, opts StopVirtInstanceOpts) error
- func (m *MockVirtService) UpdateGlobalConfig(ctx context.Context, opts UpdateVirtGlobalConfigOpts) (*VirtGlobalConfig, error)
- func (m *MockVirtService) UpdateInstance(ctx context.Context, name string, opts UpdateVirtInstanceOpts) (*VirtInstance, error)
- type NICDevice
- type NetworkInterface
- type NetworkInterfaceIPs
- type NetworkInterfaceIPsResponse
- type NetworkService
- type NetworkServiceAPI
- type NetworkSummary
- type NetworkSummaryResponse
- type PCIDevice
- type ParsedValue
- type Pool
- type PoolResponse
- type PropertyValue
- type RawDevice
- type RealtimeCPU
- type RealtimeCPUResponse
- type RealtimeDiskAggregate
- type RealtimeDiskAggregateResponse
- type RealtimeInterface
- type RealtimeInterfaceResponse
- type RealtimeMemory
- type RealtimeMemoryResponse
- type RealtimeUpdate
- type RealtimeUpdateResponse
- type Registry
- type ReportingAggregations
- type ReportingData
- type ReportingDataResponse
- type ReportingGetDataParams
- type ReportingGraph
- type ReportingGraphName
- type ReportingGraphQuery
- type ReportingGraphResponse
- type ReportingService
- func (s *ReportingService) GetData(ctx context.Context, params ReportingGetDataParams) ([]ReportingData, error)
- func (s *ReportingService) ListGraphs(ctx context.Context) ([]ReportingGraph, error)
- func (s *ReportingService) SubscribeRealtime(ctx context.Context) (*Subscription[RealtimeUpdate], error)
- type ReportingServiceAPI
- type Schedule
- type ScheduleResponse
- type SetPermOpts
- type SizePropertyField
- type Snapshot
- type SnapshotProperties
- type SnapshotResponse
- type SnapshotService
- func (s *SnapshotService) Clone(ctx context.Context, snapshot, datasetDst string) error
- func (s *SnapshotService) Create(ctx context.Context, opts CreateSnapshotOpts) (*Snapshot, error)
- func (s *SnapshotService) Delete(ctx context.Context, id string) error
- func (s *SnapshotService) Get(ctx context.Context, id string) (*Snapshot, error)
- func (s *SnapshotService) Hold(ctx context.Context, id string) error
- func (s *SnapshotService) List(ctx context.Context) ([]Snapshot, error)
- func (s *SnapshotService) Query(ctx context.Context, filters [][]any) ([]Snapshot, error)
- func (s *SnapshotService) Release(ctx context.Context, id string) error
- func (s *SnapshotService) Rollback(ctx context.Context, id string) error
- type SnapshotServiceAPI
- type StatResponse
- type StatResult
- type StopVMOpts
- type StopVirtInstanceOpts
- type SubscribeCaller
- type Subscription
- type SystemInfo
- type SystemInfoResponse
- type SystemService
- type SystemServiceAPI
- type USBDevice
- type UpdateAppOpts
- type UpdateCloudSyncTaskOpts
- type UpdateCredentialOpts
- type UpdateCronJobOpts
- type UpdateDatasetOpts
- type UpdateRegistryOpts
- type UpdateVMDeviceOpts
- type UpdateVMOpts
- type UpdateVirtGlobalConfigOpts
- type UpdateVirtInstanceOpts
- type UpdateZvolOpts
- type UserRefsProperty
- type VM
- type VMDevice
- type VMDeviceResponse
- type VMResponse
- type VMService
- func (s *VMService) CreateDevice(ctx context.Context, opts CreateVMDeviceOpts) (*VMDevice, error)
- func (s *VMService) CreateVM(ctx context.Context, opts CreateVMOpts) (*VM, error)
- func (s *VMService) DeleteDevice(ctx context.Context, id int64) error
- func (s *VMService) DeleteVM(ctx context.Context, id int64) error
- func (s *VMService) GetDevice(ctx context.Context, id int64) (*VMDevice, error)
- func (s *VMService) GetVM(ctx context.Context, id int64) (*VM, error)
- func (s *VMService) ListDevices(ctx context.Context, vmID int64) ([]VMDevice, error)
- func (s *VMService) StartVM(ctx context.Context, id int64) error
- func (s *VMService) StopVM(ctx context.Context, id int64, opts StopVMOpts) error
- func (s *VMService) UpdateDevice(ctx context.Context, id int64, opts UpdateVMDeviceOpts) (*VMDevice, error)
- func (s *VMService) UpdateVM(ctx context.Context, id int64, opts UpdateVMOpts) (*VM, error)
- type VMServiceAPI
- type VMStatusField
- type Version
- type VirtAlias
- type VirtDevice
- type VirtDeviceOpts
- type VirtDeviceResponse
- type VirtGlobalConfig
- type VirtGlobalConfigResponse
- type VirtInstance
- type VirtInstanceAliasResponse
- type VirtInstanceImageResponse
- type VirtInstanceResponse
- type VirtService
- func (s *VirtService) AddDevice(ctx context.Context, instanceID string, opts VirtDeviceOpts) error
- func (s *VirtService) CreateInstance(ctx context.Context, opts CreateVirtInstanceOpts) (*VirtInstance, error)
- func (s *VirtService) DeleteDevice(ctx context.Context, instanceID string, deviceName string) error
- func (s *VirtService) DeleteInstance(ctx context.Context, name string) error
- func (s *VirtService) GetGlobalConfig(ctx context.Context) (*VirtGlobalConfig, error)
- func (s *VirtService) GetInstance(ctx context.Context, name string) (*VirtInstance, error)
- func (s *VirtService) ListDevices(ctx context.Context, instanceID string) ([]VirtDevice, error)
- func (s *VirtService) ListInstances(ctx context.Context, filters [][]any) ([]VirtInstance, error)
- func (s *VirtService) StartInstance(ctx context.Context, name string) error
- func (s *VirtService) StopInstance(ctx context.Context, name string, opts StopVirtInstanceOpts) error
- func (s *VirtService) UpdateGlobalConfig(ctx context.Context, opts UpdateVirtGlobalConfigOpts) (*VirtGlobalConfig, error)
- func (s *VirtService) UpdateInstance(ctx context.Context, name string, opts UpdateVirtInstanceOpts) (*VirtInstance, error)
- type VirtServiceAPI
- type WriteFileParams
- type Zvol
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildCredentialsParams ¶
func BuildCredentialsParams(v Version, name, providerType string, attributes map[string]any) map[string]any
BuildCredentialsParams builds cloudsync credentials params for the appropriate API version. Pre-25.x uses separate "provider" (string) and "attributes" (object). 25.x+ uses "provider" as object with "type" merged with attributes.
func Int64Ptr ¶ added in v0.2.0
Int64Ptr returns a pointer to an int64. Helper for setting optional fields.
func ParseSize ¶
ParseSize parses a size string to bytes using go-humanize. Accepts formats like "10GB", "500MB", "1TB", "1024", "10GiB", etc. See https://pkg.go.dev/github.com/dustin/go-humanize#ParseBytes
Types ¶
type AliasType ¶ added in v0.2.4
type AliasType string
AliasType represents the type of an interface alias (IPv4 or IPv6).
type App ¶ added in v0.2.0
type App struct {
Name string
State string
CustomApp bool
Config map[string]any
Version string
HumanVersion string
LatestVersion string
UpgradeAvailable bool
ActiveWorkloads AppActiveWorkloads
}
App is the user-facing representation of a TrueNAS app.
type AppActiveWorkloads ¶ added in v0.2.4
type AppActiveWorkloads struct {
Containers int
UsedPorts []AppUsedPort
ContainerDetails []AppContainerDetails
}
AppActiveWorkloads contains active workload information for an app.
type AppActiveWorkloadsResponse ¶ added in v0.2.4
type AppActiveWorkloadsResponse struct {
Containers int `json:"containers"`
UsedPorts []AppUsedPortResponse `json:"used_ports"`
ContainerDetails []AppContainerDetailsResponse `json:"container_details"`
}
AppActiveWorkloadsResponse is the wire-format for active workload data.
type AppAvailableVersion ¶ added in v0.2.4
AppAvailableVersion represents a version available for upgrade.
type AppAvailableVersionResponse ¶ added in v0.2.4
type AppAvailableVersionResponse struct {
Version string `json:"version"`
HumanVersion string `json:"human_version"`
}
AppAvailableVersionResponse is the wire-format for an available upgrade version.
type AppContainerDetails ¶ added in v0.2.4
type AppContainerDetails struct {
ID string
ServiceName string
Image string
State ContainerState
}
AppContainerDetails represents details of a container within an app.
type AppContainerDetailsResponse ¶ added in v0.2.4
type AppContainerDetailsResponse struct {
ID string `json:"id"`
ServiceName string `json:"service_name"`
Image string `json:"image"`
State string `json:"state"`
}
AppContainerDetailsResponse represents a container detail.
type AppContainerLogEntry ¶ added in v0.2.4
AppContainerLogEntry represents a log line from a container.
type AppContainerLogEntryResponse ¶ added in v0.2.4
type AppContainerLogEntryResponse struct {
Timestamp string `json:"timestamp"`
Message string `json:"data"`
}
AppContainerLogEntryResponse is the wire-format for container log events.
type AppImageResponse ¶ added in v0.2.4
type AppImageResponse struct {
ID string `json:"id"`
RepoTags []string `json:"repo_tags"`
Size int64 `json:"size"`
Created string `json:"created"`
Dangling bool `json:"dangling"`
}
AppImageResponse is the wire-format for app.image.query results.
type AppNetworkStats ¶ added in v0.2.4
AppNetworkStats represents per-interface network stats for an app.
type AppRegistryResponse ¶
type AppRegistryResponse struct {
ID int64 `json:"id"`
Name string `json:"name"`
Description *string `json:"description"`
Username string `json:"username"`
Password string `json:"password"`
URI string `json:"uri"`
}
AppRegistryResponse represents a registry from the TrueNAS API.
type AppResponse ¶ added in v0.2.0
type AppResponse struct {
Name string `json:"name"`
State string `json:"state"`
CustomApp bool `json:"custom_app"`
Config map[string]any `json:"config"`
Version string `json:"version"`
HumanVersion string `json:"human_version"`
LatestVersion string `json:"latest_version"`
UpgradeAvailable bool `json:"upgrade_available"`
ActiveWorkloads AppActiveWorkloadsResponse `json:"active_workloads"`
}
AppResponse represents an app from the TrueNAS API.
type AppService ¶ added in v0.2.0
type AppService struct {
// contains filtered or unexported fields
}
AppService provides typed methods for the app.* API namespace.
func NewAppService ¶ added in v0.2.0
func NewAppService(c SubscribeCaller, v Version) *AppService
NewAppService creates a new AppService.
func (*AppService) AvailableSpace ¶ added in v0.2.4
func (s *AppService) AvailableSpace(ctx context.Context) (int64, error)
AvailableSpace returns the available space in bytes for app storage.
func (*AppService) CreateApp ¶ added in v0.2.0
func (s *AppService) CreateApp(ctx context.Context, opts CreateAppOpts) (*App, error)
CreateApp creates an app and returns the full object.
func (*AppService) CreateRegistry ¶ added in v0.2.0
func (s *AppService) CreateRegistry(ctx context.Context, opts CreateRegistryOpts) (*Registry, error)
CreateRegistry creates a registry and returns the full object.
func (*AppService) DeleteApp ¶ added in v0.2.0
func (s *AppService) DeleteApp(ctx context.Context, name string) error
DeleteApp deletes an app by name.
func (*AppService) DeleteRegistry ¶ added in v0.2.0
func (s *AppService) DeleteRegistry(ctx context.Context, id int64) error
DeleteRegistry deletes a registry by ID.
func (*AppService) GetAppWithConfig ¶ added in v0.2.0
GetAppWithConfig returns an app by name with its config populated, or nil if not found.
func (*AppService) GetRegistry ¶ added in v0.2.0
GetRegistry returns a registry by ID, or nil if not found.
func (*AppService) ListApps ¶ added in v0.2.0
func (s *AppService) ListApps(ctx context.Context) ([]App, error)
ListApps returns all apps.
func (*AppService) ListImages ¶ added in v0.2.4
func (s *AppService) ListImages(ctx context.Context) ([]AppImage, error)
ListImages returns all container images.
func (*AppService) ListRegistries ¶ added in v0.2.0
func (s *AppService) ListRegistries(ctx context.Context) ([]Registry, error)
ListRegistries returns all registries.
func (*AppService) RedeployApp ¶ added in v0.2.4
func (s *AppService) RedeployApp(ctx context.Context, name string) error
RedeployApp redeploys an app by name.
func (*AppService) StartApp ¶ added in v0.2.0
func (s *AppService) StartApp(ctx context.Context, name string) error
StartApp starts an app by name.
func (*AppService) StopApp ¶ added in v0.2.0
func (s *AppService) StopApp(ctx context.Context, name string) error
StopApp stops an app by name.
func (*AppService) SubscribeContainerLogs ¶ added in v0.2.4
func (s *AppService) SubscribeContainerLogs(ctx context.Context, opts ContainerLogOpts) (*Subscription[AppContainerLogEntry], error)
SubscribeContainerLogs subscribes to log output from a specific container.
func (*AppService) SubscribeStats ¶ added in v0.2.4
func (s *AppService) SubscribeStats(ctx context.Context) (*Subscription[[]AppStats], error)
SubscribeStats subscribes to app.stats events for real-time app resource usage.
func (*AppService) UpdateApp ¶ added in v0.2.0
func (s *AppService) UpdateApp(ctx context.Context, name string, opts UpdateAppOpts) (*App, error)
UpdateApp updates an app and returns the full object.
func (*AppService) UpdateRegistry ¶ added in v0.2.0
func (s *AppService) UpdateRegistry(ctx context.Context, id int64, opts UpdateRegistryOpts) (*Registry, error)
UpdateRegistry updates a registry and returns the full object.
func (*AppService) UpgradeApp ¶ added in v0.2.4
func (s *AppService) UpgradeApp(ctx context.Context, name string) error
UpgradeApp upgrades an app by name.
func (*AppService) UpgradeSummary ¶ added in v0.2.4
func (s *AppService) UpgradeSummary(ctx context.Context, name string) (*AppUpgradeSummary, error)
UpgradeSummary returns the upgrade summary for an app.
type AppServiceAPI ¶ added in v0.2.1
type AppServiceAPI interface {
CreateApp(ctx context.Context, opts CreateAppOpts) (*App, error)
GetApp(ctx context.Context, name string) (*App, error)
GetAppWithConfig(ctx context.Context, name string) (*App, error)
UpdateApp(ctx context.Context, name string, opts UpdateAppOpts) (*App, error)
ListApps(ctx context.Context) ([]App, error)
StartApp(ctx context.Context, name string) error
StopApp(ctx context.Context, name string) error
DeleteApp(ctx context.Context, name string) error
UpgradeSummary(ctx context.Context, name string) (*AppUpgradeSummary, error)
ListImages(ctx context.Context) ([]AppImage, error)
AvailableSpace(ctx context.Context) (int64, error)
UpgradeApp(ctx context.Context, name string) error
RedeployApp(ctx context.Context, name string) error
CreateRegistry(ctx context.Context, opts CreateRegistryOpts) (*Registry, error)
GetRegistry(ctx context.Context, id int64) (*Registry, error)
ListRegistries(ctx context.Context) ([]Registry, error)
UpdateRegistry(ctx context.Context, id int64, opts UpdateRegistryOpts) (*Registry, error)
DeleteRegistry(ctx context.Context, id int64) error
SubscribeStats(ctx context.Context) (*Subscription[[]AppStats], error)
SubscribeContainerLogs(ctx context.Context, opts ContainerLogOpts) (*Subscription[AppContainerLogEntry], error)
}
AppServiceAPI defines the interface for app and registry operations.
type AppStats ¶ added in v0.2.4
type AppStats struct {
AppName string
Memory int64
CPUUsage float64
BlkioRead int64
BlkioWrite int64
Networks []AppNetworkStats
}
AppStats represents stats for an app.
type AppStatsBlkioResponse ¶ added in v0.2.4
AppStatsBlkioResponse is the wire-format for block I/O stats.
type AppStatsNetworkResponse ¶ added in v0.2.4
type AppStatsNetworkResponse struct {
InterfaceName string `json:"interface_name"`
RxBytes int64 `json:"rx_bytes"`
TxBytes int64 `json:"tx_bytes"`
}
AppStatsNetworkResponse is the wire-format for per-interface network stats.
type AppStatsResponse ¶ added in v0.2.4
type AppStatsResponse struct {
AppName string `json:"app_name"`
Memory int64 `json:"memory"`
CPUUsage float64 `json:"cpu_usage"`
Blkio AppStatsBlkioResponse `json:"blkio"`
Networks []AppStatsNetworkResponse `json:"networks"`
}
AppStatsResponse is the wire-format for app.stats events.
type AppUpgradeSummary ¶ added in v0.2.4
type AppUpgradeSummary struct {
LatestVersion string
LatestHumanVersion string
UpgradeVersion string
UpgradeHumanVersion string
Changelog string
AvailableVersions []AppAvailableVersion
}
AppUpgradeSummary is the user-facing upgrade summary.
type AppUpgradeSummaryResponse ¶ added in v0.2.4
type AppUpgradeSummaryResponse struct {
LatestVersion string `json:"latest_version"`
LatestHumanVersion string `json:"latest_human_version"`
UpgradeVersion string `json:"upgrade_version"`
UpgradeHumanVersion string `json:"upgrade_human_version"`
Changelog *string `json:"changelog"`
AvailableVersions []AppAvailableVersionResponse `json:"available_versions_for_upgrade"`
}
AppUpgradeSummaryResponse is the wire-format for app.upgrade_summary.
type AppUsedPort ¶ added in v0.2.4
AppUsedPort represents a port mapping for an app.
type AppUsedPortResponse ¶ added in v0.2.4
type AppUsedPortResponse struct {
ContainerPort int `json:"container_port"`
HostPort int `json:"host_port"`
Protocol string `json:"protocol"`
}
AppUsedPortResponse represents a port mapping.
type AsyncCaller ¶ added in v0.2.0
type AsyncCaller interface {
Caller
CallAndWait(ctx context.Context, method string, params any) (json.RawMessage, error)
}
AsyncCaller adds support for long-running job-based operations.
type BwLimit ¶
type BwLimit struct {
Time string `json:"time"`
Bandwidth *int64 `json:"bandwidth"` // null when unlimited
}
BwLimit represents a bandwidth limit entry.
type CDROMDevice ¶ added in v0.2.0
type CDROMDevice struct {
Path string
}
CDROMDevice contains attributes for a CDROM device.
type Caller ¶ added in v0.2.0
type Caller interface {
Call(ctx context.Context, method string, params any) (json.RawMessage, error)
}
Caller is the base interface for making API calls. It is satisfied by client.Client and client.MockClient.
type CloudSyncCredential ¶ added in v0.2.0
type CloudSyncCredential struct {
ID int64
Name string
ProviderType string
Attributes map[string]string
}
CloudSyncCredential is the user-facing representation of a cloud sync credential.
type CloudSyncCredentialProvider ¶
type CloudSyncCredentialProvider struct {
Type string `json:"type"`
// S3 attributes
AccessKeyID string `json:"access_key_id,omitempty"`
SecretAccessKey string `json:"secret_access_key,omitempty"`
Endpoint string `json:"endpoint,omitempty"`
Region string `json:"region,omitempty"`
// B2 attributes
Account string `json:"account,omitempty"`
Key string `json:"key,omitempty"`
// GCS attributes
ServiceAccountCredentials string `json:"service_account_credentials,omitempty"`
// WebDAV attributes
URL string `json:"url,omitempty"`
Vendor string `json:"vendor,omitempty"`
User string `json:"user,omitempty"`
Pass string `json:"pass,omitempty"`
}
CloudSyncCredentialProvider contains the provider type and attributes.
type CloudSyncCredentialResponse ¶
type CloudSyncCredentialResponse struct {
ID int64 `json:"id"`
Name string `json:"name"`
Provider CloudSyncCredentialProvider `json:"provider"`
}
CloudSyncCredentialResponse represents a cloud sync credential from the API.
func ParseCredentials ¶
func ParseCredentials(data []byte, v Version) ([]CloudSyncCredentialResponse, error)
ParseCredentials parses credentials from API response using version-specific logic.
type CloudSyncService ¶ added in v0.2.0
type CloudSyncService struct {
// contains filtered or unexported fields
}
CloudSyncService provides typed methods for the cloudsync.* API namespace.
func NewCloudSyncService ¶ added in v0.2.0
func NewCloudSyncService(c AsyncCaller, v Version) *CloudSyncService
NewCloudSyncService creates a new CloudSyncService.
func (*CloudSyncService) CreateCredential ¶ added in v0.2.0
func (s *CloudSyncService) CreateCredential(ctx context.Context, opts CreateCredentialOpts) (*CloudSyncCredential, error)
CreateCredential creates a cloud sync credential and returns the full object.
func (*CloudSyncService) CreateTask ¶ added in v0.2.0
func (s *CloudSyncService) CreateTask(ctx context.Context, opts CreateCloudSyncTaskOpts) (*CloudSyncTask, error)
CreateTask creates a cloud sync task and returns the full object.
func (*CloudSyncService) DeleteCredential ¶ added in v0.2.0
func (s *CloudSyncService) DeleteCredential(ctx context.Context, id int64) error
DeleteCredential deletes a cloud sync credential by ID.
func (*CloudSyncService) DeleteTask ¶ added in v0.2.0
func (s *CloudSyncService) DeleteTask(ctx context.Context, id int64) error
DeleteTask deletes a cloud sync task by ID.
func (*CloudSyncService) GetCredential ¶ added in v0.2.0
func (s *CloudSyncService) GetCredential(ctx context.Context, id int64) (*CloudSyncCredential, error)
GetCredential returns a cloud sync credential by ID, or nil if not found.
func (*CloudSyncService) GetTask ¶ added in v0.2.0
func (s *CloudSyncService) GetTask(ctx context.Context, id int64) (*CloudSyncTask, error)
GetTask returns a cloud sync task by ID, or nil if not found.
func (*CloudSyncService) ListCredentials ¶ added in v0.2.0
func (s *CloudSyncService) ListCredentials(ctx context.Context) ([]CloudSyncCredential, error)
ListCredentials returns all cloud sync credentials.
func (*CloudSyncService) ListTasks ¶ added in v0.2.0
func (s *CloudSyncService) ListTasks(ctx context.Context) ([]CloudSyncTask, error)
ListTasks returns all cloud sync tasks.
func (*CloudSyncService) Sync ¶ added in v0.2.0
func (s *CloudSyncService) Sync(ctx context.Context, id int64) error
Sync triggers a cloud sync task and waits for it to complete.
func (*CloudSyncService) UpdateCredential ¶ added in v0.2.0
func (s *CloudSyncService) UpdateCredential(ctx context.Context, id int64, opts UpdateCredentialOpts) (*CloudSyncCredential, error)
UpdateCredential updates a cloud sync credential and returns the full object.
func (*CloudSyncService) UpdateTask ¶ added in v0.2.0
func (s *CloudSyncService) UpdateTask(ctx context.Context, id int64, opts UpdateCloudSyncTaskOpts) (*CloudSyncTask, error)
UpdateTask updates a cloud sync task and returns the full object.
type CloudSyncServiceAPI ¶ added in v0.2.1
type CloudSyncServiceAPI interface {
CreateCredential(ctx context.Context, opts CreateCredentialOpts) (*CloudSyncCredential, error)
GetCredential(ctx context.Context, id int64) (*CloudSyncCredential, error)
ListCredentials(ctx context.Context) ([]CloudSyncCredential, error)
UpdateCredential(ctx context.Context, id int64, opts UpdateCredentialOpts) (*CloudSyncCredential, error)
DeleteCredential(ctx context.Context, id int64) error
CreateTask(ctx context.Context, opts CreateCloudSyncTaskOpts) (*CloudSyncTask, error)
GetTask(ctx context.Context, id int64) (*CloudSyncTask, error)
ListTasks(ctx context.Context) ([]CloudSyncTask, error)
UpdateTask(ctx context.Context, id int64, opts UpdateCloudSyncTaskOpts) (*CloudSyncTask, error)
DeleteTask(ctx context.Context, id int64) error
Sync(ctx context.Context, id int64) error
}
CloudSyncServiceAPI defines the interface for cloud sync credential and task operations.
type CloudSyncTask ¶ added in v0.2.0
type CloudSyncTask struct {
ID int64
Description string
Path string
CredentialID int64
Direction string
TransferMode string
Snapshot bool
Transfers int64
BWLimit []BwLimit
FollowSymlinks bool
CreateEmptySrcDirs bool
FastList bool
Enabled bool
Encryption bool
EncryptionPassword string
EncryptionSalt string
Schedule Schedule
Attributes map[string]any
Exclude []string
Include []string
}
CloudSyncTask is the user-facing representation of a cloud sync task.
type CloudSyncTaskCredentialRef ¶
CloudSyncTaskCredentialRef is a minimal struct for embedded credential references in tasks. The full credential parsing is handled by ParseCredentials when needed. This avoids version-specific parsing complexity since task responses embed credentials with provider in different formats (string in 24.x, object in 25.x).
type CloudSyncTaskResponse ¶
type CloudSyncTaskResponse struct {
ID int64 `json:"id"`
Description string `json:"description"`
Path string `json:"path"`
Credentials CloudSyncTaskCredentialRef `json:"credentials"`
Attributes json.RawMessage `json:"attributes"` // Can be object or false
Schedule ScheduleResponse `json:"schedule"`
Direction string `json:"direction"`
TransferMode string `json:"transfer_mode"`
Encryption bool `json:"encryption"`
EncryptionPassword string `json:"encryption_password,omitempty"`
EncryptionSalt string `json:"encryption_salt,omitempty"`
Snapshot bool `json:"snapshot"`
Transfers int64 `json:"transfers"`
BWLimit []BwLimit `json:"bwlimit"`
Exclude []string `json:"exclude"`
Include []string `json:"include"`
FollowSymlinks bool `json:"follow_symlinks"`
CreateEmptySrcDirs bool `json:"create_empty_src_dirs"`
Enabled bool `json:"enabled"`
Job *JobStatus `json:"job,omitempty"`
}
CloudSyncTaskResponse represents a cloud sync task from the API.
type ContainerLogOpts ¶ added in v0.2.4
ContainerLogOpts specifies which container to follow logs for.
type ContainerState ¶ added in v0.2.4
type ContainerState string
ContainerState represents the state of a container.
const ( ContainerStateRunning ContainerState = "running" ContainerStateExited ContainerState = "exited" ContainerStateStarting ContainerState = "starting" ContainerStateStopped ContainerState = "stopped" )
type CreateAppOpts ¶ added in v0.2.0
CreateAppOpts contains options for creating an app.
type CreateCloudSyncTaskOpts ¶ added in v0.2.0
type CreateCloudSyncTaskOpts struct {
Description string
Path string
CredentialID int64
Direction string
TransferMode string
Snapshot bool
Transfers int64
BWLimit []BwLimit
FollowSymlinks bool
CreateEmptySrcDirs bool
FastList bool
Enabled bool
Encryption bool
EncryptionPassword string
EncryptionSalt string
Schedule Schedule
Attributes map[string]any
Exclude []string
Include []string
}
CreateCloudSyncTaskOpts contains options for creating a cloud sync task.
type CreateCredentialOpts ¶ added in v0.2.0
CreateCredentialOpts contains options for creating a cloud sync credential.
type CreateCronJobOpts ¶ added in v0.2.0
type CreateCronJobOpts struct {
User string
Command string
Description string
Enabled bool
CaptureStdout bool
CaptureStderr bool
Schedule Schedule
}
CreateCronJobOpts contains options for creating a cron job.
type CreateDatasetOpts ¶ added in v0.2.0
type CreateDatasetOpts struct {
Name string
Comments string
Compression string
Quota int64
RefQuota int64
Atime string
}
CreateDatasetOpts contains options for creating a filesystem dataset.
type CreateRegistryOpts ¶ added in v0.2.0
type CreateRegistryOpts struct {
Name string
Description string
Username string
Password string
URI string
}
CreateRegistryOpts contains options for creating a registry.
type CreateSnapshotOpts ¶ added in v0.2.0
CreateSnapshotOpts contains options for creating a snapshot.
type CreateVMDeviceOpts ¶ added in v0.2.0
type CreateVMDeviceOpts struct {
VM int64
Order *int64
DeviceType DeviceType
Disk *DiskDevice
Raw *RawDevice
CDROM *CDROMDevice
NIC *NICDevice
Display *DisplayDevice
PCI *PCIDevice
USB *USBDevice
}
CreateVMDeviceOpts contains options for creating a VM device.
type CreateVMOpts ¶ added in v0.2.0
type CreateVMOpts struct {
Name string
Description string
VCPUs int64
Cores int64
Threads int64
Memory int64
MinMemory *int64
Autostart bool
Time string
Bootloader string
BootloaderOVMF string
CPUMode string
CPUModel string
ShutdownTimeout int64
CommandLineArgs string
}
CreateVMOpts contains options for creating a VM.
type CreateVirtInstanceOpts ¶ added in v0.2.0
type CreateVirtInstanceOpts struct {
Name string
InstanceType string
Image string
CPU string
Memory int64
Autostart bool
Environment map[string]string
Devices []VirtDeviceOpts
StoragePool string
}
CreateVirtInstanceOpts contains options for creating a virt instance.
type CreateZvolOpts ¶ added in v0.2.0
type CreateZvolOpts struct {
Name string
Volsize int64
Volblocksize string
Sparse bool
ForceSize bool
Compression string
Comments string
}
CreateZvolOpts contains options for creating a zvol.
type CronJob ¶ added in v0.2.0
type CronJob struct {
ID int64
User string
Command string
Description string
Enabled bool
CaptureStdout bool
CaptureStderr bool
Schedule Schedule
}
CronJob is the user-facing representation of a TrueNAS cron job. CaptureStdout/CaptureStderr use intuitive semantics (true = capture), unlike the API's inverted stdout/stderr fields.
type CronJobResponse ¶
type CronJobResponse struct {
ID int64 `json:"id"`
User string `json:"user"`
Command string `json:"command"`
Description string `json:"description"`
Enabled bool `json:"enabled"`
Stdout bool `json:"stdout"`
Stderr bool `json:"stderr"`
Schedule ScheduleResponse `json:"schedule"`
}
CronJobResponse represents a cron job from the TrueNAS API.
type CronService ¶ added in v0.2.0
type CronService struct {
// contains filtered or unexported fields
}
CronService provides typed methods for the cronjob.* API namespace.
func NewCronService ¶ added in v0.2.0
func NewCronService(c AsyncCaller, v Version) *CronService
NewCronService creates a new CronService.
func (*CronService) Create ¶ added in v0.2.0
func (s *CronService) Create(ctx context.Context, opts CreateCronJobOpts) (*CronJob, error)
Create creates a cron job and returns the full object.
func (*CronService) Delete ¶ added in v0.2.0
func (s *CronService) Delete(ctx context.Context, id int64) error
Delete deletes a cron job by ID.
func (*CronService) List ¶ added in v0.2.0
func (s *CronService) List(ctx context.Context) ([]CronJob, error)
List returns all cron jobs.
func (*CronService) Run ¶ added in v0.4.0
Run triggers a cron job and waits for it to complete. When skipDisabled is true, disabled jobs are skipped instead of being run.
func (*CronService) Update ¶ added in v0.2.0
func (s *CronService) Update(ctx context.Context, id int64, opts UpdateCronJobOpts) (*CronJob, error)
Update updates a cron job and returns the full object.
type CronServiceAPI ¶ added in v0.2.1
type CronServiceAPI interface {
Create(ctx context.Context, opts CreateCronJobOpts) (*CronJob, error)
Get(ctx context.Context, id int64) (*CronJob, error)
List(ctx context.Context) ([]CronJob, error)
Update(ctx context.Context, id int64, opts UpdateCronJobOpts) (*CronJob, error)
Delete(ctx context.Context, id int64) error
Run(ctx context.Context, id int64, skipDisabled bool) error
}
CronServiceAPI defines the interface for cron job operations.
type Dataset ¶ added in v0.2.0
type Dataset struct {
ID string
Name string
Pool string
Mountpoint string
Comments string
Compression string
Quota int64
RefQuota int64
Atime string
Used int64
Available int64
}
Dataset is the user-facing representation of a TrueNAS filesystem dataset.
type DatasetCreateResponse ¶ added in v0.2.0
type DatasetCreateResponse struct {
ID string `json:"id"`
Name string `json:"name"`
Mountpoint string `json:"mountpoint"`
}
DatasetCreateResponse represents the response from pool.dataset.create.
type DatasetResponse ¶ added in v0.2.0
type DatasetResponse struct {
ID string `json:"id"`
Name string `json:"name"`
Pool string `json:"pool"`
Type string `json:"type"`
Mountpoint string `json:"mountpoint"`
Comments PropertyValue `json:"comments"`
Compression PropertyValue `json:"compression"`
Quota SizePropertyField `json:"quota"`
RefQuota SizePropertyField `json:"refquota"`
Atime PropertyValue `json:"atime"`
Volsize SizePropertyField `json:"volsize"`
Volblocksize PropertyValue `json:"volblocksize"`
Sparse PropertyValue `json:"sparse"`
Used SizePropertyField `json:"used"`
Available SizePropertyField `json:"available"`
}
DatasetResponse represents a dataset from the pool.dataset.query API.
type DatasetService ¶ added in v0.2.0
type DatasetService struct {
// contains filtered or unexported fields
}
DatasetService provides typed methods for the pool.dataset.* and pool.query API namespaces.
func NewDatasetService ¶ added in v0.2.0
func NewDatasetService(c Caller, v Version) *DatasetService
NewDatasetService creates a new DatasetService.
func (*DatasetService) CreateDataset ¶ added in v0.2.0
func (s *DatasetService) CreateDataset(ctx context.Context, opts CreateDatasetOpts) (*Dataset, error)
CreateDataset creates a filesystem dataset and returns the full object.
func (*DatasetService) CreateZvol ¶ added in v0.2.0
func (s *DatasetService) CreateZvol(ctx context.Context, opts CreateZvolOpts) (*Zvol, error)
CreateZvol creates a zvol and returns the full object.
func (*DatasetService) DeleteDataset ¶ added in v0.2.0
DeleteDataset deletes a dataset by ID. If recursive is true, child datasets are also deleted.
func (*DatasetService) DeleteZvol ¶ added in v0.2.0
func (s *DatasetService) DeleteZvol(ctx context.Context, id string) error
DeleteZvol deletes a zvol by ID.
func (*DatasetService) GetDataset ¶ added in v0.2.0
GetDataset returns a dataset by ID, or nil if not found.
func (*DatasetService) ListDatasets ¶ added in v0.2.0
func (s *DatasetService) ListDatasets(ctx context.Context) ([]Dataset, error)
ListDatasets returns all filesystem datasets (type FILESYSTEM only).
func (*DatasetService) ListPools ¶ added in v0.2.0
func (s *DatasetService) ListPools(ctx context.Context) ([]Pool, error)
ListPools returns all pools.
func (*DatasetService) UpdateDataset ¶ added in v0.2.0
func (s *DatasetService) UpdateDataset(ctx context.Context, id string, opts UpdateDatasetOpts) (*Dataset, error)
UpdateDataset updates a dataset and returns the full object.
func (*DatasetService) UpdateZvol ¶ added in v0.2.0
func (s *DatasetService) UpdateZvol(ctx context.Context, id string, opts UpdateZvolOpts) (*Zvol, error)
UpdateZvol updates a zvol and returns the full object.
type DatasetServiceAPI ¶ added in v0.2.1
type DatasetServiceAPI interface {
CreateDataset(ctx context.Context, opts CreateDatasetOpts) (*Dataset, error)
GetDataset(ctx context.Context, id string) (*Dataset, error)
ListDatasets(ctx context.Context) ([]Dataset, error)
UpdateDataset(ctx context.Context, id string, opts UpdateDatasetOpts) (*Dataset, error)
DeleteDataset(ctx context.Context, id string, recursive bool) error
CreateZvol(ctx context.Context, opts CreateZvolOpts) (*Zvol, error)
GetZvol(ctx context.Context, id string) (*Zvol, error)
UpdateZvol(ctx context.Context, id string, opts UpdateZvolOpts) (*Zvol, error)
DeleteZvol(ctx context.Context, id string) error
ListPools(ctx context.Context) ([]Pool, error)
}
DatasetServiceAPI defines the interface for dataset, zvol, and pool operations.
type DeviceType ¶ added in v0.2.0
type DeviceType string
DeviceType represents the type of a VM device.
const ( DeviceTypeDisk DeviceType = "DISK" DeviceTypeRaw DeviceType = "RAW" DeviceTypeCDROM DeviceType = "CDROM" DeviceTypeNIC DeviceType = "NIC" DeviceTypeDisplay DeviceType = "DISPLAY" DeviceTypePCI DeviceType = "PCI" DeviceTypeUSB DeviceType = "USB" )
type DiskDevice ¶ added in v0.2.0
type DiskDevice struct {
Path string
Type string
IOType *string
Serial string
PhysicalSectorSize *int64
Logical_Sector_Size *int64
}
DiskDevice contains attributes for a DISK device.
type DisplayDevice ¶ added in v0.2.0
type DisplayDevice struct {
Type string
Port int64
WebPort int64
Bind string
Password string
Web bool
Resolution string
Wait bool
}
DisplayDevice contains attributes for a DISPLAY device.
type DockerAddressPool ¶ added in v0.2.4
DockerAddressPool represents an address pool in Docker config.
type DockerAddressPoolResponse ¶ added in v0.2.4
DockerAddressPoolResponse represents an address pool in Docker config.
type DockerConfig ¶ added in v0.2.4
type DockerConfig struct {
Pool string
EnableImageUpdates bool
NvidiaEnabled bool
AddressPools []DockerAddressPool
}
DockerConfig is the user-facing representation of Docker configuration.
type DockerConfigResponse ¶ added in v0.2.4
type DockerConfigResponse struct {
Pool string `json:"pool"`
EnableImageUpdates bool `json:"enable_image_updates"`
NvidiaEnabled bool `json:"nvidia"`
AddressPoolsV4 []DockerAddressPoolResponse `json:"address_pools"`
}
DockerConfigResponse represents the wire-format response from docker.config.
type DockerService ¶ added in v0.2.4
type DockerService struct {
// contains filtered or unexported fields
}
DockerService provides typed methods for the docker.* API namespace.
func NewDockerService ¶ added in v0.2.4
func NewDockerService(c Caller, v Version) *DockerService
NewDockerService creates a new DockerService.
func (*DockerService) GetConfig ¶ added in v0.2.4
func (s *DockerService) GetConfig(ctx context.Context) (*DockerConfig, error)
GetConfig returns the current Docker configuration.
func (*DockerService) GetStatus ¶ added in v0.2.4
func (s *DockerService) GetStatus(ctx context.Context) (*DockerStatus, error)
GetStatus returns the current Docker runtime status.
type DockerServiceAPI ¶ added in v0.2.4
type DockerServiceAPI interface {
GetStatus(ctx context.Context) (*DockerStatus, error)
GetConfig(ctx context.Context) (*DockerConfig, error)
}
DockerServiceAPI defines the interface for Docker operations.
type DockerState ¶ added in v0.2.4
type DockerState string
DockerState represents the state of the Docker/container runtime.
const ( DockerStateRunning DockerState = "RUNNING" DockerStateStopped DockerState = "STOPPED" DockerStateInitializing DockerState = "INITIALIZING" DockerStateError DockerState = "ERROR" DockerStateUnconfigured DockerState = "UNCONFIGURED" )
type DockerStatus ¶ added in v0.2.4
type DockerStatus struct {
Status DockerState
Description string
}
DockerStatus is the user-facing representation of Docker runtime status.
type DockerStatusResponse ¶ added in v0.2.4
type DockerStatusResponse struct {
Status string `json:"status"`
Description string `json:"description"`
}
DockerStatusResponse represents the wire-format response from docker.status.
type FileCaller ¶ added in v0.2.0
type FileCaller interface {
AsyncCaller
// Deprecated: Use FilesystemService.WriteFile instead.
WriteFile(ctx context.Context, path string, params WriteFileParams) error
ReadFile(ctx context.Context, path string) ([]byte, error)
DeleteFile(ctx context.Context, path string) error
RemoveDir(ctx context.Context, path string) error
RemoveAll(ctx context.Context, path string) error
FileExists(ctx context.Context, path string) (bool, error)
Chown(ctx context.Context, path string, uid, gid int) error
ChmodRecursive(ctx context.Context, path string, mode fs.FileMode) error
MkdirAll(ctx context.Context, path string, mode fs.FileMode) error
}
FileCaller adds file system operations over SSH. Embeds AsyncCaller because filesystem.setperm is job-based.
type FilesystemService ¶ added in v0.2.0
type FilesystemService struct {
// contains filtered or unexported fields
}
FilesystemService provides typed methods for the filesystem.* API namespace.
func NewFilesystemService ¶ added in v0.2.0
func NewFilesystemService(c FileCaller, v Version) *FilesystemService
NewFilesystemService creates a new FilesystemService.
func (*FilesystemService) Client ¶ added in v0.2.0
func (s *FilesystemService) Client() FileCaller
Client returns the underlying FileCaller.
func (*FilesystemService) SetPermissions ¶ added in v0.2.0
func (s *FilesystemService) SetPermissions(ctx context.Context, opts SetPermOpts) error
SetPermissions sets filesystem permissions via the filesystem.setperm API. This is a job-based operation that blocks until complete.
func (*FilesystemService) Stat ¶ added in v0.2.0
func (s *FilesystemService) Stat(ctx context.Context, path string) (*StatResult, error)
Stat returns filesystem stat information for the given path. Mode is masked with 0o777 to strip file type bits.
func (*FilesystemService) WriteFile ¶ added in v0.3.0
func (s *FilesystemService) WriteFile(ctx context.Context, path string, params WriteFileParams) error
WriteFile writes content to a file on the remote system via filesystem.file_receive.
type FilesystemServiceAPI ¶ added in v0.2.1
type FilesystemServiceAPI interface {
Client() FileCaller
WriteFile(ctx context.Context, path string, params WriteFileParams) error
Stat(ctx context.Context, path string) (*StatResult, error)
SetPermissions(ctx context.Context, opts SetPermOpts) error
}
FilesystemServiceAPI defines the interface for filesystem operations.
type InterfaceAlias ¶ added in v0.2.4
InterfaceAlias is the user-facing representation of an IP alias on a network interface.
type InterfaceAliasResponse ¶ added in v0.2.4
type InterfaceAliasResponse struct {
Type string `json:"type"`
Address string `json:"address"`
Netmask int `json:"netmask"`
}
InterfaceAliasResponse represents an IP alias on a network interface.
type InterfaceResponse ¶ added in v0.2.4
type InterfaceResponse struct {
ID string `json:"id"`
Name string `json:"name"`
Type string `json:"type"`
Description string `json:"description"`
MTU int `json:"mtu"`
State InterfaceStateResponse `json:"state"`
Aliases []InterfaceAliasResponse `json:"aliases"`
}
InterfaceResponse represents a network interface from the query API.
type InterfaceService ¶ added in v0.2.4
type InterfaceService struct {
// contains filtered or unexported fields
}
InterfaceService provides typed methods for the network interface API namespace.
func NewInterfaceService ¶ added in v0.2.4
func NewInterfaceService(c Caller, v Version) *InterfaceService
NewInterfaceService creates a new InterfaceService.
func (*InterfaceService) Get ¶ added in v0.2.4
func (s *InterfaceService) Get(ctx context.Context, id string) (*NetworkInterface, error)
Get returns a network interface by ID, or nil if not found.
func (*InterfaceService) List ¶ added in v0.2.4
func (s *InterfaceService) List(ctx context.Context) ([]NetworkInterface, error)
List returns all network interfaces.
type InterfaceServiceAPI ¶ added in v0.2.4
type InterfaceServiceAPI interface {
List(ctx context.Context) ([]NetworkInterface, error)
Get(ctx context.Context, id string) (*NetworkInterface, error)
}
InterfaceServiceAPI defines the interface for network interface operations.
type InterfaceState ¶ added in v0.2.4
type InterfaceState struct {
Name string
LinkState LinkState
ActiveMediaType string
ActiveMediaSubtype string
}
InterfaceState is the user-facing representation of a network interface's link state.
type InterfaceStateResponse ¶ added in v0.2.4
type InterfaceStateResponse struct {
Name string `json:"name"`
LinkState string `json:"link_state"`
ActiveMediaType string `json:"active_media_type"`
ActiveMediaSubtype string `json:"active_media_subtype"`
}
InterfaceStateResponse represents the state sub-object of a network interface.
type InterfaceType ¶ added in v0.2.4
type InterfaceType string
InterfaceType represents the type of a network interface.
const ( InterfaceTypePhysical InterfaceType = "PHYSICAL" InterfaceTypeBridge InterfaceType = "BRIDGE" InterfaceTypeLAGG InterfaceType = "LINK_AGGREGATION" InterfaceTypeVLAN InterfaceType = "VLAN" )
type LinkState ¶ added in v0.2.4
type LinkState string
LinkState represents the link state of a network interface.
type MockAppService ¶ added in v0.2.1
type MockAppService struct {
CreateAppFunc func(ctx context.Context, opts CreateAppOpts) (*App, error)
GetAppFunc func(ctx context.Context, name string) (*App, error)
GetAppWithConfigFunc func(ctx context.Context, name string) (*App, error)
UpdateAppFunc func(ctx context.Context, name string, opts UpdateAppOpts) (*App, error)
ListAppsFunc func(ctx context.Context) ([]App, error)
StartAppFunc func(ctx context.Context, name string) error
StopAppFunc func(ctx context.Context, name string) error
DeleteAppFunc func(ctx context.Context, name string) error
UpgradeSummaryFunc func(ctx context.Context, name string) (*AppUpgradeSummary, error)
ListImagesFunc func(ctx context.Context) ([]AppImage, error)
AvailableSpaceFunc func(ctx context.Context) (int64, error)
UpgradeAppFunc func(ctx context.Context, name string) error
RedeployAppFunc func(ctx context.Context, name string) error
CreateRegistryFunc func(ctx context.Context, opts CreateRegistryOpts) (*Registry, error)
GetRegistryFunc func(ctx context.Context, id int64) (*Registry, error)
ListRegistriesFunc func(ctx context.Context) ([]Registry, error)
UpdateRegistryFunc func(ctx context.Context, id int64, opts UpdateRegistryOpts) (*Registry, error)
DeleteRegistryFunc func(ctx context.Context, id int64) error
SubscribeStatsFunc func(ctx context.Context) (*Subscription[[]AppStats], error)
SubscribeContainerLogsFunc func(ctx context.Context, opts ContainerLogOpts) (*Subscription[AppContainerLogEntry], error)
}
MockAppService is a test double for AppServiceAPI.
func (*MockAppService) AvailableSpace ¶ added in v0.2.4
func (m *MockAppService) AvailableSpace(ctx context.Context) (int64, error)
func (*MockAppService) CreateApp ¶ added in v0.2.1
func (m *MockAppService) CreateApp(ctx context.Context, opts CreateAppOpts) (*App, error)
func (*MockAppService) CreateRegistry ¶ added in v0.2.1
func (m *MockAppService) CreateRegistry(ctx context.Context, opts CreateRegistryOpts) (*Registry, error)
func (*MockAppService) DeleteApp ¶ added in v0.2.1
func (m *MockAppService) DeleteApp(ctx context.Context, name string) error
func (*MockAppService) DeleteRegistry ¶ added in v0.2.1
func (m *MockAppService) DeleteRegistry(ctx context.Context, id int64) error
func (*MockAppService) GetAppWithConfig ¶ added in v0.2.1
func (*MockAppService) GetRegistry ¶ added in v0.2.1
func (*MockAppService) ListApps ¶ added in v0.2.1
func (m *MockAppService) ListApps(ctx context.Context) ([]App, error)
func (*MockAppService) ListImages ¶ added in v0.2.4
func (m *MockAppService) ListImages(ctx context.Context) ([]AppImage, error)
func (*MockAppService) ListRegistries ¶ added in v0.2.1
func (m *MockAppService) ListRegistries(ctx context.Context) ([]Registry, error)
func (*MockAppService) RedeployApp ¶ added in v0.2.4
func (m *MockAppService) RedeployApp(ctx context.Context, name string) error
func (*MockAppService) StartApp ¶ added in v0.2.1
func (m *MockAppService) StartApp(ctx context.Context, name string) error
func (*MockAppService) StopApp ¶ added in v0.2.1
func (m *MockAppService) StopApp(ctx context.Context, name string) error
func (*MockAppService) SubscribeContainerLogs ¶ added in v0.2.4
func (m *MockAppService) SubscribeContainerLogs(ctx context.Context, opts ContainerLogOpts) (*Subscription[AppContainerLogEntry], error)
func (*MockAppService) SubscribeStats ¶ added in v0.2.4
func (m *MockAppService) SubscribeStats(ctx context.Context) (*Subscription[[]AppStats], error)
func (*MockAppService) UpdateApp ¶ added in v0.2.1
func (m *MockAppService) UpdateApp(ctx context.Context, name string, opts UpdateAppOpts) (*App, error)
func (*MockAppService) UpdateRegistry ¶ added in v0.2.1
func (m *MockAppService) UpdateRegistry(ctx context.Context, id int64, opts UpdateRegistryOpts) (*Registry, error)
func (*MockAppService) UpgradeApp ¶ added in v0.2.4
func (m *MockAppService) UpgradeApp(ctx context.Context, name string) error
func (*MockAppService) UpgradeSummary ¶ added in v0.2.4
func (m *MockAppService) UpgradeSummary(ctx context.Context, name string) (*AppUpgradeSummary, error)
type MockCloudSyncService ¶ added in v0.2.1
type MockCloudSyncService struct {
CreateCredentialFunc func(ctx context.Context, opts CreateCredentialOpts) (*CloudSyncCredential, error)
GetCredentialFunc func(ctx context.Context, id int64) (*CloudSyncCredential, error)
ListCredentialsFunc func(ctx context.Context) ([]CloudSyncCredential, error)
UpdateCredentialFunc func(ctx context.Context, id int64, opts UpdateCredentialOpts) (*CloudSyncCredential, error)
DeleteCredentialFunc func(ctx context.Context, id int64) error
CreateTaskFunc func(ctx context.Context, opts CreateCloudSyncTaskOpts) (*CloudSyncTask, error)
GetTaskFunc func(ctx context.Context, id int64) (*CloudSyncTask, error)
ListTasksFunc func(ctx context.Context) ([]CloudSyncTask, error)
UpdateTaskFunc func(ctx context.Context, id int64, opts UpdateCloudSyncTaskOpts) (*CloudSyncTask, error)
DeleteTaskFunc func(ctx context.Context, id int64) error
SyncFunc func(ctx context.Context, id int64) error
}
MockCloudSyncService is a test double for CloudSyncServiceAPI.
func (*MockCloudSyncService) CreateCredential ¶ added in v0.2.1
func (m *MockCloudSyncService) CreateCredential(ctx context.Context, opts CreateCredentialOpts) (*CloudSyncCredential, error)
func (*MockCloudSyncService) CreateTask ¶ added in v0.2.1
func (m *MockCloudSyncService) CreateTask(ctx context.Context, opts CreateCloudSyncTaskOpts) (*CloudSyncTask, error)
func (*MockCloudSyncService) DeleteCredential ¶ added in v0.2.1
func (m *MockCloudSyncService) DeleteCredential(ctx context.Context, id int64) error
func (*MockCloudSyncService) DeleteTask ¶ added in v0.2.1
func (m *MockCloudSyncService) DeleteTask(ctx context.Context, id int64) error
func (*MockCloudSyncService) GetCredential ¶ added in v0.2.1
func (m *MockCloudSyncService) GetCredential(ctx context.Context, id int64) (*CloudSyncCredential, error)
func (*MockCloudSyncService) GetTask ¶ added in v0.2.1
func (m *MockCloudSyncService) GetTask(ctx context.Context, id int64) (*CloudSyncTask, error)
func (*MockCloudSyncService) ListCredentials ¶ added in v0.2.1
func (m *MockCloudSyncService) ListCredentials(ctx context.Context) ([]CloudSyncCredential, error)
func (*MockCloudSyncService) ListTasks ¶ added in v0.2.1
func (m *MockCloudSyncService) ListTasks(ctx context.Context) ([]CloudSyncTask, error)
func (*MockCloudSyncService) Sync ¶ added in v0.2.1
func (m *MockCloudSyncService) Sync(ctx context.Context, id int64) error
func (*MockCloudSyncService) UpdateCredential ¶ added in v0.2.1
func (m *MockCloudSyncService) UpdateCredential(ctx context.Context, id int64, opts UpdateCredentialOpts) (*CloudSyncCredential, error)
func (*MockCloudSyncService) UpdateTask ¶ added in v0.2.1
func (m *MockCloudSyncService) UpdateTask(ctx context.Context, id int64, opts UpdateCloudSyncTaskOpts) (*CloudSyncTask, error)
type MockCronService ¶ added in v0.2.1
type MockCronService struct {
CreateFunc func(ctx context.Context, opts CreateCronJobOpts) (*CronJob, error)
GetFunc func(ctx context.Context, id int64) (*CronJob, error)
ListFunc func(ctx context.Context) ([]CronJob, error)
UpdateFunc func(ctx context.Context, id int64, opts UpdateCronJobOpts) (*CronJob, error)
DeleteFunc func(ctx context.Context, id int64) error
RunFunc func(ctx context.Context, id int64, skipDisabled bool) error
}
MockCronService is a test double for CronServiceAPI.
func (*MockCronService) Create ¶ added in v0.2.1
func (m *MockCronService) Create(ctx context.Context, opts CreateCronJobOpts) (*CronJob, error)
func (*MockCronService) Delete ¶ added in v0.2.1
func (m *MockCronService) Delete(ctx context.Context, id int64) error
func (*MockCronService) List ¶ added in v0.2.1
func (m *MockCronService) List(ctx context.Context) ([]CronJob, error)
func (*MockCronService) Update ¶ added in v0.2.1
func (m *MockCronService) Update(ctx context.Context, id int64, opts UpdateCronJobOpts) (*CronJob, error)
type MockDatasetService ¶ added in v0.2.1
type MockDatasetService struct {
CreateDatasetFunc func(ctx context.Context, opts CreateDatasetOpts) (*Dataset, error)
GetDatasetFunc func(ctx context.Context, id string) (*Dataset, error)
ListDatasetsFunc func(ctx context.Context) ([]Dataset, error)
UpdateDatasetFunc func(ctx context.Context, id string, opts UpdateDatasetOpts) (*Dataset, error)
DeleteDatasetFunc func(ctx context.Context, id string, recursive bool) error
CreateZvolFunc func(ctx context.Context, opts CreateZvolOpts) (*Zvol, error)
GetZvolFunc func(ctx context.Context, id string) (*Zvol, error)
UpdateZvolFunc func(ctx context.Context, id string, opts UpdateZvolOpts) (*Zvol, error)
DeleteZvolFunc func(ctx context.Context, id string) error
ListPoolsFunc func(ctx context.Context) ([]Pool, error)
}
MockDatasetService is a test double for DatasetServiceAPI.
func (*MockDatasetService) CreateDataset ¶ added in v0.2.1
func (m *MockDatasetService) CreateDataset(ctx context.Context, opts CreateDatasetOpts) (*Dataset, error)
func (*MockDatasetService) CreateZvol ¶ added in v0.2.1
func (m *MockDatasetService) CreateZvol(ctx context.Context, opts CreateZvolOpts) (*Zvol, error)
func (*MockDatasetService) DeleteDataset ¶ added in v0.2.1
func (*MockDatasetService) DeleteZvol ¶ added in v0.2.1
func (m *MockDatasetService) DeleteZvol(ctx context.Context, id string) error
func (*MockDatasetService) GetDataset ¶ added in v0.2.1
func (*MockDatasetService) ListDatasets ¶ added in v0.2.1
func (m *MockDatasetService) ListDatasets(ctx context.Context) ([]Dataset, error)
func (*MockDatasetService) ListPools ¶ added in v0.2.1
func (m *MockDatasetService) ListPools(ctx context.Context) ([]Pool, error)
func (*MockDatasetService) UpdateDataset ¶ added in v0.2.1
func (m *MockDatasetService) UpdateDataset(ctx context.Context, id string, opts UpdateDatasetOpts) (*Dataset, error)
func (*MockDatasetService) UpdateZvol ¶ added in v0.2.1
func (m *MockDatasetService) UpdateZvol(ctx context.Context, id string, opts UpdateZvolOpts) (*Zvol, error)
type MockDockerService ¶ added in v0.2.4
type MockDockerService struct {
GetStatusFunc func(ctx context.Context) (*DockerStatus, error)
GetConfigFunc func(ctx context.Context) (*DockerConfig, error)
}
MockDockerService is a test double for DockerServiceAPI.
func (*MockDockerService) GetConfig ¶ added in v0.2.4
func (m *MockDockerService) GetConfig(ctx context.Context) (*DockerConfig, error)
func (*MockDockerService) GetStatus ¶ added in v0.2.4
func (m *MockDockerService) GetStatus(ctx context.Context) (*DockerStatus, error)
type MockFilesystemService ¶ added in v0.2.1
type MockFilesystemService struct {
ClientFunc func() FileCaller
WriteFileFunc func(ctx context.Context, path string, params WriteFileParams) error
StatFunc func(ctx context.Context, path string) (*StatResult, error)
SetPermissionsFunc func(ctx context.Context, opts SetPermOpts) error
}
MockFilesystemService is a test double for FilesystemServiceAPI.
func (*MockFilesystemService) Client ¶ added in v0.2.1
func (m *MockFilesystemService) Client() FileCaller
func (*MockFilesystemService) SetPermissions ¶ added in v0.2.1
func (m *MockFilesystemService) SetPermissions(ctx context.Context, opts SetPermOpts) error
func (*MockFilesystemService) Stat ¶ added in v0.2.1
func (m *MockFilesystemService) Stat(ctx context.Context, path string) (*StatResult, error)
func (*MockFilesystemService) WriteFile ¶ added in v0.3.0
func (m *MockFilesystemService) WriteFile(ctx context.Context, path string, params WriteFileParams) error
type MockInterfaceService ¶ added in v0.2.4
type MockInterfaceService struct {
ListFunc func(ctx context.Context) ([]NetworkInterface, error)
GetFunc func(ctx context.Context, id string) (*NetworkInterface, error)
}
MockInterfaceService is a test double for InterfaceServiceAPI.
func (*MockInterfaceService) Get ¶ added in v0.2.4
func (m *MockInterfaceService) Get(ctx context.Context, id string) (*NetworkInterface, error)
func (*MockInterfaceService) List ¶ added in v0.2.4
func (m *MockInterfaceService) List(ctx context.Context) ([]NetworkInterface, error)
type MockNetworkService ¶ added in v0.3.0
type MockNetworkService struct {
GetSummaryFunc func(ctx context.Context) (*NetworkSummary, error)
}
MockNetworkService is a test double for NetworkServiceAPI.
func (*MockNetworkService) GetSummary ¶ added in v0.3.0
func (m *MockNetworkService) GetSummary(ctx context.Context) (*NetworkSummary, error)
type MockReportingService ¶ added in v0.2.4
type MockReportingService struct {
ListGraphsFunc func(ctx context.Context) ([]ReportingGraph, error)
GetDataFunc func(ctx context.Context, params ReportingGetDataParams) ([]ReportingData, error)
SubscribeRealtimeFunc func(ctx context.Context) (*Subscription[RealtimeUpdate], error)
}
MockReportingService is a test double for ReportingServiceAPI.
func (*MockReportingService) GetData ¶ added in v0.2.4
func (m *MockReportingService) GetData(ctx context.Context, params ReportingGetDataParams) ([]ReportingData, error)
func (*MockReportingService) ListGraphs ¶ added in v0.2.4
func (m *MockReportingService) ListGraphs(ctx context.Context) ([]ReportingGraph, error)
func (*MockReportingService) SubscribeRealtime ¶ added in v0.2.4
func (m *MockReportingService) SubscribeRealtime(ctx context.Context) (*Subscription[RealtimeUpdate], error)
type MockSnapshotService ¶ added in v0.2.1
type MockSnapshotService struct {
CreateFunc func(ctx context.Context, opts CreateSnapshotOpts) (*Snapshot, error)
GetFunc func(ctx context.Context, id string) (*Snapshot, error)
ListFunc func(ctx context.Context) ([]Snapshot, error)
DeleteFunc func(ctx context.Context, id string) error
HoldFunc func(ctx context.Context, id string) error
ReleaseFunc func(ctx context.Context, id string) error
QueryFunc func(ctx context.Context, filters [][]any) ([]Snapshot, error)
RollbackFunc func(ctx context.Context, id string) error
CloneFunc func(ctx context.Context, snapshot, datasetDst string) error
}
MockSnapshotService is a test double for SnapshotServiceAPI.
func (*MockSnapshotService) Clone ¶ added in v0.2.1
func (m *MockSnapshotService) Clone(ctx context.Context, snapshot, datasetDst string) error
func (*MockSnapshotService) Create ¶ added in v0.2.1
func (m *MockSnapshotService) Create(ctx context.Context, opts CreateSnapshotOpts) (*Snapshot, error)
func (*MockSnapshotService) Delete ¶ added in v0.2.1
func (m *MockSnapshotService) Delete(ctx context.Context, id string) error
func (*MockSnapshotService) Hold ¶ added in v0.2.1
func (m *MockSnapshotService) Hold(ctx context.Context, id string) error
func (*MockSnapshotService) List ¶ added in v0.2.1
func (m *MockSnapshotService) List(ctx context.Context) ([]Snapshot, error)
type MockSystemService ¶ added in v0.2.4
type MockSystemService struct {
GetInfoFunc func(ctx context.Context) (*SystemInfo, error)
GetVersionFunc func(ctx context.Context) (string, error)
}
MockSystemService is a test double for SystemServiceAPI.
func (*MockSystemService) GetInfo ¶ added in v0.2.4
func (m *MockSystemService) GetInfo(ctx context.Context) (*SystemInfo, error)
func (*MockSystemService) GetVersion ¶ added in v0.2.4
func (m *MockSystemService) GetVersion(ctx context.Context) (string, error)
type MockVMService ¶ added in v0.2.1
type MockVMService struct {
CreateVMFunc func(ctx context.Context, opts CreateVMOpts) (*VM, error)
GetVMFunc func(ctx context.Context, id int64) (*VM, error)
UpdateVMFunc func(ctx context.Context, id int64, opts UpdateVMOpts) (*VM, error)
DeleteVMFunc func(ctx context.Context, id int64) error
StartVMFunc func(ctx context.Context, id int64) error
StopVMFunc func(ctx context.Context, id int64, opts StopVMOpts) error
ListDevicesFunc func(ctx context.Context, vmID int64) ([]VMDevice, error)
GetDeviceFunc func(ctx context.Context, id int64) (*VMDevice, error)
CreateDeviceFunc func(ctx context.Context, opts CreateVMDeviceOpts) (*VMDevice, error)
UpdateDeviceFunc func(ctx context.Context, id int64, opts UpdateVMDeviceOpts) (*VMDevice, error)
DeleteDeviceFunc func(ctx context.Context, id int64) error
}
MockVMService is a test double for VMServiceAPI.
func (*MockVMService) CreateDevice ¶ added in v0.2.1
func (m *MockVMService) CreateDevice(ctx context.Context, opts CreateVMDeviceOpts) (*VMDevice, error)
func (*MockVMService) CreateVM ¶ added in v0.2.1
func (m *MockVMService) CreateVM(ctx context.Context, opts CreateVMOpts) (*VM, error)
func (*MockVMService) DeleteDevice ¶ added in v0.2.1
func (m *MockVMService) DeleteDevice(ctx context.Context, id int64) error
func (*MockVMService) DeleteVM ¶ added in v0.2.1
func (m *MockVMService) DeleteVM(ctx context.Context, id int64) error
func (*MockVMService) ListDevices ¶ added in v0.2.1
func (*MockVMService) StartVM ¶ added in v0.2.1
func (m *MockVMService) StartVM(ctx context.Context, id int64) error
func (*MockVMService) StopVM ¶ added in v0.2.1
func (m *MockVMService) StopVM(ctx context.Context, id int64, opts StopVMOpts) error
func (*MockVMService) UpdateDevice ¶ added in v0.2.1
func (m *MockVMService) UpdateDevice(ctx context.Context, id int64, opts UpdateVMDeviceOpts) (*VMDevice, error)
func (*MockVMService) UpdateVM ¶ added in v0.2.1
func (m *MockVMService) UpdateVM(ctx context.Context, id int64, opts UpdateVMOpts) (*VM, error)
type MockVirtService ¶ added in v0.2.1
type MockVirtService struct {
GetGlobalConfigFunc func(ctx context.Context) (*VirtGlobalConfig, error)
UpdateGlobalConfigFunc func(ctx context.Context, opts UpdateVirtGlobalConfigOpts) (*VirtGlobalConfig, error)
CreateInstanceFunc func(ctx context.Context, opts CreateVirtInstanceOpts) (*VirtInstance, error)
GetInstanceFunc func(ctx context.Context, name string) (*VirtInstance, error)
UpdateInstanceFunc func(ctx context.Context, name string, opts UpdateVirtInstanceOpts) (*VirtInstance, error)
DeleteInstanceFunc func(ctx context.Context, name string) error
StartInstanceFunc func(ctx context.Context, name string) error
StopInstanceFunc func(ctx context.Context, name string, opts StopVirtInstanceOpts) error
ListInstancesFunc func(ctx context.Context, filters [][]any) ([]VirtInstance, error)
ListDevicesFunc func(ctx context.Context, instanceID string) ([]VirtDevice, error)
AddDeviceFunc func(ctx context.Context, instanceID string, opts VirtDeviceOpts) error
DeleteDeviceFunc func(ctx context.Context, instanceID string, deviceName string) error
}
MockVirtService is a test double for VirtServiceAPI.
func (*MockVirtService) AddDevice ¶ added in v0.2.1
func (m *MockVirtService) AddDevice(ctx context.Context, instanceID string, opts VirtDeviceOpts) error
func (*MockVirtService) CreateInstance ¶ added in v0.2.1
func (m *MockVirtService) CreateInstance(ctx context.Context, opts CreateVirtInstanceOpts) (*VirtInstance, error)
func (*MockVirtService) DeleteDevice ¶ added in v0.2.1
func (*MockVirtService) DeleteInstance ¶ added in v0.2.1
func (m *MockVirtService) DeleteInstance(ctx context.Context, name string) error
func (*MockVirtService) GetGlobalConfig ¶ added in v0.2.1
func (m *MockVirtService) GetGlobalConfig(ctx context.Context) (*VirtGlobalConfig, error)
func (*MockVirtService) GetInstance ¶ added in v0.2.1
func (m *MockVirtService) GetInstance(ctx context.Context, name string) (*VirtInstance, error)
func (*MockVirtService) ListDevices ¶ added in v0.2.1
func (m *MockVirtService) ListDevices(ctx context.Context, instanceID string) ([]VirtDevice, error)
func (*MockVirtService) ListInstances ¶ added in v0.3.0
func (m *MockVirtService) ListInstances(ctx context.Context, filters [][]any) ([]VirtInstance, error)
func (*MockVirtService) StartInstance ¶ added in v0.2.1
func (m *MockVirtService) StartInstance(ctx context.Context, name string) error
func (*MockVirtService) StopInstance ¶ added in v0.2.1
func (m *MockVirtService) StopInstance(ctx context.Context, name string, opts StopVirtInstanceOpts) error
func (*MockVirtService) UpdateGlobalConfig ¶ added in v0.2.1
func (m *MockVirtService) UpdateGlobalConfig(ctx context.Context, opts UpdateVirtGlobalConfigOpts) (*VirtGlobalConfig, error)
func (*MockVirtService) UpdateInstance ¶ added in v0.2.1
func (m *MockVirtService) UpdateInstance(ctx context.Context, name string, opts UpdateVirtInstanceOpts) (*VirtInstance, error)
type NetworkInterface ¶ added in v0.2.4
type NetworkInterface struct {
ID string
Name string
Type InterfaceType
Description string
MTU int
State InterfaceState
Aliases []InterfaceAlias
}
NetworkInterface is the user-facing representation of a TrueNAS network interface.
type NetworkInterfaceIPs ¶ added in v0.3.0
NetworkInterfaceIPs contains the IPv4 and IPv6 addresses for an interface.
type NetworkInterfaceIPsResponse ¶ added in v0.3.0
NetworkInterfaceIPsResponse represents per-interface IPs from the API.
type NetworkService ¶ added in v0.3.0
type NetworkService struct {
// contains filtered or unexported fields
}
NetworkService provides typed methods for the network.* API namespace.
func NewNetworkService ¶ added in v0.3.0
func NewNetworkService(c Caller, v Version) *NetworkService
NewNetworkService creates a new NetworkService.
func (*NetworkService) GetSummary ¶ added in v0.3.0
func (s *NetworkService) GetSummary(ctx context.Context) (*NetworkSummary, error)
GetSummary returns general network information including default routes, nameservers, and per-interface IP addresses.
type NetworkServiceAPI ¶ added in v0.3.0
type NetworkServiceAPI interface {
GetSummary(ctx context.Context) (*NetworkSummary, error)
}
NetworkServiceAPI defines the interface for network operations.
type NetworkSummary ¶ added in v0.3.0
type NetworkSummary struct {
IPs map[string]NetworkInterfaceIPs
DefaultRoutes []string
Nameservers []string
}
NetworkSummary is the user-facing representation of network.general.summary.
type NetworkSummaryResponse ¶ added in v0.3.0
type NetworkSummaryResponse struct {
IPs map[string]NetworkInterfaceIPsResponse `json:"ips"`
DefaultRoutes []string `json:"default_routes"`
Nameservers []string `json:"nameservers"`
}
NetworkSummaryResponse represents the network.general.summary API response.
type PCIDevice ¶ added in v0.2.0
type PCIDevice struct {
PPTDev string
}
PCIDevice contains attributes for a PCI device.
type ParsedValue ¶
type ParsedValue struct {
Parsed int64 `json:"parsed"`
}
ParsedValue represents a ZFS property with a parsed numeric value.
type Pool ¶ added in v0.2.0
type Pool struct {
ID int64
Name string
Path string
Status string
Size int64
Allocated int64
Free int64
}
Pool is the user-facing representation of a TrueNAS pool.
type PoolResponse ¶ added in v0.2.0
type PoolResponse struct {
ID int64 `json:"id"`
Name string `json:"name"`
Path string `json:"path"`
Status string `json:"status"`
Size int64 `json:"size"`
Allocated int64 `json:"allocated"`
Free int64 `json:"free"`
}
PoolResponse represents a pool from the pool.query API.
type PropertyValue ¶
type PropertyValue struct {
Value string `json:"value"`
}
PropertyValue represents a ZFS property with a string value.
type RawDevice ¶ added in v0.2.0
type RawDevice struct {
Path string
Type string
Boot bool
IOType *string
Serial string
Exists bool
Size *int64
PhysicalSectorSize *int64
Logical_Sector_Size *int64
}
RawDevice contains attributes for a RAW device.
type RealtimeCPU ¶ added in v0.2.4
RealtimeCPU contains per-CPU usage and temperature metrics.
type RealtimeCPUResponse ¶ added in v0.2.4
type RealtimeCPUResponse struct {
Usage float64 `json:"usage"`
Temperature float64 `json:"temperature"`
}
RealtimeCPUResponse is the wire-format for per-CPU metrics.
type RealtimeDiskAggregate ¶ added in v0.2.4
type RealtimeDiskAggregate struct {
ReadOps float64
ReadBytes float64
WriteOps float64
WriteBytes float64
BusyPercent float64
}
RealtimeDiskAggregate contains aggregate disk I/O metrics.
type RealtimeDiskAggregateResponse ¶ added in v0.2.4
type RealtimeDiskAggregateResponse struct {
ReadOps float64 `json:"read_ops"`
ReadBytes float64 `json:"read_bytes"`
WriteOps float64 `json:"write_ops"`
WriteBytes float64 `json:"write_bytes"`
BusyPercent float64 `json:"busy"`
}
RealtimeDiskAggregateResponse is the wire-format for aggregate disk I/O metrics.
type RealtimeInterface ¶ added in v0.2.4
type RealtimeInterface struct {
ReceivedBytesRate float64
SentBytesRate float64
LinkState string
Speed int
}
RealtimeInterface contains per-interface network metrics.
type RealtimeInterfaceResponse ¶ added in v0.2.4
type RealtimeInterfaceResponse struct {
ReceivedBytesRate float64 `json:"received_bytes_rate"`
SentBytesRate float64 `json:"sent_bytes_rate"`
LinkState string `json:"link_state"`
Speed int `json:"speed"`
}
RealtimeInterfaceResponse is the wire-format for per-interface network metrics.
type RealtimeMemory ¶ added in v0.2.4
RealtimeMemory contains system memory metrics.
type RealtimeMemoryResponse ¶ added in v0.2.4
type RealtimeMemoryResponse struct {
PhysicalMemoryTotal int64 `json:"physical_memory_total"`
PhysicalMemoryAvailable int64 `json:"physical_memory_available"`
ArcSize int64 `json:"arc_size"`
}
RealtimeMemoryResponse is the wire-format for memory metrics.
type RealtimeUpdate ¶ added in v0.2.4
type RealtimeUpdate struct {
CPU map[string]RealtimeCPU
Memory RealtimeMemory
Disks RealtimeDiskAggregate
Interfaces map[string]RealtimeInterface
}
RealtimeUpdate is the user-facing representation of a realtime reporting event.
type RealtimeUpdateResponse ¶ added in v0.2.4
type RealtimeUpdateResponse struct {
CPU map[string]RealtimeCPUResponse `json:"cpu"`
Memory RealtimeMemoryResponse `json:"memory"`
Disks RealtimeDiskAggregateResponse `json:"disks"`
Interfaces map[string]RealtimeInterfaceResponse `json:"interfaces"`
}
RealtimeUpdateResponse represents the wire-format for reporting.realtime events.
type Registry ¶ added in v0.2.0
type Registry struct {
ID int64
Name string
Description string
Username string
Password string
URI string
}
Registry is the user-facing representation of a TrueNAS app registry.
type ReportingAggregations ¶ added in v0.2.4
type ReportingAggregations struct {
Min map[string]json.Number
Max map[string]json.Number
Mean map[string]json.Number
}
ReportingAggregations contains statistical aggregations.
type ReportingData ¶ added in v0.2.4
type ReportingData struct {
Name string
Identifier string
Data [][]json.Number
Start int64
End int64
Legend []string
Aggregations ReportingAggregations
}
ReportingData is the user-facing representation of graph data.
type ReportingDataResponse ¶ added in v0.2.4
type ReportingDataResponse struct {
Name string `json:"name"`
Identifier string `json:"identifier"`
Data [][]json.Number `json:"data"`
Start int64 `json:"start"`
End int64 `json:"end"`
Legend []string `json:"legend"`
Aggregations struct {
Min map[string]json.Number `json:"min"`
Max map[string]json.Number `json:"max"`
Mean map[string]json.Number `json:"mean"`
} `json:"aggregations"`
}
ReportingDataResponse represents data returned from reporting.netdata_get_data.
type ReportingGetDataParams ¶ added in v0.2.4
type ReportingGetDataParams struct {
Graphs []ReportingGraphQuery
Unit string // "HOUR", "DAY", "WEEK", "MONTH", "YEAR"
Page int
}
ReportingGetDataParams contains parameters for the GetData call.
type ReportingGraph ¶ added in v0.2.4
type ReportingGraph struct {
Name string
Title string
VerticalLabel string
Identifiers []string
Stacked bool
StackedShowTotal bool
}
ReportingGraph is the user-facing representation of a graph definition.
type ReportingGraphName ¶ added in v0.2.4
type ReportingGraphName string
ReportingGraphName represents standard graph identifiers.
const ( ReportingGraphCPU ReportingGraphName = "cpu" ReportingGraphCPUTemp ReportingGraphName = "cputemp" ReportingGraphMemory ReportingGraphName = "memory" ReportingGraphDisk ReportingGraphName = "disk" ReportingGraphDiskTemp ReportingGraphName = "disktemp" ReportingGraphInterface ReportingGraphName = "interface" ReportingGraphArcSize ReportingGraphName = "arcsize" ReportingGraphArcRate ReportingGraphName = "arcrate" ReportingGraphUptime ReportingGraphName = "uptime" )
type ReportingGraphQuery ¶ added in v0.2.4
type ReportingGraphQuery struct {
Name ReportingGraphName
Identifier string // e.g. disk name, interface name
}
ReportingGraphQuery specifies a graph to query.
type ReportingGraphResponse ¶ added in v0.2.4
type ReportingGraphResponse struct {
Name string `json:"name"`
Title string `json:"title"`
VerticalLabel string `json:"vertical_label"`
Identifiers []string `json:"identifiers"`
Stacked bool `json:"stacked"`
StackedShowTotal bool `json:"stacked_show_total"`
}
ReportingGraphResponse represents a graph definition from reporting.netdata_graphs.
type ReportingService ¶ added in v0.2.4
type ReportingService struct {
// contains filtered or unexported fields
}
ReportingService provides typed methods for the reporting.* API namespace.
func NewReportingService ¶ added in v0.2.4
func NewReportingService(c SubscribeCaller, v Version) *ReportingService
NewReportingService creates a new ReportingService.
func (*ReportingService) GetData ¶ added in v0.2.4
func (s *ReportingService) GetData(ctx context.Context, params ReportingGetDataParams) ([]ReportingData, error)
GetData returns reporting data for the specified graphs.
func (*ReportingService) ListGraphs ¶ added in v0.2.4
func (s *ReportingService) ListGraphs(ctx context.Context) ([]ReportingGraph, error)
ListGraphs returns all available reporting graph definitions.
func (*ReportingService) SubscribeRealtime ¶ added in v0.2.4
func (s *ReportingService) SubscribeRealtime(ctx context.Context) (*Subscription[RealtimeUpdate], error)
SubscribeRealtime subscribes to real-time system metrics (CPU, memory, disk, network).
type ReportingServiceAPI ¶ added in v0.2.4
type ReportingServiceAPI interface {
ListGraphs(ctx context.Context) ([]ReportingGraph, error)
GetData(ctx context.Context, params ReportingGetDataParams) ([]ReportingData, error)
SubscribeRealtime(ctx context.Context) (*Subscription[RealtimeUpdate], error)
}
ReportingServiceAPI defines the interface for reporting operations.
type ScheduleResponse ¶
type ScheduleResponse struct {
Minute string `json:"minute"`
Hour string `json:"hour"`
Dom string `json:"dom"`
Month string `json:"month"`
Dow string `json:"dow"`
}
ScheduleResponse represents a cron schedule from the API.
type SetPermOpts ¶ added in v0.2.0
type SetPermOpts struct {
Path string
UID *int64
GID *int64
Mode string // Octal string e.g. "755", empty omits
Recursive bool
StripACL bool
Traverse bool
}
SetPermOpts contains options for setting filesystem permissions.
type SizePropertyField ¶ added in v0.2.0
SizePropertyField represents a ZFS size property with a parsed numeric value and string representation.
type Snapshot ¶ added in v0.2.0
type Snapshot struct {
ID string
Dataset string
SnapshotName string
CreateTXG string
Used int64
Referenced int64
HasHold bool
}
Snapshot is the user-facing representation of a TrueNAS ZFS snapshot.
type SnapshotProperties ¶
type SnapshotProperties struct {
CreateTXG PropertyValue `json:"createtxg"`
Used ParsedValue `json:"used"`
Referenced ParsedValue `json:"referenced"`
UserRefs UserRefsProperty `json:"userrefs"`
}
SnapshotProperties contains ZFS properties for a snapshot.
type SnapshotResponse ¶
type SnapshotResponse struct {
ID string `json:"id"`
Name string `json:"name"` // Full snapshot ID (dataset@name)
SnapshotName string `json:"snapshot_name"` // Just the name part after @
Dataset string `json:"dataset"`
Properties SnapshotProperties `json:"properties"`
}
SnapshotResponse represents a snapshot from the query API.
func (*SnapshotResponse) HasHold ¶
func (s *SnapshotResponse) HasHold() bool
HasHold returns true if the snapshot has any holds. It checks the userrefs property which indicates the number of user holds.
type SnapshotService ¶ added in v0.2.0
type SnapshotService struct {
// contains filtered or unexported fields
}
SnapshotService provides typed methods for the snapshot API namespace.
func NewSnapshotService ¶ added in v0.2.0
func NewSnapshotService(c Caller, v Version) *SnapshotService
NewSnapshotService creates a new SnapshotService.
func (*SnapshotService) Clone ¶ added in v0.2.0
func (s *SnapshotService) Clone(ctx context.Context, snapshot, datasetDst string) error
Clone clones a snapshot to a new dataset.
func (*SnapshotService) Create ¶ added in v0.2.0
func (s *SnapshotService) Create(ctx context.Context, opts CreateSnapshotOpts) (*Snapshot, error)
Create creates a snapshot and returns the full object.
func (*SnapshotService) Delete ¶ added in v0.2.0
func (s *SnapshotService) Delete(ctx context.Context, id string) error
Delete deletes a snapshot by ID.
func (*SnapshotService) Hold ¶ added in v0.2.0
func (s *SnapshotService) Hold(ctx context.Context, id string) error
Hold places a hold on a snapshot.
func (*SnapshotService) List ¶ added in v0.2.0
func (s *SnapshotService) List(ctx context.Context) ([]Snapshot, error)
List returns all snapshots.
func (*SnapshotService) Query ¶ added in v0.3.0
Query returns snapshots matching the given filters. Filters use TrueNAS query format: [][]any{{"field", "op", "value"}}. Pass nil for no filtering (equivalent to List).
type SnapshotServiceAPI ¶ added in v0.2.1
type SnapshotServiceAPI interface {
Create(ctx context.Context, opts CreateSnapshotOpts) (*Snapshot, error)
Get(ctx context.Context, id string) (*Snapshot, error)
List(ctx context.Context) ([]Snapshot, error)
Delete(ctx context.Context, id string) error
Hold(ctx context.Context, id string) error
Release(ctx context.Context, id string) error
Query(ctx context.Context, filters [][]any) ([]Snapshot, error)
Rollback(ctx context.Context, id string) error
Clone(ctx context.Context, snapshot, datasetDst string) error
}
SnapshotServiceAPI defines the interface for snapshot operations.
type StatResponse ¶ added in v0.2.0
StatResponse represents a filesystem stat result from the TrueNAS API.
type StatResult ¶ added in v0.2.0
StatResult is the user-facing representation of a filesystem stat. Mode contains only permission bits (masked with 0o777).
type StopVMOpts ¶ added in v0.2.0
StopVMOpts contains options for stopping a VM.
type StopVirtInstanceOpts ¶ added in v0.2.0
type StopVirtInstanceOpts struct {
Timeout int64
}
StopVirtInstanceOpts contains options for stopping a virt instance.
type SubscribeCaller ¶ added in v0.2.4
type SubscribeCaller interface {
AsyncCaller
Subscribe(ctx context.Context, collection string, params any) (*Subscription[json.RawMessage], error)
}
SubscribeCaller adds real-time event subscription support. Only WebSocket transport supports this; SSH returns ErrUnsupportedOperation.
type Subscription ¶ added in v0.2.4
type Subscription[T any] struct { C <-chan T // Events channel — closed when subscription ends // contains filtered or unexported fields }
Subscription represents an active event subscription. Close the subscription to stop receiving events and free resources.
func NewSubscription ¶ added in v0.2.4
func NewSubscription[T any](ch <-chan T, cancel func()) *Subscription[T]
NewSubscription creates a new Subscription with the given channel and cancel function. This constructor is needed by packages outside truenas (e.g. client) that cannot set the unexported cancel field directly.
func (*Subscription[T]) Close ¶ added in v0.2.4
func (s *Subscription[T]) Close()
Close terminates the subscription and releases resources.
type SystemInfo ¶ added in v0.2.4
type SystemInfo struct {
Model string
Cores int
PhysicalCores int
Hostname string
Uptime string
UptimeSeconds float64
LoadAvg [3]float64
EccMemory bool
}
SystemInfo is the user-facing representation of TrueNAS system information.
type SystemInfoResponse ¶ added in v0.2.4
type SystemInfoResponse struct {
Model string `json:"model"`
Cores int `json:"cores"`
PhysicalCores int `json:"physical_cores"`
Hostname string `json:"hostname"`
Uptime string `json:"uptime"`
UptimeSeconds float64 `json:"uptime_seconds"`
LoadAvg [3]float64 `json:"loadavg"`
EccMemory bool `json:"ecc_memory"`
}
SystemInfoResponse represents the wire-format response from system.info.
type SystemService ¶ added in v0.2.4
type SystemService struct {
// contains filtered or unexported fields
}
SystemService provides typed methods for the system.* API namespace.
func NewSystemService ¶ added in v0.2.4
func NewSystemService(c Caller, v Version) *SystemService
NewSystemService creates a new SystemService.
func (*SystemService) GetInfo ¶ added in v0.2.4
func (s *SystemService) GetInfo(ctx context.Context) (*SystemInfo, error)
GetInfo returns system information.
func (*SystemService) GetVersion ¶ added in v0.2.4
func (s *SystemService) GetVersion(ctx context.Context) (string, error)
GetVersion returns the TrueNAS version string.
type SystemServiceAPI ¶ added in v0.2.4
type SystemServiceAPI interface {
GetInfo(ctx context.Context) (*SystemInfo, error)
GetVersion(ctx context.Context) (string, error)
}
SystemServiceAPI defines the interface for system operations.
type UpdateAppOpts ¶ added in v0.2.0
type UpdateAppOpts struct {
CustomComposeConfig string
}
UpdateAppOpts contains options for updating an app.
type UpdateCloudSyncTaskOpts ¶ added in v0.2.0
type UpdateCloudSyncTaskOpts = CreateCloudSyncTaskOpts
UpdateCloudSyncTaskOpts contains options for updating a cloud sync task.
type UpdateCredentialOpts ¶ added in v0.2.0
type UpdateCredentialOpts = CreateCredentialOpts
UpdateCredentialOpts contains options for updating a cloud sync credential.
type UpdateCronJobOpts ¶ added in v0.2.0
type UpdateCronJobOpts = CreateCronJobOpts
UpdateCronJobOpts contains options for updating a cron job. All fields are always sent on update.
type UpdateDatasetOpts ¶ added in v0.2.0
type UpdateDatasetOpts struct {
Compression string // Empty = don't change
Quota *int64
RefQuota *int64
Atime string // Empty = don't change
Comments *string
}
UpdateDatasetOpts contains options for updating a filesystem dataset. Pointer fields distinguish "don't change" (nil) from "set to zero/empty". String fields use empty string to mean "don't change".
type UpdateRegistryOpts ¶ added in v0.2.0
type UpdateRegistryOpts = CreateRegistryOpts
UpdateRegistryOpts contains options for updating a registry.
type UpdateVMDeviceOpts ¶ added in v0.2.0
type UpdateVMDeviceOpts = CreateVMDeviceOpts
UpdateVMDeviceOpts contains options for updating a VM device.
type UpdateVMOpts ¶ added in v0.2.0
type UpdateVMOpts = CreateVMOpts
UpdateVMOpts contains options for updating a VM. All fields are always sent on update.
type UpdateVirtGlobalConfigOpts ¶ added in v0.2.0
type UpdateVirtGlobalConfigOpts struct {
Bridge *string
V4Network *string
V6Network *string
Pool *string
}
UpdateVirtGlobalConfigOpts contains options for updating global virt configuration. Only non-nil fields are sent in the update request.
type UpdateVirtInstanceOpts ¶ added in v0.2.0
UpdateVirtInstanceOpts contains options for updating a virt instance. Only non-nil fields are sent in the update request.
type UpdateZvolOpts ¶ added in v0.2.0
type UpdateZvolOpts struct {
Volsize *int64
ForceSize bool // Only sent when true
Compression string // Empty = don't change
Comments *string
}
UpdateZvolOpts contains options for updating a zvol. Pointer fields distinguish "don't change" (nil) from "set to zero/empty". String fields use empty string to mean "don't change".
type UserRefsProperty ¶
type UserRefsProperty struct {
Parsed string `json:"parsed"` // String like "0" or "1"
}
UserRefsProperty represents the userrefs ZFS property (hold count).
type VM ¶ added in v0.2.0
type VM struct {
ID int64
Name string
Description string
VCPUs int64
Cores int64
Threads int64
Memory int64
MinMemory *int64
Autostart bool
Time string
Bootloader string
BootloaderOVMF string
CPUMode string
CPUModel string
ShutdownTimeout int64
CommandLineArgs string
State string
}
VM is the user-facing representation of a TrueNAS virtual machine.
type VMDevice ¶ added in v0.2.0
type VMDevice struct {
ID int64
VM int64
Order int64
DeviceType DeviceType
Disk *DiskDevice
Raw *RawDevice
CDROM *CDROMDevice
NIC *NICDevice
Display *DisplayDevice
PCI *PCIDevice
USB *USBDevice
}
VMDevice is the user-facing representation of a VM device.
type VMDeviceResponse ¶ added in v0.2.0
type VMDeviceResponse struct {
ID int64 `json:"id"`
VM int64 `json:"vm"`
Order int64 `json:"order"`
Attributes map[string]any `json:"attributes"`
}
VMDeviceResponse represents a VM device from the TrueNAS API.
type VMResponse ¶ added in v0.2.0
type VMResponse struct {
ID int64 `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
VCPUs int64 `json:"vcpus"`
Cores int64 `json:"cores"`
Threads int64 `json:"threads"`
Memory int64 `json:"memory"`
MinMemory *int64 `json:"min_memory"`
Autostart bool `json:"autostart"`
Time string `json:"time"`
Bootloader string `json:"bootloader"`
BootloaderOVMF string `json:"bootloader_ovmf"`
CPUMode string `json:"cpu_mode"`
CPUModel *string `json:"cpu_model"`
ShutdownTimeout int64 `json:"shutdown_timeout"`
CommandLineArgs string `json:"command_line_args"`
Status VMStatusField `json:"status"`
}
VMResponse represents a VM from the TrueNAS API.
type VMService ¶ added in v0.2.0
type VMService struct {
// contains filtered or unexported fields
}
VMService provides typed methods for the vm.* API namespace.
func NewVMService ¶ added in v0.2.0
func NewVMService(c AsyncCaller, v Version) *VMService
NewVMService creates a new VMService.
func (*VMService) CreateDevice ¶ added in v0.2.0
CreateDevice creates a VM device and returns the full object.
func (*VMService) CreateVM ¶ added in v0.2.0
CreateVM creates a VM and returns the full object. The create response includes the full VM, so no re-read is needed.
func (*VMService) DeleteDevice ¶ added in v0.2.0
DeleteDevice deletes a VM device by ID.
func (*VMService) GetDevice ¶ added in v0.2.0
GetDevice returns a VM device by ID, or nil if not found.
func (*VMService) ListDevices ¶ added in v0.2.0
ListDevices returns all devices for a VM.
func (*VMService) StopVM ¶ added in v0.2.0
StopVM stops a VM by ID using CallAndWait since it is a long-running operation.
func (*VMService) UpdateDevice ¶ added in v0.2.0
func (s *VMService) UpdateDevice(ctx context.Context, id int64, opts UpdateVMDeviceOpts) (*VMDevice, error)
UpdateDevice updates a VM device and returns the full object via re-read.
type VMServiceAPI ¶ added in v0.2.1
type VMServiceAPI interface {
CreateVM(ctx context.Context, opts CreateVMOpts) (*VM, error)
GetVM(ctx context.Context, id int64) (*VM, error)
UpdateVM(ctx context.Context, id int64, opts UpdateVMOpts) (*VM, error)
DeleteVM(ctx context.Context, id int64) error
StartVM(ctx context.Context, id int64) error
StopVM(ctx context.Context, id int64, opts StopVMOpts) error
ListDevices(ctx context.Context, vmID int64) ([]VMDevice, error)
GetDevice(ctx context.Context, id int64) (*VMDevice, error)
CreateDevice(ctx context.Context, opts CreateVMDeviceOpts) (*VMDevice, error)
UpdateDevice(ctx context.Context, id int64, opts UpdateVMDeviceOpts) (*VMDevice, error)
DeleteDevice(ctx context.Context, id int64) error
}
VMServiceAPI defines the interface for VM and VM device operations.
type VMStatusField ¶ added in v0.2.0
type VMStatusField struct {
State string `json:"state"`
PID *int64 `json:"pid"`
DomainState string `json:"domain_state"`
}
VMStatusField represents the status of a VM.
type Version ¶
Version represents a parsed TrueNAS version.
func ParseVersion ¶
ParseVersion parses a TrueNAS version string. Examples: "TrueNAS-SCALE-24.10.2.4", "TrueNAS-25.04.2.4", "TrueNAS-25.10.1"
type VirtDevice ¶ added in v0.2.0
type VirtDevice struct {
DevType string
Name string
Description string
Readonly bool
// DISK fields
Source string
Destination string
// NIC fields
Network string
NICType string
Parent string
// PROXY fields
SourceProto string
SourcePort int64
DestProto string
DestPort int64
}
VirtDevice is the user-facing representation of a device attached to a virt instance.
type VirtDeviceOpts ¶ added in v0.2.0
type VirtDeviceOpts struct {
DevType string
Name string
Readonly bool
// DISK fields
Source string
Destination string
// NIC fields
Network string
NICType string
Parent string
// PROXY fields
SourceProto string
SourcePort int64
DestProto string
DestPort int64
}
VirtDeviceOpts contains options for adding a device to a virt instance. Fields are used based on DevType: DISK uses Source/Destination, NIC uses Network/NICType/Parent, PROXY uses SourceProto/SourcePort/DestProto/DestPort.
type VirtDeviceResponse ¶ added in v0.2.0
type VirtDeviceResponse struct {
DevType string `json:"dev_type"`
Name *string `json:"name"`
Description *string `json:"description"`
Readonly bool `json:"readonly"`
// DISK fields
Source *string `json:"source"`
Destination *string `json:"destination"`
// NIC fields
Network *string `json:"network"`
NICType *string `json:"nic_type"`
Parent *string `json:"parent"`
// PROXY fields
SourceProto *string `json:"source_proto"`
SourcePort *int64 `json:"source_port"`
DestProto *string `json:"dest_proto"`
DestPort *int64 `json:"dest_port"`
}
VirtDeviceResponse represents a device attached to a virt instance from the API.
type VirtGlobalConfig ¶ added in v0.2.0
type VirtGlobalConfig struct {
Bridge string
V4Network string
V6Network string
Pool string
Dataset string
StoragePools []string
State string
}
VirtGlobalConfig is the user-facing representation of the global virt configuration.
type VirtGlobalConfigResponse ¶ added in v0.2.0
type VirtGlobalConfigResponse struct {
Bridge *string `json:"bridge"`
V4Network *string `json:"v4_network"`
V6Network *string `json:"v6_network"`
Pool *string `json:"pool"`
Dataset *string `json:"dataset"`
StoragePools []string `json:"storage_pools"`
State *string `json:"state"`
}
VirtGlobalConfigResponse represents the global virt configuration from the API.
type VirtInstance ¶ added in v0.2.0
type VirtInstance struct {
ID string
Name string
Type string
Status string
CPU string
Memory int64
Autostart bool
Environment map[string]string
Aliases []VirtAlias
Image VirtInstanceImageResponse
StoragePool string
}
VirtInstance is the user-facing representation of a virt instance.
type VirtInstanceAliasResponse ¶ added in v0.2.0
type VirtInstanceAliasResponse struct {
Type string `json:"type"`
Address string `json:"address"`
Netmask *int64 `json:"netmask"`
}
VirtInstanceAliasResponse represents a network alias from the API.
type VirtInstanceImageResponse ¶ added in v0.2.0
type VirtInstanceImageResponse struct {
Architecture string `json:"architecture"`
Description string `json:"description"`
OS string `json:"os"`
Release string `json:"release"`
Variant string `json:"variant"`
}
VirtInstanceImageResponse represents instance image metadata from the API.
type VirtInstanceResponse ¶ added in v0.2.0
type VirtInstanceResponse struct {
ID string `json:"id"`
Name string `json:"name"`
Type string `json:"type"`
Status string `json:"status"`
CPU *string `json:"cpu"`
Memory *int64 `json:"memory"`
Autostart bool `json:"autostart"`
Environment map[string]string `json:"environment"`
Aliases []VirtInstanceAliasResponse `json:"aliases"`
Image VirtInstanceImageResponse `json:"image"`
StoragePool string `json:"storage_pool"`
}
VirtInstanceResponse represents a virt instance from the API.
type VirtService ¶ added in v0.2.0
type VirtService struct {
// contains filtered or unexported fields
}
VirtService provides typed methods for the virt.* API namespace.
func NewVirtService ¶ added in v0.2.0
func NewVirtService(c AsyncCaller, v Version) *VirtService
NewVirtService creates a new VirtService.
func (*VirtService) AddDevice ¶ added in v0.2.0
func (s *VirtService) AddDevice(ctx context.Context, instanceID string, opts VirtDeviceOpts) error
AddDevice adds a device to a virt instance.
func (*VirtService) CreateInstance ¶ added in v0.2.0
func (s *VirtService) CreateInstance(ctx context.Context, opts CreateVirtInstanceOpts) (*VirtInstance, error)
CreateInstance creates a virt instance and returns the full object.
func (*VirtService) DeleteDevice ¶ added in v0.2.0
DeleteDevice removes a device from a virt instance by device name.
func (*VirtService) DeleteInstance ¶ added in v0.2.0
func (s *VirtService) DeleteInstance(ctx context.Context, name string) error
DeleteInstance deletes a virt instance by name.
func (*VirtService) GetGlobalConfig ¶ added in v0.2.0
func (s *VirtService) GetGlobalConfig(ctx context.Context) (*VirtGlobalConfig, error)
GetGlobalConfig returns the global virt configuration.
func (*VirtService) GetInstance ¶ added in v0.2.0
func (s *VirtService) GetInstance(ctx context.Context, name string) (*VirtInstance, error)
GetInstance returns a virt instance by name, or nil if not found.
func (*VirtService) ListDevices ¶ added in v0.2.0
func (s *VirtService) ListDevices(ctx context.Context, instanceID string) ([]VirtDevice, error)
ListDevices returns all devices attached to a virt instance.
func (*VirtService) ListInstances ¶ added in v0.3.0
func (s *VirtService) ListInstances(ctx context.Context, filters [][]any) ([]VirtInstance, error)
ListInstances queries virt instances with optional filters. Filters use TrueNAS query format: [][]any{{"field", "op", "value"}}. Pass nil for no filtering.
func (*VirtService) StartInstance ¶ added in v0.2.0
func (s *VirtService) StartInstance(ctx context.Context, name string) error
StartInstance starts a virt instance by name.
func (*VirtService) StopInstance ¶ added in v0.2.0
func (s *VirtService) StopInstance(ctx context.Context, name string, opts StopVirtInstanceOpts) error
StopInstance stops a virt instance by name with optional timeout.
func (*VirtService) UpdateGlobalConfig ¶ added in v0.2.0
func (s *VirtService) UpdateGlobalConfig(ctx context.Context, opts UpdateVirtGlobalConfigOpts) (*VirtGlobalConfig, error)
UpdateGlobalConfig updates the global virt configuration and returns the updated config. Only non-nil fields in opts are sent.
func (*VirtService) UpdateInstance ¶ added in v0.2.0
func (s *VirtService) UpdateInstance(ctx context.Context, name string, opts UpdateVirtInstanceOpts) (*VirtInstance, error)
UpdateInstance updates a virt instance and returns the full object.
type VirtServiceAPI ¶ added in v0.2.1
type VirtServiceAPI interface {
GetGlobalConfig(ctx context.Context) (*VirtGlobalConfig, error)
UpdateGlobalConfig(ctx context.Context, opts UpdateVirtGlobalConfigOpts) (*VirtGlobalConfig, error)
CreateInstance(ctx context.Context, opts CreateVirtInstanceOpts) (*VirtInstance, error)
GetInstance(ctx context.Context, name string) (*VirtInstance, error)
UpdateInstance(ctx context.Context, name string, opts UpdateVirtInstanceOpts) (*VirtInstance, error)
DeleteInstance(ctx context.Context, name string) error
StartInstance(ctx context.Context, name string) error
StopInstance(ctx context.Context, name string, opts StopVirtInstanceOpts) error
ListInstances(ctx context.Context, filters [][]any) ([]VirtInstance, error)
ListDevices(ctx context.Context, instanceID string) ([]VirtDevice, error)
AddDevice(ctx context.Context, instanceID string, opts VirtDeviceOpts) error
DeleteDevice(ctx context.Context, instanceID string, deviceName string) error
}
VirtServiceAPI defines the interface for virtualization instance and device operations.
type WriteFileParams ¶ added in v0.2.0
type WriteFileParams struct {
Content []byte // Required - file data to write
Mode fs.FileMode // Default: 0644
UID *int // nil = unchanged, pointer allows explicit 0 (root)
GID *int // nil = unchanged, pointer allows explicit 0 (root)
}
WriteFileParams contains parameters for writing a file.
func DefaultWriteFileParams ¶ added in v0.2.0
func DefaultWriteFileParams(content []byte) WriteFileParams
DefaultWriteFileParams returns params with sensible defaults. Mode defaults to 0644. UID/GID are nil (unchanged).
Source Files
¶
- app.go
- app_service.go
- app_service_iface.go
- cloudsync.go
- cloudsync_service.go
- cloudsync_service_iface.go
- cron.go
- cron_service.go
- cron_service_iface.go
- dataset.go
- dataset_service.go
- dataset_service_iface.go
- docker.go
- docker_service.go
- docker_service_iface.go
- errors.go
- filesystem.go
- filesystem_service.go
- filesystem_service_iface.go
- interface.go
- interface_service.go
- interface_service_iface.go
- interfaces.go
- network.go
- network_service.go
- network_service_iface.go
- registry.go
- reporting.go
- reporting_service.go
- reporting_service_iface.go
- size.go
- snapshot.go
- snapshot_service.go
- snapshot_service_iface.go
- system.go
- system_service.go
- system_service_iface.go
- version.go
- virt.go
- virt_service.go
- virt_service_iface.go
- vm.go
- vm_service.go
- vm_service_iface.go
Directories
¶
| Path | Synopsis |
|---|---|
|
Package api provides embedded TrueNAS API method definitions keyed by version.
|
Package api provides embedded TrueNAS API method definitions keyed by version. |
|
cmd
|
|
|
featurematrix
command
Command featurematrix generates a markdown feature matrix comparing implemented Go service methods against the full TrueNAS API surface.
|
Command featurematrix generates a markdown feature matrix comparing implemented Go service methods against the full TrueNAS API surface. |