6.9.1. API规范
文件服务API入口与API列表如下
- API入口:
区域 | API入口 |
---|---|
北京1区(regionone) | https://regionone-share-api.sinnetcloud.com.cn |
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} |
6.9.3. 访问规则 (Rule)
6.9.3.1. 查看访问规则
HTTP方法 | URI路径 | 描述 |
---|---|---|
POST | /v1/{tenant_id}/shares/{share_id}/action | 查看访问规则 |
请求样例
curl -s -X POST :regionone_share`/v1/{tenant_id}/shares/{share_id}/action` -H "Content-Type: application/json" -H "X-Auth-Token: {token_id}" -d '{ "os-access_list": null }'
返回样例:
{ "access_list": [ { "access_to": "10.0.0.4", "access_type": "ip", "id": "5894a742-7d6f-4794-9b05-392f2fba18dd", "state": "active" }, { "access_to": "10.0.0.5", "access_type": "ip", "id": "cbf3dc9b-59f9-4a2d-b2f5-4b161709c351", "state": "active" } ] }
6.9.3.2. 增加访问规则
HTTP方法 | URI路径 | 描述 |
---|---|---|
POST | /v1/{tenant_id}/shares/{share_id}/action | 增加访问规则 |
请求样例
curl -s -X POST :regionone_share`/v1/{tenant_id}/shares/{share_id}/action` -H "Content-Type: application/json" -H "X-Auth-Token: {token_id}" -d '{ "os-allow_access": { "access_to": "1.1.1.1", "access_type": "ip" } }'
返回样例:
{ "access": { "access_to": "1.1.1.1", "access_type": "ip", "created_at": "2014-11-27T09:21:47.833205", "deleted": "False", "deleted_at": null, "id": "09f256e4-0be1-48df-b780-0e006732d462", "share_id": "708f359f-72dd-4473-8982-a50710d10ffa", "state": "new", "updated_at": null } }
6.9.3.3. 删除访问规则
HTTP方法 | URI路径 | 描述 |
---|---|---|
POST | /v1/{tenant_id}/shares/{share_id}/action | 删除访问规则 |
请求样例
curl -s -X POST :regionone_share`/v1/{tenant_id}/shares/{share_id}/action` -H "Content-Type: application/json" -H "X-Auth-Token: {token_id}" -d '{ "os-deny_access": { "access_id": "42c2ecae-f0cb-4244-98fa-526dc8f9bd26" } }'
返回样例:
NULL
6.9.5. 配额 (Quota)
6.9.5.1. 查看配额
HTTP方法 | URI路径 | 描述 |
---|---|---|
GET | /v1/{tenant_id}/os-quota-sets/{tenant_id} | 查看配额 |
请求样例
curl -s -X GET :regionone_share`/v1/{tenant_id}/os-quota-sets/{tenant_id}` -H "Content-Type: application/json" -H "X-Auth-Token: {token_id}"
返回样例:
{ "quota_set": { "gigabytes": 1000, "id": "e6044929cfd545bdb618f60972d87a93", "share_networks": 10, "shares": 10, "snapshots": 10 } }
6.9.5.2. 查看默认配额
HTTP方法 | URI路径 | 描述 |
---|---|---|
GET | /v1/{tenant_id}/os-quota-sets/{tenant_id}/defaults | 查看默认配额 |
请求样例
curl -s -X GET :regionone_share`/v1/{tenant_id}/os-quota-sets/{tenant_id}/defaults` -H "Content-Type: application/json" -H "X-Auth-Token: {token_id}"
返回样例:
{ "quota_set": { "gigabytes": 1000, "id": "e6044929cfd545bdb618f60972d87a93", "share_networks": 10, "shares": 10, "snapshots": 10 } }
6.9.5.3. 修改配额
HTTP方法 | URI路径 | 描述 |
---|---|---|
PUT | /v1/{tenant_id}/os-quota-sets/{tenant_id} | 修改配额 |
请求样例
curl -s -X PUT :regionone_share`/v1/{tenant_id}/os-quota-sets/{tenant_id}` -H "Content-Type: application/json" -H "X-Auth-Token: {token_id}" -d '{"quota_set": {"tenant_id": "e6044929cfd545bdb618f60972d87a93", "shares": 1000}}'
返回样例:
{ "quota_set": { "gigabytes": 1000, "share_networks": 1000, "shares": 1000, "snapshots": 10 } }
6.9.5.4. 删除配额
HTTP方法 | URI路径 | 描述 |
---|---|---|
DELETE | /v1/{tenant_id}/os-quota-sets/{tenant_id} | 删除配额 |
请求样例
curl -s -X DELETE :regionone_share`/v1/{tenant_id}/os-quota-sets/{tenant_id}` -H "Content-Type: application/json" -H "X-Auth-Token: {token_id}"
返回样例:
NULL