Volumes HTTP API
The /volume
and /volumes
endpoints are used to query for and interact with
volumes.
List Volumes
This endpoint lists all volumes.
Method | Path | Produces |
---|---|---|
GET | /v1/volumes | application/json |
The table below shows this endpoint's support for blocking queries and required ACLs.
Blocking Queries | ACL Required |
---|---|
YES | namespace:csi-list-volume |
Parameters
type
(string: "")
- Specifies the type of volume to query. Currently only supportscsi
. This is specified as a query string parameter. Returns an empty list if omitted.node_id
(string: "")
- Specifies a string to filter volumes based on an Node ID prefix. Because the value is decoded to bytes, the prefix must have an even number of hexadecimal characters (0-9a-f). This is specified as a query string parameter.plugin_id
(string: "")
- Specifies a string to filter volumes based on a plugin ID prefix. Because the value is decoded to bytes, the prefix must have an even number of hexadecimal characters (0-9a-f). This is specified as a query string parameter.next_token
(string: "")
- This endpoint supports paging. Thenext_token
parameter accepts a string which identifies the next expected volume. This value can be obtained from theX-Nomad-NextToken
header from the previous response.per_page
(int: 0)
- Specifies a maximum number of volumes to return for this request. If omitted, the response is not paginated. The value of theX-Nomad-NextToken
header of the last response can be used as thenext_token
of the next request to fetch additional pages.filter
(string: "")
- Specifies the expression used to filter the results. Consider using pagination or a query parameter to reduce resource used to serve the request.
Sample Request
Sample Response
Read Volume
This endpoint reads information about a specific volume.
Method | Path | Produces |
---|---|---|
GET | /v1/volume/csi/:volume_id | application/json |
The table below shows this endpoint's support for blocking queries and required ACLs.
Blocking Queries | ACL Required |
---|---|
YES | namespace:csi-read-volume |
Parameters
:volume_id
(string: <required>)
- Specifies the ID of the volume. This must be the full ID. This is specified as part of the path.
Sample Request
Sample Response
Register Volume
This endpoint registers an external volume with Nomad. The volume must exist in the external storage provider (see Create Volume below). It is an error to register an already registered volume.
Method | Path | Produces |
---|---|---|
PUT | /v1/volume/csi/:volume_id | application/json |
The table below shows this endpoint's support for blocking queries and required ACLs.
Blocking Queries | ACL Required |
---|---|
NO | namespace:csi-write-volume |
Parameters
:volume_id
(string: <required>)
- Specifies the ID of the volume. This must be the full ID. This is specified as part of the path.
Sample Payload
The payload must include a JSON document that describes the volume's parameters.
Sample Request
Create Volume
This endpoint creates a volume in an external storage provider and registers
it with Nomad. It is an error to create an already-registered volume. Only CSI
plugins that implement the Controller interface with
the CREATE_DELETE_VOLUME
capability support this endpoint.
Method | Path | Produces |
---|---|---|
PUT | /v1/volume/csi/:volume_id/create | application/json |
The table below shows this endpoint's support for blocking queries and required ACLs.
Blocking Queries | ACL Required |
---|---|
NO | namespace:csi-write-volume |
Parameters
:volume_id
(string: <required>)
- Specifies the ID of the volume. This must be the full ID. This is specified as part of the path.
Sample Payload
The payload must include a JSON document that describes the volume's parameters.
Sample Request
Deregister Volume
This endpoint deregisters an external volume with Nomad. It is an error to deregister a volume that is in use.
Method | Path | Produces |
---|---|---|
DELETE | /v1/volume/csi/:volume_id | application/json |
The table below shows this endpoint's support for blocking queries and required ACLs.
Blocking Queries | ACL Required |
---|---|
NO | namespace:csi-write-volume |
Parameters
:volume_id
(string: <required>)
- Specifies the ID of the volume. This must be the full ID. This is specified as part of the path.force
(bool: false)
- Force deregistration of the volume and immediately drop claims for terminal allocations. Returns an error if the volume has running allocations. This does not detach the volume from client nodes. This is specified as a query string parameter.
Sample Request
Delete Volume
This endpoint deletes an external volume from the storage provider, and
deregisters it from Nomad. It is an error to delete a volume that is in
use. Only CSI plugins that implement the Controller
interface with the CREATE_DELETE_VOLUME
capability support this endpoint.
Method | Path | Produces |
---|---|---|
DELETE | /v1/volume/csi/:volume_id/delete | application/json |
The table below shows this endpoint's support for blocking queries and required ACLs.
Blocking Queries | ACL Required |
---|---|
NO | namespace:csi-write-volume |
This endpoint accepts a X-Nomad-CSI-Secrets
header to set secrets
for deleting the volume as comma-separated key-value pairs (see the
example below). These secrets will be merged with any secrets already
stored when the CSI volume was created.
Parameters
:volume_id
(string: <required>)
- Specifies the ID of the volume. This must be the full ID. This is specified as part of the path.
Sample Request
Detach Volume
This endpoint detaches an external volume from a Nomad client node. It is an error to detach a volume that is in use.
Method | Path | Produces |
---|---|---|
DELETE | /v1/volume/csi/:volume_id/detach | application/json |
The table below shows this endpoint's support for blocking queries and required ACLs.
Blocking Queries | ACL Required |
---|---|
NO | namespace:csi-write-volume |
Parameters
:volume_id
(string: <required>)
- Specifies the ID of the volume. This must be the full ID. This is specified as part of the path.node
(string: <required>)
- The node to detach the volume from. This is specified as a query string parameter.
Sample Request
List External Volumes
This endpoint lists storage volumes that are known to the external storage
provider but may not be registered with Nomad. Only CSI plugins that
implement the Controller interface with the
LIST_VOLUMES
capability support this endpoint.
Method | Path | Produces |
---|---|---|
GET | /v1/volumes/external | application/json |
The table below shows this endpoint's support for blocking queries and required ACLs.
Blocking Queries | ACL Required |
---|---|
YES | namespace:csi-list-volume |
Parameters
plugin_id
(string: "")
- Specifies a string to filter volumes based on a plugin ID prefix. Because the value is decoded to bytes, the prefix must have an even number of hexadecimal characters (0-9a-f). This is specified as a query string parameter.next_token
(string: "")
- This endpoint supports paging. Thenext_token
parameter accepts a string returned in a previous response'sNextToken
field to request the next page of results.per_page
(int: <required>)
- Specifies a maximum number of snapshots to return for this request. The response will include aNextToken
field that can be passed to the next request to fetch additional pages.
Sample Request
Sample Response
Create Snapshot
This endpoint creates a snapshot of a volume on the external storage
provider. Only CSI plugins that implement the
Controller interface with the
CREATE_DELETE_SNAPSHOT
capability support this endpoint.
Method | Path | Produces |
---|---|---|
POST | /v1/volumes/snapshot | application/json |
The table below shows this endpoint's support for blocking queries and required ACLs.
Blocking Queries | ACL Required |
---|---|
NO | namespace:csi-write-volume |
Sample Payload
The payload must include a JSON document that describes the snapshot's parameters.
Sample Request
Sample Response
Delete Snapshot
This endpoint deletes a volume snapshot from the external storage
provider. Only CSI plugins that implement the
Controller interface with the
CREATE_DELETE_SNAPSHOT
capability support this endpoint.
Method | Path | Produces |
---|---|---|
DELETE | /v1/volumes/snapshot | application/json |
The table below shows this endpoint's support for blocking queries and required ACLs.
Blocking Queries | ACL Required |
---|---|
NO | namespace:csi-write-volume |
This endpoint accepts a X-Nomad-CSI-Secrets
header to set secrets
for deleting the snapshot as comma-separated key-value pairs (see the
example below). These secrets will be merged with any secrets already
stored when the CSI snapshot was created.
Parameters
plugin_id
(string: <required>)
- Specifies the prefix of a CSI plugin ID to perform the delete. Because the value is decoded to bytes, the prefix must have an even number of hexadecimal characters (0-9a-f). This is specified as a query string parameter.snapshot_id
(string: <required>)
- Specifies the snapshot ID to delete. This is specified as a query parameter.
Sample Request
List Snapshots
This endpoint lists volume snapshots on the external storage provider. Only
CSI plugins that implement the Controller interface
with the LIST_SNAPSHOTS
capability support this endpoint.
Method | Path | Produces |
---|---|---|
GET | /v1/volumes/snapshot | application/json |
The table below shows this endpoint's support for blocking queries and required ACLs.
Blocking Queries | ACL Required |
---|---|
YES | namespace:csi-list-volume |
This endpoint accepts a X-Nomad-CSI-Secrets
header to set secrets
for deleting the snapshot as comma-separated key-value pairs (see the
example below). These secrets will be merged with any secrets already
stored when the CSI snapshot was created.
Parameters
plugin_id
(string: <required>)
- Specifies the prefix of a CSI plugin ID to perform the list. Because the value is decoded to bytes, the prefix must have an even number of hexadecimal characters (0-9a-f). This is specified as a query string parameter.next_token
(string: "")
- This endpoint supports paging. Thenext_token
parameter accepts a string returned in a previous response'sNextToken
field to request the next page of results.per_page
(int: <required>)
- Specifies a maximum number of snapshots to return for this request. The response will include aNextToken
field that can be passed to the next request to fetch additional pages.
Sample Request
Sample Response