open-nomad/website/source/docs/http/client-fs.html.md
2016-06-24 11:09:24 -07:00

2.8 KiB

layout page_title sidebar_current description
http HTTP API: /v1/client/fs docs-http-client-fs The '/v1/client/fs` endpoints are used to read the contents of an allocation directory.

/v1/client/fs

The fs endpoints are used to read the contents of files and directories inside an allocation directory. The API endpoints are hosted by the Nomad client and requests have to be made to the Client where the particular allocation was placed.

GET

Description
Read contents of a file in an allocation directory.
Method
GET
URL
`/v1/client/fs/cat/`
Parameters
  • path required The path relative to the root of the allocation directory. It defaults to `/`
Returns
```

... 07:49 docker/3e8f0f4a67c2[924]: 1:M 22 Jun 21:07:49.110 # Server started, Redis version 3.2.1 07:49 docker/3e8f0f4a67c2[924]: 1:M 22 Jun 21:07:49.110 * The server is now ready to accept connections on port 6379 ... ```

Description
List files in an allocation directory.
Method
GET
URL
`/v1/client/fs/ls/`
Parameters
  • path required The path relative to the root of the allocation directory. It defaults to `/`, the root of the allocation directory.
Returns
```javascript
[
  {
    "Name": "alloc",
    "IsDir": true,
    "Size": 4096,
    "FileMode": "drwxrwxr-x",
    "ModTime": "2016-03-15T15:40:00.414236712-07:00"
  },
  {
    "Name": "redis",
    "IsDir": true,
    "Size": 4096,
    "FileMode": "drwxrwxr-x",
    "ModTime": "2016-03-15T15:40:56.810238153-07:00"
  }
]
```
Description
Stat a file in an allocation directory.
Method
GET
URL
`/v1/client/fs/stat/`
Parameters
  • path required The path of the file relative to the root of the allocation directory.
Returns
```javascript
{
  "Name": "redis-syslog-collector.out",
  "IsDir": false,
  "Size": 96,
  "FileMode": "-rw-rw-r--",
  "ModTime": "2016-03-15T15:40:56.822238153-07:00"
}
```