Go to main content

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

Exit Print View

Updated: December 2017
 
 

Target Groups

Target groups are collections of targets.

Table 57  Target Group Commands
Request
Path /san/v1.0
Description
GET
/<protocol>/target-groups
List all SAN target group for the given protocol (FC, iSCSI, SRP) objects
GET
/<protocol>/target-groups /<target-group>
Get the specified SAN target group for the given protocol (FC, iSCSI, SRP) properties
POST
/<protocol>/target-groups
Create a new SAN target group for the given protocol (FC, iSCSI, SRP)
PUT
/<protocol>/target-groups /<target-group>
Modify the specified SAN target group for the given protocol (FC, iSCSI, SRP) object
DELETE
/<protocol>/target-groups /<target-group>
Destroy the specified target-group object

These commands use the following URI parameters.

Table 58  URI Parameters
Name
Description
protocol
The NAS protocol for the initiator (FC, iSCSI, SRP)
name
The name of the target group

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.1986-03.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 named "target-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.1986-03.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.1986-03.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.1986-03.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