All project operations can be scoped to a given pool. Commands that operate across all projects append "/projects" to the URI, and commands that operate on a single project append "/projects/{project}".
|
The following table shows the list of editable properties within a project resource.
|
This command lists all of the projects in a given pool. Each returned project contains the list of modifiable properties listed above as well as the pool name, creation time, loading state, replication actions and data usage.
Query Parameters filter– A simple string match filter that requires a property within the project to contain the same filter string within its value.
|
Example Request:
GET /api/storage/v1/pools/gold/projects HTTP/1.1 Host: zfs-storage.example.com Accept: application/json
On a successful get, an HTTP code 200 (OK) is returned along with an array of project properties in JSON format.
Example Result:
HTTP/1.1 200 OK Content-Type: application/json { “projects”: [{ “name”: “proj-01”, ... }, { “name”: “proj-02”, ... } }
A list of all projects across all pools is also supported; the URI would contain only the /projects path.
Example Request to Get all Projects with "backup" as Part its Properties:
GET /projects?filter=backup HTTP/1.1 Host: zfs-storage.example.com Accept: application/json
This command lists the properties for a single project in a given pool. A successful get returns HTTP Code 200 (OK) along with the project properties in JSON format.
|
Example Request to List Project Named "proj-01" in the "gold" Pool:
GET /api/storage/v1/pools/gold/projects/proj-01 HTTP/1.1 Host: zfs-storage.example.com Accept: application/json
Example Response:
HTTP/1.1 200 OK Content-Type: application/json { "project": { "default_volblocksize": 8192.0, "logbias": "latency", "creation": "20130411T20:02:35", "nodestroy": false, "dedup": false, "sharenfs": "on", "sharesmb": "off", "default_permissions": "700", "mountpoint": "/export", "snaplabel": "", "id": "042919bb-0882-d903-0000-000000000000", "readonly": false, "rrsrc_actions": [], "compression": "off", "sharetftp": "", "default_sparse": false, "snapdir": "hidden", "aclmode": "discard", "copies": 1, "aclinherit": "restricted", "shareftp": "", "canonical_name": "gold/local/default", "recordsize": 131072.0, "usage": { "available": 1758424767306.0, "loading": false, "quota": 0.0, "snapshots": 0.0, "compressratio": 100.0, "child_reservation": 0.0, "reservation": 0.0, "total": 45960.0, "data": 45960.0 }, "default_volsize": 0.0, "secondarycache": "all", "collection": "local", "exported": true, "vscan": false, "reservation": 0.0, "atime": true, "pool": "gold", "default_user": "nobody", "name": "default", "checksum": "fletcher4", "default_group": "other", "sharesftp": "", "nbmand": false, "sharedav": "", "rstchown": true } }
The create project command creates a project with a given name residing in the given storage pool. The new project with default properties is returned.
|
JSON Body Request Parameters:
name – The project name must be supplied to create a project.
project properties – Any of the project properties can be set as the new project's initial values.
Example Request (to create a project named "proj-01"):
POST /api/storage/v1/pools/gold/projects HTTP/1.1 Hosta: zfs-storage.example.com Content-Type: application/json Accept: application/json { “name”: “proj-01”, “sharenfs”: “ro” }
Successful creation returns HTTP Status 201 (Created) with the location header containing the URI of the new project. The body contains all of the project properties in JSON format.
Example Results:
HTTP/1.1 201 Created Content-Type: application/json Location: http://zfs-storage.example.com:215 /pools/gold/projects/proj-01 { “project”: { “name”: “proj-01”, "href": "/api/storage/v1/pools/gold/projects/proj-01", “mountpoint”: “/export/acme/gold”, ... } }
The modify project command changes the attributes of an existing project.
|
Request Parameters - Project Properties – Any of the project properties can be set as the new project’s initial values.
Example Request (to change a project's name from "proj-01" to "new-name"):
POST /api/storage/v1/pools/gold/projects/proj-01 HTTP/1.1 Host: zfs-storage.example.com Content-Type: application/json Accept: application/json { “name”: “new-name”, “sharenfs”: “rw”, “compression”: “gzip-9” }
Successful response returns HTTP Status 202 (Accepted) and lists all project properties.
Example Response:
HTTP/1.1 201 Created Content-Type: application/json Location: /api/storage/v1/pools/gold/projects/new-name { “project”: { “name”: “new-name”, “sharenfs”: “rw”, “compression: “gzip-9”, ... } }
The delete project command removes a single project in a given pool.
|
Example Request:
DELETE /api/storage/v1/pools/gold/projects/proj-01 HTTP/1.1 Host: zfs-storage.example.com Accept: application/json
Get requests project usage resources can be used to get usage data per user or per group for the project.