API规范

文件服务API入口与API列表如下:

  • API入口:
区域 API入口
北京1区(bj1) https://bj1.share.api.shenzhouyun.com
广东1区(gd1) https://gd1.share.api.shenzhouyun.com

Note

广东节点暂未上线

  • API列表:
资源 操作 HTTP方法 URI路径
文件共享 (Share) 查看所有文件共享 GET /v1/{tenant_id}/shares
查看所有文件共享详情 GET /v1/{tenant_id}/shares/detail
查看文件共享 GET /v1/{tenant_id}/shares/{share_id}
创建文件共享 POST /v1/{tenant_id}/shares
修改文件共享 PUT /v1/{tenant_id}/shares/{share_id}
删除文件共享 DELETE /v1/{tenant_id}/shares/{share_id}
访问规则 (Rule) 查看访问规则 POST /v1/{tenant_id}/shares/{share_id}/action
增加访问规则 POST /v1/{tenant_id}/shares/{share_id}/action
删除访问规则 POST /v1/{tenant_id}/shares/{share_id}/action
共享网络 (ShareNetwork) 查看所有共享网络 GET /v1/{tenant_id}/share-networks
查看所有共享网络详情 GET /v1/{tenant_id}/share-networks/detail
查看共享网络 GET /v1/{tenant_id}/share-networks/{share_network_id}
创建共享网络 POST /v1/{tenant_id}/share-networks
修改共享网络 PUT /v1/{tenant_id}/share-networks/{share_network_id}
删除共享网络 DELETE /v1/{tenant_id}/share-networks/{share_network_id}
配额 (Quota) 查看配额 GET /v1/{tenant_id}/os-quota-sets/{tenant_id}
查看默认配额 GET /v1/{tenant_id}/os-quota-sets/{tenant_id}/defaults
修改配额 PUT /v1/{tenant_id}/os-quota-sets/{tenant_id}
删除配额 DELETE /v1/{tenant_id}/os-quota-sets/{tenant_id}

文件共享 (Share)

查看所有文件共享

HTTP方法 URI路径 描述
GET /v1/{tenant_id}/shares 查看所有文件共享

请求样例

curl -s \
     -X GET https://bj1.share.api.shenzhouyun.com//v1/{tenant_id}/shares \
     -H "Accept: application/json" \
     -H "X-Auth-Token: {token_id}"

返回样例:

{
    "shares": [
        {
            "id": "708f359f-72dd-4473-8982-a50710d10ffa",
            "links": [
                {
                    "href": "http://10.250.10.250:8786/v1/75076824281346f6b61942638a45e856/shares/708f359f-72dd-4473-8982-a50710d10ffa",
                    "rel": "self"
                },
                {
                    "href": "http://10.250.10.250:8786/75076824281346f6b61942638a45e856/shares/708f359f-72dd-4473-8982-a50710d10ffa",
                    "rel": "bookmark"
                }
            ],
            "name": "222"
        },
        {
            "id": "c030cb55-f3cf-4136-881c-cab87eda0fa1",
            "links": [
                {
                    "href": "http://10.250.10.250:8786/v1/75076824281346f6b61942638a45e856/shares/c030cb55-f3cf-4136-881c-cab87eda0fa1",
                    "rel": "self"
                },
                {
                    "href": "http://10.250.10.250:8786/75076824281346f6b61942638a45e856/shares/c030cb55-f3cf-4136-881c-cab87eda0fa1",
                    "rel": "bookmark"
                }
            ],
            "name": "111"
        }
    ]
}

查看所有文件共享详情

HTTP方法 URI路径 描述
GET /v1/{tenant_id}/shares/detail 查看所有文件共享详情

请求样例

curl -s \
     -X GET https://bj1.share.api.shenzhouyun.com//v1/{tenant_id}/shares/detail \
     -H "Accept: application/json" \
     -H "X-Auth-Token: {token_id}"

返回样例:

{
    "shares": [
        {
            "availability_zone": "nova",
            "created_at": "2014-11-26T06:40:08.000000",
            "description": "222",
            "export_location": "10.254.0.18:/shares/share-708f359f-72dd-4473-8982-a50710d10ffa",
            "host": "devstack-manila@backend1",
            "id": "708f359f-72dd-4473-8982-a50710d10ffa",
            "links": [
                {
                    "href": "http://10.250.10.250:8786/v1/75076824281346f6b61942638a45e856/shares/708f359f-72dd-4473-8982-a50710d10ffa",
                    "rel": "self"
                },
                {
                    "href": "http://10.250.10.250:8786/75076824281346f6b61942638a45e856/shares/708f359f-72dd-4473-8982-a50710d10ffa",
                    "rel": "bookmark"
                }
            ],
            "metadata": {},
            "name": "222",
            "project_id": "75076824281346f6b61942638a45e856",
            "share_network_id": "31633d57-3255-436f-9883-6241fcf5343e",
            "share_proto": "NFS",
            "size": 4,
            "snapshot_id": null,
            "status": "available",
            "volume_type": null
        },
        {
            "availability_zone": "nova",
            "created_at": "2014-11-24T11:10:43.000000",
            "description": "111",
            "export_location": "10.254.0.3:/shares/share-c030cb55-f3cf-4136-881c-cab87eda0fa1",
            "host": "devstack-manila@backend1",
            "id": "c030cb55-f3cf-4136-881c-cab87eda0fa1",
            "links": [
                {
                    "href": "http://10.250.10.250:8786/v1/75076824281346f6b61942638a45e856/shares/c030cb55-f3cf-4136-881c-cab87eda0fa1",
                    "rel": "self"
                },
                {
                    "href": "http://10.250.10.250:8786/75076824281346f6b61942638a45e856/shares/c030cb55-f3cf-4136-881c-cab87eda0fa1",
                    "rel": "bookmark"
                }
            ],
            "metadata": {},
            "name": "111",
            "project_id": "75076824281346f6b61942638a45e856",
            "share_network_id": "9c774780-ff5e-43a8-ad6e-00743637e128",
            "share_proto": "NFS",
            "size": 1,
            "snapshot_id": null,
            "status": "available",
            "volume_type": null
        }
    ]
}

查看指定文件共享

HTTP方法 URI路径 描述
GET /v1/{tenant_id}/shares/{share_id} 查看文件共享

请求样例

curl -s \
     -X GET https://bj1.share.api.shenzhouyun.com//v1/{tenant_id}/shares/{share_id} \
     -H "Accept: application/json" \
     -H "X-Auth-Token: {token_id}"

返回样例:

{
"share": {
"availability_zone": "nova",
"created_at": "2014-11-24T11:10:43.000000",
"description": "111",
"export_location": "10.254.0.3:/shares/share-c030cb55-f3cf-4136-881c-cab87eda0fa1",
"host": "devstack-manila@backend1",
"id": "c030cb55-f3cf-4136-881c-cab87eda0fa1",
"links": [
{
"href": "http://10.250.10.250:8786/v1/75076824281346f6b61942638a45e856/shares/c030cb55-f3cf-4136-881c-cab87eda0fa1",
"rel": "self"
},
{
"href": "http://10.250.10.250:8786/75076824281346f6b61942638a45e856/shares/c030cb55-f3cf-4136-881c-cab87eda0fa1",
"rel": "bookmark"
}
],
"metadata": {},
"name": "111",
"project_id": "75076824281346f6b61942638a45e856",
"share_network_id": "9c774780-ff5e-43a8-ad6e-00743637e128",
"share_proto": "NFS",
"size": 1,
"snapshot_id": null,
"status": "available",
"volume_type"