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 4974989a0163c981fcb7b8129f63884b81d4a6f7 Author: tonymmm1 <t...@mail.magnatox.com> AuthorDate: Mon Jul 22 18:11:20 2024 -0500 implement QuotaTariffDelete --- cloudstack/QuotaService.go | 74 +++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 67 insertions(+), 7 deletions(-) diff --git a/cloudstack/QuotaService.go b/cloudstack/QuotaService.go index e06c328..ca2f0c0 100644 --- a/cloudstack/QuotaService.go +++ b/cloudstack/QuotaService.go @@ -38,13 +38,8 @@ type QuotaServiceIface interface { NewQuotaSummaryParams() *QuotaSummaryParams QuotaTariffCreate(p *QuotaTariffCreateParams) (*QuotaTariffCreateResponse, error) NewQuotaTariffCreateParams(name, usagetype, value string) *QuotaTariffCreateParams - //CreateStatement(p *CreateStatementParams) (*CreateStatementResponse, error) - //ListSummary(p *GetSummaryParams) (*GetSummaryResponse, error) - //CreateTariff(p *CreateTariffParams) (*CreateTariffResponse, error) - //DeleteTariff(p *DeleteTariffParams) (*DeleteTariffResponse, error) - //ListTariffs(p *ListTariffsParams) (*ListTariffsResponse, error) - //UpdateTariff(p *UpdateTariffParams) (*UpdateTariffResponse, error) - //UpdateQuota(p *UpdateQuotaParams) (*UpdateQuotaResponse, error) + QuotaTariffDelete(p *QuotaTariffDeleteParams) (*QuotaTariffDeleteResponse, error) + NewQuotaTariffDeleteParams(id string) *QuotaTariffDeleteParams } type QuotaBalanceParams struct { @@ -1055,3 +1050,68 @@ type QuotaTariffCreateResponse struct { UsageUnit string `json:"usageUnit"` Uuid string `json:"uuid"` } + +type QuotaTariffDeleteParams struct { + p map[string]interface{} +} + +func (p *QuotaTariffDeleteParams) toURLValues() url.Values { + u := url.Values{} + if p.p == nil { + return u + } + if v, found := p.p["id"]; found { + u.Set("id", v.(string)) + } + return u +} + +func (p *QuotaTariffDeleteParams) SetId(v string) { + if p.p == nil { + p.p = make(map[string]interface{}) + } + p.p["id"] = v +} + +func (p *QuotaTariffDeleteParams) ResetId() { + if p.p == nil { + p.p = make(map[string]interface{}) + } + delete(p.p, "id") +} + +func (p *QuotaTariffDeleteParams) GetId() (string, bool) { + if p.p == nil { + p.p = make(map[string]interface{}) + } + value, ok := p.p["id"].(string) + return value, ok +} + +// You should always use this function to get a new QuotaTariffDeleteParams instance, +// as then you are sure you have configured all required params +func (s *QuotaService) NewQuotaTariffDeleteParams(id string) *QuotaTariffDeleteParams { + p := &QuotaTariffDeleteParams{} + p.p = make(map[string]interface{}) + p.p["id"] = id + return p +} + +func (s *QuotaService) QuotaTariffDelete(p *QuotaTariffDeleteParams) (*QuotaTariffDeleteResponse, error) { + resp, err := s.cs.newRequest("quotaTariffDelete", p.toURLValues()) + if err != nil { + return nil, err + } + + var r QuotaTariffDeleteResponse + if err := json.Unmarshal(resp, &r); err != nil { + return nil, err + } + + return &r, nil +} + +type QuotaTariffDeleteResponse struct { + DisplayText string `json:"displaytext"` + Success bool `json:"success"` +}