Table of Contents
Introduction
These APIs provide services for manipulating ote-stack platform on AI Edge Blueprint.
...
Code Block | ||
---|---|---|
| ||
GET /v1/business/id/1 { "data": { "name": "name", "userId": 123, "introduce": "introduce", "objective": "", "scale": "1400000000", "comment": "comment", "id": 1, "status": 0, "createTime": 1590062196, "updateTime": 1590062196 } "code":200, "message": "Success" } |
Audit Business
PUT /v1/business/id/[id]
Description
This can only be done by system administrator. A namespace, named "ns+business_id", will be created in all edge clusters. For example, the business id is 123, then the name of namespace is ns123.
Parameters
Name | Type | Required | Description |
---|---|---|---|
id | string | yes | business id |
comment | string | yes | audit comment |
status | int8 | yes | comment result: 1: approved; 2: disapproved |
Example
Code Block | ||
---|---|---|
| ||
PUT /v1/business/id/1
{
"comment": "pass",
"status": 1
} |
Cluster Management
Get Cluster List
GET /v1/cluster
Description
Get all the cluster list.
Parameters
Name | Type | Required | Default | Description |
---|---|---|---|---|
clusterLabel | string | no | all | cluster label filter |
page | int | no | 1 | page |
pageSize | int | no | no limited | page size |
Response Parameters
Name | Type | Description |
---|---|---|
clusterName | string | cluster name |
nodeCount | int | number of nodes in the cluster |
isReady | bool | flag to indicate if the cluster is alive |
total | int | total number of clusters under the filter |
Example
Code Block | ||||
---|---|---|---|---|
| ||||
GET /v1/cluster?clusterLabel=all&page=1&pageSize=10
Response:
{
"code" : 200,
"message" : "success",
"data": [
{ "clusterName": "GuangZhou", "nodeCount": 1, "isReady": false},
{ "clusterName": "BeiJing", "nodeCount": 2, "isReady": true}
},
"total": 2
} |
Add Label to Cluster
POST /v1/cluster/label
Description
Label the clusters.
Parameters
Name | Type | Required | Description |
---|---|---|---|
clusterName | []string | yes | the list of clusters that need to be labeled. |
clusterLabel | string | yes | label name that only use uppercase and lowercase letters, numbers and special character - . |
Example
Code Block | ||||
---|---|---|---|---|
| ||||
POST /v1/cluster/label
{
"clusterLabel": "label1",
"clusterName": ["GuangZhou", "BeiJing"]
}
Response
{
"code" : 200,
"message" : "success"
} |
Delete Label
DELETE /v1/cluster/label
Description
Delete label of specified clusters.
Parameters
Name | Type | Required | Description |
---|---|---|---|
clusterName | [ ]string | yes | the list of clusters that need to be labeled. |
clusterLabel | string | yes | label name that needs to be removed. |
Example
Code Block | ||
---|---|---|
| ||
DELETE /v1/cluster/label
{
"clusterLabel": "label1",
"clusterName": ["GuangZhou", "BeiJing"]
}
Response
{
"code" : 200,
"message" : "success"
} |
Get Label List
GET /v1/cluster/label
Description
Get the list of labels that have been created.
Parameters
Response Parameters
Name | Type | Description |
---|---|---|
data | []string | the list of label |
Example
Code Block | ||
---|---|---|
| ||
GET /v1/cluster/label
Response:
{
"code" : 200,
"message" : "success",
"data": [
"label1", "label2"
]
} |
Get Label
GET /v1/cluster/label/[clusterNamel]
Description
Get the labels under the specified cluster.
Parameters
Name | Type | Required | Default | Description |
---|---|---|---|---|
clusterName | string | yes | cluster name | |
page | int | no | 1 | page |
pageSize | int | no | 10 | page size. 0: no limited |
Response Parameters
Name | type | Description |
---|---|---|
clusterLabel | string | cluster label |
createTime | int64 | create time of label |
total | int32 | total number |
Example
Code Block | ||
---|---|---|
| ||
GET /v1/cluster/label/cluster1?page=1&pageSize=10
Response:
{
"code" : 200,
"message" : "success",
"data": [
{ "clusterLabel":"GuangZhou", "createTime": 1234567890 },
{ "clusterLabel":"BeiJing", "createTime": 1234567891 }
],
"total": 2
} |
Node Management
Get Node List
GET /v1/node
Description
Parameters
Name | Type | Required | default | Description |
---|---|---|---|---|
field | string | no | fields that need be presented | |
nodeLabel | string | no | node label to filter nodes | |
clusterName | string | no | cluster name for filtering result | |
nodeName | string | no | node name for filtering result. | |
page | int | no | 1 | the page number |
pageSize | int | no | 10 | the size of per page |
Response Parameters
Name | Tyep | Description |
---|---|---|
nodeName | string | node name |
clusterName | string | cluster that node belongs to |
operatingSystem | string | os of node |
kernelVersion | string | kernel version of node |
ip | string | ip address |
memory | int64 | memory(byte) |
cpu | int | cpu core |
isReady | bool | flag to indicate if the node is alive. |
total | int | total number of nodes |
gpu | int | GPU memory(byte) |
disk | int64 | disk size(byte) |
readyNodeCount | int | the number of alive node |
Example
Code Block | ||
---|---|---|
| ||
GET /v1/node
Response:
{
"code" : 200,
"message" : "success",
"data": [
{
"nodeName": "GZ1",
"operatingSystem": "Linux",
"clusterName": "GuangZhou",
"kernelVersion" : "2.6",
"isReady": true,
"ip": "1.2.3.4"
},
{
"nodeName": "BJ1",
"operatingSystem": "Linux",
"clusterName": "BeiJing",
"kernelVersion" : "2.6",
"isReady": true,
"ip": "1.2.3.4"
}
},
"meta": {
"readyNodeCount": 2
},
"total": 2
} |
Add Label to Node
POST /v1/node/label
Description
Label the nodes.
Parameters
Name | Type | Required | Description |
---|---|---|---|
nodeName | []string | yes | the list of nodes that need to be labeled. |
nodeLabel | string | yes | label name that only use uppercase and lowercase letters, numbers and special character - . |
clusterName | string | yes | cluster that nodes belong to. |
Example
Code Block | ||||
---|---|---|---|---|
| ||||
POST /v1/node/label
{
"nodeLabel": "label1",
"clusterName": "c1",
"nodeName": ["GuangZhou", "BeiJing"]
}
Response:
{
"code" : 200,
"message" : "success"
} |
Delete Label
DELETE /v1/node/label
Description
Delete label of specified nodes.
Parameters
Name | Type | Required | Default | Description |
---|---|---|---|---|
nodeName | [ ]string | yes | the list of nodes that need to remove label. | |
nodeLabel | string | yes | the label that needs to be removed. | |
clusterName | string | yes | cluster that nodes belong to. | |
deleteDeploy | bool | no | no | allow to delete deployment on the node that have been labeled. |
Example
Code Block | ||
---|---|---|
| ||
DELETE /v1/node/label
{
"nodeLabel": "label1",
"clusterName": "c1",
"nodeName": ["GuangZhou", "BeiJing"],
"deleteDeploy": true
}
Response:
{
"code" : 200,
"message" : "success"
} |
Get Label List
GET /v1/node/label
Description
Return the list of label of nodes under the specified cluster.
Parameters
Name | Type | Required | Description |
---|---|---|---|
clusterName | string | no | Return node labels in all clusters by default. |
Response Parameters
Name | Type | Description |
---|---|---|
data | [ ]string | the list of label |
Example
Code Block | ||
---|---|---|
| ||
GET /v1/node/label?clusterName=c1
Response:
{
"code" : 200,
"message" : "success",
"data": ["label1"]
} |
Repository Management
Get Images
GET /v1/repository/image
Description
List images of the specified project.
Parameters
Name | Type | Required | Default | Description |
---|---|---|---|---|
orderBy | string | no | id | OrderBy allows sorting by id. |
order | string | no | desc | Sort order: asc, desc. |
page | int | no | 1 | The page number. |
pageSize | int | no | 10 | The size of per page, 0 for no limited. |
projectName | string | yes | The name of project. | |
imageName | string | no | Image name for filtering result. |
Response code
Code | Description |
---|---|
200 | Searched for images of Harbor successfully. |
400 | Invalid parameters. |
401 | User need to log in first. |
403 | User does not have permission of admin role. |
500 | Unexpected internal errors |
Response Parameters
Name | Type | Description |
---|---|---|
projectName | string | The name of project |
public | bool | The flag to indicate the publicity of the image. |
imageName | string | The name of image |
imageAddress | string | The registry url of image which do not including tag. |
createTime | int | The create time of image |
updateTime | int | The update time of image |
total | int | total number of images |
Example
Code Block | ||
---|---|---|
| ||
GET /v1/repository/image
Response:
{
"data": [
{
"projectName": "test",
"public": false,
"imageName": "test/test-demo1",
"imageAddress": "registry.dcdn.baidu.com/test/test-demo1",
"createTime": 1551758321,
"updateTime": 1551758321
},
{
"projectName": "test2",
"public": false,
"imageName": "test2/test-demo2",
"imageAddress": "registry.dcdn.baidu.com/test2/test-demo2",
"createTime": 1551758321,
"updateTime": 1551758321
}
],
"total": 2,
"code": 200,
"message": "success"
} |
Get Tag of Image
GET /v1/repository/image/tag?imageName=[imageName]
Description
List tags under the specific image name.
Parameters
Name | Type | Required | Default | Description |
---|---|---|---|---|
page | int | no | 1 | The page number. |
pageSize | int | no | 10 | The size of per page, 0 for no limited. |
imageName | string | yes | The image name for filtering result. |
Response code
Code | Description |
---|---|
200 | Get tags successfully. |
400 | Bad request. |
401 | User need to log in first. |
403 | User does not have permission of admin role. |
500 | Unexpected internal errors |
Response Parameters
Name | Type | Description |
---|---|---|
tag | string | tag of docker image |
imageAddress | string | repository of docker image |
createTime | int | create time |
updateTime | int | update time |
total | int | total number of images |
Example
Code Block | ||
---|---|---|
| ||
GET /v1/repository/image/tag?imageName=test/demo1
{
"data": [
{
"tag": "latest",
"imageAddress": "registry.dcdn.baidu.com/test/test-demo1",
"createTime": 1551758321,
"updateTime": 1551758321
},
{
"tag": "v1",
"imageAddress": "registry.dcdn.baidu.com/test/test-demo1",
"createTime": 1551758321,
"updateTime": 1551758321
}
],
"total": 2,
"code": 200,
"message": "success"
} |
Delete Image
DELETE /v1/repository/image
Description
Delete multiple images specified by name.
Parameters
Name | Type | Required | Default | Descripton |
---|---|---|---|---|
imageName | [ ]string | yes | name of images |
Example
Code Block | ||||
---|---|---|---|---|
| ||||
DELETE /v1/repository/image
Body:
{
"imageName": ["img1", "img2"]
}
Response:
{
"code": 200,
"message": "success"
} |
Delete Tag of Image
DELETE /v1/repository/image/tag
Description
Delete the image specified by name and tags.
Parameters
Name | Type | Required | Default | Description |
---|---|---|---|---|
tag | [ ]string | yes | tags of image that needs to be removed | |
imageName | string | yes | name of image that needs to be removed |
Example
Code Block | ||
---|---|---|
| ||
DELETE /v1/repository/image/tag
Body:
{
"imageName": "test/demo1"
"tag": ["v1", "v2"]
}
Response:
{
"code": 200,
"message": "success"
} |
Create User
POST /v1/repository/user
Description
Create a new user of harbor repository.
Parameters
Name | Type | Required | Default | Description |
---|---|---|---|---|
user | string | yes | username | |
password | string | yes | password |
Response code
Code | Description |
---|---|
200 | User created successfully. |
400 | Unsatisfied with constraints of the user creation. |
409 | username conflict |
403 | User registration can only be used by admin role user when self-registration is off. |
415 | The Media Type of the request is not supported, it has to be "application/json" |
500 | Unexpected internal errors. |
Example
Code Block | ||
---|---|---|
| ||
POST /v1/repository/user
{
"user": "user1",
"password": "xxxx"
}
Response:
{
"code": 200,
"message": "success"
} |
Update Password
PUT /v1/repository/user
Description
Modify password of current logged-in user.
Parameters
Name | Type | Required | Default | Description |
---|---|---|---|---|
password | string | yes | new password |
Response code
Code | Description |
---|---|
200 | Updated password successfully. |
400 | Invalid user ID; Old password is blank; New password is blank. |
401 | Don't have authority to change password. Please check login status. |
403 | The caller does not have permission to update the password of the user with given ID, or the old password in request body is not correct. |
500 | Unexpected internal errors. |
Example
Code Block | ||
---|---|---|
| ||
PUT /v1/repository/user
{
"password": "xxxx"
}
Response:
{
"code": 200,
"message": "success"
} |
Get Projects of Repository
GET /v1/repository/project
Description
List all projects of current logged-in user.
Parameters
Name | Type | Required | Default | Description |
---|---|---|---|---|
projectName | string | no | Project name for filtering results. | |
public | bool | no | Public sign for filtering projects. | |
page | int | no | 1 | The page number. |
pageSize | int | no | 10 | The size of per page. |
Response code
Code | Description |
---|---|
401 | User need to log in first. |
200 | Return all matched projects. |
500 | Internal errors. |
Response parameters
Name | Type | Description |
---|---|---|
projectId | int | Project ID. |
projectName | string | The name of the project |
createTime | string | The creation time of the project. |
updateTime | string | The update time of the project. |
public | bool | The public status of the project. |
imageCount | int | The count of the images under this project. |
total | int | Total number of the projects. |
Example
Code Block | ||
---|---|---|
| ||
GET /v1/repository/project
Response:
{
"data": [ {
"projectId": 13,
"projectName": "calico",
"createTime": 1551758321,
"updateTime": 1551758321,
"imageCount": 3,
"public": true
} ],
"total": 2,
"code": 200,
"message": "success"
} |
Create Project
POST /v1/repository/project
Description
Create a new project of the current user.
Parameters
Name | Type | Required | Default | Description |
---|---|---|---|---|
projectName | string | yes | The name of project. | |
public | bool | yes | The public status of the project. |
Response code
Code | Description |
---|---|
201 | Project created successfully. |
400 | Unsatisfied with constraints of the project creation. |
401 | User need to log in first. |
409 | Project name already exists. |
415 | The Media Type of the request is not supported, it has to be "application/json" |
500 | Unexpected internal errors. |
Example
Code Block | ||
---|---|---|
| ||
POST /v1/repository/project
{
"projectName": "calico",
"public": true
}
Response:
{
"code": 200,
"message": "success"
} |
Delete Project
DELETE /v1/repository/project
Description
Delete the projects specified by ID.
Parameters
Name | Type | Required | Default | Description |
---|---|---|---|---|
projectId | [ ]int64 | yes | The IDs of projects |
Response code
Code | Description |
---|---|
201 | Project created successfully. |
400 | Unsatisfied with constraints of the project creation. |
401 | User need to log in first. |
409 | Project name already exists. |
415 | The Media Type of the request is not supported, it has to be "application/json" |
500 | Unexpected internal errors. |
Example
Code Block | ||
---|---|---|
| ||
DELETE /v1/repository/project
{
"projectId": [ 1, 2 ]
}
Response:
{
"code": 200,
"message": "success"
} |
Create External Repository
POST /v1/repository/third
Description
Create a secret registry record for pulling docker images from external repository.
Parameters
Name | Type | Required | Description |
---|---|---|---|
repositoryId | string | yes | A unique name for specifying repository. |
address | string | yes | The address of repository. |
user | string | yes | username for pulling images. |
password | string | yes | password for pulling images. |
Example
Code Block | ||
---|---|---|
| ||
POST /v1/repository
Body:
{
"repositoryId": "repo1",
"address": "127.0.0.1",
"user": "user1",
"password": "password1"
}
Response:
{
"code": 200,
"message": "success"
} |
Delete External Repository
DELETE /v1/repository/third
Description
Delete the external repository record by ID. It won't affect existing deployment.
Parameters
Name | Type | Required | Description |
---|---|---|---|
repositoryId | [ ]string | yes | The ID of repository |
Example
Code Block | ||
---|---|---|
| ||
DELETE /v1/repository
Body:
{
"repositoryId": ["repo1", "repo2"]
}
Response:
{
"code": 200,
"message": "success"
} |
Get External Repository List
GET /v1/repository/third
Description
List the external repository.
Parameters
Name | Type | Required | Default | Description |
---|---|---|---|---|
pageSize | int | no | 10 | The size of per page, 0 for no limited. |
page | int | no | 1 | The page number. |
orderBy | string | no | id | orderBy allows sorting by id. |
order | string | no | asc | sort order: asc, desc. |
Response Parameters
Name | Type | Description |
---|---|---|
repositoryId | string | The unique name for specifying repository. |
address | string | The address of repository. |
user | string | username for pulling images. |
Example
Code Block | ||
---|---|---|
| ||
GET /v1/repository/third?pageSize=0
response:
{
"data": [ {
"id": 1,
"repositoryId":"yq01",
"address":"xxzxsdsdsds",
"user":"ddddddd"
}, {
"id": 2,
"repositoryId":"yq02",
"address":"xxzxsdsdsds",
"user":"ddddddd"
} ],
"code": 200,
"total": 2,
"message": "Success"
} |
Get External Repository
GET /v1/repository/third/[repoId]
Description
Return the external repository by ID.
Parameters
Name | Type | Required | Default | Description |
---|---|---|---|---|
repoId | string | yes | The unique name of repository |
Response code
状态码 | 说明 |
---|---|
200 | Get repository successfully. |
404 | Not found |
500 | Unexpected internal errors |
Response parameters
Name | Type | Description |
---|---|---|
repositoryId | string | The unique name for specifying repository. |
address | string | The address of repository. |
user | string | username for pulling images. |
Example
Code Block | ||
---|---|---|
| ||
GET /v1/repository/third/repo1
Response:
{
"data": {
"repositoryId":"yq01",
"address":"xxzxsdsdsds",
"user":"ddddddd"
},
"code": 200,
"message": "Success"
} |