Documentation ¶
Index ¶
- Constants
- Variables
- func AuthenticateKC(auth Auth) error
- type AdminChargeBillingReq
- type AppCostsReq
- type ApplyInvoiceReq
- type Auth
- type AuthBase
- type AuthReq
- type ConsumptionRecordReq
- type CostApp
- type CostAppListResp
- type CostOverview
- type CostOverviewResp
- type ErrorMessage
- type GetCostAppListReq
- type GetInvoiceReq
- type GetPaymentReq
- type GetPropertiesResp
- type GetPropertiesRespData
- type GetRealNameInfoReq
- type GetRealNameInfoResp
- type GetRealNameInfoRespData
- type GetTransferRecordReq
- type JWTManager
- type JwtUser
- type LimitReq
- type LimitResp
- type NamespaceBillingHistoryReq
- type NamespaceBillingHistoryResp
- type NamespaceBillingHistoryRespData
- type RechargeDiscountResp
- type SetInvoiceStatusReq
- type SetPaymentInvoiceReq
- type Task
- type TaskQueue
- type TimeRange
- type TransferAmountReq
- type UseGiftCodeReq
- type UseGiftCodeResp
- type UseGiftCodeRespData
- type UserClaims
- type UserTimeRangeReq
- type UserUsageReq
Constants ¶
View Source
const ( GROUP = "/account/v1alpha1" GetAccount = "/account" GetPayment = "/payment" GetHistoryNamespaces = "/namespaces" GetProperties = "/properties" GetRechargeAmount = "/costs/recharge" GetConsumptionAmount = "/costs/consumption" GetAllRegionConsumptionAmount = "/costs/all-region-consumption" GetPropertiesUsed = "/costs/properties" GetAPPCosts = "/costs/app" SetPaymentInvoice = "/payment/set-invoice" GetUserCosts = "/costs" SetTransfer = "/transfer" GetTransfer = "/get-transfer" GetRegions = "/regions" GetOverview = "/cost-overview" GetAppList = "/cost-app-list" GetAppTypeList = "/cost-app-type-list" GetBasicCostDistribution = "/cost-basic-distribution" GetAppCostTimeRange = "/cost-app-time-range" CheckPermission = "/check-permission" GetInvoice = "/invoice/get" ApplyInvoice = "/invoice/apply" SetStatusInvoice = "/invoice/set-status" GetInvoicePayment = "/invoice/get-payment" UseGiftCode = "/gift-code/use" UserUsage = "/user-usage" GetRechargeDiscount = "/recharge-discount" GetUserRealNameInfo = "/real-name-info" )
View Source
const ( AdminGroup = "/admin/v1alpha1" AdminGetAccountWithWorkspace = "/account-with-workspace" AdminChargeBilling = "/charge-billing" AdminActiveBilling = "/active-billing" )
View Source
const ( ConfigPath = "/config/config.json" EnvMongoURI = "MONGO_URI" ENVGlobalCockroach = "GLOBAL_COCKROACH_URI" ENVLocalCockroach = "LOCAL_COCKROACH_URI" EnvLocalRegion = "LOCAL_REGION" EnvJwtSecret = "ACCOUNT_API_JWT_SECRET" )
env
Variables ¶
View Source
var ( // ErrorCounter is a counter for account service errors ErrorCounter = promauto.With(registry).NewCounterVec( prometheus.CounterOpts{ Name: "sealos_account_errors_total", Help: "account service error counter", }, []string{"error_type", "function", "user_uid"}, ) // CallCounter is a counter for account service calls CallCounter = promauto.With(registry).NewCounterVec( prometheus.CounterOpts{ Name: "sealos_account_calls_total", Help: "account service call counter", }, []string{"function", "user_uid"}, ) )
View Source
var ErrNullAuth = fmt.Errorf("null auth found")
Functions ¶
func AuthenticateKC ¶
Types ¶
type AdminChargeBillingReq ¶
type AdminChargeBillingReq struct { Amount int64 `json:"amount" bson:"amount" example:"100000000"` Namespace string `json:"namespace" bson:"namespace" example:"ns-admin"` Owner string `json:"owner" bson:"owner" example:"admin"` AppType string `json:"appType" bson:"appType"` AppName string `json:"appName" bson:"appName"` UserUID uuid.UUID `json:"userUID" bson:"userUID"` }
func ParseAdminChargeBillingReq ¶
func ParseAdminChargeBillingReq(c *gin.Context) (*AdminChargeBillingReq, error)
type AppCostsReq ¶
type AppCostsReq struct { // @Summary Order ID // @Description Order ID // @JSONSchema OrderID string `json:"orderID,omitempty" bson:"orderID" example:"order-id-1"` UserTimeRangeReq `json:",inline" bson:",inline"` // @Summary Namespace // @Description Namespace Namespace string `json:"namespace,omitempty" bson:"namespace" example:"ns-admin"` // @Summary App type // @Description App type AppType string `json:"appType,omitempty" bson:"appType" example:"app"` // @Summary App Name // @Description App Name AppName string `json:"appName,omitempty" bson:"appName" example:"app"` // @Summary Page // @Description Page Page int `json:"page,omitempty" bson:"page" example:"1"` // @Summary Page Size // @Description Page Size PageSize int `json:"pageSize,omitempty" bson:"pageSize" example:"10"` }
func ParseAppCostsReq ¶
func ParseAppCostsReq(c *gin.Context) (*AppCostsReq, error)
type ApplyInvoiceReq ¶
type ApplyInvoiceReq struct { // @Summary Authentication information // @Description Authentication information // @JSONSchema required AuthBase `json:",inline" bson:",inline"` // payment id list // @Summary Payment ID list // @Description Payment ID list // @JSONSchema required PaymentIDList []string `json:"paymentIDList" bson:"paymentIDList" binding:"required" example:"[\"payment-id-1\",\"payment-id-2\"]"` // invoice detail information json // @Summary Invoice detail information // @Description Invoice detail information // @JSONSchema required Detail string `` /* 343-byte string literal not displayed */ }
func ParseApplyInvoiceReq ¶
func ParseApplyInvoiceReq(c *gin.Context) (*ApplyInvoiceReq, error)
type Auth ¶
type Auth struct { Owner string `json:"owner" bson:"owner" example:"admin"` UserUID uuid.UUID `json:"userUID" bson:"userUID" example:"user-123"` UserID string `json:"userID" bson:"userID" example:"admin"` KubeConfig string `json:"kubeConfig" bson:"kubeConfig"` Token string `json:"token" bson:"token" example:"token"` }
type ConsumptionRecordReq ¶
type ConsumptionRecordReq struct { // @Summary Start and end time for the request // @Description Start and end time for the request // @JSONSchema required TimeRange `json:",inline" bson:",inline"` // @Summary Namespace // @Description Namespace Namespace string `json:"namespace,omitempty" bson:"namespace" example:"ns-admin"` // @Summary Authentication information // @Description Authentication information // @JSONSchema required AuthBase `json:",inline" bson:",inline"` // @Summary App type // @Description App type AppType string `json:"appType,omitempty" bson:"appType" example:"app"` // @Summary App Name // @Description App Name AppName string `json:"appName,omitempty" bson:"appName" example:"app"` }
func ParseConsumptionRecordReq ¶
func ParseConsumptionRecordReq(c *gin.Context) (*ConsumptionRecordReq, error)
type CostApp ¶
type CostApp struct { // @Summary Namespace // @Description Namespace Namespace string `json:"namespace" bson:"namespace"` // @Summary App type // @Description App type AppType uint8 `json:"appType" bson:"appType"` // @Summary App Name // @Description App Name AppName string `json:"appName" bson:"appName"` }
type CostAppListResp ¶
type CostOverview ¶
type CostOverview struct { // @Summary Amount // @Description Amount Amount int64 `json:"amount" bson:"amount"` // @Summary Namespace // @Description Namespace Namespace string `json:"namespace" bson:"namespace"` // @Summary Region domain // @Description Region domain RegionDomain string `json:"regionDomain" bson:"regionDomain" example:"region-domain-1"` // @Summary App type // @Description App type AppType uint8 `json:"appType" bson:"appType"` AppName string `json:"appName" bson:"appName"` }
type CostOverviewResp ¶
type CostOverviewResp struct { // @Summary Cost overview // @Description Cost overview Overviews []CostOverview `json:"overviews" bson:"overviews"` // @Summary Limit response // @Description Limit response LimitResp `json:",inline" bson:",inline"` }
type ErrorMessage ¶
type ErrorMessage struct {
Error string `json:"error,omitempty" bson:"error,omitempty" example:"authentication failure"`
}
type GetCostAppListReq ¶
type GetCostAppListReq struct { // @Summary Authentication information // @Description Authentication information AuthBase `json:",inline" bson:",inline"` // @Summary Namespace // @Description Namespace Namespace string `json:"namespace" bson:"namespace"` // @Summary App type // @Description App type AppType string `json:"appType" bson:"appType"` // @Summary App Name // @Description App Name AppName string `json:"appName" bson:"appName"` // @Summary Limit request // @Description Limit request LimitReq `json:",inline" bson:",inline"` }
func ParseGetCostAppListReq ¶
func ParseGetCostAppListReq(c *gin.Context) (*GetCostAppListReq, error)
type GetInvoiceReq ¶
type GetInvoiceReq struct { // @Summary Invoice ID // @Description Invoice ID // @JSONSchema InvoiceID string `json:"invoiceID,omitempty" bson:"invoiceID" example:"invoice-id-1"` // @Summary Authentication information // @Description Authentication information // @JSONSchema required AuthBase `json:",inline" bson:",inline"` // @Summary Limit request // @Description Limit request LimitReq `json:",inline" bson:",inline"` }
func ParseGetInvoiceReq ¶
func ParseGetInvoiceReq(c *gin.Context) (*GetInvoiceReq, error)
type GetPaymentReq ¶
type GetPaymentReq struct { // @Summary Payment ID // @Description Payment ID // @JSONSchema PaymentID string `json:"paymentID,omitempty" bson:"paymentID" example:"payment-id-1"` // @Summary Invoiced // @Description Invoiced // @JSONSchema Invoiced *bool `json:"invoiced,omitempty" bson:"invoiced" example:"true"` // @Summary Authentication information // @Description Authentication information // @JSONSchema required AuthBase `json:",inline" bson:",inline"` // @Summary Limit request // @Description Limit request LimitReq `json:",inline" bson:",inline"` }
func ParsePaymentReq ¶
func ParsePaymentReq(c *gin.Context) (*GetPaymentReq, error)
type GetPropertiesResp ¶
type GetPropertiesResp struct { Data GetPropertiesRespData `json:"data,omitempty" bson:"data,omitempty"` Message string `json:"message,omitempty" bson:"message" example:"successfully retrieved properties"` }
type GetPropertiesRespData ¶
type GetPropertiesRespData struct {
Properties []common.PropertyQuery `json:"properties,omitempty" bson:"properties,omitempty"`
}
type GetRealNameInfoReq ¶
type GetRealNameInfoReq struct { // @Summary Authentication information // @Description Authentication information // @JSONSchema required AuthBase `json:",inline" bson:",inline"` }
func ParseGetRealNameInfoReq ¶
func ParseGetRealNameInfoReq(c *gin.Context) (*GetRealNameInfoReq, error)
type GetRealNameInfoResp ¶
type GetRealNameInfoResp struct { Data GetRealNameInfoRespData `json:"data,omitempty" bson:"data,omitempty"` Message string `json:"message,omitempty" bson:"message" example:"Successfully retrieved real name information"` }
type GetRealNameInfoRespData ¶
type GetTransferRecordReq ¶
type GetTransferRecordReq struct { UserTimeRangeReq `json:",inline" bson:",inline"` // 0: all, 1: in, 2: out // @Summary Type of the request // @Description Type of the request: 0: all, 1: transfer in, 2: transfer out Type int `json:"type,omitempty" bson:"type" example:"0"` // @Summary Transfer ID // @Description Transfer ID TransferID string `json:"transferID,omitempty" bson:"transferID" example:"transfer-id-1"` // @Summary Page // @Description Page Page int `json:"page,omitempty" bson:"page" example:"1"` // @Summary Page Size // @Description Page Size PageSize int `json:"pageSize,omitempty" bson:"pageSize" example:"10"` }
func ParseGetTransferRecordReq ¶
func ParseGetTransferRecordReq(c *gin.Context) (*GetTransferRecordReq, error)
type JWTManager ¶
type JWTManager struct {
// contains filtered or unexported fields
}
func NewJWTManager ¶
func NewJWTManager(secretKey string, tokenDuration time.Duration) *JWTManager
func (*JWTManager) GenerateToken ¶
func (manager *JWTManager) GenerateToken(user JwtUser) (string, error)
func (*JWTManager) ParseUser ¶
func (manager *JWTManager) ParseUser(c *gin.Context) (*JwtUser, error)
func (*JWTManager) VerifyToken ¶
func (manager *JWTManager) VerifyToken(tokenString string) (*UserClaims, error)
type JwtUser ¶
type JwtUser struct { Requester string `json:"requester,omitempty"` UserUID uuid.UUID `json:"userUid,omitempty"` UserCrUID string `json:"userCrUid,omitempty"` UserCrName string `json:"userCrName,omitempty"` RegionUID string `json:"regionUid,omitempty"` UserID string `json:"userId,omitempty"` WorkspaceID string `json:"workspaceId,omitempty"` WorkspaceUID string `json:"workspaceUid,omitempty"` }
type NamespaceBillingHistoryReq ¶
type NamespaceBillingHistoryReq struct { // @Summary Start and end time for the request // @Description Start and end time for the request // @JSONSchema required TimeRange `json:",inline" bson:",inline"` // @Summary Authentication information // @Description Authentication information // @JSONSchema required AuthBase `json:",inline" bson:",inline"` // @Summary Type of the request (optional) // @Description Type of the request (optional) // @JSONSchema Type int `json:"type" bson:"type"` }
func ParseNamespaceBillingHistoryReq ¶
func ParseNamespaceBillingHistoryReq(c *gin.Context) (*NamespaceBillingHistoryReq, error)
type NamespaceBillingHistoryResp ¶
type NamespaceBillingHistoryResp struct { Data NamespaceBillingHistoryRespData `json:"data,omitempty" bson:"data,omitempty"` Message string `json:"message,omitempty" bson:"message" example:"successfully retrieved namespace list"` }
type NamespaceBillingHistoryRespData ¶
type NamespaceBillingHistoryRespData struct {
List []string `json:"list,omitempty" bson:"list,omitempty" example:"[\"ns-admin\",\"ns-test1\"]"`
}
type RechargeDiscountResp ¶
type SetInvoiceStatusReq ¶
type SetInvoiceStatusReq struct { // Invoice id list // @Summary Invoice ID list // @Description Invoice ID list // @JSONSchema required InvoiceIDList []string `json:"invoiceIDList" bson:"invoiceIDList" binding:"required" example:"[\"invoice-id-1\",\"invoice-id-2\"]"` // Invoice status // @Summary Invoice status // @Description Invoice status // @JSONSchema required Status string `json:"status" bson:"status" binding:"required" example:"COMPLETED,REJECTED,PENDING"` // @Summary Authentication information // @Description Authentication information // @JSONSchema required AuthBase `json:",inline" bson:",inline"` }
func ParseSetInvoiceStatusReq ¶
func ParseSetInvoiceStatusReq(c *gin.Context) (*SetInvoiceStatusReq, error)
type SetPaymentInvoiceReq ¶
type SetPaymentInvoiceReq struct { // @Summary Payment ID list // @Description Payment ID list // @JSONSchema required PaymentIDList []string `json:"paymentIDList" bson:"paymentIDList" binding:"required" example:"[\"payment-id-1\",\"payment-id-2\"]"` // @Summary Authentication information // @Description Authentication information // @JSONSchema required AuthBase `json:",inline" bson:",inline"` }
func ParseSetPaymentInvoiceReq ¶
func ParseSetPaymentInvoiceReq(c *gin.Context) (*SetPaymentInvoiceReq, error)
type TransferAmountReq ¶
type TransferAmountReq struct { // @Summary Transfer amount // @Description Transfer amount // @JSONSchema required Amount int64 `json:"amount" bson:"amount" example:"100000000"` // @Summary To user // @Description To user // @JSONSchema required ToUser string `json:"toUser" bson:"toUser" binding:"required" example:"admin"` // @Summary Authentication information // @Description Authentication information // @JSONSchema required AuthBase `json:",inline" bson:",inline"` // @Summary Transfer all // @Description Transfer all amount TransferAll bool `json:"transferAll" bson:"transferAll"` }
func ParseTransferAmountReq ¶
func ParseTransferAmountReq(c *gin.Context) (*TransferAmountReq, error)
type UseGiftCodeReq ¶
type UseGiftCodeReq struct { // @Summary Gift code to be used // @Description The code of the gift card to be redeemed // @JSONSchema required Code string `json:"code" bson:"code" binding:"required" example:"HAPPY2024"` // @Summary Authentication information // @Description Authentication information // @JSONSchema required AuthBase `json:",inline" bson:",inline"` }
func ParseUseGiftCodeReq ¶
func ParseUseGiftCodeReq(c *gin.Context) (*UseGiftCodeReq, error)
type UseGiftCodeResp ¶
type UseGiftCodeResp struct { Data UseGiftCodeRespData `json:"data,omitempty" bson:"data,omitempty"` Message string `json:"message,omitempty" bson:"message" example:"Gift code successfully redeemed"` }
type UseGiftCodeRespData ¶
type UseGiftCodeRespData struct {
UserID string `json:"userID" bson:"userID" example:"user-123"`
}
type UserClaims ¶
type UserClaims struct { jwt.StandardClaims `json:",inline"` JwtUser `json:",inline"` }
type UserTimeRangeReq ¶
type UserTimeRangeReq struct { // @Summary Start and end time for the request // @Description Start and end time for the request // @JSONSchema required TimeRange `json:",inline" bson:",inline"` // @Summary Authentication information // @Description Authentication information // @JSONSchema required AuthBase `json:",inline" bson:",inline"` }
func ParseUserTimeRangeReq ¶
func ParseUserTimeRangeReq(c *gin.Context) (*UserTimeRangeReq, error)
type UserUsageReq ¶
type UserUsageReq struct { // @Summary Start and end time for the request // @Description Start and end time for the request // @JSONSchema required TimeRange `json:",inline" bson:",inline"` // @Summary Authentication information // @Description Authentication information // @JSONSchema required AuthBase `json:",inline" bson:",inline"` // NamespaceList // @Summary Namespace list // @Description Namespace list // @JSONSchema NamespaceList []string `json:"namespaceList" bson:"namespaceList" example:"[\"ns-admin\",\"ns-test1\"]"` }
func ParseUserUsageReq ¶
func ParseUserUsageReq(c *gin.Context) (*UserUsageReq, error)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.