Go to main content

Oracle® ZFS Storage Appliance RESTful API Guide, Release OS8.8.0

Exit Print View

Updated: November 2018
 
 

Target Groups

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:

protocol

The NAS protocol for the initiator: fc, iscsi, or srp

target-group

The name of the target group

Table 54  Target Groups Commands
Request
Append to Path /san/v1.0
Description
GET
/protocol/target-groups
List all SAN target group for the given protocol: fc, iscsi, or srp objects
GET
/protocol/target-groups/target-group
Get the specified SAN target group for the given protocol: fc, iscsi, or srp properties
POST
/protocol/target-groups
Create a new SAN target group for the given protocol: fc, iscsi, or srp
PUT
/protocol/target-groups/target-group
Modify the specified SAN target group for the given protocol: fc, iscsi, or srp object
DELETE
/protocol/target-groups/target-group
Destroy the specified target-group object

List Target Groups

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",
        ...
    }]
}

Get Target 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"]
    }
}

Create a Target Group

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"]
    }
}

Delete a Target Group

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