32 lines
999 B
Go
32 lines
999 B
Go
package cloud
|
|
|
|
// CloudBillingRecord 云账单同步记录(跨平台统一结构) // Logan.Li
|
|
type CloudBillingRecord struct {
|
|
BillingDate string `json:"billing_date"`
|
|
Provider string `json:"provider"`
|
|
Cost float64 `json:"cost"`
|
|
Currency string `json:"currency"`
|
|
Service string `json:"service"`
|
|
Region string `json:"region"`
|
|
Description string `json:"description"`
|
|
}
|
|
|
|
// BillingFetcher 云账单拉取接口
|
|
type BillingFetcher interface {
|
|
FetchDailyBill(billingDate string) ([]CloudBillingRecord, error)
|
|
}
|
|
|
|
// SupportedBillingProviders 已接入账单 API 的云厂商列表。 // Logan.Li
|
|
var SupportedBillingProviders = []string{"aliyun", "tencent"}
|
|
|
|
// NewBillingFetcher 根据云厂商创建账单拉取器
|
|
func NewBillingFetcher(provider, accessKey, secretKey string) BillingFetcher {
|
|
switch provider {
|
|
case "aliyun":
|
|
return NewAliyunProvider(accessKey, secretKey)
|
|
case "tencent":
|
|
return NewTencentProvider(accessKey, secretKey)
|
|
}
|
|
return nil
|
|
}
|