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 ¶
- 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 DeleteOperateFileOrDir(ctx echo.Context) error
- func DeleteSambaConnections(ctx echo.Context) error
- func DeleteSambaShares(ctx echo.Context) error
- func DeleteSambaUser(ctx echo.Context) error
- func DirPath(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 GetFileCount(ctx echo.Context) error
- func GetFileImage(ctx echo.Context) error
- func GetFileUpload(ctx echo.Context) error
- func GetFilerContent(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 GetSize(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 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 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 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 PostSshLogin(ctx echo.Context) error
- func PostSystemStatusNotify(ctx echo.Context) error
- func PutAlerts(ctx echo.Context) error
- func PutAutoUpdate(ctx echo.Context) error
- func PutCasaOSPort(ctx echo.Context) error
- func PutFileContent(ctx echo.Context) error
- func PutNotifyRead(ctx echo.Context) error
- func PutSambaShare(ctx echo.Context) error
- func PutSambaUserPassword(ctx echo.Context) error
- func PutSystemState(ctx echo.Context) error
- func PutTelemetry(ctx echo.Context) error
- func RebootSystemOSUpgrade(ctx echo.Context) error
- func RemoveSystemModule(ctx echo.Context) error
- func RenamePath(ctx echo.Context) error
- func ResumeSystemOSUpgrade(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
Constants ¶
This section is empty.
Variables ¶
This section is empty.
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"]" @Success 200 {string} string "ok" @Router /file/delete [delete]
func DeleteOperateFileOrDir ¶
func DeleteSambaConnections ¶
func DeleteSambaShares ¶
func DeleteSambaUser ¶
DeleteSambaUser removes a share account, refusing while any share still names it. Removing it anyway would leave those shares listing 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 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 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 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 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 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 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 or remove, 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 or rollback_incomplete for an install 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. @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 ¶
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 InstallSystemModule ¶ added in v0.4.75
@Summary install a module @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-..."}, with no field besides it. 202 with the status (data.job.kind is install 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, disk_short, disk_unknown, apt_missing, apt_failed, apt_removes, apt_downgrades, held_package, package_not_exact, with data.data.checks); 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 PlanSystemModule ¶ added in v0.4.75
@Summary the plan of installing a module: 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 checks in their order (catalogue, os, arch, recasaos, already_installed, foreign_unit, busy, disk, apt, each with code, ok and detail), 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 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) for a name that is not a module's; 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 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 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 PutCasaOSPort ¶
@Summary edit casaos server port @Produce application/json @Accept application/json @Tags sys @Security ApiKeyAuth @Param port json string true "port" @Success 200 {string} string "ok" @Router /sys/port [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 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 moves an existing share between guest access and a named account, in either direction, and turns its Time Machine flag on or off. An empty username makes it a guest share again.
The body replaces both fields, so a client that omits time_machine clears it.
Only the shared directory itself is re-owned, never its contents. A media share can hold millions of files and walking them inside an HTTP request is not something a NAS should be asked to do. It is not needed either: 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.
func PutSambaUserPassword ¶
PutSambaUserPassword replaces the password of an existing share account.
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 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 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 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. 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"`
}