-
Notifications
You must be signed in to change notification settings - Fork 474
/
quota_spec_binding.go
30 lines (26 loc) · 1021 Bytes
/
quota_spec_binding.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package models
import (
"github.com/kiali/kiali/kubernetes"
)
type QuotaSpecBindings []QuotaSpecBinding
type QuotaSpecBinding struct {
Name string `json:"name"`
CreatedAt string `json:"createdAt"`
ResourceVersion string `json:"resourceVersion"`
QuotaSpecs interface{} `json:"quotaSpecs"`
Services interface{} `json:"services"`
}
func (qsbs *QuotaSpecBindings) Parse(quotaSpecBindings []kubernetes.IstioObject) {
for _, qsb := range quotaSpecBindings {
quotaSpecBinding := QuotaSpecBinding{}
quotaSpecBinding.Parse(qsb)
*qsbs = append(*qsbs, quotaSpecBinding)
}
}
func (qsb *QuotaSpecBinding) Parse(quotaSpecBinding kubernetes.IstioObject) {
qsb.Name = quotaSpecBinding.GetObjectMeta().Name
qsb.CreatedAt = formatTime(quotaSpecBinding.GetObjectMeta().CreationTimestamp.Time)
qsb.ResourceVersion = quotaSpecBinding.GetObjectMeta().ResourceVersion
qsb.QuotaSpecs = quotaSpecBinding.GetSpec()["rules"]
qsb.Services = quotaSpecBinding.GetSpec()["services"]
}