设置存储共享
将指定 NAS 存储实例共享给企业内的其他用户,或调整、撤销已有的共享授权。请求体为一个数组,可在一次调用中对多个用户批量设置授权,每个授权项通过 policy 指定该用户对该存储的访问权限。设置完成后,可调用查询存储共享列表确认共享结果。
POST
https://api.alayanew.com/v1/nasStorage/instance/{id}/share鉴权(Authorizations)
bearerAuthAuthorizationString必填用户获取Authorization请求头后,通过该请求头完成身份认证。例如:Authorization: [your-auth-header]。
Path Parameters
idString必填NAS存储实例ID,即要设置共享的目标存储卷。例如:00964ce3-b99c-43da-8826-ab9c5574eef2。
Request body
application/jsonuserIdString必填被共享用户的 ID,即把该存储授权给哪位企业成员。例如:00964ce3-b99c-43da-8826-ab9c5574eef2。
policyString必填共享策略,决定该用户对存储的访问权限。取值:R 只读、RW 读写、取消共享(移除该用户对此存储的授权)。例如:R。
Response
application/json · 200statusInteger业务状态码,200 表示共享设置成功。
messageString接口响应信息,成功或失败原因描述。例如:"OK"。
dataObject本接口成功时不返回业务数据,固定为空对象 {}。
curl -X 'POST' \
'https://api.alayanew.com/v1/nasStorage/instance/00964ce3-b99c-43da-8826-ab9c5574eef2/share' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-H 'Authorization: [your-auth-header]' \
-d '[
{
"userId": "00964ce3-b99c-43da-8826-ab9c5574eef1",
"policy": "R"
}
]'import requests
storage_id = "00964ce3-b99c-43da-8826-ab9c5574eef2"
url = f"https://api.alayanew.com/v1/nasStorage/instance/{storage_id}/share"
headers = {
"accept": "application/json",
"Content-Type": "application/json",
"Authorization": "[your-auth-header]"
}
payload = [
{
"userId": "00964ce3-b99c-43da-8826-ab9c5574eef1",
"policy": "R"
}
]
response = requests.post(url, headers=headers, json=payload)
print(response.json())const storageId = '00964ce3-b99c-43da-8826-ab9c5574eef2';
const payload = [
{
userId: '00964ce3-b99c-43da-8826-ab9c5574eef1',
policy: 'R'
}
];
fetch(`https://api.alayanew.com/v1/nasStorage/instance/${storageId}/share`, {
method: 'POST',
headers: {
'accept': 'application/json',
'Content-Type': 'application/json',
'Authorization': '[your-auth-header]'
},
body: JSON.stringify(payload)
})
.then(res => res.json())
.then(console.log)
.catch(console.error);{
"status": 200,
"message": "OK",
"data": {}
}{
"status": 403,
"message": "Forbidden",
"data": {}
}{
"status": 500,
"message": "Internal Server Error",
"data": {}
}最后更新于
