From 796d667e48cb7e5e9a24be705632bb533eeaf047 Mon Sep 17 00:00:00 2001 From: Rao Yunkun Date: Tue, 20 Apr 2021 11:40:23 +0800 Subject: [PATCH] Add comments for metering price info struct. Signed-off-by: Rao Yunkun --- pkg/models/metering/type.go | 16 +++++++++++----- pkg/simple/client/metering/options.go | 16 +++++++++++----- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/pkg/models/metering/type.go b/pkg/models/metering/type.go index 3cb802897..4c784af98 100644 --- a/pkg/models/metering/type.go +++ b/pkg/models/metering/type.go @@ -1,12 +1,18 @@ package metering type PriceInfo struct { - Currency string `json:"currency" description:"currency"` - CpuPerCorePerHour float64 `json:"cpu_per_core_per_hour,omitempty" description:"cpu price"` - MemPerGigabytesPerHour float64 `json:"mem_per_gigabytes_per_hour,omitempty" description:"mem price"` + // currency unit, currently support CNY and USD + Currency string `json:"currency" description:"currency"` + // cpu cost with above currency unit for per core per hour + CpuPerCorePerHour float64 `json:"cpu_per_core_per_hour,omitempty" description:"cpu price"` + // mem cost with above currency unit for per GB per hour + MemPerGigabytesPerHour float64 `json:"mem_per_gigabytes_per_hour,omitempty" description:"mem price"` + // ingress network traffic cost with above currency unit for per MB per hour IngressNetworkTrafficPerMegabytesPerHour float64 `json:"ingress_network_traffic_per_megabytes_per_hour,omitempty" description:"ingress price"` - EgressNetworkTrafficPerMegabytesPerHour float64 `json:"egress_network_traffic_per_megabytes_per_hour,omitempty" description:"egress price"` - PvcPerGigabytesPerHour float64 `json:"pvc_per_gigabytes_per_hour,omitempty" description:"pvc price"` + // egress network traffice cost with above currency unit for per MB per hour + EgressNetworkTrafficPerMegabytesPerHour float64 `json:"egress_network_traffic_per_megabytes_per_hour,omitempty" description:"egress price"` + // pvc cost with above currency unit for per GB per hour + PvcPerGigabytesPerHour float64 `json:"pvc_per_gigabytes_per_hour,omitempty" description:"pvc price"` } type PriceResponse struct { diff --git a/pkg/simple/client/metering/options.go b/pkg/simple/client/metering/options.go index 0a76926ac..323c3d438 100644 --- a/pkg/simple/client/metering/options.go +++ b/pkg/simple/client/metering/options.go @@ -1,12 +1,18 @@ package metering type PriceInfo struct { - CpuPerCorePerHour float64 `json:"cpuPerCorePerHour" yaml:"cpuPerCorePerHour"` - MemPerGigabytesPerHour float64 `json:"memPerGigabytesPerHour" yaml:"memPerGigabytesPerHour"` + // currency unit, currently support CNY and USD + CpuPerCorePerHour float64 `json:"cpuPerCorePerHour" yaml:"cpuPerCorePerHour"` + // cpu cost with above currency unit for per core per hour + MemPerGigabytesPerHour float64 `json:"memPerGigabytesPerHour" yaml:"memPerGigabytesPerHour"` + // mem cost with above currency unit for per GB per hour IngressNetworkTrafficPerMegabytesPerHour float64 `json:"ingressNetworkTrafficPerMegabytesPerHour" yaml:"ingressNetworkTrafficPerGiagabytesPerHour"` - EgressNetworkTrafficPerMegabytesPerHour float64 `json:"egressNetworkTrafficPerMegabytesPerHour" yaml:"egressNetworkTrafficPerGigabytesPerHour"` - PvcPerGigabytesPerHour float64 `json:"pvcPerGigabytesPerHour" yaml:"pvcPerGigabytesPerHour"` - CurrencyUnit string `json:"currencyUnit" yaml:"currencyUnit"` + // ingress network traffic cost with above currency unit for per MB per hour + EgressNetworkTrafficPerMegabytesPerHour float64 `json:"egressNetworkTrafficPerMegabytesPerHour" yaml:"egressNetworkTrafficPerGigabytesPerHour"` + // egress network traffice cost with above currency unit for per MB per hour + PvcPerGigabytesPerHour float64 `json:"pvcPerGigabytesPerHour" yaml:"pvcPerGigabytesPerHour"` + // pvc cost with above currency unit for per GB per hour + CurrencyUnit string `json:"currencyUnit" yaml:"currencyUnit"` } type Billing struct {