查询容器组已开放端口
查询指定容器组当前已开放的端口列表,含系统端口与自定义端口。同步返回。
GET
https://api.alayanew.com/api/osm/v1/training/instance/{id}/{podName}/open-port/list鉴权(Authorizations)
bearerAuthAuthorizationString必填用户获取Authorization请求头后,通过该请求头完成身份认证。例如:Authorization: [your-auth-header]。
Path Parameters
Response
application/json · 200statusInteger业务状态码,200 表示成功。
messageString接口响应信息。例如:"OK"。
dataObject开放端口信息。
显示 properties
portsArray系统开放端口列表。
显示 properties
protocolString协议。例如:"TCP"。
portInteger容器端口。例如:22。
externalHostString外部访问地址。例如:"train-job-01-worker-0.example.com"。
externalPortInteger外部访问端口。例如:30022。
customPortsArray自定义开放端口列表。
显示 properties
protocolString协议。例如:"TCP"。
portInteger容器端口。例如:7778。
externalHostString外部访问地址。例如:"train-job-01-worker-0.example.com"。
externalPortInteger外部访问端口。例如:37778。
curl -X 'GET' \
'https://api.alayanew.com/api/osm/v1/training/instance/a3c8f6d1-7b42-4e95-9d20-8f1a4c6b3e58/train-job-01-worker-0/open-port/list' \
-H 'accept: application/json' \
-H 'Authorization: [your-auth-header]'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}/open-port/list"
headers = {
"accept": "application/json",
"Authorization": "[your-auth-header]"
}
response = requests.get(url, headers=headers)
print(response.json())const taskId = 'a3c8f6d1-7b42-4e95-9d20-8f1a4c6b3e58';
const podName = 'train-job-01-worker-0';
fetch(`https://api.alayanew.com/api/osm/v1/training/instance/${taskId}/${podName}/open-port/list`, {
method: 'GET',
headers: {
'accept': 'application/json',
'Authorization': '[your-auth-header]'
}
})
.then(res => res.json())
.then(console.log)
.catch(console.error);{
"status": 200,
"message": "OK",
"data": {
"ports": [
{
"protocol": "TCP",
"port": 22,
"externalHost": "train-job-01-worker-0.example.com",
"externalPort": 30022
}
],
"customPorts": [
{
"protocol": "TCP",
"port": 7778,
"externalHost": "train-job-01-worker-0.example.com",
"externalPort": 37778
}
]
}
}最后更新于
