Documentation ¶
Index ¶
- Variables
- func Init(ctx context.Context) error
- type Account
- func (m *Account) ActiveBilling(req resources.ActiveBilling) error
- func (m *Account) ApplyInvoice(req *helper.ApplyInvoiceReq) (invoice types.Invoice, payments []types.Payment, err error)
- func (m *Account) ArchiveHourlyBilling(hourStart, hourEnd time.Time) error
- func (m *Account) ChargeBilling(req *helper.AdminChargeBillingReq) error
- func (m *Account) Disconnect(ctx context.Context) error
- func (m *Account) GetBillingHistoryNamespaceList(req *helper.NamespaceBillingHistoryReq) ([][]string, error)
- func (m *Account) GetInvoice(req *helper.GetInvoiceReq) ([]types.Invoice, types.LimitResp, error)
- func (m *Account) GetInvoicePayments(invoiceID string) ([]types.Payment, error)
- func (m *Account) GetRechargeDiscount(req helper.AuthReq) (helper.RechargeDiscountResp, error)
- func (m *Account) GetUserRealNameInfo(req *helper.GetRealNameInfoReq) (*types.UserRealNameInfo, error)
- func (m *Account) InitDB() error
- func (m *Account) ProcessPendingTaskRewards() error
- func (m *Account) ReconcileActiveBilling(startTime, endTime time.Time) error
- func (m *Account) ReconcileUnsettledLLMBilling(startTime, endTime time.Time) error
- func (m *Account) SetStatusInvoice(req *helper.SetInvoiceStatusReq) error
- func (m *Account) UseGiftCode(req *helper.UseGiftCodeReq) (*types.GiftCode, error)
- type ActiveBillingReconcile
- type ActiveBillingReq
- type ArchiveBillingReconcile
- type Cockroach
- func (g *Cockroach) GetAccount(ops types.UserQueryOpts) (*types.Account, error)
- func (g *Cockroach) GetAccountWithWorkspace(workspace string) (*types.Account, error)
- func (g *Cockroach) GetLocalRegion() types.Region
- func (g *Cockroach) GetPayment(ops *types.UserQueryOpts, req *helper.GetPaymentReq) ([]types.Payment, types.LimitResp, error)
- func (g *Cockroach) GetRechargeAmount(ops types.UserQueryOpts, startTime, endTime time.Time) (int64, error)
- func (g *Cockroach) GetRegions() ([]types.Region, error)
- func (g *Cockroach) GetTransfer(ops *types.GetTransfersReq) (*types.GetTransfersResp, error)
- func (g *Cockroach) GetUserCrName(ops types.UserQueryOpts) (string, error)
- func (g *Cockroach) GetUserID(ops types.UserQueryOpts) (string, error)
- func (g *Cockroach) GetWorkspaceName(namespaces []string) ([][]string, error)
- func (g *Cockroach) SetPaymentInvoice(req *helper.SetPaymentInvoiceReq) error
- func (g *Cockroach) Transfer(req *helper.TransferAmountReq) error
- type Config
- type Interface
- type MongoDB
- func (m *MongoDB) GetAppCostTimeRange(req helper.GetCostAppListReq) (helper.TimeRange, error)
- func (m *MongoDB) GetAppCosts(req *helper.AppCostsReq) (results *common.AppCosts, rErr error)
- func (m *MongoDB) GetAppCostsByOrderIDAndAppName(req *helper.AppCostsReq) ([]common.AppCost, error)
- func (m *MongoDB) GetBasicCostDistribution(req helper.GetCostAppListReq) (map[string]int64, error)
- func (m *MongoDB) GetConsumptionAmount(req helper.ConsumptionRecordReq) (int64, error)
- func (m *MongoDB) GetCostAppList(req helper.GetCostAppListReq) (resp helper.CostAppListResp, rErr error)
- func (m *MongoDB) GetCostOverview(req helper.GetCostAppListReq) (resp helper.CostOverviewResp, rErr error)
- func (m *MongoDB) GetCosts(req helper.ConsumptionRecordReq) (common.TimeCostsMap, error)
- func (m *MongoDB) GetMonitorUniqueValues(startTime, endTime time.Time, namespaces []string) ([]common.Monitor, error)
- func (m *MongoDB) GetProperties() ([]common.PropertyQuery, error)
- func (m *MongoDB) GetPropertiesUsedAmount(user string, startTime, endTime time.Time) (map[string]int64, error)
- func (m *MongoDB) SaveActiveBillings(billing ...*resources.ActiveBilling) error
- func (m *MongoDB) SaveBillings(billing ...*resources.Billing) error
- func (m *MongoDB) UpdateBillingStatus(orderID string, status resources.BillingStatus) error
- type Region
Constants ¶
This section is empty.
Variables ¶
View Source
var ( DBClient Interface JwtMgr *helper.JWTManager Cfg *Config BillingTask *helper.TaskQueue Debug bool )
Functions ¶
Types ¶
type Account ¶
func (*Account) ActiveBilling ¶
func (m *Account) ActiveBilling(req resources.ActiveBilling) error
func (*Account) ApplyInvoice ¶
func (*Account) ArchiveHourlyBilling ¶
func (*Account) ChargeBilling ¶
func (m *Account) ChargeBilling(req *helper.AdminChargeBillingReq) error
func (*Account) GetBillingHistoryNamespaceList ¶
func (m *Account) GetBillingHistoryNamespaceList(req *helper.NamespaceBillingHistoryReq) ([][]string, error)
func (*Account) GetInvoice ¶
func (*Account) GetInvoicePayments ¶
func (*Account) GetRechargeDiscount ¶
func (*Account) GetUserRealNameInfo ¶
func (m *Account) GetUserRealNameInfo(req *helper.GetRealNameInfoReq) (*types.UserRealNameInfo, error)
func (*Account) ProcessPendingTaskRewards ¶
func (*Account) ReconcileActiveBilling ¶
func (*Account) ReconcileUnsettledLLMBilling ¶
func (*Account) SetStatusInvoice ¶
func (m *Account) SetStatusInvoice(req *helper.SetInvoiceStatusReq) error
func (*Account) UseGiftCode ¶
type ActiveBillingReconcile ¶
func (*ActiveBillingReconcile) Execute ¶
func (a *ActiveBillingReconcile) Execute() error
type ActiveBillingReq ¶
type ActiveBillingReq struct {
resources.ActiveBilling
}
func ParseAdminActiveBillingReq ¶
func ParseAdminActiveBillingReq(c *gin.Context) (*ActiveBillingReq, error)
func (*ActiveBillingReq) Execute ¶
func (a *ActiveBillingReq) Execute() error
type ArchiveBillingReconcile ¶
func (*ArchiveBillingReconcile) Execute ¶
func (a *ArchiveBillingReconcile) Execute() error
type Cockroach ¶
type Cockroach struct {
// contains filtered or unexported fields
}
func (*Cockroach) GetAccount ¶
func (*Cockroach) GetAccountWithWorkspace ¶
func (*Cockroach) GetLocalRegion ¶
func (*Cockroach) GetPayment ¶
func (g *Cockroach) GetPayment(ops *types.UserQueryOpts, req *helper.GetPaymentReq) ([]types.Payment, types.LimitResp, error)
func (*Cockroach) GetRechargeAmount ¶
func (*Cockroach) GetTransfer ¶
func (g *Cockroach) GetTransfer(ops *types.GetTransfersReq) (*types.GetTransfersResp, error)
func (*Cockroach) GetUserCrName ¶
func (g *Cockroach) GetUserCrName(ops types.UserQueryOpts) (string, error)
func (*Cockroach) GetUserID ¶
func (g *Cockroach) GetUserID(ops types.UserQueryOpts) (string, error)
func (*Cockroach) GetWorkspaceName ¶
func (*Cockroach) SetPaymentInvoice ¶
func (g *Cockroach) SetPaymentInvoice(req *helper.SetPaymentInvoiceReq) error
type Interface ¶
type Interface interface { GetBillingHistoryNamespaceList(req *helper.NamespaceBillingHistoryReq) ([][]string, error) GetAccountWithWorkspace(workspace string) (*types.Account, error) GetProperties() ([]common.PropertyQuery, error) GetCosts(req helper.ConsumptionRecordReq) (common.TimeCostsMap, error) GetAppCosts(req *helper.AppCostsReq) (*common.AppCosts, error) ChargeBilling(req *helper.AdminChargeBillingReq) error GetAppCostTimeRange(req helper.GetCostAppListReq) (helper.TimeRange, error) GetCostOverview(req helper.GetCostAppListReq) (helper.CostOverviewResp, error) GetBasicCostDistribution(req helper.GetCostAppListReq) (map[string]int64, error) GetCostAppList(req helper.GetCostAppListReq) (helper.CostAppListResp, error) Disconnect(ctx context.Context) error GetConsumptionAmount(req helper.ConsumptionRecordReq) (int64, error) GetRechargeAmount(ops types.UserQueryOpts, startTime, endTime time.Time) (int64, error) GetPropertiesUsedAmount(user string, startTime, endTime time.Time) (map[string]int64, error) GetAccount(ops types.UserQueryOpts) (*types.Account, error) GetPayment(ops *types.UserQueryOpts, req *helper.GetPaymentReq) ([]types.Payment, types.LimitResp, error) GetMonitorUniqueValues(startTime, endTime time.Time, namespaces []string) ([]common.Monitor, error) ApplyInvoice(req *helper.ApplyInvoiceReq) (invoice types.Invoice, payments []types.Payment, err error) GetInvoice(req *helper.GetInvoiceReq) ([]types.Invoice, types.LimitResp, error) GetInvoicePayments(invoiceID string) ([]types.Payment, error) SetStatusInvoice(req *helper.SetInvoiceStatusReq) error GetWorkspaceName(namespaces []string) ([][]string, error) SetPaymentInvoice(req *helper.SetPaymentInvoiceReq) error Transfer(req *helper.TransferAmountReq) error GetTransfer(ops *types.GetTransfersReq) (*types.GetTransfersResp, error) GetUserID(ops types.UserQueryOpts) (string, error) GetUserCrName(ops types.UserQueryOpts) (string, error) GetRegions() ([]types.Region, error) GetLocalRegion() types.Region UseGiftCode(req *helper.UseGiftCodeReq) (*types.GiftCode, error) GetRechargeDiscount(req helper.AuthReq) (helper.RechargeDiscountResp, error) ProcessPendingTaskRewards() error GetUserRealNameInfo(req *helper.GetRealNameInfoReq) (*types.UserRealNameInfo, error) ReconcileUnsettledLLMBilling(startTime, endTime time.Time) error ReconcileActiveBilling(startTime, endTime time.Time) error ArchiveHourlyBilling(hourStart, hourEnd time.Time) error ActiveBilling(req resources.ActiveBilling) error }
func NewAccountInterface ¶
type MongoDB ¶
type MongoDB struct { Client *mongo.Client AccountDBName string BillingConn string ActiveBillingConn string PropertiesConn string Properties *resources.PropertyTypeLS }
func (*MongoDB) GetAppCostTimeRange ¶
func (*MongoDB) GetAppCosts ¶
func (*MongoDB) GetAppCostsByOrderIDAndAppName ¶
func (*MongoDB) GetBasicCostDistribution ¶
GetBasicCostDistribution cost: map[string]int64: key: property type (cpu,memory,storage,network,nodeport: 0,1,2,3,4), value: used amount
func (*MongoDB) GetConsumptionAmount ¶
func (m *MongoDB) GetConsumptionAmount(req helper.ConsumptionRecordReq) (int64, error)
func (*MongoDB) GetCostAppList ¶
func (m *MongoDB) GetCostAppList(req helper.GetCostAppListReq) (resp helper.CostAppListResp, rErr error)
func (*MongoDB) GetCostOverview ¶
func (m *MongoDB) GetCostOverview(req helper.GetCostAppListReq) (resp helper.CostOverviewResp, rErr error)
func (*MongoDB) GetCosts ¶
func (m *MongoDB) GetCosts(req helper.ConsumptionRecordReq) (common.TimeCostsMap, error)
func (*MongoDB) GetMonitorUniqueValues ¶
func (*MongoDB) GetProperties ¶
func (m *MongoDB) GetProperties() ([]common.PropertyQuery, error)
func (*MongoDB) GetPropertiesUsedAmount ¶
func (*MongoDB) SaveActiveBillings ¶
func (m *MongoDB) SaveActiveBillings(billing ...*resources.ActiveBilling) error
func (*MongoDB) UpdateBillingStatus ¶
func (m *MongoDB) UpdateBillingStatus(orderID string, status resources.BillingStatus) error
Click to show internal directories.
Click to hide internal directories.