Skip to content

Commit

Permalink
introduce public_ip endpoint with filters and pagination support
Browse files Browse the repository at this point in the history
- implement the get publicIps database query and api handler
- unify the default sorting function for twins/contracts/ips
- write tests for the new endpoint
- document the api filters/sorting params
  • Loading branch information
Omarabdul3ziz committed Sep 17, 2024
1 parent 953055d commit 87c13b0
Show file tree
Hide file tree
Showing 18 changed files with 725 additions and 38 deletions.
129 changes: 128 additions & 1 deletion grid-proxy/docs/docs.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

129 changes: 128 additions & 1 deletion grid-proxy/docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -777,6 +777,115 @@
}
}
},
"/ips": {
"get": {
"description": "Get all public ips on the grid with pagination and filtration support.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"GridProxy"
],
"summary": "Show public ips on the grid",
"parameters": [
{
"type": "integer",
"description": "Page number",
"name": "page",
"in": "query"
},
{
"type": "integer",
"description": "Max result per page",
"name": "size",
"in": "query"
},
{
"type": "boolean",
"description": "Set ips' count on headers based on filter",
"name": "ret_count",
"in": "query"
},
{
"type": "boolean",
"description": "Get random patch of ips",
"name": "randomize",
"in": "query"
},
{
"enum": [
"ip",
"farm_id",
"contract_id"
],
"type": "string",
"description": "Sort by specific ip field",
"name": "sort_by",
"in": "query"
},
{
"enum": [
"desc",
"asc"
],
"type": "string",
"description": "The sorting order, default is 'asc'",
"name": "sort_order",
"in": "query"
},
{
"type": "integer",
"description": "Get ips on specific farm",
"name": "farm_id",
"in": "query"
},
{
"type": "string",
"description": "filter with the ip",
"name": "ip",
"in": "query"
},
{
"type": "string",
"description": "filter with the gateway",
"name": "gateway",
"in": "query"
},
{
"type": "boolean",
"description": "Get only the free ips, based on the ip have a contract id or not",
"name": "free",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/types.PublicIP"
}
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "string"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "string"
}
}
}
}
},
"/nodes": {
"get": {
"description": "Get all nodes on the grid, It has pagination",
Expand Down Expand Up @@ -1610,6 +1719,9 @@
"items": {
"$ref": "#/definitions/types.Processor"
}
},
"updatedAt": {
"type": "integer"
}
}
},
Expand Down Expand Up @@ -1706,6 +1818,12 @@
"farmingPolicyId": {
"type": "integer"
},
"gpus": {
"type": "array",
"items": {
"$ref": "#/definitions/types.NodeGPU"
}
},
"gridVersion": {
"type": "integer"
},
Expand Down Expand Up @@ -1895,6 +2013,12 @@
"farmingPolicyId": {
"type": "integer"
},
"gpus": {
"type": "array",
"items": {
"$ref": "#/definitions/types.NodeGPU"
}
},
"gridVersion": {
"type": "integer"
},
Expand Down Expand Up @@ -1996,7 +2120,7 @@
"type": "integer"
},
"farm_id": {
"type": "string"
"type": "integer"
},
"gateway": {
"type": "string"
Expand All @@ -2019,6 +2143,9 @@
"node_twin_id": {
"type": "integer"
},
"updatedAt": {
"type": "integer"
},
"upload": {
"description": "in bit/sec",
"type": "number"
Expand Down
Loading

0 comments on commit 87c13b0

Please sign in to comment.