v1 - subutai-io/cdn GitHub Wiki
/kurjun/rest/{template,apt,raw}/download
Methods:
- GET
download endpoint allows a user to download an artifact from Gorjun.
There are 3 types of repositories:
templateaptraw
Following fields can be used for filtering artifacts:
id- https://cdn.subutai.io:8338/kurjun/rest/template/download?id=a697e70f3fc538b4f4763588a7868388name- https://cdn.subutai.io:8338/kurjun/rest/template/download?name=mastertoken- user authentication token for accessing private data.
curl -k -s -Ffile=@/tmp/file.tgz -Ftoken=$TOKEN "$URL/raw/upload"
/kurjun/rest/{template,apt,raw}/upload
Methods:
- POST
upload endpoint allows a user to upload an artifact to Gorjun.
There are 3 types of repositories:
templateaptraw
Following fields are required:
file- is a data that should be uploaded;token- user authentication token.
curl -k -s -Ffile=@/tmp/file.tgz -Ftoken=$TOKEN "$URL/raw/upload"
/kurjun/rest/{template,apt,raw}/info
Methods:
- GET
info endpoint provides JSON formatted output about artifacts stored in Kurjun.
There are 3 types of repositories:
templateaptraw
Filters for artifacts:
id- https://cdn.subutai.io:8338/kurjun/rest/template/info?id=a697e70f3fc538b4f4763588a7868388name- https://cdn.subutai.io:8338/kurjun/rest/template/info?name=masterowner- https://cdn.subutai.io:8338/kurjun/rest/template/info?owner=subutaiversion- https://cdn.subutai.io:8338/kurjun/rest/template/info?name=management&version=4.0.6verified- https://cdn.subutai.io:8338/kurjun/rest/template/info?name=elasticsearch&verified=true
Auth:
token
Formatting:
page
/kurjun/rest/template/tag
Methods:
POSTDELETE
tag endpoint adds tags to the Kurjun template information.
Fields:
id- artifact identifier;token- authentication token;tags- list of tags.
Example:
curl -Ftags=aaa,bbb,ccc,qqq -Ftoken=$TOKEN -Fid=4ae98d783858397268f5a5c2edc1f547 "$URL/template/tag"
curl -X DELETE -Ftags=aaa,bbb,ccc,qqq -Ftoken=$TOKEN -Fid=4ae98d783858397268f5a5c2edc1f547 "$URL/template/tag"
/kurjun/rest/share
Methods:
POSTGET
share endpoint allows users to share repositories with each other.
There are 3 types of repositories:
templateaptraw
POST
Following fields are required:
token- user authentication token.id- repository idadd- add to list of users id's who can access the fileremove- remove form list of users id's who can access the filerepo- repository type
Example:
{
"token":"5e9f67d0ca627b581f9c9c26d301d11dae54ea2f44b9cde34c3fae50b3560fcd",
"id":"23373ff9-10c9-4134-99a0-18c055dba39f",
"add": [ "alica" ],
"remove": [],
"repo":"raw"
}
/tmp/share.json
{
"token":"5e9f67d0ca627b581f9c9c26d301d11dae54ea2f44b9cde34c3fae50b3560fcd",
"id":"23373ff9-10c9-4134-99a0-18c055dba39f",
"add": [ "alica" ],
"remove": [],
"repo":"raw"
}
#!/bin/bash
URL=http://127.0.0.1:8080
curl -k -s -Fjson="`cat /tmp/share.json`" "$URL/kurjun/rest/share"
GET
Returns all users id's who have access to repository.
Following fields are required:
token- user authentication token.id- repository idrepo- repository type
#!/bin/bash
URL=http://127.0.0.1:8080
ID="23373ff9-10c9-4134-99a0-18c055dba39f"
TOKEN=fabfc86778ce1a7a04b72280eff5efc49d6165beea226b1375f8a8b0e5991bb9
REPO=raw
curl -k "$URL/kurjun/rest/share?id=$ID&token=$TOKEN&repo=$REPO" -o /tmp/share
/kurjun/rest/quota
Methods:
POSTGET
quota endpoint allows users to set their quota. Default quota is 2GB.
Only allowed users can set their quota. Allowed users are subutai and Hub.
POST
Following fields are required:
token- user authentication token.user- username.quota- size of quota in bytes
URL=http://127.0.0.1:8080/kurjun/rest
USER=subutai
[email protected]
QUOTA=4294967296
curl -k "$URL/auth/token?user=$USER" -o /tmp/filetosign
gpg --armor -u $EMAIL --clearsign /tmp/filetosign
TOKEN=$(curl -k -s -Fmessage="`cat /tmp/filetosign.asc`" -Fuser=$USER "$URL/auth/token")
curl -k -s -Fuser=$USER -Fquota=$QUOTA -Ftoken="$TOKEN" "$URL/quota"
GET
Following fields are required:
token- user authentication token.user- username.fix- any parameter with length > 0
URL=http://127.0.0.1:8080/kurjun/rest
USER=subutai
[email protected]
FIX=fix
curl -k "$URL/auth/token?user=$USER" -o /tmp/filetosign
gpg --armor -u $EMAIL --clearsign /tmp/filetosign
TOKEN=$(curl -k -s -Fmessage="`cat /tmp/filetosign.asc`" -Fuser=$USER "$URL/auth/token")
curl -k "$URL/quota?user=$USER&token=$TOKEN&fix=$FIX"
//{"left":4294967296,"quota":4294967296,"used":0}
/kurjun/rest/{template,apt,raw}/delete
Methods:
DELETE
delete endpoint allows a user to delete an artifact from Gorjun.
Following fields are required:
token- user authentication token.id- artifact identifier.
URL=https://devcdn.subutai.io:8338/kurjun/rest
ID=ab93021f-10a3-48cd-a291-37ae80d4c66e
TOKEN=95a25d0eb8d58549d5e985eb26c32aa2c023ac8f6e5c427351a13b13e50c59bd
curl -v -X "DELETE" "$URL/raw/delete?id=$ID&token=$TOKEN"
/kurjun/rest/{template,apt,raw}/upload
upload endpoint allows a user upload private and public artifacts to CDN.
USER=tester
[email protected]
echo "Obtaining auth id..."
curl -k "$URL/auth/token?user=$USER" -o /tmp/filetosign
rm -rf /tmp/filetosign.asc
gpg --armor -u $EMAIL --clearsign /tmp/filetosign
SIGNED_AUTH_ID=$(cat /tmp/filetosign.asc)
echo "Auth id obtained and signed\\n$SIGNED_AUTH_ID"
TOKEN=$(curl -k -s -Fmessage="$SIGNED_AUTH_ID" -Fuser=$USER "$URL/auth/token")
echo "Token obtained $TOKEN"
echo "Uploading file..."
ID=$(curl -sk -H "token: $TOKEN" -Ffile=@abdysamat-apache-subutai-template_4.0.0_amd64.tar.gz -Fprivate="true" "$URL/template/upload")
echo "File uploaded with ID $ID"
echo "Signing file..."
SIGN=$(echo $ID | gpg --clearsign -u $EMAIL)
curl -ks -Ftoken="$TOKEN" -Fsignature="$SIGN" "$URL/auth/sign"
echo -e "\\nCompleted"```