QuotaService.go 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. //
  2. // Copyright 2016, Sander van Harmelen
  3. //
  4. // Licensed under the Apache License, Version 2.0 (the "License");
  5. // you may not use this file except in compliance with the License.
  6. // You may obtain a copy of the License at
  7. //
  8. // http://www.apache.org/licenses/LICENSE-2.0
  9. //
  10. // Unless required by applicable law or agreed to in writing, software
  11. // distributed under the License is distributed on an "AS IS" BASIS,
  12. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. // See the License for the specific language governing permissions and
  14. // limitations under the License.
  15. //
  16. package cloudstack
  17. import (
  18. "encoding/json"
  19. "net/url"
  20. )
  21. type QuotaIsEnabledParams struct {
  22. p map[string]interface{}
  23. }
  24. func (p *QuotaIsEnabledParams) toURLValues() url.Values {
  25. u := url.Values{}
  26. if p.p == nil {
  27. return u
  28. }
  29. return u
  30. }
  31. // You should always use this function to get a new QuotaIsEnabledParams instance,
  32. // as then you are sure you have configured all required params
  33. func (s *QuotaService) NewQuotaIsEnabledParams() *QuotaIsEnabledParams {
  34. p := &QuotaIsEnabledParams{}
  35. p.p = make(map[string]interface{})
  36. return p
  37. }
  38. // Return true if the plugin is enabled
  39. func (s *QuotaService) QuotaIsEnabled(p *QuotaIsEnabledParams) (*QuotaIsEnabledResponse, error) {
  40. resp, err := s.cs.newRequest("quotaIsEnabled", p.toURLValues())
  41. if err != nil {
  42. return nil, err
  43. }
  44. var r QuotaIsEnabledResponse
  45. if err := json.Unmarshal(resp, &r); err != nil {
  46. return nil, err
  47. }
  48. return &r, nil
  49. }
  50. type QuotaIsEnabledResponse struct {
  51. Isenabled bool `json:"isenabled,omitempty"`
  52. }