Documentation
¶
Overview ¶
* @Author: LinkLeong link@icewhale.com * @Date: 2022-07-26 11:08:48 * @LastEditors: LinkLeong * @LastEditTime: 2022-08-17 18:25:42 * @FilePath: /CasaOS/route/v1/samba.go * @Description: * @Website: https://www.casaos.io * Copyright (c) 2022 by icewhale, All Rights Reserved.
Index ¶
- Variables
- func AbortSystemOSUpgrade(ctx echo.Context) error
- func AckSystemOSUpgrade(ctx echo.Context) error
- func CheckNetwork()
- func ConnectWebSocket(ctx echo.Context) error
- func CreateNet(address, s, e, c string) string
- func DeleteFile(ctx echo.Context) error
- func DeleteFleetBox(ctx echo.Context) error
- func DeleteFleetMember(ctx echo.Context) error
- func DeleteFleetRemoteDevice(ctx echo.Context) error
- func DeleteOperateFileOrDir(ctx echo.Context) error
- func DeleteSambaConnections(ctx echo.Context) error
- func DeleteSambaShares(ctx echo.Context) error
- func DeleteSambaUser(ctx echo.Context) error
- func DeleteShareApp(ctx echo.Context) error
- func DeleteShareApps(ctx echo.Context) error
- func DeleteShareGuardBan(ctx echo.Context) error
- func DeleteShareGuardPerson(ctx echo.Context) error
- func DeleteTrash(ctx echo.Context) error
- func DirPath(ctx echo.Context) error
- func EmptyTrash(ctx echo.Context) error
- func FleetRelay(ctx echo.Context) error
- func FleetTunnel(ctx echo.Context) error
- func GetAddress() string
- func GetAlerts(ctx echo.Context) error
- func GetAutoUpdate(ctx echo.Context) error
- func GetCasaOSErrorLogs(ctx echo.Context) error
- func GetCasaOSPort(ctx echo.Context) error
- func GetDockerUpdateStatus(ctx echo.Context) error
- func GetDownloadFile(ctx echo.Context) error
- func GetDownloadSingleFile(ctx echo.Context) error
- func GetFeeds(ctx echo.Context) error
- func GetFileCount(ctx echo.Context) error
- func GetFileImage(ctx echo.Context) error
- func GetFileRoots(ctx echo.Context) error
- func GetFileUpload(ctx echo.Context) error
- func GetFilerContent(ctx echo.Context) error
- func GetFleet(ctx echo.Context) error
- func GetFleetBackups(ctx echo.Context) error
- func GetFleetRemote(ctx echo.Context) error
- func GetLocalFile(ctx echo.Context) error
- func GetPeers(ctx echo.Context) error
- func GetPort(ctx echo.Context) error
- func GetRecoverStorage(ctx echo.Context) error
- func GetSambaConnectionsList(ctx echo.Context) error
- func GetSambaSharesList(ctx echo.Context) error
- func GetSambaStatus(ctx echo.Context) error
- func GetSambaUsersList(ctx echo.Context) error
- func GetSearchResult(ctx echo.Context) error
- func GetShare(ctx echo.Context) error
- func GetShareGuard(ctx echo.Context) error
- func GetShareGuardBans(ctx echo.Context) error
- func GetShareGuardEvents(ctx echo.Context) error
- func GetShareGuardRelayRefusals(ctx echo.Context) error
- func GetSize(ctx echo.Context) error
- func GetStats(ctx echo.Context) error
- func GetStatsAlerts(ctx echo.Context) error
- func GetStatsSeries(ctx echo.Context) error
- func GetStorage(ctx echo.Context) error
- func GetSystemCheckVersion(ctx echo.Context) error
- func GetSystemConfigDebug(ctx echo.Context) error
- func GetSystemCupInfo(ctx echo.Context) error
- func GetSystemDiskInfo(ctx echo.Context) error
- func GetSystemDockerContainers(ctx echo.Context) error
- func GetSystemEntry(ctx echo.Context) error
- func GetSystemHardwareInfo(ctx echo.Context) error
- func GetSystemMemInfo(ctx echo.Context) error
- func GetSystemModuleStatus(ctx echo.Context) error
- func GetSystemModules(ctx echo.Context) error
- func GetSystemNetInfo(ctx echo.Context) error
- func GetSystemOS(ctx echo.Context) error
- func GetSystemOSPlan(ctx echo.Context) error
- func GetSystemOSReadiness(ctx echo.Context) error
- func GetSystemOSRunbook(ctx echo.Context) error
- func GetSystemOSUpgradeStatus(ctx echo.Context) error
- func GetSystemPackageUpdateStatus(ctx echo.Context) error
- func GetSystemPackageUpdates(ctx echo.Context) error
- func GetSystemProxy(ctx echo.Context) error
- func GetSystemUtilization(ctx echo.Context) error
- func GetTelemetry(ctx echo.Context) error
- func GetTrash(ctx echo.Context) error
- func GetUpdateChannel(ctx echo.Context) error
- func GetZTIPs() []gjson.Result
- func InstallSystemModule(ctx echo.Context) error
- func JoinAndUpdateNet(address, networkId, ip string)
- func ListDriverInfo(ctx echo.Context) error
- func ListStorages(ctx echo.Context) error
- func MkdirAll(ctx echo.Context) error
- func NotifyWS(ctx echo.Context) error
- func PatchFleetBox(ctx echo.Context) error
- func PlanSystemModule(ctx echo.Context) error
- func PortCheck(ctx echo.Context) error
- func PostAlertsTest(ctx echo.Context) error
- func PostCreateFile(ctx echo.Context) error
- func PostFileOctet(ctx echo.Context) error
- func PostFileUpload(ctx echo.Context) error
- func PostFleetBoxCode(ctx echo.Context) error
- func PostFleetBoxes(ctx echo.Context) error
- func PostFleetRemoteDevice(ctx echo.Context) error
- func PostKillCasaOS(ctx echo.Context) error
- func PostNotifyMessage(ctx echo.Context) error
- func PostOperateFileOrDir(ctx echo.Context) error
- func PostSambaConnectionsCreate(ctx echo.Context) error
- func PostSambaSharesCreate(ctx echo.Context) error
- func PostSambaUserCreate(ctx echo.Context) error
- func PostShareGuardPerson(ctx echo.Context) error
- func PostShareGuardPersonCode(ctx echo.Context) error
- func PostSshLogin(ctx echo.Context) error
- func PostSystemStatusNotify(ctx echo.Context) error
- func PutAlerts(ctx echo.Context) error
- func PutAutoUpdate(ctx echo.Context) error
- func PutFeeds(ctx echo.Context) error
- func PutFileContent(ctx echo.Context) error
- func PutFleetMaster(ctx echo.Context) error
- func PutFleetMember(ctx echo.Context) error
- func PutFleetRelay(ctx echo.Context) error
- func PutFleetRemote(ctx echo.Context) error
- func PutNotifyRead(ctx echo.Context) error
- func PutSambaShare(ctx echo.Context) error
- func PutSambaUserPassword(ctx echo.Context) error
- func PutSambaUserShares(ctx echo.Context) error
- func PutShareApp(ctx echo.Context) error
- func PutShareGuardApp(ctx echo.Context) error
- func PutShareGuardBox(ctx echo.Context) error
- func PutShareGuardPerson(ctx echo.Context) error
- func PutShareGuardProtection(ctx echo.Context) error
- func PutShareGuardRelay(ctx echo.Context) error
- func PutShareName(ctx echo.Context) error
- func PutStatsAlerts(ctx echo.Context) error
- func PutSystemState(ctx echo.Context) error
- func PutTelemetry(ctx echo.Context) error
- func PutUpdateChannel(ctx echo.Context) error
- func RebootSystemOSUpgrade(ctx echo.Context) error
- func RemoveSystemModule(ctx echo.Context) error
- func RenamePath(ctx echo.Context) error
- func RestoreTrash(ctx echo.Context) error
- func ResumeSystemOSUpgrade(ctx echo.Context) error
- func SearchFiles(ctx echo.Context) error
- func SetSystemOSUpgradeBeta(ctx echo.Context) error
- func StartDockerUpdate(ctx echo.Context) error
- func StartSystemOSPlan(ctx echo.Context) error
- func StartSystemOSUpgrade(ctx echo.Context) error
- func StartSystemOSUpgradeRefresh(ctx echo.Context) error
- func StartSystemPackageUpdate(ctx echo.Context) error
- func SystemUpdate(ctx echo.Context) error
- func UmountStorage(ctx echo.Context) error
- func WsSsh(ctx echo.Context) error
- func ZerotierProxy(ctx echo.Context) error
- type CenterHandler
- type Client
- type FsListResp
- type ListReq
- type ObjResp
- type PeerModel
- type SearchResp
Constants ¶
This section is empty.
Variables ¶
Share is the public sharing the routes answer for; tests replace it.
Functions ¶
func AbortSystemOSUpgrade ¶ added in v0.4.74
@Summary call off an upgrade before its point of no return @Description The owner's click on "stop": the unit is stopped and the machine is put back as it was. Valid while the unit runs the blocks that can be undone (refreshing, rehearsing, running before block 5); after that nothing can be called off. Works whatever the switch says. The body is {}. 202 with the status; 409 with data.error_code: no_run, run_unreadable, not_abortable (data.data.reason: point_of_no_return, past_block or not_running); 500 internal when the flag of the call could not be written. The token goes in the Authorization header, and is not the refresh token. @Produce application/json @Accept application/json @Tags sys @Security ApiKeyAuth @Success 202 {object} model.Result "the unit is stopped and is put back: data is the status" @Failure 409 {object} model.Result "refused: data.error_code says why" @Router /sys/os/upgrade/abort [post]
func AckSystemOSUpgrade ¶ added in v0.4.74
@Summary the owner's word on an upgrade that is not running @Description action is acknowledge (close a run that ended or stopped, which lets backups and automatic updates go on), discard (the same, and drop the plan it was made for; for a rehearsal, put the machine back) or manual (take the run over: the core stops acting, and the owner finishes the hop by hand from its text). A machine that is half upgraded is let go of only with the word that the status gives in ack_word, typed in word. Works whatever the switch says. 200 with the status; 400 bad_request for a field that is not valid; 409 with data.error_code: no_run, run_unreadable, not_terminal (data.data.state), not_resumable (discard of a rehearsal whose unwind cannot be started now), word_required, bad_word, unit_active; 500 close_failed when the backup folder could not be put away (the run is as it was), start_failed when the log could not say that the owner took the run over. The token goes in the Authorization header, and is not the refresh token. @Produce application/json @Accept application/json @Tags sys @Security ApiKeyAuth @Success 200 {object} model.Result "data is the status" @Failure 400 {object} model.Result "the body or a field is not valid: data.error_code is bad_request" @Failure 409 {object} model.Result "refused: data.error_code says why" @Router /sys/os/upgrade/ack [post]
func CheckNetwork ¶
func CheckNetwork()
func ConnectWebSocket ¶
func DeleteFile ¶
@Summary delete file @Produce application/json @Accept application/json @Tags file @Security ApiKeyAuth @Param body body string true "paths eg ["/a/b/c","/d/e/f"]" @Param to_trash query bool false "move to the trash of each disk instead of deleting" @Success 200 {string} string "ok" @Router /file/delete [delete]
func DeleteFleetBox ¶ added in v0.4.90
DeleteFleetBox revokes a box.
@Summary fleet: remove a box @Produce application/json @Tags fleet @Security ApiKeyAuth @Success 200 {object} model.Result @Router /fleet/boxes/{id} [delete]
func DeleteFleetMember ¶ added in v0.4.90
DeleteFleetMember leaves the fleet.
@Summary fleet: leave the fleet @Produce application/json @Tags fleet @Security ApiKeyAuth @Success 200 {object} model.Result @Router /fleet/member [delete]
func DeleteFleetRemoteDevice ¶ added in v0.4.96
DeleteFleetRemoteDevice takes a phone or PC off the network.
@Summary fleet: remove a phone or PC @Produce application/json @Tags fleet @Security ApiKeyAuth @Success 200 {object} model.Result @Router /fleet/remote/devices/{id} [delete]
func DeleteOperateFileOrDir ¶
func DeleteSambaConnections ¶
func DeleteSambaShares ¶
func DeleteSambaUser ¶
DeleteSambaUser removes a share account, taking it out of every share it may mount first. A share it owns passes to another member, with the files it owned.
It refuses while the account is the only member of a share. Removing it anyway would leave that share with a "valid users" entry that no longer resolves, which smbd treats as nobody being allowed in — the share would simply stop working with no explanation.
func DeleteShareApp ¶ added in v0.4.111
DeleteShareApp stops sharing an app.
@Summary share: stop sharing an app @Produce application/json @Tags share @Security ApiKeyAuth @Success 200 {object} model.Result @Router /share/apps/{name} [delete]
func DeleteShareApps ¶ added in v0.4.111
DeleteShareApps stops sharing every app; the name stays.
@Summary share: stop sharing every app @Produce application/json @Tags share @Security ApiKeyAuth @Success 200 {object} model.Result @Router /share/apps [delete]
func DeleteShareGuardBan ¶ added in v0.4.114
DeleteShareGuardBan lifts a ban now. The key (an address or a range) arrives escaped from the router: it is unescaped once here.
@Summary share: lift a ban @Tags share @Security ApiKeyAuth @Success 204 @Router /share/guard/bans/{key} [delete]
func DeleteShareGuardPerson ¶ added in v0.4.114
DeleteShareGuardPerson removes a person: their code stops working.
@Summary share: remove a person @Tags share @Security ApiKeyAuth @Success 204 @Router /share/guard/people/{id} [delete]
func DeleteTrash ¶ added in v0.4.85
DeleteTrash removes items for good.
func DirPath ¶
@Summary 获取目录列表 @Produce application/json @Accept application/json @Tags file @Security ApiKeyAuth @Param path query string false "路径" @Success 200 {string} string "ok" @Router /file/dirpath [get]
func EmptyTrash ¶ added in v0.4.85
EmptyTrash removes everything in the trash.
func FleetRelay ¶ added in v0.4.90
FleetRelay forwards a request into a box's tunnel and answers what the box answered, as it is. Only the routes of the table pass; everything else is 403.
@Summary fleet: relay one of a box's own routes @Tags fleet @Security ApiKeyAuth @Success 200 {object} model.Result @Router /fleet/boxes/{id}/relay/{path} [get]
func FleetTunnel ¶ added in v0.4.90
FleetTunnel is the box's end of a tunnel: a WebSocket, outside the JWT group, authorised by the box's key.
func GetAddress ¶
func GetAddress() string
func GetAlerts ¶ added in v0.4.63
GetAlerts answers the push alerts' channels, each by name, service and host and never by its URL, the categories, the disk threshold and the last send that failed.
@Summary push alerts: channels and settings @Produce application/json @Tags sys @Security ApiKeyAuth @Success 200 {object} model.Result @Router /sys/alerts [get]
func GetAutoUpdate ¶ added in v0.4.62
GetAutoUpdate answers whether automatic updates are on, their window, their state, the release they aim at and their last attempt.
@Summary automatic updates: settings and state @Produce application/json @Tags sys @Security ApiKeyAuth @Success 200 {object} model.Result @Router /sys/autoupdate [get]
func GetCasaOSErrorLogs ¶
@Summary get logs @Produce application/json @Accept application/json @Tags sys @Security ApiKeyAuth @Success 200 {string} string "ok" @Router /sys/error/logs [get]
func GetCasaOSPort ¶
@Summary get casaos server port @Produce application/json @Accept application/json @Tags sys @Security ApiKeyAuth @Success 200 {string} string "ok" @Router /sys/port [get]
func GetDockerUpdateStatus ¶ added in v0.4.67
@Summary how the update of Docker is going, or how it went @Produce application/json @Tags sys @Security ApiKeyAuth @Success 200 {object} model.Result @Router /sys/docker/update/status [get]
func GetDownloadFile ¶
@Summary download @Produce application/json @Accept application/json @Tags file @Security ApiKeyAuth @Param format query string false "Compression format" Enums(zip,tar,targz) @Param files query string true "file list eg: filename1,filename2,filename3 " @Success 200 {string} string "ok" @Router /file/download [get]
func GetDownloadSingleFile ¶
func GetFeeds ¶ added in v0.4.121
GetFeeds answers the footer's feeds: the switch, the feeds and their cached headlines. It never waits on a feed: a refresh that is due starts in the background (CasaOS#180).
@Summary footer feeds: settings and headlines @Produce application/json @Tags sys @Security ApiKeyAuth @Success 200 {object} model.Result @Router /sys/feeds [get]
func GetFileCount ¶
func GetFileImage ¶
@Summary image thumbnail/original image @Produce application/json @Accept application/json @Tags file @Security ApiKeyAuth @Param path query string true "path" @Param type query string false "original,thumbnail" Enums(original,thumbnail) @Success 200 {string} string "ok" @Router /file/image [get]
func GetFileRoots ¶ added in v0.4.90
GetFileRoots answers the configured file ManagementRoots (empty: the file API is unconfined and the dashboard keeps /DATA). For an account, its folders, and the ones it may write.
func GetFileUpload ¶
@Summary upload file @Produce application/json @Accept application/json @Tags file @Security ApiKeyAuth @Param path formData string false "file path" @Param file formData file true "file" @Success 200 {string} string "ok" @Router /file/upload [get]
func GetFilerContent ¶
@Summary 读取文件 @Produce application/json @Accept application/json @Tags file @Security ApiKeyAuth @Param path query string true "路径" @Success 200 {string} string "ok" @Router /file/read [get]
func GetFleet ¶ added in v0.4.90
GetFleet answers the role of this box and the state of the role it plays.
@Summary fleet: the role and its state @Produce application/json @Tags fleet @Security ApiKeyAuth @Success 200 {object} model.Result @Router /fleet [get]
func GetFleetBackups ¶ added in v0.4.104
GetFleetBackups answers the state of every box's backups, from the snapshots the master's poller keeps (it asks no box), with whether a Fleet alert would be sent anywhere and how often the boxes are read.
@Summary fleet: the state of the boxes' backups @Produce application/json @Tags fleet @Security ApiKeyAuth @Success 200 {object} model.Result @Failure 409 {object} model.Result "this box is not a master" @Router /fleet/backups [get]
func GetFleetRemote ¶ added in v0.4.96
GetFleetRemote asks the relay for the devices on this box's network and, on a master, its boxes' addresses. The dashboard calls it on demand (the remote access page opening, a refresh button), never on a timer: the relay limits Bearer calls to 60 an hour per IP, shared with join keys.
@Summary fleet: remote access devices and addresses @Produce application/json @Tags fleet @Security ApiKeyAuth @Success 200 {object} model.Result @Router /fleet/remote [get]
func GetLocalFile ¶
func GetPort ¶
@Summary 获取一个可用端口 @Produce application/json @Accept application/json @Tags app @Param type query string true "端口类型 udp/tcp" @Security ApiKeyAuth @Success 200 {string} string "ok" @Router /app/getport [get]
func GetRecoverStorage ¶
func GetSambaSharesList ¶
func GetSambaStatus ¶
func GetSambaUsersList ¶
GetSambaUsersList returns the share accounts CasaOS created. Accounts that belong to the operating system are not listed and cannot be managed here.
func GetSearchResult ¶
func GetShare ¶ added in v0.4.111
GetShare answers the state of public sharing: the name, the apps and their addresses, the certificate and the tunnel.
@Summary share: the state of public sharing @Produce application/json @Tags share @Security ApiKeyAuth @Success 200 {object} model.Result @Router /share [get]
func GetShareGuard ¶ added in v0.4.114
GetShareGuard answers the protection of shared apps: the box's policy, each shared app's access, the people and what the Gateway has seen. No code and no hash of a code is in it.
@Summary share: the protection of shared apps @Produce application/json @Tags share @Security ApiKeyAuth @Success 200 {object} model.Result @Router /share/guard [get]
func GetShareGuardBans ¶ added in v0.4.114
GetShareGuardBans relays the Gateway's active bans.
@Summary share: the active bans @Produce application/json @Tags share @Security ApiKeyAuth @Success 200 {object} model.Result @Router /share/guard/bans [get]
func GetShareGuardEvents ¶ added in v0.4.114
GetShareGuardEvents relays the Gateway's journal of refused requests, filtered by app (compose name) and reason.
@Summary share: the journal of the protection @Produce application/json @Tags share @Security ApiKeyAuth @Success 200 {object} model.Result @Router /share/guard/events [get]
func GetShareGuardRelayRefusals ¶ added in v0.4.115
GetShareGuardRelayRefusals passes on the relay's refusals of this box's name.
@Summary share: what the relay refused @Produce application/json @Tags share @Security ApiKeyAuth @Success 200 {object} model.Result @Router /share/guard/relay-refusals [get]
func GetStats ¶ added in v0.4.80
GetStats lists what is measured: the machine.
@Summary statistics: the measured items @Produce application/json @Tags sys @Security ApiKeyAuth @Success 200 {object} model.Result @Router /sys/stats [get]
func GetStatsAlerts ¶ added in v0.4.80
GetStatsAlerts answers the alert rules of the machine and its firing alerts.
@Summary statistics: alert rules and firing alerts of one item @Produce application/json @Tags sys @Security ApiKeyAuth @Param id path string true "item id" @Success 200 {object} model.Result @Router /sys/stats/{id}/alerts [get]
func GetStatsSeries ¶ added in v0.4.80
GetStatsSeries answers the history of the machine over ?range= (live when absent).
@Summary statistics: the series of one item @Produce application/json @Tags sys @Security ApiKeyAuth @Param id path string true "item id" @Param range query string false "live, 15m, 1h, 24h or 7d" @Success 200 {object} model.Result @Router /sys/stats/{id} [get]
func GetStorage ¶
func GetSystemCheckVersion ¶
@Summary check version @Produce application/json @Accept application/json @Tags sys @Security ApiKeyAuth @Success 200 {string} string "ok" @Router /sys/version/check [get]
func GetSystemCupInfo ¶
@Summary get cpu info @Produce application/json @Accept application/json @Tags sys @Security ApiKeyAuth @Success 200 {string} string "ok" @Router /sys/cpu [get]
func GetSystemDiskInfo ¶
@Summary get disk info @Produce application/json @Accept application/json @Tags sys @Security ApiKeyAuth @Success 200 {string} string "ok" @Router /sys/disk [get]
func GetSystemDockerContainers ¶ added in v0.4.67
@Summary list the running Docker containers, which an update of Docker stops @Produce application/json @Tags sys @Security ApiKeyAuth @Success 200 {object} model.Result @Router /sys/docker/containers [get]
func GetSystemEntry ¶
func GetSystemHardwareInfo ¶
@Summary get system hardware info @Produce application/json @Accept application/json @Tags sys @Security ApiKeyAuth @Success 200 {string} string "ok" @Router /sys/hardware/info [get]
func GetSystemMemInfo ¶
@Summary get mem info @Produce application/json @Accept application/json @Tags sys @Security ApiKeyAuth @Success 200 {string} string "ok" @Router /sys/mem [get]
func GetSystemModuleStatus ¶ added in v0.4.75
@Summary how the job of a module is going, and the module @Description data.job is the job that the core started for the module, or the last that it started: kind (install, remove or update, as the core started it; "" when the log does not say, as for a job that was started by hand), state (idle, running, succeeded, refused, failed or interrupted), step (where it is, or where it failed), code (why it was refused or failed), undo (rolled_back, rolled_back_with_left or rollback_incomplete for an install or an update that failed after it changed the box), kept_packages (the packages an install that failed left on the box, null when it is not known), started_at, ended_at and log_tail (the last 20 lines of the log that are not marker lines, as text). data.status is the module as the assistant says it: installed, version, unit (active, enabled) and route (answers). It runs no apt and takes no lock of a job: it is safe to ask every few seconds. 400 bad_request for a name that is not a module's. @Produce application/json @Tags sys @Security ApiKeyAuth @Param name path string true "the name of the module" @Success 200 {object} model.Result @Failure 400 {object} model.Result "the name is not a module's: data.error_code is bad_request" @Router /sys/modules/{name}/status [get]
func GetSystemModules ¶ added in v0.4.75
@Summary the modules that this release can install, and what the box says of each @Description The catalogue of this release joined with what is installed: catalogue (ok, and when it is not, error: none, unreadable or invalid, with the place in detail; the list is then empty, never partial), and modules, each with name, title, description, tier (core or community), tag, whether the catalogue has it, installed (null, or its version), system (supported, and the codes of the checks that say no: os, arch, recasaos) and broken when its manifest cannot be read. It only reads. A module that is installed and no longer in the catalogue is listed all the same, with catalogue false. @Produce application/json @Tags sys @Security ApiKeyAuth @Success 200 {object} model.Result @Router /sys/modules [get]
func GetSystemNetInfo ¶
@Summary get Net info @Produce application/json @Accept application/json @Tags sys @Security ApiKeyAuth @Success 200 {string} string "ok" @Router /sys/net [get]
func GetSystemOS ¶ added in v0.4.69
@Summary the operating system, and how long its security updates last @Produce application/json @Tags sys @Security ApiKeyAuth @Success 200 {object} model.Result @Router /sys/os [get]
func GetSystemOSPlan ¶ added in v0.4.73
@Summary how the plan of the upgrade of the operating system is going, or how it went @Description Whether a plan can be made (plannable, and reason when it cannot; unknown when that could not be told, and then it is asked again), the state of the job (idle, running, done, failed), its phase, its times, why it failed (error: code, phase, detail, data), the sandbox directory that a job that is over could not remove (sandbox_left_behind) and, when it is done and has not expired, the plan without the tree of the sources. It runs no apt, and takes no lock of the package updater; asking who the machine is takes a moment when no job runs, and the requests that come together share the answer. @Produce application/json @Tags sys @Security ApiKeyAuth @Success 200 {object} model.Result @Router /sys/os/upgrade/plan [get]
func GetSystemOSReadiness ¶ added in v0.4.71
@Summary whether this machine could be upgraded to the next release of its operating system @Description A report that only reads the machine: the state (ready, attention, blocked, latest, unsupported), the checks by code with their severity, and the same as plain text. It takes up to twenty seconds. @Produce application/json @Accept application/json @Tags sys @Security ApiKeyAuth @Success 200 {object} model.Result @Router /sys/os/readiness [get]
func GetSystemOSRunbook ¶ added in v0.4.73
@Summary the text with which to do the hop to the next release of the operating system by hand @Description Written from the plan that is there, for this machine: a shell file of blocks, each to be read and pasted into a console, with its blocks listed. 409 with data.error_code no_plan (data.data.reason: idle, running, failed, expired, blocked) when there is no plan to write it from, no_runbook when the text could not be written safely. With run=current it is the text of the upgrade that is open instead (the one that was written when it began, which does not need the plan to be alive), with from_run true, for the owner who takes the run over: 409 no_run when there is none, run_unreadable when its text cannot be read; any other value of run is a 400. It has what the files of the box say, so the token goes in the Authorization header, and is not the refresh token. @Produce application/json @Tags sys @Security ApiKeyAuth @Param run query string false "current: the text of the upgrade that is open, and not of the plan" @Success 200 {object} model.Result @Failure 400 {object} model.Result "run is asked for and is not current" @Failure 409 {object} model.Result "no plan, or no runbook, or no run: data.error_code says which" @Router /sys/os/upgrade/runbook [get]
func GetSystemOSUpgradeStatus ¶ added in v0.4.74
@Summary how the upgrade of the operating system is going @Description The state of the upgrade that is open or the last that was, as a code the page puts in words (state, reason, cause, class of what stopped it), the block that runs, whether the point of no return is behind it, whether the machine is held (busy), what the owner can do now (actions, which the page shows as they are), the checks that stand before the restart, the findings of the check afterwards, where the owner stands if they take the run over (manual) and the end of the unit's output with the addresses of the sources reduced to their host. It runs no apt and takes no lock of a run: it is safe to ask every few seconds. beta_enabled says whether the switch of the feature is on; the upgrade that is open is told whatever the switch says. @Description last_refresh_at (RFC 3339, UTC) is when the old release was last brought up to date; it is left out when there is no such time or it cannot be read. @Produce application/json @Tags sys @Security ApiKeyAuth @Success 200 {object} model.Result @Router /sys/os/upgrade/status [get]
func GetSystemPackageUpdateStatus ¶
@Summary get operating system package update status @Produce application/json @Tags sys @Security ApiKeyAuth @Success 200 {object} model.Result @Router /sys/packages/update/status [get]
func GetSystemPackageUpdates ¶
@Summary check for operating system package updates @Produce application/json @Tags sys @Security ApiKeyAuth @Success 200 {object} model.Result @Router /sys/packages [get]
func GetSystemProxy ¶
GetSystemProxy answers the dashboard's "add a link" panel: does the address the owner typed answer? It says the status the address answered with and nothing else. It used to relay the whole response, through CasaOS-Common's HTTP helpers, which add the internal secret to a request aimed at loopback: any signed-in account could read a service's private routes as the box itself. The request goes out on a plain client, without the secret, and the body stays here.
func GetSystemUtilization ¶
@Summary system utilization @Produce application/json @Accept application/json @Tags sys @Security ApiKeyAuth @Success 200 {string} string "ok" @Router /sys/utilization [get]
func GetTelemetry ¶ added in v0.4.60
GetTelemetry answers whether the anonymous statistics are on, whether the dashboard's notice was seen, and the heartbeat exactly as it would be sent now.
@Summary anonymous statistics: state and preview @Produce application/json @Tags sys @Security ApiKeyAuth @Success 200 {object} model.Result @Router /sys/telemetry [get]
func GetTrash ¶ added in v0.4.85
GetTrash lists the trash of every disk, the last deleted first, with the space it takes.
func GetUpdateChannel ¶ added in v0.4.124
GetUpdateChannel answers the update channel of the box: release or prerelease.
@Summary update channel @Produce application/json @Tags sys @Security ApiKeyAuth @Success 200 {object} model.Result @Router /sys/update-channel [get]
func InstallSystemModule ¶ added in v0.4.75
@Summary install a module, or update one that is installed @Description Starts the unit that installs the module, for the plan that the user read (plan_id): the plan is made again now and must be the same, and nothing else may be changing the box. The body is strict JSON, {"plan_id": "m1-..."} for an install and {"plan_id": "m1-...", "mode": "update"} for the update of a module that is installed (the plan_id is the one of the plan of that mode, and a mode that is not there is an install), with no field besides them; mode is install or update, any other value is a 400 bad_request (data.data.field is mode). 202 with the status (data.job.kind is install, or update for an update, and data.job.state is running; follow it with GET /sys/modules/{name}/status); 400 bad_request (data.data.field) for a name, a body or a field that is not valid; 409 with data.error_code when it is refused: not_root, unsupported, busy (data.data.reason), plan_changed, plan_timeout, and the codes of the plan's checks (catalogue, os, arch, recasaos, already_installed, foreign_unit, dpkg_state, disk_short, disk_unknown, apt_missing, apt_failed, apt_removes, apt_downgrades, held_package, package_not_exact, with data.data.checks; for an update: catalogue, os, arch, recasaos, not_installed, manifest_invalid, files_unreadable, files_unverified, version_unknown, up_to_date, downgrade, foreign_unit, unit_changed, busy, dpkg_state, disk_short, disk_unknown, apt_missing, apt_failed, apt_removes, apt_downgrades, held_package, package_not_exact); 500 start_failed when the unit could not be started (the log could not be written, systemd did not start it, or /usr/bin/casaos is not a program that can be run): nothing was changed. Every busy carries data.data.reason. The token goes in the Authorization header, and is not the refresh token. @Produce application/json @Accept application/json @Tags sys @Security ApiKeyAuth @Param name path string true "the name of the module" @Success 202 {object} model.Result "the unit was started: data is the status" @Failure 400 {object} model.Result "the name, the body or a field is not valid: data.error_code is bad_request" @Failure 409 {object} model.Result "refused: data.error_code says why" @Failure 500 {object} model.Result "start_failed: nothing was changed" @Router /sys/modules/{name}/install [post]
func JoinAndUpdateNet ¶
func JoinAndUpdateNet(address, networkId, ip string)
func ListDriverInfo ¶
func ListStorages ¶
func MkdirAll ¶
@Summary create folder @Produce application/json @Accept application/json @Tags file @Security ApiKeyAuth @Param path body string true "path of folder" @Success 200 {string} string "ok" @Router /file/mkdir [post]
func NotifyWS ¶
@Summary websocket 接口,连接成功后发送一个"notify"字符串 @Produce application/json @Accept application/json @Tags notify @Security ApiKeyAuth @Param token path string true "token" @Success 200 {string} string "ok" @Router /notify/ws [get]
func PatchFleetBox ¶ added in v0.4.90
PatchFleetBox renames a box or changes its dashboard link.
@Summary fleet: rename a box or change its address @Accept application/json @Produce application/json @Tags fleet @Security ApiKeyAuth @Success 200 {object} model.Result @Router /fleet/boxes/{id} [patch]
func PlanSystemModule ¶ added in v0.4.75
@Summary the plan of installing a module, or of updating one that is installed: what the box says of it and what apt would do, with the machine unchanged @Description Runs the module assistant's plan in the core, for at most 60 seconds. The body is optional and, as it always was, ignored when it is not a JSON object or has no "mode" key: that is the plan of an install. {"mode": "update"} is the plan of the update of a module that is installed to the tag the catalogue names; when "mode" is there it is install or update, once, and anything else is a 400 bad_request (data.data.field is mode). The checks of an install in their order (catalogue, os, arch, recasaos, already_installed, foreign_unit, busy, dpkg_state, disk, apt, each with code, ok and detail); those of an update (catalogue, os, arch, recasaos, installed, newer, foreign_unit, busy, dpkg_state, disk, apt), with mode "update" and update (installed and latest tags, added: the packages apt says it would install (those of the new manifest that are not installed), dropped: those it no longer names, which are never removed), and refused with not_installed, manifest_invalid, files_unreadable, files_unverified, version_unknown, up_to_date, downgrade or unit_changed besides the codes of an install; then refused (null, or the code of the first check that failed), the packages apt would install and upgrade with the sizes it gives, the archive, and plan_id, the id that the install or the update must be given back. A plan that is refused is still a plan: 200 with refused set. 400 bad_request (data.data.field is name or mode) for a name or a mode that is not valid; 409 with data.error_code plan_timeout when the plan could not be made in its time. It changes nothing. The token goes in the Authorization header, and is not the refresh token. @Produce application/json @Tags sys @Security ApiKeyAuth @Param name path string true "the name of the module" @Success 200 {object} model.Result @Failure 400 {object} model.Result "the name is not a module's: data.error_code is bad_request" @Failure 409 {object} model.Result "plan_timeout" @Router /sys/modules/{name}/plan [post]
func PortCheck ¶
@Summary 检查端口是否可用 @Produce application/json @Accept application/json @Tags app @Param port path int true "端口号" @Param type query string true "端口类型 udp/tcp" @Security ApiKeyAuth @Success 200 {string} string "ok" @Router /app/check/{port} [get]
func PostAlertsTest ¶ added in v0.4.63
PostAlertsTest sends a test message to channel_id, or to every channel without it, and answers per channel {id, ok, error} once each has answered. An unknown channel_id is a 400.
@Summary push alerts: send a test message @Accept application/json @Produce application/json @Tags sys @Security ApiKeyAuth @Success 200 {object} model.Result @Router /sys/alerts/test [post]
func PostCreateFile ¶
@Summary create file @Produce application/json @Accept application/json @Tags file @Security ApiKeyAuth @Param path body string true "path of folder (path need to url encode)" @Success 200 {string} string "ok" @Router /file/create [post]
func PostFileOctet ¶
func PostFileUpload ¶
@Summary upload file @Produce application/json @Accept multipart/form-data @Tags file @Security ApiKeyAuth @Param path formData string false "file path" @Param file formData file true "file" @Success 200 {string} string "ok" @Router /file/upload [post]
func PostFleetBoxCode ¶ added in v0.4.90
PostFleetBoxCode gives a box a fresh code; the old one stops working.
@Summary fleet: regenerate a box's code @Produce application/json @Tags fleet @Security ApiKeyAuth @Success 200 {object} model.Result @Router /fleet/boxes/{id}/code [post]
func PostFleetBoxes ¶ added in v0.4.90
PostFleetBoxes enrols a box and hands over its code once. self enrols this box itself.
@Summary fleet: add a box, get its enrolment code @Accept application/json @Produce application/json @Tags fleet @Security ApiKeyAuth @Success 200 {object} model.Result @Router /fleet/boxes [post]
func PostFleetRemoteDevice ¶ added in v0.4.96
PostFleetRemoteDevice gives a one-time code a phone or PC joins the network with.
@Summary fleet: add a phone or PC, get its code @Produce application/json @Tags fleet @Security ApiKeyAuth @Success 200 {object} model.Result @Router /fleet/remote/devices [post]
func PostKillCasaOS ¶
@Summary active killing casaos @Produce application/json @Accept application/json @Tags sys @Security ApiKeyAuth @Success 200 {string} string "ok" @Router /sys/stop [post]
func PostNotifyMessage ¶
func PostOperateFileOrDir ¶
@Summary copy or move file @Produce application/json @Accept application/json @Tags file @Security ApiKeyAuth @Param body body model.FileOperate true "type:move,copy" @Success 200 {string} string "ok" @Router /file/operate [post]
func PostSambaSharesCreate ¶
func PostSambaUserCreate ¶
PostSambaUserCreate adds an account that can mount protected shares. It has no home directory and no login shell, so it cannot be used to reach the host.
func PostShareGuardPerson ¶ added in v0.4.114
PostShareGuardPerson adds a person and answers their access code, which is shown this once.
@Summary share: add a person @Accept application/json @Produce application/json @Tags share @Security ApiKeyAuth @Success 200 {object} model.Result @Router /share/guard/people [post]
func PostShareGuardPersonCode ¶ added in v0.4.114
PostShareGuardPersonCode gives a person a new code: the old one stops working.
@Summary share: a new code for a person @Produce application/json @Tags share @Security ApiKeyAuth @Success 200 {object} model.Result @Router /share/guard/people/{id}/code [post]
func PostSshLogin ¶
func PostSystemStatusNotify ¶
func PutAlerts ¶ added in v0.4.63
PutAlerts sets channels, categories and disk_threshold, each optional; other fields are ignored. channels replaces the list: an entry with an id and no url keeps its stored URL, a new entry needs a url. A URL Shoutrrr cannot parse, an unknown id or a threshold outside 50 to 99 is a 400. It answers the new settings, as GET does.
@Summary push alerts: set the channels, categories and disk threshold @Accept application/json @Produce application/json @Tags sys @Security ApiKeyAuth @Success 200 {object} model.Result @Router /sys/alerts [put]
func PutAutoUpdate ¶ added in v0.4.62
PutAutoUpdate sets enabled, window_start and window_end, and resumes a paused release with resume, each optional; other fields are ignored. A window that is not HH:MM, or shorter than an hour, is a 400. It answers the new state, as GET does.
@Summary automatic updates: turn them on or off, set the window, resume @Accept application/json @Produce application/json @Tags sys @Security ApiKeyAuth @Success 200 {object} model.Result @Router /sys/autoupdate [put]
func PutFeeds ¶ added in v0.4.121
PutFeeds sets {enabled, feeds}: at most ten http(s) feeds, else a 400. It answers as GET does.
@Summary footer feeds: set the switch and the feeds @Accept application/json @Produce application/json @Tags sys @Security ApiKeyAuth @Success 200 {object} model.Result @Router /sys/feeds [put]
func PutFileContent ¶
@Summary update file @Produce application/json @Accept application/json @Tags file @Security ApiKeyAuth @Param path body string true "path" @Param content body string true "content" @Success 200 {string} string "ok" @Router /file/update [put]
func PutFleetMaster ¶ added in v0.4.90
PutFleetMaster turns the master role on, or off. On: over the relay given (the dashboard names the official one too), or in advanced mode at an address typed by hand; neither is a 400. Disabling closes every tunnel, forgets the boxes and, over a relay, deletes the fleet there and leaves its network.
@Summary fleet: become the master, or stop being one @Accept application/json @Produce application/json @Tags fleet @Security ApiKeyAuth @Success 200 {object} model.Result @Router /fleet/master [put]
func PutFleetMember ¶ added in v0.4.90
PutFleetMember joins (or re-joins) a fleet from a pasted code. A box with remote access answers 409 until leave_remote confirms that joining turns it off.
@Summary fleet: join a fleet @Accept application/json @Produce application/json @Tags fleet @Security ApiKeyAuth @Param code body string true "the code pasted from the master" @Param leave_remote body bool false "confirms that joining turns this box's remote access off" @Success 200 {object} model.Result @Failure 409 {object} model.Result "this box has remote access: send leave_remote true to join anyway" @Router /fleet/member [put]
func PutFleetRelay ¶ added in v0.4.93
PutFleetRelay moves the master to another relay: a new fleet there, this box on its network, and every box asked for a new code.
@Summary fleet: change the master's relay @Accept application/json @Produce application/json @Tags fleet @Security ApiKeyAuth @Success 200 {object} model.Result @Router /fleet/relay [put]
func PutFleetRemote ¶ added in v0.4.96
PutFleetRemote turns remote access on, over the relay given (the official one when empty), or off.
@Summary fleet: turn remote access on or off @Accept application/json @Produce application/json @Tags fleet @Security ApiKeyAuth @Success 200 {object} model.Result @Router /fleet/remote [put]
func PutNotifyRead ¶
@Summary 标记notify已读 @Produce application/json @Accept application/json @Tags notify @Security ApiKeyAuth @Success 200 {string} string "ok" @Router /notify/read/{id} [put]
func PutSambaShare ¶
PutSambaShare sets who may mount an existing share, moving it between guest access and named accounts in either direction, and turns its Time Machine flag on or off. An empty member list makes it a guest share again; a body with a username and no members is what older clients send, and means that one account with write access.
The body replaces all of it, so a client that omits time_machine clears it.
Moving between guest access and accounts re-owns only the shared directory itself, never its contents: files created under a guest share are world-readable, and files created under a protected share stay reachable by root, which is who a guest session maps to. A change from one owning account to another also hands the old owner's files over, in the background after the answer (see moveShareOwnership).
func PutSambaUserPassword ¶
PutSambaUserPassword replaces the password of an existing share account.
func PutSambaUserShares ¶ added in v0.4.95
PutSambaUserShares sets which protected shares one account may mount, and whether it may write there: the member's view of the same data the share dialog edits. Shares left out of the list lose the account.
Guest shares are refused rather than quietly protected, and so is a change that would leave a share with nobody at all: an empty "valid users" would let every account in, and turning it back into a guest share would publish a private folder.
func PutShareApp ¶ added in v0.4.111
PutShareApp publishes an installed app at its own address under the box's name.
@Summary share: share an app @Produce application/json @Tags share @Security ApiKeyAuth @Success 200 {object} model.Result @Router /share/apps/{name} [put]
func PutShareGuardApp ¶ added in v0.4.114
PutShareGuardApp sets who may enter a shared app, and its own settings.
@Summary share: the protection of one app @Accept application/json @Produce application/json @Tags share @Security ApiKeyAuth @Success 200 {object} model.Result @Router /share/guard/apps/{name} [put]
func PutShareGuardBox ¶ added in v0.4.114
PutShareGuardBox replaces the box's policy.
@Summary share: the box's protection policy @Accept application/json @Produce application/json @Tags share @Security ApiKeyAuth @Success 200 {object} model.Result @Router /share/guard/box [put]
func PutShareGuardPerson ¶ added in v0.4.114
PutShareGuardPerson renames a person and sets the apps they may enter.
@Summary share: change a person @Accept application/json @Produce application/json @Tags share @Security ApiKeyAuth @Success 200 {object} model.Result @Router /share/guard/people/{id} [put]
func PutShareGuardProtection ¶ added in v0.4.114
PutShareGuardProtection turns the protection of shared apps on or off.
@Summary share: protection on or off @Accept application/json @Produce application/json @Tags share @Security ApiKeyAuth @Success 200 {object} model.Result @Router /share/guard/protection [put]
func PutShareGuardRelay ¶ added in v0.4.115
PutShareGuardRelay changes what the relay does for this box: filtering, and sharing the box's bans.
@Summary share: the relay's protection settings @Accept application/json @Produce application/json @Tags share @Security ApiKeyAuth @Success 200 {object} model.Result @Router /share/guard/relay [put]
func PutShareName ¶ added in v0.4.111
PutShareName claims this box's public name at the relay; accept_tos confirms the terms of Let's Encrypt.
@Summary share: claim the public name @Accept application/json @Produce application/json @Tags share @Security ApiKeyAuth @Success 200 {object} model.Result @Router /share/name [put]
func PutStatsAlerts ¶ added in v0.4.80
PutStatsAlerts replaces the rules listed, by key; the others keep theirs. A malformed body, whatever its fault, is bad_rules naming the field.
@Summary statistics: set alert rules of one item @Accept application/json @Produce application/json @Tags sys @Security ApiKeyAuth @Param id path string true "item id" @Success 200 {object} model.Result @Router /sys/stats/{id}/alerts [put]
func PutSystemState ¶
func PutTelemetry ¶ added in v0.4.60
PutTelemetry sets enabled and notice_seen, each optional; other fields are ignored. It answers the new state, as GET does.
@Summary anonymous statistics: turn them on or off, mark the notice seen @Accept application/json @Produce application/json @Tags sys @Security ApiKeyAuth @Success 200 {object} model.Result @Router /sys/telemetry [put]
func PutUpdateChannel ¶ added in v0.4.124
PutUpdateChannel sets {channel}: "release", or "prerelease" to be offered a pre-release newer than the last release when updating by hand. The night's automatic update installs releases only, whatever the channel. Anything else is a 400.
@Summary set the update channel @Accept application/json @Produce application/json @Tags sys @Security ApiKeyAuth @Success 200 {object} model.Result @Router /sys/update-channel [put]
func RebootSystemOSUpgrade ¶ added in v0.4.74
@Summary restart the machine that waits for its restart @Description The owner's click on "restart now". Valid when the machine waits for its restart (awaiting_reboot, reboot_stalled, or a refresh that asks for one), with no unit of the upgrade running, no other package manager at work and, for a hop, what stands before the restart green (asked again now). Works whatever the switch says. The body is {}. 202 with the status (rebooting); 409 with data.error_code: no_run, run_unreadable, not_awaiting_reboot (data.data.state), barrier_failed (data.data.checks), unit_active, dpkg_locked; 500 reboot_failed when systemd would not restart the machine, start_failed when the log of the run could not say that the restart was asked for (nothing was asked), internal for anything else. The token goes in the Authorization header, and is not the refresh token. @Produce application/json @Accept application/json @Tags sys @Security ApiKeyAuth @Success 202 {object} model.Result "the restart was asked for: data is the status" @Failure 409 {object} model.Result "refused: data.error_code says why" @Failure 500 {object} model.Result "reboot_failed" @Router /sys/os/upgrade/reboot [post]
func RemoveSystemModule ¶ added in v0.4.75
@Summary remove a module @Description Starts the unit that removes the module: its unit is stopped and disabled, and exactly the files it put down are deleted, with its manifest. It never purges packages and never touches the module's data. The body is {}. 202 with the status (data.job.kind is remove and data.job.state is running); 400 bad_request for a name or a body that is not valid; 409 with data.error_code when it is refused: not_root, unsupported, busy (data.data.reason), not_installed. 500 start_failed when the unit could not be started (the log could not be written, systemd did not start it, or /usr/bin/casaos is not a program that can be run): nothing was changed. The token goes in the Authorization header, and is not the refresh token. @Produce application/json @Accept application/json @Tags sys @Security ApiKeyAuth @Param name path string true "the name of the module" @Success 202 {object} model.Result "the unit was started: data is the status" @Failure 400 {object} model.Result "the name or the body is not valid: data.error_code is bad_request" @Failure 409 {object} model.Result "refused: data.error_code says why" @Failure 500 {object} model.Result "start_failed: nothing was changed" @Router /sys/modules/{name}/remove [post]
func RenamePath ¶
@Summary rename file or dir @Produce application/json @Accept application/json @Tags file @Security ApiKeyAuth @Param oldpath body string true "path of old" @Param newpath body string true "path of new" @Success 200 {string} string "ok" @Router /file/rename [put]
func RestoreTrash ¶ added in v0.4.85
RestoreTrash puts items back where they were and answers where they are now (another name when theirs is taken).
func ResumeSystemOSUpgrade ¶ added in v0.4.74
@Summary go on with an upgrade that stopped half way @Description The owner's click on "go on": starts a unit of its own that mends what the stop left and runs the blocks that remain. Valid for a run that stopped or was interrupted after its point of no return, for a class of stop that can be gone on from. Works whatever the switch says. The body is {}. 202 with the status; 409 with data.error_code: no_run, run_unreadable, not_resumable (data.data.state, data.data.class), unit_active, busy; 500 start_failed when the unit could not be started, internal for anything else. The token goes in the Authorization header, and is not the refresh token. @Produce application/json @Accept application/json @Tags sys @Security ApiKeyAuth @Success 202 {object} model.Result "a unit was started: data is the status" @Failure 409 {object} model.Result "refused: data.error_code says why" @Router /sys/os/upgrade/resume [post]
func SearchFiles ¶ added in v0.4.123
SearchFiles finds the files and folders whose name holds q (2 to 200 characters, case not minded) under path, "/" when absent: under a folder within the roots, or, from a folder above them ("/" for the dashboard's Root), under each root it leads to. Names only, links not followed, at most filesearch.DefaultLimits (CasaOS#184). The owner's: an account is refused, as the Gateway refuses it the route.
@Summary search Files by name @Produce application/json @Tags file @Security ApiKeyAuth @Param path query string false "where to search" @Param q query string true "part of a name" @Success 200 {object} model.Result @Router /file/search [get]
func SetSystemOSUpgradeBeta ¶ added in v0.4.74
@Summary switch the upgrade of the operating system on or off @Description The owner's switch of the feature, which gates what begins something (a start); what is open goes on whatever it says, so that a machine that is half upgraded is never trapped behind it. Turning it off while a run is open is refused. The same as creating or removing the file /etc/casaos/os-upgrade.beta. 200 with data.beta_enabled; 400 bad_request when enabled is not true or false; 409 run_open (data.data.state, data.data.run_id) when turning it off with a run open. The token goes in the Authorization header, and is not the refresh token. @Produce application/json @Accept application/json @Tags sys @Security ApiKeyAuth @Success 200 {object} model.Result "data.beta_enabled is what the switch is now" @Failure 400 {object} model.Result "the body has no enabled, or it is not true or false: data.error_code is bad_request" @Failure 409 {object} model.Result "run_open" @Router /sys/os/upgrade/beta [post]
func StartDockerUpdate ¶ added in v0.4.67
@Summary update the Docker engine, to the plan the check offered @Produce application/json @Accept application/json @Tags sys @Security ApiKeyAuth @Success 200 {object} model.Result @Failure 400 {object} model.Result "the body is not a plan_id" @Failure 409 {object} model.Result "refused: data.error_code says why" @Failure 501 {object} model.Result "this host cannot update packages" @Router /sys/docker/update [post]
func StartSystemOSPlan ¶ added in v0.4.73
@Summary start the plan of the upgrade of the operating system: what apt would do, with the machine unchanged @Description Starts a job that rewrites the sources to the next release in a temporary directory, lets apt plan the upgrade there (a real update of the target's package lists, a simulated transaction) and judges what it says. It changes nothing of the machine. 202 when a job began (data.state is running), 200 when one already runs (data.already_running), 409 with data.error_code (not_root, hop_not_planned, identity_unsupported, busy, no_room) when none can be started. The token goes in the Authorization header, and is not the refresh token. @Produce application/json @Tags sys @Security ApiKeyAuth @Success 202 {object} model.Result "a job began" @Success 200 {object} model.Result "a job already runs: data.already_running" @Failure 409 {object} model.Result "refused: data.error_code says why" @Router /sys/os/upgrade/plan [post]
func StartSystemOSUpgrade ¶ added in v0.4.74
@Summary start the upgrade of the operating system, or its rehearsal @Description Starts the unit that runs the blocks of the hop to the next release for the plan that the owner read: its plan_id, what they said stands between them and a machine that does not come back (safety_net: snapshot, console_and_backup or reinstall_ok), the name of the machine typed again (hostname), the removals and the sources put aside that they accepted (accept_removals, paused_sources, as the plan lists them) and the acknowledgements that the plan asks for (acks: no_interruption and no_way_back always, sources_paused when the plan puts sources aside, removals_read when it has removals to accept). With rehearsal true it runs only the half that can be undone, holds the sources of the next release for half an hour and puts the machine back; it needs neither safety_net nor no_way_back. The body is strict JSON with no field besides these. 202 with the status when the unit was started; 400 bad_request (data.data.field) for a body or a field that is not valid; 409 with data.error_code when it is refused (beta_off, not_root, identity_unsupported, hop_not_planned, run_open, manual_run_found, no_plan, plan_changed, plan_blocked, plan_older_than_refresh, bad_safety_net, hostname_mismatch, acks_missing, removals_mismatch, paused_mismatch, sources_changed, readiness_refuses, busy, apps_busy, no_room, runbook_unsafe, runbook_too_large); 500 start_failed when nothing could be started: no unit was started and no package was touched. The token goes in the Authorization header, and is not the refresh token. @Produce application/json @Accept application/json @Tags sys @Security ApiKeyAuth @Success 202 {object} model.Result "the unit was started: data is the status" @Failure 400 {object} model.Result "the body or a field is not valid: data.error_code is bad_request" @Failure 409 {object} model.Result "refused: data.error_code says why" @Failure 500 {object} model.Result "start_failed: no unit was started and no package was touched" @Router /sys/os/upgrade/start [post]
func StartSystemOSUpgradeRefresh ¶ added in v0.4.74
@Summary bring the old release up to its last state @Description Starts the unit that brings the release that the machine runs to its last state (apt-get update and apt-get dist-upgrade with the phased updates, removing nothing, with the sources that are not Debian's put aside and put back), which the plan is made after: a plan that was made before it is not good for a start. It has no point of no return: when it stops, the unit puts the sources and the timers back. It ends as refreshed, or as reboot_first when the machine wants a restart (the restart button is then valid). accept_releaseinfo_change, false when it is not said, is the owner's word that a repository whose release information changed (its Origin, Label or Codename: apt of Debian 11 takes a new Suite or Version without a word) is to be taken: a refresh that apt stopped for it is failed with failure.hint releaseinfo_change, and is asked again with it said. A download that got 404 from the security mirror of Debian 11 (security.debian.org, deb.debian.org or an alias) that the refresh did not move to archive.debian.org is failed with class network and failure.hint security_archive_gap. The body is strict JSON with no field besides that. 202 with the status when the unit was started; 400 bad_request (data.data.field) for a body or a field that is not valid; 409 with data.error_code when it is refused (beta_off, not_root, identity_unsupported, hop_not_planned, run_open, manual_run_found, readiness_refuses, busy, apps_busy, no_room, source_unrecognized with data.data.file and line, runbook_unsafe, runbook_too_large); 500 start_failed when nothing could be started: no unit was started and no package was touched. The token goes in the Authorization header, and is not the refresh token. @Produce application/json @Accept application/json @Tags sys @Security ApiKeyAuth @Success 202 {object} model.Result "the unit was started: data is the status" @Failure 400 {object} model.Result "the body or a field is not valid: data.error_code is bad_request" @Failure 409 {object} model.Result "refused: data.error_code says why" @Failure 500 {object} model.Result "start_failed: no unit was started and no package was touched" @Router /sys/os/upgrade/refresh [post]
func StartSystemPackageUpdate ¶
@Summary start operating system package updates @Produce application/json @Tags sys @Security ApiKeyAuth @Success 200 {object} model.Result @Router /sys/packages/update [post]
func SystemUpdate ¶
@Summary 系统信息 @Produce application/json @Accept application/json @Tags sys @Security ApiKeyAuth @Success 200 {string} string "ok" @Router /sys/update [post]
func UmountStorage ¶
func ZerotierProxy ¶
Types ¶
type CenterHandler ¶
type CenterHandler struct {
// contains filtered or unexported fields
}
type FsListResp ¶
type ObjResp ¶
type ObjResp struct {
Name string `json:"name"`
Size int64 `json:"size"`
IsDir bool `json:"is_dir"`
Modified time.Time `json:"modified"`
Sign string `json:"sign"`
Thumb string `json:"thumb"`
Type int `json:"type"`
Path string `json:"path"`
Date time.Time `json:"date"`
Extensions map[string]interface{} `json:"extensions"`
}
type SearchResp ¶ added in v0.4.123
SearchResp is the hits of a search of Files, and whether a limit stopped it early.