Swift命令

创建用户

  1. root@dev:~# radosgw-admin subuser create --uid=mona --subuser=mona:swift --access=full --secret=secretkey --key-type=swift
  2. {
  3. "user_id": "mona",
  4. "display_name": "Monika Singh",
  5. "email": "mona@example.com",
  6. "suspended": 0,
  7. "max_buckets": 1000,
  8. "auid": 0,
  9. "subusers": [
  10. {
  11. "id": "mona:swift",
  12. "permissions": "<none>"
  13. }
  14. ],
  15. "keys": [
  16. {
  17. "user": "mona",
  18. "access_key": "2196PJ0MA6FLHCVKVFDW",
  19. "secret_key": "eO1\/dmEOEU5LlooexlWwcqJYZrt3Gzp\/nBXsQCwz"
  20. },
  21. {
  22. "user": "mona:swift",
  23. "access_key": "2FTDLNGGOWALF1ZS5XHY",
  24. "secret_key": ""
  25. }
  26. ],
  27. "swift_keys": [
  28. {
  29. "user": "mona:swift",
  30. "secret_key": "secretkey"
  31. }
  32. ],
  33. "caps": [
  34. {
  35. "type": "buckets",
  36. "perm": "*"
  37. },
  38. {
  39. "type": "metadata",
  40. "perm": "*"
  41. },
  42. {
  43. "type": "users",
  44. "perm": "*"
  45. },
  46. {
  47. "type": "zone",
  48. "perm": "*"
  49. }
  50. ],
  51. "op_mask": "read, write, delete",
  52. "default_placement": "",
  53. "placement_tags": [],
  54. "bucket_quota": {
  55. "enabled": false,
  56. "max_size_kb": -1,
  57. "max_objects": -1
  58. },
  59. "user_quota": {
  60. "enabled": false,
  61. "max_size_kb": -1,
  62. "max_objects": -1
  63. },
  64. "temp_url_keys": []
  65. }

安装Swift客户端

  1. apt-get install python-pip
  2. pip install python-swiftclient

Swift命令

  1. swift -V 1.0 -A http://localhost/auth -U mona:swift -K secretkey post example-bucket
  1. swift -V 1.0 -A http://localhost/auth -U mona:swift -K secretkey list