设置共享授权
设置或取消实例的共享授权,同步完成;请求体为本次提交的用户授权列表,DISABLE 即取消该用户的共享,不在列表中的既有授权用户保持不变;被授权用户须为同企业的非管理员用户。
POST
https://api.alayanew.com/api/osm/v1/nasStorage/instance/{id}/share鉴权(Authorizations)
bearerAuthAuthorizationString必填用户获取Authorization请求头后,通过该请求头完成身份认证。例如:Authorization: [your-auth-header]。
Path Parameters
idString必填实例 ID(来自分页查询 NAS 实例列表的 id)。例如:3f2b8c94-6d17-4a52-9c8e-7b1d0a5f6e21。
Request body
application/jsonbodyArray必填用户授权列表,数组元素为对象。
显示 properties
userIdString必填被授权用户 ID。例如:"9a5d2e7f-1c48-4b6a-8e3d-5f0c7a2b9d14"。
policyString必填授权策略:R 只读 / RW 读写 / DISABLE 取消共享。
Response
application/json · 200statusInteger业务状态码,200 表示成功;失败时为错误码。
messageString响应信息,成功为 "OK";失败时为错误描述。
curl -X 'POST' \
'https://api.alayanew.com/api/osm/v1/nasStorage/instance/3f2b8c94-6d17-4a52-9c8e-7b1d0a5f6e21/share' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-H 'Authorization: [your-auth-header]' \
-d '[
{
"userId": "9a5d2e7f-1c48-4b6a-8e3d-5f0c7a2b9d14",
"policy": "RW"
},
{
"userId": "c8e61a4b-7f39-4d25-9b0a-2e6f1d8c4a53",
"policy": "DISABLE"
}
]'import requests
instance_id = "3f2b8c94-6d17-4a52-9c8e-7b1d0a5f6e21"
url = f"https://api.alayanew.com/api/osm/v1/nasStorage/instance/{instance_id}/share"
headers = {
"accept": "application/json",
"Content-Type": "application/json",
"Authorization": "[your-auth-header]"
}
payload = [
{
"userId": "9a5d2e7f-1c48-4b6a-8e3d-5f0c7a2b9d14",
"policy": "RW",
},
{
"userId": "c8e61a4b-7f39-4d25-9b0a-2e6f1d8c4a53",
"policy": "DISABLE",
},
]
response = requests.post(url, headers=headers, json=payload)
print(response.json())const instanceId = '3f2b8c94-6d17-4a52-9c8e-7b1d0a5f6e21';
const payload = [
{
userId: '9a5d2e7f-1c48-4b6a-8e3d-5f0c7a2b9d14',
policy: 'RW'
},
{
userId: 'c8e61a4b-7f39-4d25-9b0a-2e6f1d8c4a53',
policy: 'DISABLE'
}
];
fetch(`https://api.alayanew.com/api/osm/v1/nasStorage/instance/${instanceId}/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"
}最后更新于
