ScriptController Resource

This controller is responsible for handling user scripts. These user can be used by the provisoner to run on the created VMs.

POST /user/v1.0/script/

Security Roles Allowed
ADMIN, USER
Request Body
media type data type
application/json Script (JSON)
application/xml script (XML)
Response Codes
code condition
401 Bad credentials
Response Body
media type data type
application/json string (JSON)
application/xml string (XML)

Example

Request
POST /user/v1.0/script/
Content-Type: application/json
Accept: application/json

                
{
  "name" : "config.sh",
  "contents" : "    #!/bin/bash\necho \"Reading system-wide config....\" >&2\\n. /etc/cool.cfg\nif [ -r ~/.coolrc ]; then\n  echo \"Reading user config....\" >&2\\n  . ~/.coolrc\\nfi",
  "owner" : "user1",
  "id" : "58e3946e0fb4f562d84ba1ad",
  "timestamp" : 1499793079011
}
                
              
Response
HTTP/1.1 201 Looks Good
Content-Type: application/json

                
...
                
              

DELETE /user/v1.0/script/all

Security Roles Allowed
ADMIN
Response Codes
code condition
401 Bad credentials
Response Body
media type data type
application/json string (JSON)
application/xml string (XML)

Example

Request
DELETE /user/v1.0/script/all
Accept: application/json

              
Response
HTTP/1.1 204 Looks Good
Content-Type: application/json

                
...
                
              

GET /user/v1.0/script/ids

Gets the IDs of all the stored scripts

Response Codes
code condition
401 Bad credentials
Response Body
media type data type description
application/json array of string (JSON) a list of all the IDs
application/xml list of string (XML)

Example

Request
GET /user/v1.0/script/ids
Accept: application/json

              
Response
HTTP/1.1 200 Looks Good
Content-Type: application/json

                
...
                
              

GET /user/v1.0/script/sample

Security Roles Allowed
ADMIN, USER
Response Codes
code condition
401 Bad credentials
Response Body
media type data type
application/json Script (JSON)
application/xml script (XML)

Example

Request
GET /user/v1.0/script/sample
Accept: application/json

              
Response
HTTP/1.1 200 Looks Good
Content-Type: application/json

                
{
  "name" : "config.sh",
  "contents" : "    #!/bin/bash\necho \"Reading system-wide config....\" >&2\\n. /etc/cool.cfg\nif [ -r ~/.coolrc ]; then\n  echo \"Reading user config....\" >&2\\n  . ~/.coolrc\\nfi",
  "owner" : "user1",
  "id" : "58e3946e0fb4f562d84ba1ad",
  "timestamp" : 1499793079011
}
                
              

POST /user/v1.0/script/upload

Uploads a script

Security Roles Allowed
ADMIN, USER
Request Parameters
name type description constraints
file query   required
Response Codes
code condition
401 Bad credentials
Response Body
media type data type description
application/json string (JSON) the ID of the stopred script
application/xml string (XML)

Example

Request
POST /user/v1.0/script/upload
Accept: application/json

              
Response
HTTP/1.1 201 Looks Good
Content-Type: application/json

                
...
                
              

DELETE /user/v1.0/script/{id}

Security Roles Allowed
ADMIN, USER
Request Parameters
name type description constraints
id path   required
Response Codes
code condition
401 Bad credentials
Response Body
media type data type
application/json string (JSON)
application/xml string (XML)

Example

Request
DELETE /user/v1.0/script/{id}
Accept: application/json

              
Response
HTTP/1.1 204 Looks Good
Content-Type: application/json

                
...
                
              

GET /user/v1.0/script/{id}

Gets a script

Security Roles Allowed
ADMIN, USER
Request Parameters
name type description constraints
id path   required
Response Codes
code condition
401 Bad credentials
Response Body
media type data type description
application/json Script (JSON) the script
application/xml script (XML)

Example

Request
GET /user/v1.0/script/{id}
Accept: application/json

              
Response
HTTP/1.1 200 Looks Good
Content-Type: application/json

                
{
  "name" : "config.sh",
  "contents" : "    #!/bin/bash\necho \"Reading system-wide config....\" >&2\\n. /etc/cool.cfg\nif [ -r ~/.coolrc ]; then\n  echo \"Reading user config....\" >&2\\n  . ~/.coolrc\\nfi",
  "owner" : "user1",
  "id" : "58e3946e0fb4f562d84ba1ad",
  "timestamp" : 1499793079011
}