Advertisement
Guest User

Untitled

a guest
Feb 21st, 2020
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.27 KB | None | 0 0
  1. #!/bin/bash -x
  2.  
  3. vRA='cld-mg-vra.hci.spoc'
  4.  
  5. token=$(curl --insecure -s -H "Accept: application/json" -H 'Content-Type: application/json' \
  6. --data '{"username":"configurationadmin-a@vsphere.local","password":"D3ll2020!","tenant":"tenant-a"}' \
  7. https://$vRA/identity/api/tokens | jq -r .id)
  8.  
  9. request_template_url=$(curl -s --insecure -H "Content-Type: application/json" -H "Authorization: Bearer $token" \
  10. https://$vRA/catalog-service/api/consumer/entitledCatalogItemViews \
  11. | jq -r '.content|.[]|select(.name|test("Centos7Dev"))|.links|.[]|select(.rel|test("GET"))|.href')
  12.  
  13. curl -s --insecure -H "Accept: application/json" -H "Content-Type: application/json" \
  14. -H "Authorization: Bearer $token" $request_template_url > request_template.json
  15.  
  16. request_url=$(curl -s --insecure -H "Content-Type: application/json" -H "Authorization: Bearer $token" \
  17. https://$vRA/catalog-service/api/consumer/entitledCatalogItemViews \
  18. | jq -r '.content|.[]|select(.name|test("Centos7Dev"))|.links|.[]|select(.rel|test("POST"))|.href')
  19.  
  20. curl -v -s --insecure -H "Accept: application/json" -H "Content-Type: application/json" \
  21. -H "Authorization: Bearer $token" --data @request_template.json $request_url
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement