From 3bc46b42534960d947c61a127f0fd708b69b57d0 Mon Sep 17 00:00:00 2001 From: HUAHUAI23 Date: Fri, 14 Feb 2025 10:02:45 +0000 Subject: [PATCH 1/2] chore(add amdin real name info query) --- .../pkg/database/cockroach/accountv2.go | 6 ++ service/account/api/admin.go | 55 +++++++++++++++++++ service/account/dao/interface.go | 16 +++--- service/account/helper/common.go | 1 + service/account/router/router.go | 1 + 5 files changed, 70 insertions(+), 9 deletions(-) diff --git a/controllers/pkg/database/cockroach/accountv2.go b/controllers/pkg/database/cockroach/accountv2.go index 92b6065e89f..ca9e40a0edf 100644 --- a/controllers/pkg/database/cockroach/accountv2.go +++ b/controllers/pkg/database/cockroach/accountv2.go @@ -1184,6 +1184,9 @@ func (c *Cockroach) GetUserRealNameInfoByUserID(userID string) (*types.UserRealN // get user realname info var userRealNameInfo types.UserRealNameInfo if err := c.DB.Where(&types.UserRealNameInfo{UserUID: user.UserUID}).First(&userRealNameInfo).Error; err != nil { + if errors.Is(err, gorm.ErrRecordNotFound) { + return nil, gorm.ErrRecordNotFound + } return nil, fmt.Errorf("failed to get user real name info: %w", err) } return &userRealNameInfo, nil @@ -1201,6 +1204,9 @@ func (c *Cockroach) GetEnterpriseRealNameInfoByUserID(userID string) (*types.Ent // get user realname info var enterpriseRealNameInfo types.EnterpriseRealNameInfo if err := c.DB.Where(&types.EnterpriseRealNameInfo{UserUID: user.UserUID}).First(&enterpriseRealNameInfo).Error; err != nil { + if errors.Is(err, gorm.ErrRecordNotFound) { + return nil, gorm.ErrRecordNotFound + } return nil, fmt.Errorf("failed to get enterprise real name info: %w", err) } return &enterpriseRealNameInfo, nil diff --git a/service/account/api/admin.go b/service/account/api/admin.go index 04d6a319ac4..2c6c37cfb35 100644 --- a/service/account/api/admin.go +++ b/service/account/api/admin.go @@ -1,12 +1,16 @@ package api import ( + "errors" "fmt" "net/http" "github.com/gin-gonic/gin" + "github.com/google/uuid" + "github.com/labring/sealos/controllers/pkg/types" "github.com/labring/sealos/service/account/dao" "github.com/labring/sealos/service/account/helper" + "gorm.io/gorm" ) // GetAccount @@ -73,6 +77,57 @@ func AdminChargeBilling(c *gin.Context) { }) } +// AdminGetUserRealNameInfo +// @Summary Get user real name info +// @Description Get user real name info +// @Tags Account +// @Accept json +// @Produce json +// @Success 200 {object} map[string]interface{} "successfully retrieved user real name info" +// @Failure 401 {object} map[string]interface{} "authenticate error" +// @Failure 500 {object} map[string]interface{} "failed to get user real name info" +// @Router /admin/v1alpha1/real-name-info [get] +func AdminGetUserRealNameInfo(c *gin.Context) { + err := authenticateAdminRequest(c) + if err != nil { + c.JSON(http.StatusUnauthorized, helper.ErrorMessage{Error: fmt.Sprintf("authenticate error : %v", err)}) + return + } + userUID, exist := c.GetQuery("userUID") + if !exist || userUID == "" { + c.JSON(http.StatusBadRequest, helper.ErrorMessage{Error: "empty userUID"}) + return + } + userID, err := dao.DBClient.GetUserID(types.UserQueryOpts{UID: uuid.MustParse(userUID)}) + if err != nil { + c.JSON(http.StatusInternalServerError, helper.ErrorMessage{Error: fmt.Sprintf("failed to get user ID: %v", err)}) + return + } + ck := dao.DBClient.GetCockroach() + + userRealNameInfo, err := ck.GetUserRealNameInfoByUserID(userID) + + if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) { + c.JSON(http.StatusInternalServerError, helper.ErrorMessage{Error: fmt.Sprintf("failed to get user real name info: %v", err)}) + return + } + + enterpriseRealNameInfo, err := ck.GetEnterpriseRealNameInfoByUserID(userID) + + if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) { + c.JSON(http.StatusInternalServerError, helper.ErrorMessage{Error: fmt.Sprintf("failed to get enterprise real name info: %v", err)}) + return + } + + isVerified := (userRealNameInfo != nil && userRealNameInfo.IsVerified) || + (enterpriseRealNameInfo != nil && enterpriseRealNameInfo.IsVerified) + + c.JSON(http.StatusOK, gin.H{ + "userUID": userUID, + "isRealName": isVerified, + }) +} + // ActiveBilling // @Summary Active billing // @Description Active billing diff --git a/service/account/dao/interface.go b/service/account/dao/interface.go index 960cd9511ab..15ce33ac264 100644 --- a/service/account/dao/interface.go +++ b/service/account/dao/interface.go @@ -2,7 +2,6 @@ package dao import ( "context" - "errors" "fmt" "strconv" "strings" @@ -73,6 +72,7 @@ type Interface interface { ReconcileActiveBilling(startTime, endTime time.Time) error ArchiveHourlyBilling(hourStart, hourEnd time.Time) error ActiveBilling(req resources.ActiveBilling) error + GetCockroach() *cockroach.Cockroach } type Account struct { @@ -93,6 +93,10 @@ type Cockroach struct { ck *cockroach.Cockroach } +func (g *Cockroach) GetCockroach() *cockroach.Cockroach { + return g.ck +} + func (g *Cockroach) GetAccount(ops types.UserQueryOpts) (*types.Account, error) { account, err := g.ck.GetAccount(&ops) if err != nil { @@ -1576,10 +1580,7 @@ func (m *Account) GetUserRealNameInfo(req *helper.GetRealNameInfoReq) (*types.Us userRealNameInfo, err := m.ck.GetUserRealNameInfoByUserID(req.UserID) if err != nil { - if errors.Is(err, gorm.ErrRecordNotFound) { - return nil, gorm.ErrRecordNotFound - } - return nil, fmt.Errorf("failed to get user real name info: %v", err) + return nil, err } return userRealNameInfo, nil @@ -1590,10 +1591,7 @@ func (m *Account) GetEnterpriseRealNameInfo(req *helper.GetRealNameInfoReq) (*ty enterpriseRealNameInfo, err := m.ck.GetEnterpriseRealNameInfoByUserID(req.UserID) if err != nil { - if errors.Is(err, gorm.ErrRecordNotFound) { - return nil, gorm.ErrRecordNotFound - } - return nil, fmt.Errorf("failed to get enterprise real name info: %v", err) + return nil, err } return enterpriseRealNameInfo, nil diff --git a/service/account/helper/common.go b/service/account/helper/common.go index 2a1634876e7..545f07115c2 100644 --- a/service/account/helper/common.go +++ b/service/account/helper/common.go @@ -37,6 +37,7 @@ const ( AdminGetAccountWithWorkspace = "/account-with-workspace" AdminChargeBilling = "/charge-billing" AdminActiveBilling = "/active-billing" + AdminGetUserRealNameInfo = "/real-name-info" ) // env diff --git a/service/account/router/router.go b/service/account/router/router.go index 60e5c7e30b8..4b57ce7bca7 100644 --- a/service/account/router/router.go +++ b/service/account/router/router.go @@ -75,6 +75,7 @@ func RegisterPayRouter() { POST(helper.GetUserRealNameInfo, api.GetUserRealNameInfo) router.Group(helper.AdminGroup). GET(helper.AdminGetAccountWithWorkspace, api.AdminGetAccountWithWorkspaceID). + GET(helper.AdminGetUserRealNameInfo, api.AdminGetUserRealNameInfo). POST(helper.AdminChargeBilling, api.AdminChargeBilling) //POST(helper.AdminActiveBilling, api.AdminActiveBilling) docs.SwaggerInfo.Host = env.GetEnvWithDefault("SWAGGER_HOST", "localhost:2333") From 2cbd7a61abf687a4a527292b3e70f67ed1acff79 Mon Sep 17 00:00:00 2001 From: HUAHUAI23 Date: Fri, 14 Feb 2025 10:14:23 +0000 Subject: [PATCH 2/2] chore --- service/account/api/api.go | 2 +- service/account/docs/docs.go | 259 ++++++++++++++++++++++++++---- service/account/docs/swagger.json | 259 ++++++++++++++++++++++++++---- service/account/docs/swagger.yaml | 182 ++++++++++++++++++--- 4 files changed, 620 insertions(+), 82 deletions(-) diff --git a/service/account/api/api.go b/service/account/api/api.go index 0c675e0a5d7..a8d5885fe1b 100644 --- a/service/account/api/api.go +++ b/service/account/api/api.go @@ -984,7 +984,7 @@ func UserUsage(c *gin.Context) { // @Tags RechargeDiscount // @Accept json // @Produce json -// @Param request body helper.GetRechargeDiscountReq true "Get recharge discount request" +// @Param request body object true "Get recharge discount request" // @Success 200 {object} map[string]interface{} "successfully get recharge discount" // @Failure 400 {object} map[string]interface{} "failed to parse get recharge discount request" // @Failure 401 {object} map[string]interface{} "authenticate error" diff --git a/service/account/docs/docs.go b/service/account/docs/docs.go index f7363cf476a..882e722bf0a 100644 --- a/service/account/docs/docs.go +++ b/service/account/docs/docs.go @@ -1245,40 +1245,85 @@ const docTemplate = `{ "GetUserRealNameInfo" ], "summary": "Get user real name information", + "responses": { + "200": { + "description": "Successfully retrieved user real name info", + "schema": { + "$ref": "#/definitions/helper.GetRealNameInfoResp" + } + }, + "400": { + "description": "Failed to parse get real name info request", + "schema": { + "$ref": "#/definitions/helper.ErrorMessage" + } + }, + "401": { + "description": "Authentication error", + "schema": { + "$ref": "#/definitions/helper.ErrorMessage" + } + }, + "500": { + "description": "Failed to get user real name info or info not found/verified", + "schema": { + "$ref": "#/definitions/helper.ErrorMessage" + } + } + } + } + }, + "/account/v1alpha1/recharge/discount": { + "post": { + "description": "Get recharge discount", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "RechargeDiscount" + ], + "summary": "Get recharge discount", "parameters": [ { - "description": "Get real name info request", + "description": "Get recharge discount request", "name": "request", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/helper.GetRealNameInfoReq" + "type": "object" } } ], "responses": { "200": { - "description": "Successfully retrieved user real name info", + "description": "successfully get recharge discount", "schema": { - "$ref": "#/definitions/helper.GetRealNameInfoResp" + "type": "object", + "additionalProperties": true } }, "400": { - "description": "Failed to parse get real name info request", + "description": "failed to parse get recharge discount request", "schema": { - "$ref": "#/definitions/helper.ErrorMessage" + "type": "object", + "additionalProperties": true } }, "401": { - "description": "Authentication error", + "description": "authenticate error", "schema": { - "$ref": "#/definitions/helper.ErrorMessage" + "type": "object", + "additionalProperties": true } }, "500": { - "description": "Failed to get user real name info or info not found/verified", + "description": "failed to get recharge discount", "schema": { - "$ref": "#/definitions/helper.ErrorMessage" + "type": "object", + "additionalProperties": true } } } @@ -1426,6 +1471,120 @@ const docTemplate = `{ } } } + }, + "/admin/v1alpha1/account": { + "get": { + "description": "Get user account", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Account" + ], + "summary": "Get user account", + "responses": { + "200": { + "description": "successfully retrieved user account", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "authenticate error", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "failed to get user account", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/admin/v1alpha1/charge": { + "post": { + "description": "Charge billing", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Account" + ], + "summary": "Charge billing", + "responses": { + "200": { + "description": "successfully charged billing", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "authenticate error", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "failed to charge billing", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/admin/v1alpha1/real-name-info": { + "get": { + "description": "Get user real name info", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Account" + ], + "summary": "Get user real name info", + "responses": { + "200": { + "description": "successfully retrieved user real name info", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "authenticate error", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "failed to get user real name info", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } } }, "definitions": { @@ -1505,6 +1664,10 @@ const docTemplate = `{ "userID": { "type": "string", "example": "admin" + }, + "userUID": { + "type": "string", + "example": "user-123" } } }, @@ -1545,6 +1708,10 @@ const docTemplate = `{ "userID": { "type": "string", "example": "admin" + }, + "userUID": { + "type": "string", + "example": "user-123" } } }, @@ -1565,6 +1732,10 @@ const docTemplate = `{ "userID": { "type": "string", "example": "admin" + }, + "userUID": { + "type": "string", + "example": "user-123" } } }, @@ -1608,6 +1779,10 @@ const docTemplate = `{ "userID": { "type": "string", "example": "admin" + }, + "userUID": { + "type": "string", + "example": "user-123" } } }, @@ -1747,6 +1922,10 @@ const docTemplate = `{ "userID": { "type": "string", "example": "admin" + }, + "userUID": { + "type": "string", + "example": "user-123" } } }, @@ -1788,6 +1967,10 @@ const docTemplate = `{ "userID": { "type": "string", "example": "admin" + }, + "userUID": { + "type": "string", + "example": "user-123" } } }, @@ -1834,6 +2017,10 @@ const docTemplate = `{ "userID": { "type": "string", "example": "admin" + }, + "userUID": { + "type": "string", + "example": "user-123" } } }, @@ -1860,26 +2047,6 @@ const docTemplate = `{ } } }, - "helper.GetRealNameInfoReq": { - "type": "object", - "properties": { - "kubeConfig": { - "type": "string" - }, - "owner": { - "type": "string", - "example": "admin" - }, - "token": { - "type": "string", - "example": "token" - }, - "userID": { - "type": "string", - "example": "admin" - } - } - }, "helper.GetRealNameInfoResp": { "type": "object", "properties": { @@ -1950,6 +2117,10 @@ const docTemplate = `{ "userID": { "type": "string", "example": "admin" + }, + "userUID": { + "type": "string", + "example": "user-123" } } }, @@ -1982,6 +2153,10 @@ const docTemplate = `{ "userID": { "type": "string", "example": "admin" + }, + "userUID": { + "type": "string", + "example": "user-123" } } }, @@ -2037,6 +2212,10 @@ const docTemplate = `{ "userID": { "type": "string", "example": "admin" + }, + "userUID": { + "type": "string", + "example": "user-123" } } }, @@ -2071,6 +2250,10 @@ const docTemplate = `{ "userID": { "type": "string", "example": "admin" + }, + "userUID": { + "type": "string", + "example": "user-123" } } }, @@ -2108,6 +2291,10 @@ const docTemplate = `{ "userID": { "type": "string", "example": "admin" + }, + "userUID": { + "type": "string", + "example": "user-123" } } }, @@ -2136,6 +2323,10 @@ const docTemplate = `{ "userID": { "type": "string", "example": "admin" + }, + "userUID": { + "type": "string", + "example": "user-123" } } }, @@ -2185,6 +2376,10 @@ const docTemplate = `{ "userID": { "type": "string", "example": "admin" + }, + "userUID": { + "type": "string", + "example": "user-123" } } }, @@ -2224,6 +2419,10 @@ const docTemplate = `{ "userID": { "type": "string", "example": "admin" + }, + "userUID": { + "type": "string", + "example": "user-123" } } } diff --git a/service/account/docs/swagger.json b/service/account/docs/swagger.json index 5bfce6955d9..cffbff5dd35 100644 --- a/service/account/docs/swagger.json +++ b/service/account/docs/swagger.json @@ -1238,40 +1238,85 @@ "GetUserRealNameInfo" ], "summary": "Get user real name information", + "responses": { + "200": { + "description": "Successfully retrieved user real name info", + "schema": { + "$ref": "#/definitions/helper.GetRealNameInfoResp" + } + }, + "400": { + "description": "Failed to parse get real name info request", + "schema": { + "$ref": "#/definitions/helper.ErrorMessage" + } + }, + "401": { + "description": "Authentication error", + "schema": { + "$ref": "#/definitions/helper.ErrorMessage" + } + }, + "500": { + "description": "Failed to get user real name info or info not found/verified", + "schema": { + "$ref": "#/definitions/helper.ErrorMessage" + } + } + } + } + }, + "/account/v1alpha1/recharge/discount": { + "post": { + "description": "Get recharge discount", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "RechargeDiscount" + ], + "summary": "Get recharge discount", "parameters": [ { - "description": "Get real name info request", + "description": "Get recharge discount request", "name": "request", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/helper.GetRealNameInfoReq" + "type": "object" } } ], "responses": { "200": { - "description": "Successfully retrieved user real name info", + "description": "successfully get recharge discount", "schema": { - "$ref": "#/definitions/helper.GetRealNameInfoResp" + "type": "object", + "additionalProperties": true } }, "400": { - "description": "Failed to parse get real name info request", + "description": "failed to parse get recharge discount request", "schema": { - "$ref": "#/definitions/helper.ErrorMessage" + "type": "object", + "additionalProperties": true } }, "401": { - "description": "Authentication error", + "description": "authenticate error", "schema": { - "$ref": "#/definitions/helper.ErrorMessage" + "type": "object", + "additionalProperties": true } }, "500": { - "description": "Failed to get user real name info or info not found/verified", + "description": "failed to get recharge discount", "schema": { - "$ref": "#/definitions/helper.ErrorMessage" + "type": "object", + "additionalProperties": true } } } @@ -1419,6 +1464,120 @@ } } } + }, + "/admin/v1alpha1/account": { + "get": { + "description": "Get user account", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Account" + ], + "summary": "Get user account", + "responses": { + "200": { + "description": "successfully retrieved user account", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "authenticate error", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "failed to get user account", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/admin/v1alpha1/charge": { + "post": { + "description": "Charge billing", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Account" + ], + "summary": "Charge billing", + "responses": { + "200": { + "description": "successfully charged billing", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "authenticate error", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "failed to charge billing", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "/admin/v1alpha1/real-name-info": { + "get": { + "description": "Get user real name info", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Account" + ], + "summary": "Get user real name info", + "responses": { + "200": { + "description": "successfully retrieved user real name info", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "401": { + "description": "authenticate error", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "500": { + "description": "failed to get user real name info", + "schema": { + "type": "object", + "additionalProperties": true + } + } + } + } } }, "definitions": { @@ -1498,6 +1657,10 @@ "userID": { "type": "string", "example": "admin" + }, + "userUID": { + "type": "string", + "example": "user-123" } } }, @@ -1538,6 +1701,10 @@ "userID": { "type": "string", "example": "admin" + }, + "userUID": { + "type": "string", + "example": "user-123" } } }, @@ -1558,6 +1725,10 @@ "userID": { "type": "string", "example": "admin" + }, + "userUID": { + "type": "string", + "example": "user-123" } } }, @@ -1601,6 +1772,10 @@ "userID": { "type": "string", "example": "admin" + }, + "userUID": { + "type": "string", + "example": "user-123" } } }, @@ -1740,6 +1915,10 @@ "userID": { "type": "string", "example": "admin" + }, + "userUID": { + "type": "string", + "example": "user-123" } } }, @@ -1781,6 +1960,10 @@ "userID": { "type": "string", "example": "admin" + }, + "userUID": { + "type": "string", + "example": "user-123" } } }, @@ -1827,6 +2010,10 @@ "userID": { "type": "string", "example": "admin" + }, + "userUID": { + "type": "string", + "example": "user-123" } } }, @@ -1853,26 +2040,6 @@ } } }, - "helper.GetRealNameInfoReq": { - "type": "object", - "properties": { - "kubeConfig": { - "type": "string" - }, - "owner": { - "type": "string", - "example": "admin" - }, - "token": { - "type": "string", - "example": "token" - }, - "userID": { - "type": "string", - "example": "admin" - } - } - }, "helper.GetRealNameInfoResp": { "type": "object", "properties": { @@ -1943,6 +2110,10 @@ "userID": { "type": "string", "example": "admin" + }, + "userUID": { + "type": "string", + "example": "user-123" } } }, @@ -1975,6 +2146,10 @@ "userID": { "type": "string", "example": "admin" + }, + "userUID": { + "type": "string", + "example": "user-123" } } }, @@ -2030,6 +2205,10 @@ "userID": { "type": "string", "example": "admin" + }, + "userUID": { + "type": "string", + "example": "user-123" } } }, @@ -2064,6 +2243,10 @@ "userID": { "type": "string", "example": "admin" + }, + "userUID": { + "type": "string", + "example": "user-123" } } }, @@ -2101,6 +2284,10 @@ "userID": { "type": "string", "example": "admin" + }, + "userUID": { + "type": "string", + "example": "user-123" } } }, @@ -2129,6 +2316,10 @@ "userID": { "type": "string", "example": "admin" + }, + "userUID": { + "type": "string", + "example": "user-123" } } }, @@ -2178,6 +2369,10 @@ "userID": { "type": "string", "example": "admin" + }, + "userUID": { + "type": "string", + "example": "user-123" } } }, @@ -2217,6 +2412,10 @@ "userID": { "type": "string", "example": "admin" + }, + "userUID": { + "type": "string", + "example": "user-123" } } } diff --git a/service/account/docs/swagger.yaml b/service/account/docs/swagger.yaml index 316bc458d97..fb7bc9c8b33 100644 --- a/service/account/docs/swagger.yaml +++ b/service/account/docs/swagger.yaml @@ -70,6 +70,9 @@ definitions: userID: example: admin type: string + userUID: + example: user-123 + type: string type: object helper.ApplyInvoiceReq: properties: @@ -104,6 +107,9 @@ definitions: userID: example: admin type: string + userUID: + example: user-123 + type: string required: - detail - paymentIDList @@ -121,6 +127,9 @@ definitions: userID: example: admin type: string + userUID: + example: user-123 + type: string type: object helper.ConsumptionRecordReq: properties: @@ -159,6 +168,9 @@ definitions: userID: example: admin type: string + userUID: + example: user-123 + type: string type: object helper.CostApp: properties: @@ -294,6 +306,9 @@ definitions: userID: example: admin type: string + userUID: + example: user-123 + type: string type: object helper.GetInvoiceReq: properties: @@ -331,6 +346,9 @@ definitions: userID: example: admin type: string + userUID: + example: user-123 + type: string type: object helper.GetPaymentReq: properties: @@ -375,6 +393,9 @@ definitions: userID: example: admin type: string + userUID: + example: user-123 + type: string type: object helper.GetPropertiesResp: properties: @@ -391,20 +412,6 @@ definitions: $ref: '#/definitions/common.PropertyQuery' type: array type: object - helper.GetRealNameInfoReq: - properties: - kubeConfig: - type: string - owner: - example: admin - type: string - token: - example: token - type: string - userID: - example: admin - type: string - type: object helper.GetRealNameInfoResp: properties: data: @@ -466,6 +473,9 @@ definitions: userID: example: admin type: string + userUID: + example: user-123 + type: string type: object helper.NamespaceBillingHistoryReq: properties: @@ -492,6 +502,9 @@ definitions: userID: example: admin type: string + userUID: + example: user-123 + type: string type: object helper.NamespaceBillingHistoryRespData: properties: @@ -536,6 +549,9 @@ definitions: userID: example: admin type: string + userUID: + example: user-123 + type: string required: - invoiceIDList - status @@ -564,6 +580,9 @@ definitions: userID: example: admin type: string + userUID: + example: user-123 + type: string required: - paymentIDList type: object @@ -599,6 +618,9 @@ definitions: userID: example: admin type: string + userUID: + example: user-123 + type: string required: - toUser type: object @@ -622,6 +644,9 @@ definitions: userID: example: admin type: string + userUID: + example: user-123 + type: string required: - code type: object @@ -658,6 +683,9 @@ definitions: userID: example: admin type: string + userUID: + example: user-123 + type: string type: object helper.UserUsageReq: properties: @@ -690,6 +718,9 @@ definitions: userID: example: admin type: string + userUID: + example: user-123 + type: string type: object host: localhost:2333 info: @@ -1525,13 +1556,6 @@ paths: consumes: - application/json description: Retrieve the real name information for a user - parameters: - - description: Get real name info request - in: body - name: request - required: true - schema: - $ref: '#/definitions/helper.GetRealNameInfoReq' produces: - application/json responses: @@ -1554,6 +1578,44 @@ paths: summary: Get user real name information tags: - GetUserRealNameInfo + /account/v1alpha1/recharge/discount: + post: + consumes: + - application/json + description: Get recharge discount + parameters: + - description: Get recharge discount request + in: body + name: request + required: true + schema: + type: object + produces: + - application/json + responses: + "200": + description: successfully get recharge discount + schema: + additionalProperties: true + type: object + "400": + description: failed to parse get recharge discount request + schema: + additionalProperties: true + type: object + "401": + description: authenticate error + schema: + additionalProperties: true + type: object + "500": + description: failed to get recharge discount + schema: + additionalProperties: true + type: object + summary: Get recharge discount + tags: + - RechargeDiscount /account/v1alpha1/regions: post: consumes: @@ -1651,4 +1713,82 @@ paths: summary: Get user usage tags: - UserUsage + /admin/v1alpha1/account: + get: + consumes: + - application/json + description: Get user account + produces: + - application/json + responses: + "200": + description: successfully retrieved user account + schema: + additionalProperties: true + type: object + "401": + description: authenticate error + schema: + additionalProperties: true + type: object + "500": + description: failed to get user account + schema: + additionalProperties: true + type: object + summary: Get user account + tags: + - Account + /admin/v1alpha1/charge: + post: + consumes: + - application/json + description: Charge billing + produces: + - application/json + responses: + "200": + description: successfully charged billing + schema: + additionalProperties: true + type: object + "401": + description: authenticate error + schema: + additionalProperties: true + type: object + "500": + description: failed to charge billing + schema: + additionalProperties: true + type: object + summary: Charge billing + tags: + - Account + /admin/v1alpha1/real-name-info: + get: + consumes: + - application/json + description: Get user real name info + produces: + - application/json + responses: + "200": + description: successfully retrieved user real name info + schema: + additionalProperties: true + type: object + "401": + description: authenticate error + schema: + additionalProperties: true + type: object + "500": + description: failed to get user real name info + schema: + additionalProperties: true + type: object + summary: Get user real name info + tags: + - Account swagger: "2.0"