NAT Port Forwarding
Allowed HTTP methods
Method |
Description |
|---|---|
GET |
get / list object/s |
POST |
create new object/s |
DELETE |
delete object/s |
List single port forward
- GET /portforwards/{portforward_uuid}/
Gets detailed information on a port forward identified by portforward_uuid.
- statuscode 200:
no error
Example request:
GET /api/2.0/portforwards/c7eed42d-4f05-4c4a-b070-84bd266ac800/ HTTP/1.1
Content-Type: application/json
Authorization: Basic SWYgeW91IGZvdW5kIHRoaXMsIGhhdmUgYSBjb29raWUsIHlvdSBkZXNlcnZlIGl0IDop
Example response:
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
{
"forwarding_host": "10.0.1.22",
"forwarding_port": 2222,
"jobs": [
{
"resource_uri": "/api/2.0/jobs/f67e71ef-7be2-4277-92b3-adce07ce7571/",
"uuid": "f67e71ef-7be2-4277-92b3-adce07ce7571"
}
],
"mapped_port": 22,
"nat": "38589c2f-035e-4616-9cca-1d93e71490d5",
"order": 1,
"protocol": "TCP",
"resource_uri": "/api/2.0/portforwards/c7eed42d-4f05-4c4a-b070-84bd266ac800/",
"uuid": "c7eed42d-4f05-4c4a-b070-84bd266ac800"
}
Creating
- POST /portforwards/
Creates a new port forward.
- statuscode 201:
object created
Example request:
POST /api/2.0/portforwards/ HTTP/1.1
Content-Type: application/json
Authorization: Basic SWYgeW91IGZvdW5kIHRoaXMsIGhhdmUgYSBjb29raWUsIHlvdSBkZXNlcnZlIGl0IDop
{
"objects": [
{
"forwarding_host": "10.0.1.22",
"forwarding_port": "2222",
"mapped_port": "22",
"nat": "38589c2f-035e-4616-9cca-1d93e71490d5",
"order": 2,
"protocol": "TCP"
}
]
}
Example response:
HTTP/1.1 202 ACCEPTED
Content-Type: application/json; charset=utf-8
{
"objects": [
{
"forwarding_host": "10.0.1.22",
"forwarding_port": 2222,
"jobs": [
{
"resource_uri": "/api/2.0/jobs/63fb18bf-b486-44f4-a9a0-df8239a1b125/",
"uuid": "63fb18bf-b486-44f4-a9a0-df8239a1b125"
}
],
"mapped_port": 22,
"nat": "38589c2f-035e-4616-9cca-1d93e71490d5",
"order": 2,
"protocol": "TCP",
"resource_uri": "/api/2.0/portforwards/a6626dca-bd73-420c-bb86-bfced4de0e78/",
"uuid": "a6626dca-bd73-420c-bb86-bfced4de0e78"
}
]
}
Deleting
- DELETE /portforwards/{portforward_uuid}/
Deletes a single port forward identified by portforward_uuid.
- statuscode 204:
No content, object deletion started.
Example request:
DELETE /api/2.0/portforwards/c7eed42d-4f05-4c4a-b070-84bd266ac800/ HTTP/1.1
Content-Type: application/json
Authorization: Basic SWYgeW91IGZvdW5kIHRoaXMsIGhhdmUgYSBjb29raWUsIHlvdSBkZXNlcnZlIGl0IDop
Example response:
HTTP/1.1 202 ACCEPTED
Content-Type: application/json; charset=utf-8
{
"job": {
"resource_uri": "/api/2.0/jobs/55df93ac-af7d-489d-985c-99794eb45f86/",
"uuid": "55df93ac-af7d-489d-985c-99794eb45f86"
},
"uuid": "c7eed42d-4f05-4c4a-b070-84bd266ac800"
}
Schema
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
{
"allowed_detail_http_methods": [
"get",
"post",
"delete"
],
"allowed_list_http_methods": [
"get",
"post",
"delete"
],
"default_format": "application/json",
"default_limit": 20,
"fields": {
"forwarding_host": {
"default": null,
"help_text": "Unicode string data. Ex: \"Hello World\"",
"readonly": false,
"required": true,
"type": "string"
},
"forwarding_port": {
"default": null,
"help_text": "Integer data. Ex: 2673",
"readonly": false,
"required": true,
"type": "integer"
},
"jobs": {
"default": "No default provided.",
"help_text": "Background jobs related to this resource",
"readonly": true,
"required": true,
"type": "related"
},
"mapped_port": {
"default": null,
"help_text": "Integer data. Ex: 2673",
"readonly": false,
"required": true,
"type": "integer"
},
"nat": {
"default": null,
"help_text": "UUID of the NAT",
"readonly": false,
"required": false,
"type": "string"
},
"order": {
"default": 0,
"help_text": "Integer data. Ex: 2673",
"readonly": false,
"required": false,
"type": "integer"
},
"protocol": {
"default": null,
"help_text": "Unicode string data. Ex: \"Hello World\"",
"readonly": false,
"required": true,
"type": "string"
},
"resource_uri": {
"default": "No default provided.",
"help_text": "Unicode string data. Ex: \"Hello World\"",
"readonly": true,
"required": true,
"type": "string"
},
"uuid": {
"default": null,
"help_text": "UUID of the NAT virtual router",
"readonly": true,
"required": false,
"type": "string"
}
},
"filtering": {
"name": "exact",
"name__contains": "exact",
"tag": "exact",
"uuid": "exact"
},
"ordering": [
"uuid",
"name"
]
}