organization.go 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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. api "yunion.io/x/onecloud/pkg/apis/identity"
  18. "yunion.io/x/onecloud/pkg/mcclient/options"
  19. )
  20. type OrganizationListOptions struct {
  21. options.BaseListOptions
  22. }
  23. func (opts *OrganizationListOptions) Params() (jsonutils.JSONObject, error) {
  24. return options.ListStructToParams(opts)
  25. }
  26. type OrganizationCreateOptions struct {
  27. NAME string `help:"name of organization" json:"name"`
  28. TYPE string `help:"type of organization" choices:"project|domain|object" json:"type"`
  29. Desc string `help:"description" json:"description"`
  30. Key []string `help:"tag keys" json:"key"`
  31. }
  32. func (opts *OrganizationCreateOptions) Params() (jsonutils.JSONObject, error) {
  33. return jsonutils.Marshal(opts), nil
  34. }
  35. type OrganizationIdOptions struct {
  36. ID string `help:"ID or name of organization" json:"-"`
  37. }
  38. func (opts *OrganizationIdOptions) GetId() string {
  39. return opts.ID
  40. }
  41. func (opts *OrganizationIdOptions) Params() (jsonutils.JSONObject, error) {
  42. return nil, nil
  43. }
  44. type OrganizationSyncOptions struct {
  45. OrganizationIdOptions
  46. Reset bool `help:"reset organization nodes"`
  47. }
  48. func (opts *OrganizationSyncOptions) Params() (jsonutils.JSONObject, error) {
  49. return jsonutils.Marshal(opts), nil
  50. }
  51. type OrganizationShowNodesOptions struct {
  52. OrganizationIdOptions
  53. }
  54. type OrganizationAddLevelOptions struct {
  55. OrganizationIdOptions
  56. api.OrganizationPerformAddLevelsInput
  57. }
  58. func (opts *OrganizationAddLevelOptions) Params() (jsonutils.JSONObject, error) {
  59. return jsonutils.Marshal(opts), nil
  60. }
  61. type OrganizationAddNodeOptions struct {
  62. OrganizationIdOptions
  63. api.OrganizationPerformAddNodeInput
  64. }
  65. func (opts *OrganizationAddNodeOptions) Params() (jsonutils.JSONObject, error) {
  66. return jsonutils.Marshal(opts), nil
  67. }