Target groups are collections of targets. The target groups commands are listed in the table below.
The target groups commands take the following URI parameters:
The NAS protocol for the initiator: fc, iscsi, or srp
The name of the target group
|
Lists all of the target groups available for an appliance. On success, HTTP status 200 (OK) is returned and the body contains a JSON object with a property named groups that contains an array of target group objects.
Example Request:
GET /api/san/v1/iscsi/target-groups Host: zfs-storage.example.com:215 Authorization: Basic abcd123MWE= Accept: application/json
Example Response:
HTTP/1.1 200 OK Content-Type: application/json Content-Length: 237 { "groups": [{ "href": "/api/san/v1/iscsi/target-groups/test-group", "name": "test-group", "targets": [ "iqn.zfs-storage.example.com.sun:02:31d26d2e-6aa0-6054-fe58-8b1fb508b008" ] }, { "href": "/api/san/v1/iscsi/target-groups/alt-group", ... }] }
Gets a single target group. The request takes a single URI parameter, which is the target group name. The response body contains a JSON object property named group that contains the target group properties.
Example Request:
GET /api/san/v1/iscsi/target-groups/test-group Host: zfs-storage.example.com:215 Authorization: Basic abcd123MWE= Accept: application/json
Example Response:
HTTP/1.1 200 OK Content-Type: application/json { "group": { "href": "/api/san/v1/iscsi/target-groups/test-group", "name": "test-group", "targets": [ "iqn.zfs-storage.example.com.sun:02:0d5a0ed8-44b6-49f8-a594-872bf787ca5a"] } }
Creates a new iSCSI target group. The request body is a JSON object with a single name property that is the name of the new group.
Example Request:
POST /api/san/v1/iscsi/target-groups HTTP/1.1 Host: zfs-storage.example.com:215 Authorization: Basic abcd123MWE Accept: application/json Content-Type: application/json Content-Length: 97 {"name":"test-group", "targets": ["iqn.zfs-storage.example.com.sun:02:31d26d2e-6aa0-6054-fe58-8b1fb508b008"]}
Example Response:
HTTP/1.1 201 Created Content-Type: application/json Content-Length: 154 X-Zfssa-San-Api: 1.0 Location: /api/san/v1/iscsi/target-groups/test-group { "group": { "href": "/api/san/v1/iscsi/target-groups/test-group", "name": "test-group", "targets": [ "iqn.zfs-storage.example.com.sun:02:31d26d2e-6aa0-6054-fe58-8b1fb508b008"] } }
Deletes an existing target group.
Example Request:
DELETE /api/nas/v1.0/iscsi/target-groups/test-group
Successful delete returns HTTP status 204 (No Content):
HTTP/1.1 204 No-Content