关闭容器组端口
关闭指定容器组上已开放的自定义端口。同步完成。可先通过查询容器组已开放端口确认要关闭的端口。
POST
https://api.alayanew.com/api/osm/v1/training/instance/{id}/{podName}/close-port鉴权(Authorizations)
bearerAuthAuthorizationString必填用户获取Authorization请求头后,通过该请求头完成身份认证。例如:Authorization: [your-auth-header]。
Path Parameters
Request body
application/jsonportInteger必填要关闭的端口。例如:7778。
Response
application/json · 200statusInteger业务状态码,200 表示关闭成功;失败时为错误码。
messageString响应信息,成功为 "OK";失败时为错误描述。
curl -X 'POST' \
'https://api.alayanew.com/api/osm/v1/training/instance/a3c8f6d1-7b42-4e95-9d20-8f1a4c6b3e58/train-job-01-worker-0/close-port' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-H 'Authorization: [your-auth-header]' \
-d '{
"port": 7778
}'import requests
task_id = "a3c8f6d1-7b42-4e95-9d20-8f1a4c6b3e58"
pod_name = "train-job-01-worker-0"
url = f"https://api.alayanew.com/api/osm/v1/training/instance/{task_id}/{pod_name}/close-port"
headers = {
"accept": "application/json",
"Content-Type": "application/json",
"Authorization": "[your-auth-header]"
}
payload = {
"port": 7778
}
response = requests.post(url, headers=headers, json=payload)
print(response.json())const taskId = 'a3c8f6d1-7b42-4e95-9d20-8f1a4c6b3e58';
const podName = 'train-job-01-worker-0';
const payload = {
port: 7778
};
fetch(`https://api.alayanew.com/api/osm/v1/training/instance/${taskId}/${podName}/close-port`, {
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"
}最后更新于
