metadata.go 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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 compute
  15. import (
  16. "yunion.io/x/jsonutils"
  17. "yunion.io/x/pkg/errors"
  18. "yunion.io/x/onecloud/pkg/mcclient/options"
  19. )
  20. type ServerGetPropertyTagValuePairOptions struct {
  21. ServerListOptions
  22. options.TagValuePairsOptions
  23. }
  24. func (opts *ServerGetPropertyTagValuePairOptions) Params() (jsonutils.JSONObject, error) {
  25. params, err := opts.ServerListOptions.Params()
  26. if err != nil {
  27. return nil, errors.Wrap(err, "ProjectListOptions.Params")
  28. }
  29. tagParams, _ := opts.TagValuePairsOptions.Params()
  30. params.(*jsonutils.JSONDict).Update(tagParams)
  31. return params, nil
  32. }
  33. type ServerGetPropertyTagValueTreeOptions struct {
  34. ServerListOptions
  35. options.TagValueTreeOptions
  36. }
  37. func (opts *ServerGetPropertyTagValueTreeOptions) Params() (jsonutils.JSONObject, error) {
  38. params, err := opts.ServerListOptions.Params()
  39. if err != nil {
  40. return nil, errors.Wrap(err, "ProjectListOptions.Params")
  41. }
  42. tagParams, _ := opts.TagValueTreeOptions.Params()
  43. params.(*jsonutils.JSONDict).Update(tagParams)
  44. return params, nil
  45. }
  46. type ServerGetPropertyProjectTagValuePairOptions struct {
  47. ServerListOptions
  48. options.ProjectTagValuePairsOptions
  49. }
  50. func (opts *ServerGetPropertyProjectTagValuePairOptions) Params() (jsonutils.JSONObject, error) {
  51. params, err := opts.ServerListOptions.Params()
  52. if err != nil {
  53. return nil, errors.Wrap(err, "ProjectListOptions.Params")
  54. }
  55. tagParams, _ := opts.ProjectTagValuePairsOptions.Params()
  56. params.(*jsonutils.JSONDict).Update(tagParams)
  57. return params, nil
  58. }
  59. type ServerGetPropertyProjectTagValueTreeOptions struct {
  60. ServerListOptions
  61. options.ProjectTagValueTreeOptions
  62. }
  63. func (opts *ServerGetPropertyProjectTagValueTreeOptions) Params() (jsonutils.JSONObject, error) {
  64. params, err := opts.ServerListOptions.Params()
  65. if err != nil {
  66. return nil, errors.Wrap(err, "ProjectListOptions.Params")
  67. }
  68. tagParams, _ := opts.ProjectTagValueTreeOptions.Params()
  69. params.(*jsonutils.JSONDict).Update(tagParams)
  70. return params, nil
  71. }
  72. type ServerGetPropertyDomainTagValuePairOptions struct {
  73. ServerListOptions
  74. options.DomainTagValuePairsOptions
  75. }
  76. func (opts *ServerGetPropertyDomainTagValuePairOptions) Params() (jsonutils.JSONObject, error) {
  77. params, err := opts.ServerListOptions.Params()
  78. if err != nil {
  79. return nil, errors.Wrap(err, "ProjectListOptions.Params")
  80. }
  81. tagParams, _ := opts.DomainTagValuePairsOptions.Params()
  82. params.(*jsonutils.JSONDict).Update(tagParams)
  83. return params, nil
  84. }
  85. type ServerGetPropertyDomainTagValueTreeOptions struct {
  86. ServerListOptions
  87. options.DomainTagValueTreeOptions
  88. }
  89. func (opts *ServerGetPropertyDomainTagValueTreeOptions) Params() (jsonutils.JSONObject, error) {
  90. params, err := opts.ServerListOptions.Params()
  91. if err != nil {
  92. return nil, errors.Wrap(err, "ProjectListOptions.Params")
  93. }
  94. tagParams, _ := opts.DomainTagValueTreeOptions.Params()
  95. params.(*jsonutils.JSONDict).Update(tagParams)
  96. return params, nil
  97. }