文件服务
发布:神州云
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} |
访问规则 (Rule)¶
查看访问规则¶
HTTP方法 | URI路径 | 描述 |
---|---|---|
POST | /v1/{tenant_id}/shares/{share_id}/action | 查看访问规则 |
请求样例
curl -s \ -X POST https://bj1.share.api.shenzhouyun.com//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"
}
]
}
增加访问规则¶
HTTP方法 | URI路径 | 描述 |
---|---|---|
POST | /v1/{tenant_id}/shares/{share_id}/action | 增加访问规则 |
请求样例
curl -s \ -X POST https://bj1.share.api.shenzhouyun.com//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
}
}
删除访问规则¶
HTTP方法 | URI路径 | 描述 |
---|---|---|
POST | /v1/{tenant_id}/shares/{share_id}/action | 删除访问规则 |
请求样例
curl -s \ -X POST https://bj1.share.api.shenzhouyun.com//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" } }'
返回样例:
HTTP/1.1 204 No Content
配额 (Quota)¶
查看配额¶
HTTP方法 | URI路径 | 描述 |
---|---|---|
GET | /v1/{tenant_id}/os-quota-sets/{tenant_id} | 查看配额 |
请求样例
curl -s \ -X GET https://bj1.share.api.shenzhouyun.com//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
}
}
查看默认配额¶
HTTP方法 | URI路径 | 描述 |
---|---|---|
GET | /v1/{tenant_id}/os-quota-sets/{tenant_id}/defaults | 查看默认配额 |
请求样例
curl -s \ -X GET https://bj1.share.api.shenzhouyun.com//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
}
}
修改配额¶
HTTP方法 | URI路径 | 描述 |
---|---|---|
PUT | /v1/{tenant_id}/os-quota-sets/{tenant_id} | 修改配额 |
请求样例
curl -s \ -X PUT https://bj1.share.api.shenzhouyun.com//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
}
}
恢复默认配额¶
HTTP方法 | URI路径 | 描述 |
---|---|---|
DELETE | /v1/{tenant_id}/os-quota-sets/{tenant_id} | 删除配额 |
请求样例
curl -s \ -X DELETE https://bj1.share.api.shenzhouyun.com//v1/{tenant_id}/os-quota-sets/{tenant_id} \ -H "Content-Type: application/json" \ -H "X-Auth-Token: {token_id}"
返回样例:
HTTP/1.1 204 No Content