cloudusers.go 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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 cloudid
  15. import (
  16. "yunion.io/x/jsonutils"
  17. "yunion.io/x/onecloud/cmd/climc/shell"
  18. "yunion.io/x/onecloud/pkg/mcclient/modulebase"
  19. modules "yunion.io/x/onecloud/pkg/mcclient/modules/cloudid"
  20. "yunion.io/x/onecloud/pkg/mcclient/options/cloudid"
  21. )
  22. func init() {
  23. cmd := shell.NewResourceCmd(&modules.Cloudusers).WithKeyword("cloud-user")
  24. cmd.List(&cloudid.ClouduserListOptions{})
  25. cmd.Create(&cloudid.ClouduserCreateOptions{})
  26. cmd.Show(&cloudid.ClouduserIdOption{})
  27. cmd.Custom(shell.CustomActionGet, "login-info", &cloudid.ClouduserIdOption{})
  28. cmd.Delete(&cloudid.ClouduserIdOption{})
  29. cmd.Perform("syncstatus", &cloudid.ClouduserIdOption{})
  30. cmd.Perform("attach-policy", &cloudid.ClouduserPolicyOptions{})
  31. cmd.Perform("detach-policy", &cloudid.ClouduserPolicyOptions{})
  32. cmd.Perform("change-owner", &cloudid.ClouduserChangeOwnerOptions{})
  33. cmd.Perform("reset-password", &cloudid.ClouduserResetPasswordOptions{})
  34. cmd.Perform("join-group", &cloudid.ClouduserGroupOptions{})
  35. cmd.Perform("leave-group", &cloudid.ClouduserGroupOptions{})
  36. cmd.GetWithCustomShow("access-keys", func(result jsonutils.JSONObject) {
  37. ret := modulebase.JSON2ListResult(result)
  38. shell.PrintList(ret, nil)
  39. }, &cloudid.ClouduserListAccessKeyInput{})
  40. cmd.Perform("delete-access-key", &cloudid.ClouduserDeleteAccessKeyInput{})
  41. cmd.Perform("create-access-key", &cloudid.ClouduserCreateAccessKeyInput{})
  42. }