{ "swagger": "2.0", "info": { "description": "Liaison Swagger API", "title": "Liaison Swagger API", "contact": { "name": "Austin Zhai", "email": "singchia@163.com" }, "license": { "name": "Apache 2.0", "url": "http://www.apache.org/licenses/LICENSE-2.0.html" }, "version": "1.0" }, "paths": { "/api/v1/applications": { "get": { "tags": [ "1.0" ], "summary": "ListApplications", "parameters": [ { "type": "string", "name": "application_name", "in": "query" }, { "type": "integer", "name": "device_id", "in": "query" }, { "type": "string", "name": "device_name", "in": "query" }, { "type": "integer", "name": "page", "in": "query" }, { "type": "integer", "name": "page_size", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/v1.ListApplicationsResponse" } } } }, "post": { "tags": [ "1.0" ], "summary": "CreateApplication", "parameters": [ { "type": "string", "name": "application_type", "in": "query" }, { "type": "integer", "name": "device_id", "in": "query" }, { "type": "integer", "name": "edge_id", "in": "query" }, { "type": "string", "name": "ip", "in": "query" }, { "type": "string", "name": "name", "in": "query" }, { "type": "integer", "name": "port", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/v1.CreateApplicationResponse" } } } } }, "/api/v1/applications/{id}": { "put": { "tags": [ "1.0" ], "summary": "UpdateApplication", "parameters": [ { "type": "integer", "description": "application id", "name": "id", "in": "path", "required": true }, { "type": "integer", "name": "id", "in": "query" }, { "type": "string", "name": "name", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/v1.UpdateApplicationResponse" } } } }, "delete": { "tags": [ "1.0" ], "summary": "DeleteApplication", "parameters": [ { "type": "integer", "description": "application id", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/v1.DeleteApplicationResponse" } } } } }, "/api/v1/devices": { "get": { "tags": [ "1.0" ], "summary": "ListDevices", "parameters": [ { "type": "string", "description": "IP搜索", "name": "ip", "in": "query" }, { "type": "string", "description": "设备名", "name": "name", "in": "query" }, { "type": "integer", "description": "页码", "name": "page", "in": "query" }, { "type": "integer", "description": "每页数量", "name": "page_size", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/v1.ListDevicesResponse" } } } } }, "/api/v1/devices/{id}": { "get": { "tags": [ "1.0" ], "summary": "GetDevice", "parameters": [ { "type": "integer", "description": "device id", "name": "id", "in": "path", "required": true }, { "type": "integer", "description": "设备ID", "name": "id", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/v1.GetDeviceResponse" } } } }, "put": { "tags": [ "1.0" ], "summary": "UpdateDevice", "parameters": [ { "type": "integer", "description": "device id", "name": "id", "in": "path", "required": true }, { "type": "string", "description": "描述", "name": "description", "in": "query" }, { "type": "integer", "description": "设备ID", "name": "id", "in": "query" }, { "type": "string", "description": "名称", "name": "name", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/v1.UpdateDeviceResponse" } } } } }, "/api/v1/edges": { "get": { "tags": [ "1.0" ], "summary": "ListEdges", "parameters": [ { "type": "string", "name": "device_name", "in": "query" }, { "type": "integer", "name": "page", "in": "query" }, { "type": "integer", "name": "page_size", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/v1.ListEdgesResponse" } } } }, "post": { "tags": [ "1.0" ], "summary": "CreateEdge", "parameters": [ { "type": "string", "description": "描述", "name": "description", "in": "query" }, { "type": "string", "description": "名称", "name": "name", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/v1.CreateEdgeResponse" } } } } }, "/api/v1/edges/{edge_id}/scan_application_tasks": { "get": { "tags": [ "1.0" ], "summary": "GetEdgeScanApplicationTask", "parameters": [ { "type": "integer", "name": "edge_id", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/v1.GetEdgeScanApplicationTaskResponse" } } } }, "post": { "tags": [ "1.0" ], "summary": "CreateEdgeScanApplicationTask", "parameters": [ { "type": "integer", "name": "edge_id", "in": "query" }, { "type": "integer", "name": "port", "in": "query" }, { "type": "string", "name": "protocol", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/v1.CreateEdgeScanApplicationTaskResponse" } } } } }, "/api/v1/edges/{id}": { "get": { "tags": [ "1.0" ], "summary": "GetEdge", "parameters": [ { "type": "integer", "description": "edge id", "name": "id", "in": "path", "required": true }, { "type": "integer", "name": "id", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/v1.GetEdgeResponse" } } } }, "put": { "tags": [ "1.0" ], "summary": "UpdateEdge", "parameters": [ { "type": "integer", "description": "edge id", "name": "id", "in": "path", "required": true }, { "type": "string", "name": "description", "in": "query" }, { "type": "integer", "name": "id", "in": "query" }, { "type": "string", "name": "name", "in": "query" }, { "type": "integer", "description": "1: running, 2: stopped", "name": "status", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/v1.UpdateEdgeResponse" } } } }, "delete": { "tags": [ "1.0" ], "summary": "DeleteEdge", "parameters": [ { "type": "integer", "description": "edge id", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/v1.DeleteEdgeResponse" } } } } }, "/api/v1/iam/login": { "post": { "tags": [ "IAM" ], "summary": "Login", "parameters": [ { "description": "登录请求", "name": "params", "in": "body", "required": true, "schema": { "$ref": "#/definitions/v1.LoginRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/v1.LoginResponse" } } } } }, "/api/v1/iam/logout": { "post": { "tags": [ "IAM" ], "summary": "Logout", "parameters": [ { "description": "登出请求", "name": "params", "in": "body", "required": true, "schema": { "$ref": "#/definitions/v1.LogoutRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/v1.LogoutResponse" } } } } }, "/api/v1/iam/password": { "post": { "tags": [ "IAM" ], "summary": "ChangePassword", "parameters": [ { "description": "修改密码请求", "name": "params", "in": "body", "required": true, "schema": { "$ref": "#/definitions/v1.ChangePasswordRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/v1.ChangePasswordResponse" } } } } }, "/api/v1/iam/profile": { "get": { "tags": [ "IAM" ], "summary": "GetProfile", "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/v1.GetProfileResponse" } } } } }, "/api/v1/proxies": { "get": { "tags": [ "1.0" ], "summary": "ListProxies", "parameters": [ { "type": "integer", "name": "page", "in": "query" }, { "type": "integer", "name": "page_size", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/v1.ListProxiesResponse" } } } }, "post": { "tags": [ "1.0" ], "summary": "CreateProxy", "parameters": [ { "type": "integer", "name": "application_id", "in": "query" }, { "type": "string", "name": "description", "in": "query" }, { "type": "string", "name": "name", "in": "query" }, { "type": "integer", "name": "port", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/v1.CreateProxyResponse" } } } } }, "/api/v1/proxies/{id}": { "put": { "tags": [ "1.0" ], "summary": "UpdateProxy", "parameters": [ { "type": "integer", "description": "proxy id", "name": "id", "in": "path", "required": true }, { "type": "string", "name": "description", "in": "query" }, { "type": "integer", "name": "id", "in": "query" }, { "type": "string", "name": "name", "in": "query" }, { "type": "integer", "name": "port", "in": "query" }, { "type": "string", "name": "status", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/v1.UpdateProxyResponse" } } } }, "delete": { "tags": [ "1.0" ], "summary": "DeleteProxy", "parameters": [ { "type": "integer", "description": "proxy id", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/v1.DeleteProxyResponse" } } } } } }, "definitions": { "v1.AccessKey": { "type": "object", "properties": { "access_key": { "description": "连接器Access Key", "type": "string" }, "command": { "description": "连接器安装命令: `curl -LsSf https://liaison.cc/install.sh | bash`", "type": "string" }, "secret_key": { "description": "连接器Secret Key", "type": "string" } } }, "v1.Application": { "type": "object", "properties": { "application_type": { "description": "应用类型", "type": "string" }, "created_at": { "description": "创建时间", "type": "string" }, "device": { "description": "所属设备", "allOf": [ { "$ref": "#/definitions/v1.Device" } ] }, "edge_id": { "description": "边缘ID", "type": "integer" }, "id": { "description": "应用ID", "type": "integer" }, "ip": { "description": "内网IP地址", "type": "string" }, "name": { "description": "名称", "type": "string" }, "port": { "description": "端口", "type": "integer" }, "proxy": { "description": "关联Proxy", "allOf": [ { "$ref": "#/definitions/v1.Proxy" } ] }, "updated_at": { "description": "更新时间", "type": "string" } } }, "v1.Applications": { "type": "object", "properties": { "applications": { "type": "array", "items": { "$ref": "#/definitions/v1.Application" } }, "total": { "type": "integer" } } }, "v1.ChangePasswordRequest": { "type": "object", "properties": { "new_password": { "description": "新密码", "type": "string" }, "old_password": { "description": "旧密码", "type": "string" } } }, "v1.ChangePasswordResponse": { "type": "object", "properties": { "code": { "type": "integer" }, "message": { "type": "string" } } }, "v1.CreateApplicationResponse": { "type": "object", "properties": { "code": { "type": "integer" }, "message": { "type": "string" } } }, "v1.CreateEdgeResponse": { "type": "object", "properties": { "code": { "type": "integer" }, "data": { "$ref": "#/definitions/v1.AccessKey" }, "message": { "type": "string" } } }, "v1.CreateEdgeScanApplicationTaskResponse": { "type": "object", "properties": { "code": { "type": "integer" }, "message": { "type": "string" } } }, "v1.CreateProxyResponse": { "type": "object", "properties": { "code": { "type": "integer" }, "data": { "$ref": "#/definitions/v1.Proxy" }, "message": { "type": "string" } } }, "v1.DeleteApplicationResponse": { "type": "object", "properties": { "code": { "type": "integer" }, "message": { "type": "string" } } }, "v1.DeleteEdgeResponse": { "type": "object", "properties": { "code": { "type": "integer" }, "message": { "type": "string" } } }, "v1.DeleteProxyResponse": { "type": "object", "properties": { "code": { "type": "integer" }, "message": { "type": "string" } } }, "v1.Device": { "type": "object", "properties": { "cpu": { "description": "核心数", "type": "integer" }, "created_at": { "description": "创建时间", "type": "string" }, "description": { "type": "string" }, "disk": { "description": "磁盘,MB", "type": "integer" }, "id": { "type": "integer" }, "interfaces": { "description": "网卡", "type": "array", "items": { "$ref": "#/definitions/v1.EthernetInterface" } }, "memory": { "description": "内存,MB", "type": "integer" }, "name": { "description": "名称", "type": "string" }, "os": { "description": "操作系统", "type": "string" }, "updated_at": { "description": "更新时间", "type": "string" }, "version": { "description": "系统版本", "type": "string" } } }, "v1.Devices": { "type": "object", "properties": { "devices": { "description": "分页数", "type": "array", "items": { "$ref": "#/definitions/v1.Device" } }, "total": { "description": "总数", "type": "integer" } } }, "v1.Edge": { "type": "object", "properties": { "created_at": { "description": "创建时间", "type": "string" }, "description": { "description": "描述", "type": "string" }, "device": { "description": "所在设备", "allOf": [ { "$ref": "#/definitions/v1.Device" } ] }, "id": { "type": "integer" }, "name": { "description": "名称", "type": "string" }, "online": { "description": "1. online 在线, 2. offline 离线", "type": "integer" }, "status": { "description": "1. running 运行中, 2. stopped 停止", "type": "integer" }, "updated_at": { "description": "更新时间", "type": "string" } } }, "v1.EdgeScanApplicationTask": { "type": "object", "properties": { "applications": { "type": "array", "items": { "type": "string" } }, "created_at": { "type": "string" }, "edge_id": { "type": "integer" }, "error": { "type": "string" }, "id": { "type": "integer" }, "task_status": { "type": "string" }, "updated_at": { "type": "string" } } }, "v1.Edges": { "type": "object", "properties": { "edges": { "description": "连接器列表", "type": "array", "items": { "$ref": "#/definitions/v1.Edge" } }, "total": { "description": "总数", "type": "integer" } } }, "v1.EthernetInterface": { "type": "object", "properties": { "ip": { "description": "网卡IP地址,带掩码", "type": "array", "items": { "type": "string" } }, "mac": { "description": "网卡MAC地址", "type": "string" }, "name": { "description": "网卡名", "type": "string" } } }, "v1.GetDeviceResponse": { "type": "object", "properties": { "code": { "description": "状态码", "type": "integer" }, "data": { "description": "设备", "allOf": [ { "$ref": "#/definitions/v1.Device" } ] }, "message": { "description": "消息", "type": "string" } } }, "v1.GetEdgeResponse": { "type": "object", "properties": { "code": { "type": "integer" }, "data": { "$ref": "#/definitions/v1.Edge" }, "message": { "type": "string" } } }, "v1.GetEdgeScanApplicationTaskResponse": { "type": "object", "properties": { "code": { "type": "integer" }, "data": { "$ref": "#/definitions/v1.EdgeScanApplicationTask" }, "message": { "type": "string" } } }, "v1.GetProfileResponse": { "type": "object", "properties": { "code": { "type": "integer" }, "data": { "$ref": "#/definitions/v1.User" }, "message": { "type": "string" } } }, "v1.ListApplicationsResponse": { "type": "object", "properties": { "code": { "type": "integer" }, "data": { "$ref": "#/definitions/v1.Applications" }, "message": { "type": "string" } } }, "v1.ListDevicesResponse": { "type": "object", "properties": { "code": { "description": "状态码", "type": "integer" }, "data": { "description": "设备列表", "allOf": [ { "$ref": "#/definitions/v1.Devices" } ] }, "message": { "description": "消息", "type": "string" } } }, "v1.ListEdgesResponse": { "type": "object", "properties": { "code": { "type": "integer" }, "data": { "$ref": "#/definitions/v1.Edges" }, "message": { "type": "string" } } }, "v1.ListProxiesResponse": { "type": "object", "properties": { "code": { "type": "integer" }, "data": { "$ref": "#/definitions/v1.Proxies" }, "message": { "type": "string" } } }, "v1.LoginData": { "type": "object", "properties": { "token": { "type": "string" }, "user": { "$ref": "#/definitions/v1.User" } } }, "v1.LoginRequest": { "type": "object", "properties": { "email": { "type": "string" }, "password": { "type": "string" } } }, "v1.LoginResponse": { "type": "object", "properties": { "code": { "type": "integer" }, "data": { "$ref": "#/definitions/v1.LoginData" }, "message": { "type": "string" } } }, "v1.LogoutRequest": { "type": "object" }, "v1.LogoutResponse": { "type": "object", "properties": { "code": { "type": "integer" }, "message": { "type": "string" } } }, "v1.Proxies": { "type": "object", "properties": { "proxies": { "type": "array", "items": { "$ref": "#/definitions/v1.Proxy" } }, "total": { "type": "integer" } } }, "v1.Proxy": { "type": "object", "properties": { "application": { "$ref": "#/definitions/v1.Application" }, "created_at": { "type": "string" }, "description": { "type": "string" }, "id": { "type": "integer" }, "name": { "type": "string" }, "port": { "type": "integer" }, "status": { "type": "string" }, "updated_at": { "type": "string" } } }, "v1.UpdateApplicationResponse": { "type": "object", "properties": { "code": { "type": "integer" }, "data": { "$ref": "#/definitions/v1.Application" }, "message": { "type": "string" } } }, "v1.UpdateDeviceResponse": { "type": "object", "properties": { "code": { "description": "状态码", "type": "integer" }, "data": { "description": "设备", "allOf": [ { "$ref": "#/definitions/v1.Device" } ] }, "message": { "description": "消息", "type": "string" } } }, "v1.UpdateEdgeResponse": { "type": "object", "properties": { "code": { "type": "integer" }, "data": { "$ref": "#/definitions/v1.Edge" }, "message": { "type": "string" } } }, "v1.UpdateProxyResponse": { "type": "object", "properties": { "code": { "type": "integer" }, "data": { "$ref": "#/definitions/v1.Proxy" }, "message": { "type": "string" } } }, "v1.User": { "type": "object", "properties": { "created_at": { "description": "注册时间", "type": "string" }, "email": { "type": "string" }, "id": { "type": "integer" }, "last_login": { "description": "最后登录时间", "type": "string" }, "login_ip": { "description": "登录IP", "type": "string" } } } } }