domain.go 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. // Copyright 2019 Yunion
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. package identity
  15. import (
  16. "yunion.io/x/jsonutils"
  17. "yunion.io/x/pkg/errors"
  18. "yunion.io/x/onecloud/pkg/mcclient/options"
  19. )
  20. type DomainListOptions struct {
  21. options.BaseListOptions
  22. IdpId string `help:"filter by idp_id"`
  23. IdpEntityId string `help:"filter by idp_entity_id"`
  24. }
  25. func (opts *DomainListOptions) Params() (jsonutils.JSONObject, error) {
  26. return options.ListStructToParams(opts)
  27. }
  28. type DomainGetPropertyTagValuePairOptions struct {
  29. DomainListOptions
  30. options.TagValuePairsOptions
  31. }
  32. func (opts *DomainGetPropertyTagValuePairOptions) Params() (jsonutils.JSONObject, error) {
  33. params, err := opts.DomainListOptions.Params()
  34. if err != nil {
  35. return nil, errors.Wrap(err, "DomainListOptions.Params")
  36. }
  37. tagParams, _ := opts.TagValuePairsOptions.Params()
  38. params.(*jsonutils.JSONDict).Update(tagParams)
  39. return params, nil
  40. }
  41. type DomainGetPropertyTagValueTreeOptions struct {
  42. DomainListOptions
  43. options.TagValueTreeOptions
  44. }
  45. func (opts *DomainGetPropertyTagValueTreeOptions) Params() (jsonutils.JSONObject, error) {
  46. params, err := opts.DomainListOptions.Params()
  47. if err != nil {
  48. return nil, errors.Wrap(err, "DomainListOptions.Params")
  49. }
  50. tagParams, _ := opts.TagValueTreeOptions.Params()
  51. params.(*jsonutils.JSONDict).Update(tagParams)
  52. return params, nil
  53. }