Advertisement
Guest User

Untitled

a guest
May 11th, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. #! /usr/bin/env ruby
  2.  
  3. require 'json'
  4.  
  5. credentials = JSON.parse(
  6. <<~DATA
  7.  
  8. Paste your Bluemix Object Storage credentials here. Pls+Thnx.
  9.  
  10. DATA
  11. )
  12.  
  13. body = JSON.dump({
  14. auth: {
  15. identity: {
  16. methods: ['password'],
  17. password: {
  18. user: {
  19. id: credentials['userId'],
  20. password: credentials['password']
  21. }
  22. }
  23. },
  24. scope: {
  25. project: {
  26. id: credentials['projectId']
  27. }
  28. }
  29. }
  30. })
  31.  
  32. command = "curl -i -H 'Content-Type: application/json' -H 'Host: identity.open.softlayer.com:443' -X POST -d '#{body}' #{credentials['auth_url']}/v3/auth/tokens"
  33.  
  34. puts command
  35.  
  36. system(command)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement