Last active
August 29, 2015 13:57
-
-
Save okjake/9512697 to your computer and use it in GitHub Desktop.
EMC Atmos file upload
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Edit the following with relevant details | |
| uid="" | |
| key="" | |
| endpoint="" | |
| file_to_upload="/local/path/to/large/file.ext" | |
| atmos_dir="/test/" | |
| contentType="image/jpeg" | |
| # Stop editing here | |
| filename=`basename $file_to_upload` | |
| atmos_path="/rest/namespace${atmos_dir}$filename" | |
| date=`date -u +"%a, %d %b %Y %H:%M:%S GMT"` | |
| signstr="POST\n${contentType}\n\n\n${atmos_path}\nx-emc-date:${date}\nx-emc-uid:${uid}" | |
| sig=$(python -c "import base64, hmac, sha; print base64.b64encode(hmac.new(base64.b64decode(\"$key\"), \"$signstr\", sha).digest())") | |
| curl -v -i -X POST -H "Content-Type:$contentType" -H "x-emc-date:$date" -H "x-emc-uid:$uid" -H "x-emc-signature:$sig" --data-binary @${file_to_upload} ${endpoint}${atmos_path} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment