Go to main content

Oracle® ZFS Storage Appliance RESTful API 指南,发行版 OS8.8.0

退出打印视图

更新时间: 2018 年 11 月
 
 

模式

管理定制模式属性。

表 68  模式命令
请求
附加到路径 /api/storage/v1
说明
GET
/schema
列出所有 NAS 模式属性对象
GET
/schema/property
获取指定的 NAS 模式属性属性
POST
/schema
创建新的 NAS 模式属性
PUT
/schema/property
修改指定的 NAS 模式属性对象
DELETE
/schema/property
删除指定的 NAS 模式属性对象

通过在定制属性名称中添加前缀 custom:,可在项目、文件系统和 LUN 中设置各个定制模式属性。

例如,以下 PUT 正文修改了名为 priority 的定制 int 属性:

{"custom:priority": 5}
表 69  模式参数
参数
说明
property
属性名称(不可变)
description
属性描述(针对浏览器界面)
type
类型("String"、"Integer"、"PositiveInteger"、"Boolean"、"EmailAddress"、"Host")

列出属性

列出模式属性。

请求示例:

GET /api/storage/v1/schema

结果示例:

{
    "properties": [{
        "description": "bob",
        "href": "/api/storage/v1/schema/bob",
        "property": "bob",
        "type": "String"
    },{
        "description": "boo",
        "href": "/api/storage/v1/schema/boo",
        "property": "boo",
        "type": "String"
    }]
}

获取属性

获取模式属性。

请求示例:

GET /api/storage/v1/schema/priority

结果示例:

{
    "property": {
        "description": "priority",
        "href": "/api/storage/v1/schema/priority",
        "property": "bob",
        "type": "Integer"
    }
}

创建属性

创建新的模式属性。

请求示例:

POST /api/storage/v1/schema HTTP/1.1
Host: zfs-storage.example.com:215
Content-Type: application/json
Content-Length: 64

{"property":"priority", "type":"Integer", "description":"Oh my"}

结果示例:

HTTP/1.1 201 Created
Content-Length: 89
X-Zfssa-Nas-Api: 1.0
Content-Type: application/json
Location: /api/storage/v1/schema/priority

{
    "property": {
        "href": "/api/storage/v1/schema",
        "type": "Integer",
        "description": "Oh my"
    }
}

修改属性

修改模式属性。

请求示例:

PUT /api/storage/v1/schema/priority

{"description":"My custom priority level"}

结果示例:

HTTP/1.1 202 Accepted
X-Zfssa-Nas-Api: 1.0
Content-Type: application/json
Content-Length: 90

{
    "property": {
        "href": "//api/storage/v1/schema/priority",
        "type": "Integer",
        "description": "My custom priority level"
    }
}

删除属性

此命令删除模式属性。

请求示例:

DELETE /api/storage/v1/schema/me HTTP/1.1

结果示例:

HTTP/1.1 204 No Content