This is an automated email from the ASF dual-hosted git repository. dahn pushed a commit to branch pr90 in repository https://gitbox.apache.org/repos/asf/cloudstack-go.git
commit 9844bc1f95d2bb2f276b4f3227e8ff12bc1f3d97 Author: tonymmm1 <t...@mail.magnatox.com> AuthorDate: Mon Jul 22 18:13:28 2024 -0500 implement QuotaTariffList --- cloudstack/QuotaService.go | 53 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/cloudstack/QuotaService.go b/cloudstack/QuotaService.go index ca2f0c0..c4c0229 100644 --- a/cloudstack/QuotaService.go +++ b/cloudstack/QuotaService.go @@ -40,6 +40,8 @@ type QuotaServiceIface interface { NewQuotaTariffCreateParams(name, usagetype, value string) *QuotaTariffCreateParams QuotaTariffDelete(p *QuotaTariffDeleteParams) (*QuotaTariffDeleteResponse, error) NewQuotaTariffDeleteParams(id string) *QuotaTariffDeleteParams + QuotaTariffList(p *QuotaTariffListParams) (*QuotaTariffListResponse, error) + NewQuotaTariffListParams() *QuotaTariffListParams } type QuotaBalanceParams struct { @@ -1115,3 +1117,54 @@ type QuotaTariffDeleteResponse struct { DisplayText string `json:"displaytext"` Success bool `json:"success"` } + +type QuotaTariffListParams struct { + p map[string]interface{} +} + +func (p *QuotaTariffListParams) toURLValues() url.Values { + u := url.Values{} + if p.p == nil { + return u + } + return u +} + +// You should always use this function to get a new QuotaTariffListParams instance, +// as then you are sure you have configured all required params +func (s *QuotaService) NewQuotaTariffListParams() *QuotaTariffListParams { + p := &QuotaTariffListParams{} + p.p = make(map[string]interface{}) + return p +} + +func (s *QuotaService) QuotaTariffList(p *QuotaTariffListParams) (*QuotaTariffListResponse, error) { + resp, err := s.cs.newRequest("quotaTariffList", p.toURLValues()) + if err != nil { + return nil, err + } + + var r QuotaTariffListResponse + if err := json.Unmarshal(resp, &r); err != nil { + return nil, err + } + + return &r, nil +} + +type QuotaTariffListResponse struct { + Activationrule string `json:"activationRule"` + Currency string `json:"currency"` + Description string `json:"description"` + EffectiveDate string `json:"effectiveDate"` + EndDate string `json:"endDate"` + Name string `json:"name"` + Removed string `json:"removed"` + TariffValue string `json:"tariffValue"` + UsageDiscriminator string `json:"usageDiscriminator"` + UsageName string `json:"usageName"` + UsageType string `json:"usageType"` + UsageTypeDescription string `json:"usageTypeDescription"` + UsageUnit string `json:"usageUnit"` + Uuid string `json:"uuid"` +}