diff --git a/sdk/api-gateway-sdk/contracts.json b/sdk/api-gateway-sdk/contracts.json index 90dbbb5..f63fc4a 100644 --- a/sdk/api-gateway-sdk/contracts.json +++ b/sdk/api-gateway-sdk/contracts.json @@ -89,9 +89,105 @@ "name": "userShowValue", "type": "string[]", "description": "主名称 次名称" + }, + { + "name": "accessToken", + "type": "string", + "description": "SSO OAuth2 授权登录场景下,认证中心签发的令牌" } ] - } + }, + "examples": [ + { + "description": { + "en": "check login", + "zh": "判断用户是否登录" + }, + "request": { + "method": "GET", + "uri": "http://127.0.0.1:8107/api/auth/login" + }, + "response": { + "headers": { + "Content-Type": "application/json; charset=utf-8" + }, + "body": "{\n \"code\": 0,\n \"codeExplain\": \"\",\n \"error\": \"\",\n \"data\": {\n \"loggedIn\": true,\n \"username\": \"easyops\",\n \"org\": 8888,\n \"location\": \"\",\n \"userInstanceId\": \"5dc1e51810dc4\",\n \"loginFrom\": \"\",\n \"accessRule\": \"\",\n \"isAdmin\": true,\n \"csrfToken\": \"\",\n \"accessToken\": \"\",\n }\n}" + } + } + ] + }, + { + "contract": "api_gateway.auth.CheckLoginByName", + "category": { + "en": "auth", + "zh": "认证" + }, + "name": "CheckLoginByName", + "version": "1.2.0", + "description": "判断用户是否登录", + "endpoint": { + "method": "POST", + "uri": "/api/auth/user/check/login" + }, + "import": [], + "request": { + "type": "object", + "fields": [ + { + "name": "username", + "type": "user_name", + "description": "用户名" + }, + { + "name": "org", + "type": "org", + "description": "客户id" + } + ] + }, + "response": { + "type": "object", + "fields": [ + { + "name": "loggedIn", + "type": "bool", + "description": "是否已经登录" + }, + { + "name": "username", + "type": "user_name", + "description": "用户名" + }, + { + "name": "org", + "type": "org", + "description": "客户id" + }, + { + "name": "loginSession", + "type": "string", + "description": "登录Session" + } + ] + }, + "examples": [ + { + "description": { + "en": "check login by name", + "zh": "通过用户名是否登录" + }, + "request": { + "method": "POST", + "uri": "http://127.0.0.1:8107/api/auth/user/check/login" + }, + "response": { + "headers": { + "Content-Type": "application/json; charset=utf-8" + }, + "body": "{\n \"code\": 0,\n \"codeExplain\": \"\",\n \"error\": \"\",\n \"data\": {\n \"loggedIn\": true,\n \"username\": \"easyops\",\n \"org\": 8888\n }\n}" + } + } + ] }, { "contract": "api_gateway.auth.GetCaptcha", @@ -277,6 +373,22 @@ "name": "csrfToken", "type": "string", "description": "csrf_token,开启了csrf特性才返回值" + }, + { + "name": "changePasswordRequired", + "type": "bool", + "description": "是否需要修改密码(开启 check-password-security 特性时, 初次登录和密码过期时需要修改密码)" + }, + { + "name": "changePasswordReason", + "type": "string", + "enum": ["firstLogin", "expired"], + "description": "修改密码的具体原因(firstLogin:初次登录, expired:密码已过期)" + }, + { + "name": "passwordRemainingDays", + "type": "int", + "description": "密码有效期剩余时间(当 changePasswordRequired 为 true 时,这个值为 -1)" } ] }, @@ -301,7 +413,7 @@ "X-B3-Traceid": "8fffffffffffffff6c1e84cea8ce252c" }, "status_code": 200, - "body": "{\n \"code\": 0,\n \"codeExplain\": \"\",\n \"error\": \"\",\n \"data\": {\n \"loggedIn\": true,\n \"username\": \"easyops\",\n \"org\": 2988466,\n \"location\": \"\",\n \"userInstanceId\": \"5b1338f33ee9c\",\n \"loginFrom\": \"\",\n \"accessRule\": \"\",\n \"isAdmin\": true,\n \"csrfToken\": \"\"\n }\n}" + "body": "{\n \"code\": 0,\n \"codeExplain\": \"\",\n \"error\": \"\",\n \"data\": {\n \"loggedIn\": true,\n \"username\": \"easyops\",\n \"org\": 2988466,\n \"location\": \"\",\n \"userInstanceId\": \"5b1338f33ee9c\",\n \"loginFrom\": \"\",\n \"accessRule\": \"\",\n \"isAdmin\": true,\n \"csrfToken\": \"\",\n \"changePasswordRequired\": true,\n \"changePasswordReason\": \"firstLogin\",\n \"passwordRemainingDays\": 30,\n }\n}" } } ] @@ -613,6 +725,86 @@ } ] }, + { + "contract": "api_gateway.auth.SwitchOrg", + "category": { + "en": "auth", + "zh": "认证" + }, + "name": "SwitchOrg", + "version": "1.0.0", + "description": "多组织用户切换组织", + "endpoint": { + "method": "POST", + "uri": "/api/auth/login/switch_org" + }, + "request": { + "type": "object", + "fields": [ + { + "name": "org", + "type": "org", + "description": "切换到哪个组织 (具体是哪个用户切换组织,从 context 中获取 username)" + } + ], + "required": ["org"] + }, + "response": { + "type": "object", + "fields": [ + { + "name": "username", + "type": "user_name", + "description": "用户名" + }, + { + "name": "org", + "type": "org", + "description": "组织 org" + }, + { + "name": "userInstanceId", + "type": "instance_id", + "description": "用户 id" + }, + { + "name": "isAdmin", + "type": "bool", + "description": "判断当前登录用户是否是系统管理员" + }, + { + "name": "userShowValue", + "type": "string[]", + "description": "主名称 次名称" + } + ] + }, + "examples": [ + { + "description": { + "en": "SwitchOrg", + "zh": "多组织用户切换组织" + }, + "request": { + "method": "POST", + "uri": "http://localhost:8104/api/auth/login/switch", + "headers": { + "Content-Type": "application/json" + }, + "body": "{\n \"org\": 8888,\n}" + }, + "response": { + "headers": { + "Content-Type": "application/json; charset=utf-8", + "Set-Cookie": "PHPSESSID=VFMTWAJHYRCMUWODZMVGHPSMV4UXCDN4Q3OKODAQAQBZYTUH2QDA; Path=/; Expires=Tue, 28 Dec 2021 11:45:20 GMT; Max-Age=7200", + "X-B3-Traceid": "8fffffffffffffff6c1e84cea8ce252c" + }, + "status_code": 200, + "body": "{\n \"code\": 0,\n \"codeExplain\": \"\",\n \"error\": \"\",\n \"data\": {\n \"username\": \"easyops\",\n \"org\": 2988466,\n \"userInstanceId\": \"5b1338f33ee9c\",\n \"isAdmin\": true,\n \"userShowValue\": [],\n }\n}" + } + } + ] + }, { "contract": "api_gateway.auth.TokenLDAPLogin", "category": { @@ -928,6 +1120,46 @@ "type": "StoryBoard" } }, + { + "contract": "api_gateway.bootstrap_standalone.BatchDeleteBootstrapStandaloneCache", + "category": { + "en": "Bootstrap Standalone", + "zh": "独立部署Bootstrap" + }, + "name": "BatchDeleteBootstrapStandaloneCache", + "version": "1.0.0", + "description": "批量删除独立小产品主页缓存", + "endpoint": { + "method": "POST", + "uri": "/api/v1/bootstrap_standalone_cache/batch_delete" + }, + "request": { + "type": "object", + "fields": [ + { + "name": "homePage", + "type": "string[]", + "description": "主页" + } + ] + }, + "response": null, + "examples": [ + { + "description": { + "en": "Batch Delete bootstrap standalone home page cache", + "zh": "批量删除独立小产品主页缓存" + }, + "request": { + "method": "DELETE", + "uri": "http://127.0.0.1:8104/api/v1/bootstrap_standalone_cache/batch_delete" + }, + "response": { + "body": "{\n \"code\": 0,\n \"error\": \"\",\n \"message\": \"\",\n \"data\": null\n}" + } + } + ] + }, { "contract": "api_gateway.bootstrap_standalone.DeleteBootstrapStandaloneCache", "category": { @@ -1465,6 +1697,71 @@ ] } }, + { + "contract": "api_gateway.custom_auth_config.CreateBackendNode", + "name": "CreateBackendNode", + "version": "1.4.0", + "description": "创建后端节点", + "endpoint": { + "method": "POST", + "uri": "/api/v1/api_gateway/backend_node" + }, + "import": ["easyops/model/api_gateway/backend_node"], + "request": { + "type": "object", + "fields": [ + { + "name": "node", + "type": "BackendNode", + "description": "节点" + }, + { + "name": "serviceInstanceIds", + "type": "instance_id[]", + "description": "关联的服务ID列表" + } + ], + "required": [ + "node.ip", + "node.port", + "node.scheme", + "node.weight", + "node.enabled" + ] + }, + "response": { + "type": "object", + "fields": [ + { + "name": "id", + "type": "instance_id", + "description": "节点id" + } + ] + }, + "examples": [ + { + "description": { + "en": "CreateBackendNode", + "zh": "创建后端节点" + }, + "request": { + "method": "POST", + "uri": "http://127.0.0.1:8107/api/v1/api_gateway/backend_node", + "headers": { + "Content-Type": "application/json; charset=utf-8" + }, + "body": "{\n \"serviceInstanceIds\": [\"5aaec6de45fd6\"],\n \"node\": {\n \"ip\":\"172.30.0.90\",\n \"port\":8888,\n \"scheme\":\"http\",\n \"enabled\":true,\n \"weight\":100\n },\n}" + }, + "response": { + "headers": { + "Content-Type": "application/json; charset=utf-8" + }, + "body": "{\n \"code\": 0,\n \"codeExplain\": \"\",\n \"data\": {\n \"instanceId\": \"5aaec6de45fe7\" \n },\n \"error\": \"\"\n }\n}" + } + } + ] + }, { "contract": "api_gateway.custom_auth_config.CreateCustomAuthConfig", "name": "CreateCustomAuthConfig", @@ -1815,6 +2112,85 @@ } ] }, + { + "contract": "api_gateway.custom_auth_config.UpdateBackendNode", + "name": "UpdateBackendNode", + "version": "1.4.0", + "description": "更新后端节点", + "endpoint": { + "method": "PUT", + "uri": "/api/v1/api_gateway/backend_node" + }, + "import": ["easyops/model/api_gateway/backend_node"], + "request": { + "type": "object", + "fields": [ + { + "name": "node", + "type": "BackendNode", + "description": "节点" + }, + { + "name": "serviceOperation", + "type": "object[]", + "description": "解绑或者绑定服务", + "fields": [ + { + "name": "operate", + "type": "string", + "enum": ["append", "remove"], + "description": "绑定/解绑" + }, + { + "name": "instanceId", + "type": "instance_id", + "description": "服务实例id" + } + ] + } + ], + "required": [ + "node.ip", + "node.port", + "node.scheme", + "node.weight", + "node.enabled", + "node.instanceId" + ] + }, + "response": { + "type": "object", + "fields": [ + { + "name": "id", + "type": "instance_id", + "description": "节点id" + } + ] + }, + "examples": [ + { + "description": { + "en": "UpdateBackendNode", + "zh": "更新后端节点" + }, + "request": { + "method": "PUT", + "uri": "http://127.0.0.1:8107/api/v1/api_gateway/backend_node", + "headers": { + "Content-Type": "application/json; charset=utf-8" + }, + "body": "{\n \"serviceInstanceIds\": [\"5aaec6de45fd6\"],\n \"node\": {\n \"ip\":\"172.30.0.90\",\n \"port\":8888,\n \"scheme\":\"http\",\n \"enabled\":true,\n \"weight\":100\n },\n}" + }, + "response": { + "headers": { + "Content-Type": "application/json; charset=utf-8" + }, + "body": "{\n \"code\": 0,\n \"codeExplain\": \"\",\n \"data\": {\n \"instanceId\": \"5aaec6de45fe7\" \n },\n \"error\": \"\"\n }\n}" + } + } + ] + }, { "contract": "api_gateway.esb.EsbLogin", "name": "EsbLogin", @@ -2384,17 +2760,57 @@ { "contract": "api_gateway.sso.SSOAuthorizeRedirect", "name": "SSOAuthorizeRedirect", - "version": "1.0.0", + "version": "1.0.1", "description": "SSO访问令牌认证; SSO身份认证成功后认证服务将会携带 登录凭证 重定向至该接口", "detail": "该接口最后会直接重定向到easyops平台的/next/sso-auth/authorize页面,可以是GET请求也可以是POST请求", "endpoint": { "method": "POST", - "uri": "/api/v2/sso/authorization" + "uri": "/api/v2/sso/authorization/:protocol", + "ext_fields": [ + { + "name": "body", + "source": "body" + } + ] }, "request": { - "type": "value" + "type": "object", + "fields": [ + { + "name": "protocol", + "type": "string", + "description": "身份认证协议类型, 如OAuth2、cas等" + }, + { + "name": "body", + "type": "value", + "description": "认证参数" + } + ] }, - "response": null + "response": null, + "examples": [ + { + "description": { + "en": "SSOAuthorizeRedirect", + "zh": "sso 认证重定向接口" + }, + "request": { + "method": "POST", + "uri": "http://localhost:8107/api/v2/sso/authorization/oauth2", + "headers": { + "Content-Type": "application/json" + }, + "body": "{\n \"token\": \"5444212577\"\n}" + }, + "response": { + "headers": { + "Content-Type": "application/json; charset=utf-8" + }, + "body": "{\n \"code\": 0,\n \"error\": \"成功: Success\",\n \"message\": \"Success\",\n \"data\": null\n}" + } + } + ] }, { "contract": "api_gateway.sso.SSOLogin", @@ -2499,6 +2915,201 @@ ] } }, + { + "contract": "api_gateway.sso.ValidateAccessToken", + "name": "ValidateAccessToken", + "version": "1.0.0", + "description": "云盾平台子系统校验access token, 使用HEADER携带AccessToken", + "endpoint": { + "method": "POST", + "uri": "/api/v1/sso/auth/token/validate" + }, + "request": null, + "response": { + "type": "object", + "fields": [ + { + "name": "username", + "type": "string", + "description": "用户名" + }, + { + "name": "userId", + "type": "string", + "description": "用户ID" + }, + { + "name": "expired", + "type": "int", + "description": "access token过期时长" + }, + { + "name": "nickname", + "type": "string", + "description": "昵称" + } + ] + }, + "examples": [ + { + "description": { + "en": "ValidateAccessToken", + "zh": "云盾平台子系统校验access token, 使用HEADER携带AccessToken" + }, + "request": { + "method": "POST", + "uri": "http://localhost:8107/api/v1/sso/auth/token/validate", + "headers": { + "AccessToken": "UTQVYYK57WRALIPCZYO27XRTWWGLJ4CGA5RWL6N7MUNTWKYWOGFA" + } + }, + "response": { + "body": "{\n \"code\": 0,\n \"error\": \"\",\n \"codeExplain\": \"\",\n \"data\": {\n \"username\": \"demo\",\n \"userId\": \"xxx\",\n \"expired\": 7200,\n \"nickname\": \"\"\n }\n}" + } + } + ] + }, + { + "contract": "api_gateway.sso_server.OauthAccessToken", + "name": "OauthAccessToken", + "version": "1.0.0", + "description": "oauth2授权码模式,获取accessToken接口", + "endpoint": { + "method": "POST", + "uri": "/api/v1/api_gateway/sso_server/oauth2/access_token" + }, + "request": { + "type": "object", + "fields": [ + { + "name": "client_id", + "type": "string", + "description": "clientId", + "validate": { + "pattern": "^[0-9a-z]{20}$" + } + }, + { + "name": "client_secret", + "type": "string", + "description": "可信任的密钥凭证" + }, + { + "name": "redirect_uri", + "type": "url", + "description": "重定向uri" + }, + { + "name": "code", + "type": "string", + "description": "授权码,这里传拿到的授权码" + }, + { + "name": "grant_type", + "type": "string", + "description": "授权类型,这里是使用授权码,传authorization_code" + } + ], + "required": ["client_id", "redirect_uri", "grant_type", "code"] + }, + "response": { + "wrapper": false, + "type": "object", + "fields": [ + { + "name": "access_token", + "type": "string", + "description": "生成的accessToken" + }, + { + "name": "expires_in", + "type": "int64", + "description": "超时时间,单位秒" + }, + { + "name": "token_type", + "type": "string", + "description": "访问令牌的类型,通常值为 \"Bearer\"" + }, + { + "name": "scope", + "type": "string", + "description": "表示访问令牌的范围" + }, + { + "name": "refresh_token", + "type": "string", + "description": "refresh_token,这里先声明这个字段,暂不生成" + } + ] + }, + "examples": [ + { + "description": { + "en": "OauthAccessToken", + "zh": "oauth2授权码模式,获取accessToken接口" + }, + "request": { + "method": "POST", + "uri": "http://localhost:8107/api/v1/api_gateway/sso_server/oauth2/access_token", + "headers": { + "Content-Type": "application/json" + }, + "body": "{\n \"redirect_uri\": \"http://your_redirect_uri\",\n \"client_id\": \"your_client_id\",\n \"client_secret\": \"your_client_secret\",\n \"code\": \"your_authorization_code\",\n \"grant_type\": \"authorization_code\"\n}" + }, + "response": { + "headers": { + "Content-Type": "application/json; charset=utf-8" + }, + "body": "{\n \"access_token\": \"your_access_token\",\n \"token_type\": \"Bearer\",\n \"scope\": \"read\",\n \"expires_in\": 3600,\n \"refresh_token\": \"\"\n}" + } + } + ] + }, + { + "contract": "api_gateway.sso_server.OauthUserInfo", + "name": "OauthUserInfo", + "version": "1.0.0", + "description": "oauth2授权码模式,获取userInfo接口", + "endpoint": { + "method": "GET", + "uri": "/api/v1/api_gateway/sso_server/oauth2/user_info" + }, + "request": null, + "response": { + "wrapper": false, + "type": "object", + "fields": [ + { + "name": "sub", + "type": "string", + "description": "用户信息" + } + ] + }, + "examples": [ + { + "description": { + "en": "OauthUserInfo", + "zh": "oauth2授权码模式,获取userInfo接口" + }, + "request": { + "method": "GET", + "uri": "http://localhost:8107/api/v1/api_gateway/sso_server/oauth2/user_info", + "headers": { + "Content-Type": "application/json", + "Authorization": "Bearer {your_access_token}" + } + }, + "response": { + "headers": { + "Content-Type": "application/json; charset=utf-8" + }, + "body": "{\n \"sub\": \"user_id\"\n}" + } + } + ] + }, { "contract": "api_gateway.union_pay.UnionPayLogin", "name": "UnionPayLogin", diff --git a/sdk/api-gateway-sdk/src/api/api_gateway/auth/checkLogin.ts b/sdk/api-gateway-sdk/src/api/api_gateway/auth/checkLogin.ts index 0a24366..e80b3fa 100644 --- a/sdk/api-gateway-sdk/src/api/api_gateway/auth/checkLogin.ts +++ b/sdk/api-gateway-sdk/src/api/api_gateway/auth/checkLogin.ts @@ -34,6 +34,9 @@ export interface AuthApi_CheckLoginResponseBody { /** 主名称 次名称 */ userShowValue?: string[]; + + /** SSO OAuth2 授权登录场景下,认证中心签发的令牌 */ + accessToken?: string; } /** diff --git a/sdk/api-gateway-sdk/src/api/api_gateway/auth/checkLoginByName.ts b/sdk/api-gateway-sdk/src/api/api_gateway/auth/checkLoginByName.ts new file mode 100644 index 0000000..f47475c --- /dev/null +++ b/sdk/api-gateway-sdk/src/api/api_gateway/auth/checkLoginByName.ts @@ -0,0 +1,40 @@ +import { http, HttpOptions } from "@next-core/http"; +import { ResponseBodyWrapper } from "../../../wrapper.js"; + +export interface AuthApi_CheckLoginByNameRequestBody { + /** 用户名 */ + username?: string; + + /** 客户id */ + org?: number; +} + +export interface AuthApi_CheckLoginByNameResponseBody { + /** 是否已经登录 */ + loggedIn?: boolean; + + /** 用户名 */ + username?: string; + + /** 客户id */ + org?: number; + + /** 登录Session */ + loginSession?: string; +} + +/** + * @description 判断用户是否登录 + * @endpoint POST /api/auth/user/check/login + */ +export const AuthApi_checkLoginByName = async ( + data: AuthApi_CheckLoginByNameRequestBody, + options?: HttpOptions +): Promise => + /**! @contract easyops.api.api_gateway.auth.CheckLoginByName@1.2.0 */ ( + await http.post>( + "api/auth/user/check/login", + data, + options + ) + ).data; diff --git a/sdk/api-gateway-sdk/src/api/api_gateway/auth/index.ts b/sdk/api-gateway-sdk/src/api/api_gateway/auth/index.ts index b128f8f..afb4ce9 100644 --- a/sdk/api-gateway-sdk/src/api/api_gateway/auth/index.ts +++ b/sdk/api-gateway-sdk/src/api/api_gateway/auth/index.ts @@ -1,4 +1,5 @@ export * from "./checkLogin.js"; +export * from "./checkLoginByName.js"; export * from "./getCaptcha.js"; export * from "./ldapLogin.js"; export * from "./loginV2.js"; @@ -6,5 +7,6 @@ export * from "./logout.js"; export * from "./refreshToken.js"; export * from "./register.js"; export * from "./registerV2.js"; +export * from "./switchOrg.js"; export * from "./tokenLdapLogin.js"; export * from "./tokenLogin.js"; diff --git a/sdk/api-gateway-sdk/src/api/api_gateway/auth/loginV2.ts b/sdk/api-gateway-sdk/src/api/api_gateway/auth/loginV2.ts index 6b31d04..c23e2af 100644 --- a/sdk/api-gateway-sdk/src/api/api_gateway/auth/loginV2.ts +++ b/sdk/api-gateway-sdk/src/api/api_gateway/auth/loginV2.ts @@ -42,6 +42,15 @@ export interface AuthApi_LoginV2ResponseBody { /** csrf_token,开启了csrf特性才返回值 */ csrfToken?: string; + + /** 是否需要修改密码(开启 check-password-security 特性时, 初次登录和密码过期时需要修改密码) */ + changePasswordRequired?: boolean; + + /** 修改密码的具体原因(firstLogin:初次登录, expired:密码已过期) */ + changePasswordReason?: "firstLogin" | "expired"; + + /** 密码有效期剩余时间(当 changePasswordRequired 为 true 时,这个值为 -1) */ + passwordRemainingDays?: number; } /** diff --git a/sdk/api-gateway-sdk/src/api/api_gateway/auth/switchOrg.ts b/sdk/api-gateway-sdk/src/api/api_gateway/auth/switchOrg.ts new file mode 100644 index 0000000..d08a6e2 --- /dev/null +++ b/sdk/api-gateway-sdk/src/api/api_gateway/auth/switchOrg.ts @@ -0,0 +1,40 @@ +import { http, HttpOptions } from "@next-core/http"; +import { ResponseBodyWrapper } from "../../../wrapper.js"; + +export interface AuthApi_SwitchOrgRequestBody { + /** 切换到哪个组织 (具体是哪个用户切换组织,从 context 中获取 username) */ + org: number; +} + +export interface AuthApi_SwitchOrgResponseBody { + /** 用户名 */ + username?: string; + + /** 组织 org */ + org?: number; + + /** 用户 id */ + userInstanceId?: string; + + /** 判断当前登录用户是否是系统管理员 */ + isAdmin?: boolean; + + /** 主名称 次名称 */ + userShowValue?: string[]; +} + +/** + * @description 多组织用户切换组织 + * @endpoint POST /api/auth/login/switch_org + */ +export const AuthApi_switchOrg = async ( + data: AuthApi_SwitchOrgRequestBody, + options?: HttpOptions +): Promise => + /**! @contract easyops.api.api_gateway.auth.SwitchOrg@1.0.0 */ ( + await http.post>( + "api/auth/login/switch_org", + data, + options + ) + ).data; diff --git a/sdk/api-gateway-sdk/src/api/api_gateway/bootstrap_standalone/batchDeleteBootstrapStandaloneCache.ts b/sdk/api-gateway-sdk/src/api/api_gateway/bootstrap_standalone/batchDeleteBootstrapStandaloneCache.ts new file mode 100644 index 0000000..124112a --- /dev/null +++ b/sdk/api-gateway-sdk/src/api/api_gateway/bootstrap_standalone/batchDeleteBootstrapStandaloneCache.ts @@ -0,0 +1,20 @@ +import { http, HttpOptions } from "@next-core/http"; + +export interface BootstrapStandaloneApi_BatchDeleteBootstrapStandaloneCacheRequestBody { + /** 主页 */ + homePage?: string[]; +} + +/** + * @description 批量删除独立小产品主页缓存 + * @endpoint POST /api/v1/bootstrap_standalone_cache/batch_delete + */ +export const BootstrapStandaloneApi_batchDeleteBootstrapStandaloneCache = ( + data: BootstrapStandaloneApi_BatchDeleteBootstrapStandaloneCacheRequestBody, + options?: HttpOptions +): Promise => + /**! @contract easyops.api.api_gateway.bootstrap_standalone.BatchDeleteBootstrapStandaloneCache@1.0.0 */ http.post( + "api/v1/bootstrap_standalone_cache/batch_delete", + data, + options + ); diff --git a/sdk/api-gateway-sdk/src/api/api_gateway/bootstrap_standalone/index.ts b/sdk/api-gateway-sdk/src/api/api_gateway/bootstrap_standalone/index.ts index 8e28802..10b31fb 100644 --- a/sdk/api-gateway-sdk/src/api/api_gateway/bootstrap_standalone/index.ts +++ b/sdk/api-gateway-sdk/src/api/api_gateway/bootstrap_standalone/index.ts @@ -1,3 +1,4 @@ +export * from "./batchDeleteBootstrapStandaloneCache.js"; export * from "./deleteBootstrapStandaloneCache.js"; export * from "./deleteLaunchpadEtagCache.js"; export * from "./getBrandFavicon.js"; diff --git a/sdk/api-gateway-sdk/src/api/api_gateway/custom_auth_config/createBackendNode.ts b/sdk/api-gateway-sdk/src/api/api_gateway/custom_auth_config/createBackendNode.ts new file mode 100644 index 0000000..7568d67 --- /dev/null +++ b/sdk/api-gateway-sdk/src/api/api_gateway/custom_auth_config/createBackendNode.ts @@ -0,0 +1,30 @@ +import { http, HttpOptions } from "@next-core/http"; +import { ModelBackendNode } from "../../../model/api_gateway/index.js"; +import { ResponseBodyWrapper } from "../../../wrapper.js"; + +export interface CustomAuthConfigApi_CreateBackendNodeRequestBody { + /** 节点 */ + node?: Partial; + + /** 关联的服务ID列表 */ + serviceInstanceIds?: string[]; +} + +export interface CustomAuthConfigApi_CreateBackendNodeResponseBody { + /** 节点id */ + id?: string; +} + +/** + * @description 创建后端节点 + * @endpoint POST /api/v1/api_gateway/backend_node + */ +export const CustomAuthConfigApi_createBackendNode = async ( + data: CustomAuthConfigApi_CreateBackendNodeRequestBody, + options?: HttpOptions +): Promise => + /**! @contract easyops.api.api_gateway.custom_auth_config.CreateBackendNode@1.4.0 */ ( + await http.post< + ResponseBodyWrapper + >("api/v1/api_gateway/backend_node", data, options) + ).data; diff --git a/sdk/api-gateway-sdk/src/api/api_gateway/custom_auth_config/index.ts b/sdk/api-gateway-sdk/src/api/api_gateway/custom_auth_config/index.ts index 31cae3a..210c996 100644 --- a/sdk/api-gateway-sdk/src/api/api_gateway/custom_auth_config/index.ts +++ b/sdk/api-gateway-sdk/src/api/api_gateway/custom_auth_config/index.ts @@ -1,6 +1,8 @@ +export * from "./createBackendNode.js"; export * from "./createCustomAuthConfig.js"; export * from "./deleteCustomAuthConfig.js"; export * from "./getCustomAuthConfig.js"; export * from "./listCustomAuthConfig.js"; export * from "./oAuth2AccessTokenDebug.js"; export * from "./updateCustomAuthConfig.js"; +export * from "./updateBackendNode.js"; diff --git a/sdk/api-gateway-sdk/src/api/api_gateway/custom_auth_config/updateBackendNode.ts b/sdk/api-gateway-sdk/src/api/api_gateway/custom_auth_config/updateBackendNode.ts new file mode 100644 index 0000000..b261fda --- /dev/null +++ b/sdk/api-gateway-sdk/src/api/api_gateway/custom_auth_config/updateBackendNode.ts @@ -0,0 +1,38 @@ +import { http, HttpOptions } from "@next-core/http"; +import { ModelBackendNode } from "../../../model/api_gateway/index.js"; +import { ResponseBodyWrapper } from "../../../wrapper.js"; + +export interface CustomAuthConfigApi_UpdateBackendNodeRequestBody { + /** 节点 */ + node?: Partial; + + /** 解绑或者绑定服务 */ + serviceOperation?: CustomAuthConfigApi_UpdateBackendNodeRequestBody_serviceOperation_item[]; +} + +export interface CustomAuthConfigApi_UpdateBackendNodeResponseBody { + /** 节点id */ + id?: string; +} + +/** + * @description 更新后端节点 + * @endpoint PUT /api/v1/api_gateway/backend_node + */ +export const CustomAuthConfigApi_updateBackendNode = async ( + data: CustomAuthConfigApi_UpdateBackendNodeRequestBody, + options?: HttpOptions +): Promise => + /**! @contract easyops.api.api_gateway.custom_auth_config.UpdateBackendNode@1.4.0 */ ( + await http.put< + ResponseBodyWrapper + >("api/v1/api_gateway/backend_node", data, options) + ).data; + +export interface CustomAuthConfigApi_UpdateBackendNodeRequestBody_serviceOperation_item { + /** 绑定/解绑 */ + operate?: "append" | "remove"; + + /** 服务实例id */ + instanceId?: string; +} diff --git a/sdk/api-gateway-sdk/src/api/api_gateway/sso/index.ts b/sdk/api-gateway-sdk/src/api/api_gateway/sso/index.ts index 04b23ee..2a37662 100644 --- a/sdk/api-gateway-sdk/src/api/api_gateway/sso/index.ts +++ b/sdk/api-gateway-sdk/src/api/api_gateway/sso/index.ts @@ -6,3 +6,4 @@ export * from "./ssoAuthorizeRedirect.js"; export * from "./ssoLogin.js"; export * from "./ssoLogout.js"; export * from "./ssoLogoutV2.js"; +export * from "./validateAccessToken.js"; diff --git a/sdk/api-gateway-sdk/src/api/api_gateway/sso/ssoAuthorizeRedirect.ts b/sdk/api-gateway-sdk/src/api/api_gateway/sso/ssoAuthorizeRedirect.ts index 00ff681..a766526 100644 --- a/sdk/api-gateway-sdk/src/api/api_gateway/sso/ssoAuthorizeRedirect.ts +++ b/sdk/api-gateway-sdk/src/api/api_gateway/sso/ssoAuthorizeRedirect.ts @@ -1,17 +1,19 @@ import { http, HttpOptions } from "@next-core/http"; +/** 认证参数 */ export type SsoApi_SsoAuthorizeRedirectRequestBody = any; /** * @description SSO访问令牌认证; SSO身份认证成功后认证服务将会携带 登录凭证 重定向至该接口 (该接口最后会直接重定向到easyops平台的/next/sso-auth/authorize页面,可以是GET请求也可以是POST请求) - * @endpoint POST /api/v2/sso/authorization + * @endpoint POST /api/v2/sso/authorization/:protocol */ export const SsoApi_ssoAuthorizeRedirect = ( + protocol: string | number, data: SsoApi_SsoAuthorizeRedirectRequestBody, options?: HttpOptions ): Promise => - /**! @contract easyops.api.api_gateway.sso.SSOAuthorizeRedirect@1.0.0 */ http.post( - "api/v2/sso/authorization", + /**! @contract easyops.api.api_gateway.sso.SSOAuthorizeRedirect@1.0.1 */ http.post( + `api/v2/sso/authorization/${protocol}`, data, options ); diff --git a/sdk/api-gateway-sdk/src/api/api_gateway/sso/validateAccessToken.ts b/sdk/api-gateway-sdk/src/api/api_gateway/sso/validateAccessToken.ts new file mode 100644 index 0000000..acad71f --- /dev/null +++ b/sdk/api-gateway-sdk/src/api/api_gateway/sso/validateAccessToken.ts @@ -0,0 +1,29 @@ +import { http, HttpOptions } from "@next-core/http"; +import { ResponseBodyWrapper } from "../../../wrapper.js"; + +export interface SsoApi_ValidateAccessTokenResponseBody { + /** 用户名 */ + username?: string; + + /** 用户ID */ + userId?: string; + + /** access token过期时长 */ + expired?: number; + + /** 昵称 */ + nickname?: string; +} + +/** + * @description 云盾平台子系统校验access token, 使用HEADER携带AccessToken + * @endpoint POST /api/v1/sso/auth/token/validate + */ +export const SsoApi_validateAccessToken = async ( + options?: HttpOptions +): Promise => + /**! @contract easyops.api.api_gateway.sso.ValidateAccessToken@1.0.0 */ ( + await http.post< + ResponseBodyWrapper + >("api/v1/sso/auth/token/validate", undefined, options) + ).data; diff --git a/sdk/api-gateway-sdk/src/api/api_gateway/sso_server/index.ts b/sdk/api-gateway-sdk/src/api/api_gateway/sso_server/index.ts new file mode 100644 index 0000000..8092088 --- /dev/null +++ b/sdk/api-gateway-sdk/src/api/api_gateway/sso_server/index.ts @@ -0,0 +1,2 @@ +export * from "./oauthAccessToken.js"; +export * from "./oauthUserInfo.js"; diff --git a/sdk/api-gateway-sdk/src/api/api_gateway/sso_server/oauthAccessToken.ts b/sdk/api-gateway-sdk/src/api/api_gateway/sso_server/oauthAccessToken.ts new file mode 100644 index 0000000..654c45d --- /dev/null +++ b/sdk/api-gateway-sdk/src/api/api_gateway/sso_server/oauthAccessToken.ts @@ -0,0 +1,49 @@ +import { http, HttpOptions } from "@next-core/http"; + +export interface SsoServerApi_OauthAccessTokenRequestBody { + /** clientId */ + client_id: string; + + /** 可信任的密钥凭证 */ + client_secret?: string; + + /** 重定向uri */ + redirect_uri: string; + + /** 授权码,这里传拿到的授权码 */ + code: string; + + /** 授权类型,这里是使用授权码,传authorization_code */ + grant_type: string; +} + +export interface SsoServerApi_OauthAccessTokenResponseBody { + /** 生成的accessToken */ + access_token?: string; + + /** 超时时间,单位秒 */ + expires_in?: number; + + /** 访问令牌的类型,通常值为 "Bearer" */ + token_type?: string; + + /** 表示访问令牌的范围 */ + scope?: string; + + /** refresh_token,这里先声明这个字段,暂不生成 */ + refresh_token?: string; +} + +/** + * @description oauth2授权码模式,获取accessToken接口 + * @endpoint POST /api/v1/api_gateway/sso_server/oauth2/access_token + */ +export const SsoServerApi_oauthAccessToken = ( + data: SsoServerApi_OauthAccessTokenRequestBody, + options?: HttpOptions +): Promise => + /**! @contract easyops.api.api_gateway.sso_server.OauthAccessToken@1.0.0 */ http.post( + "api/v1/api_gateway/sso_server/oauth2/access_token", + data, + options + ); diff --git a/sdk/api-gateway-sdk/src/api/api_gateway/sso_server/oauthUserInfo.ts b/sdk/api-gateway-sdk/src/api/api_gateway/sso_server/oauthUserInfo.ts new file mode 100644 index 0000000..a6ee8ec --- /dev/null +++ b/sdk/api-gateway-sdk/src/api/api_gateway/sso_server/oauthUserInfo.ts @@ -0,0 +1,18 @@ +import { http, HttpOptions } from "@next-core/http"; + +export interface SsoServerApi_OauthUserInfoResponseBody { + /** 用户信息 */ + sub?: string; +} + +/** + * @description oauth2授权码模式,获取userInfo接口 + * @endpoint GET /api/v1/api_gateway/sso_server/oauth2/user_info + */ +export const SsoServerApi_oauthUserInfo = ( + options?: HttpOptions +): Promise => + /**! @contract easyops.api.api_gateway.sso_server.OauthUserInfo@1.0.0 */ http.get( + "api/v1/api_gateway/sso_server/oauth2/user_info", + options + ); diff --git a/sdk/api-gateway-sdk/src/index.ts b/sdk/api-gateway-sdk/src/index.ts index aa67cc8..fe2059e 100644 --- a/sdk/api-gateway-sdk/src/index.ts +++ b/sdk/api-gateway-sdk/src/index.ts @@ -9,6 +9,7 @@ export * from "./api/api_gateway/mfa/index.js"; export * from "./api/api_gateway/oauth/index.js"; export * from "./api/api_gateway/org/index.js"; export * from "./api/api_gateway/sso/index.js"; +export * from "./api/api_gateway/sso_server/index.js"; export * from "./api/api_gateway/union_pay/index.js"; export * from "./api/api_gateway/walmart/index.js"; export * from "./api/api_gateway/wechat/index.js"; diff --git a/sdk/api-gateway-sdk/src/model/api_gateway/ModelBackendNode.ts b/sdk/api-gateway-sdk/src/model/api_gateway/ModelBackendNode.ts new file mode 100644 index 0000000..62eddb4 --- /dev/null +++ b/sdk/api-gateway-sdk/src/model/api_gateway/ModelBackendNode.ts @@ -0,0 +1,20 @@ +/** 后端节点 */ +export interface ModelBackendNode { + /** 实例ID */ + instanceId: string; + + /** ip/host */ + ip: string; + + /** port */ + port: number; + + /** 协议 */ + scheme: "http" | "https"; + + /** 是否启用 */ + enabled: boolean; + + /** 权重 */ + weight: number; +} diff --git a/sdk/api-gateway-sdk/src/model/api_gateway/index.ts b/sdk/api-gateway-sdk/src/model/api_gateway/index.ts index fc149b6..3d415d5 100644 --- a/sdk/api-gateway-sdk/src/model/api_gateway/index.ts +++ b/sdk/api-gateway-sdk/src/model/api_gateway/index.ts @@ -3,6 +3,7 @@ export * from "./ModelStoryBoard.js"; export * from "./ModelDesktopItem.js"; export * from "./ModelDesktop.js"; export * from "./ModelSiteMap.js"; +export * from "./ModelBackendNode.js"; export * from "./ModelCustomAuthConfigBasicAuth.js"; export * from "./ModelCustomAuthConfigApiKey.js"; export * from "./ModelCustomAuthConfigOAuth2.js"; diff --git a/sdk/api-gateway-sdk/src/model/micro_app/ModelInstalledMicroApp.ts b/sdk/api-gateway-sdk/src/model/micro_app/ModelInstalledMicroApp.ts index 3e6e344..d56ae13 100644 --- a/sdk/api-gateway-sdk/src/model/micro_app/ModelInstalledMicroApp.ts +++ b/sdk/api-gateway-sdk/src/model/micro_app/ModelInstalledMicroApp.ts @@ -111,6 +111,9 @@ export interface ModelInstalledMicroApp { /** 使用主题 */ theme: string; + /** UI版本 */ + uiVersion: string; + /** 微应用在容器中的排序 */ position: number; @@ -122,6 +125,18 @@ export interface ModelInstalledMicroApp { /** 是否独立部署 */ standaloneMode: boolean; + + /** 定时触发的工作流信息 */ + periodicWorkflowInfo: ModelInstalledMicroApp_periodicWorkflowInfo_item[]; + + /** 数据变更触发的工作流信息 */ + dataChangedWorkflowInfo: ModelInstalledMicroApp_dataChangedWorkflowInfo_item[]; + + /** 应用描述 */ + description: string; + + /** 应用作者 */ + author: string[]; } export interface ModelInstalledMicroApp_defaultContainer { @@ -137,3 +152,19 @@ export interface ModelInstalledMicroApp_defaultContainer { /** 排序 */ order?: number; } + +export interface ModelInstalledMicroApp_periodicWorkflowInfo_item { + /** 工作流id */ + workflowId?: string; + + /** 定时任务id */ + taskId?: string; +} + +export interface ModelInstalledMicroApp_dataChangedWorkflowInfo_item { + /** 工作流id */ + workflowId?: string; + + /** 订阅任务id */ + subscriptionId?: string; +} diff --git a/sdk/api-gateway-sdk/src/model/micro_app_standalone/ModelLaunchpadDesktop.ts b/sdk/api-gateway-sdk/src/model/micro_app_standalone/ModelLaunchpadDesktop.ts index 4d9dd3f..3d063d0 100644 --- a/sdk/api-gateway-sdk/src/model/micro_app_standalone/ModelLaunchpadDesktop.ts +++ b/sdk/api-gateway-sdk/src/model/micro_app_standalone/ModelLaunchpadDesktop.ts @@ -2,9 +2,15 @@ import { ModelLaunchpadDesktopItem } from "./index.js"; /** Launchpad桌面容器 */ export interface ModelLaunchpadDesktop { + /** 实例Id */ + instanceId: string; + /** 桌面名称 */ name: string; + /** 容器Id */ + id: string; + /** 排序 */ order: number; diff --git a/sdk/api-gateway-sdk/src/model/micro_app_standalone/ModelLaunchpadDesktopItem.ts b/sdk/api-gateway-sdk/src/model/micro_app_standalone/ModelLaunchpadDesktopItem.ts index f51dbfa..be7f9c0 100644 --- a/sdk/api-gateway-sdk/src/model/micro_app_standalone/ModelLaunchpadDesktopItem.ts +++ b/sdk/api-gateway-sdk/src/model/micro_app_standalone/ModelLaunchpadDesktopItem.ts @@ -1,20 +1,31 @@ +import { ModelInstalledMicroAppMenuIcon } from "../micro_app/index.js"; + /** Launchpad桌面元素 */ export interface ModelLaunchpadDesktopItem { + /** 实例ID */ + instanceId: string; + /** 元素类型 */ - type: "app" | "dir"; + type: "app" | "dir" | "custom"; - /** 小产品id */ + /** dir/app/custom id */ id: string; - /** dir/custom名称 */ + /** dir/app/custom 名称 */ name: string; - /** custom_item.url */ + /** custom url */ url: string; + /** 菜单中显示的图标 */ + menuIcon: Partial; + /** 元素位置 */ position: number; /** 小产品列表(type为dir时有效) */ items: Partial[]; + + /** locales(type为app时有效) */ + locales: Record; } diff --git a/sdk/api-gateway-sdk/src/model/micro_app_standalone/ModelLaunchpadStoryboard.ts b/sdk/api-gateway-sdk/src/model/micro_app_standalone/ModelLaunchpadStoryboard.ts index 5790523..60d40fd 100644 --- a/sdk/api-gateway-sdk/src/model/micro_app_standalone/ModelLaunchpadStoryboard.ts +++ b/sdk/api-gateway-sdk/src/model/micro_app_standalone/ModelLaunchpadStoryboard.ts @@ -10,6 +10,9 @@ export interface ModelLaunchpadStoryboard { } export interface ModelLaunchpadStoryboard_app { + /** 实例Id */ + instanceId?: string; + /** 小产品id */ id?: string;