@@ -70,8 +70,7 @@ func (qos *QualityOfService) unmarshalQOSList(raw []byte) error {
70
70
return nil
71
71
}
72
72
73
- // CreateQuota sets the QoS limits for a `User`. To change QoS limits, a delete and recreate is necessary.
74
- func (client Client ) CreateQuota (ctx context.Context , user User , qos QualityOfService ) error {
73
+ func (qos QualityOfService ) queryParams () (map [string ]string , error ) {
75
74
rawParams := map [string ]* int64 {
76
75
"hlStorageQuotaKBytes" : qos .Hard .StorageQuotaKiBs ,
77
76
"wlStorageQuotaKBytes" : qos .Warning .StorageQuotaKiBs ,
@@ -92,10 +91,19 @@ func (client Client) CreateQuota(ctx context.Context, user User, qos QualityOfSe
92
91
val = * raw
93
92
}
94
93
if val < - 1 {
95
- return fmt .Errorf ("invalid QoS limit value: %d" , val )
94
+ return nil , fmt .Errorf ("invalid QoS limit value: %d" , val )
96
95
}
97
96
params [key ] = strconv .FormatInt (val , 10 )
98
97
}
98
+ return params , nil
99
+ }
100
+
101
+ // CreateQuota sets the QoS limits for a `User`. To change QoS limits, a delete and recreate is necessary.
102
+ func (client Client ) CreateQuota (ctx context.Context , user User , qos QualityOfService ) error {
103
+ params , err := qos .queryParams ()
104
+ if err != nil {
105
+ return err
106
+ }
99
107
100
108
resp , err := client .newRequest (ctx ).
101
109
SetQueryParam ("userId" , user .UserID ).
0 commit comments