billingclient

package
v0.0.0-...-c9dffe9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 20, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

README

Billing Server Client

我们通过openapi生成了billing server client端的代码,但为了更方便的使用,我们在它的基础上包装了一层,主要函数的功能如下:

  • GetBillingClient:创建billing server的client
  • InitUserBillingAccount:初始化用户的账户,目前初始金额是hardcode到代码里的,之后可以移到数据库
  • GetUserBalance:获取用户的余额
  • GetOneComputeUnit:获取一个算力规格的具体内容
  • GetComputeUnitListByUserID:获取一个用户可以使用的所有算力规格
  • GetComputeUnitListByGroupName:获取指定group下所有的算力规格
  • GetComputeUnitPrice:获取指定算力规格的价格
  • AddComputeunitGroupToUser:给用户添加算力规格的group

目前这个工具包会被webserver以及webhook使用。

Documentation

Overview

Package billingclient provides billingclient.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddComputeunitGroupToUser

func AddComputeunitGroupToUser(client *apigen.Client, userID string, groupName string) error

func GetBillingClient

func GetBillingClient(billingServerURL string) (*apigen.Client, error)

func GetComputeUnitListByGroupName

func GetComputeUnitListByGroupName(client *apigen.Client, groupName string) ([]apigen.ComputeunitInfo, error)

func GetComputeUnitListByUserID

func GetComputeUnitListByUserID(client *apigen.Client, userID string) ([]apigen.ComputeunitInfo, error)

func GetComputeUnitPrice

func GetComputeUnitPrice(client *apigen.Client, ComputeUnitID string) (float64, error)

func GetOneComputeUnit

func GetOneComputeUnit(client *apigen.Client, userID string, computeunitID string) (*apigen.ComputeunitInfo, error)

func GetUserBalance

func GetUserBalance(client *apigen.Client, userID string) (*float64, error)

func InitUserBillingAccount

func InitUserBillingAccount(client *apigen.Client, userID string, internalURL string) error

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL