modem_port_mappings
Creates, updates, deletes, gets or lists a modem_port_mappings resource.
Overview​
| Name | modem_port_mappings |
| Type | Resource |
| Id | ovh.xdsl.modem_port_mappings |
Fields​
The following fields are returned by SELECT queries:
- get
- list
successful operation
| Name | Datatype | Description |
|---|---|---|
id | integer | ID of the port mapping entry |
name | string | Name of the port mapping entry |
task_id | integer | ID of the ongoing todo (NULL if none) (wire: taskId) |
allowed_remote_ip | string (ipv4) | An ip which will access to the defined rule. Default : no restriction applied (example: 192.0.2.0) (wire: allowedRemoteIp) |
description | string | Description of the Port Mapping |
external_port_end | integer | The last port of the interval on the External Client that will get the connections (wire: externalPortEnd) |
external_port_start | integer | External Port that the modem will listen on. List of externalPorts not available for now in the API : 8, 21, 68, 5060, 21800-21805, 51005 (wire: externalPortStart) |
internal_client | string (ipv4) | IP address (e.g., 192.0.2.0) (example: 192.0.2.0) (wire: internalClient) |
internal_port | integer | The port on the Internal Client that will get the connections (wire: internalPort) |
internal_port_end | integer | The last port of the interval on the Internal Client that will get the connections (wire: internalPortEnd) |
protocol | string | Type of protocol for the Port Mapping (TCP, UDP) |
Port Mappings
| Name | Datatype | Description |
|---|---|---|
id | integer | ID of the port mapping entry |
name | string | Name of the port mapping entry |
task_id | integer | ID of the ongoing todo (NULL if none) (wire: taskId) |
allowed_remote_ip | string (ipv4) | An ip which will access to the defined rule. Default : no restriction applied (example: 192.0.2.0) (wire: allowedRemoteIp) |
description | string | Description of the Port Mapping |
external_port_end | integer | The last port of the interval on the External Client that will get the connections (wire: externalPortEnd) |
external_port_start | integer | External Port that the modem will listen on. List of externalPorts not available for now in the API : 8, 21, 68, 5060, 21800-21805, 51005 (wire: externalPortStart) |
internal_client | string (ipv4) | IP address (e.g., 192.0.2.0) (example: 192.0.2.0) (wire: internalClient) |
internal_port | integer | The port on the Internal Client that will get the connections (wire: internalPort) |
internal_port_end | integer | The last port of the interval on the Internal Client that will get the connections (wire: internalPortEnd) |
protocol | string | Type of protocol for the Port Mapping (TCP, UDP) |
Methods​
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | name, service_name | Returns a port mapping rule: its protocol, external and internal ports, internal client, allowed remote IP and description. | |
list | select | service_name | x_pagination_mode | Returns the names of the port mapping rules of the modem of the access. |
create | insert | service_name, external_port_start, internal_client, internal_port, name, protocol | Adds a rule that forwards an external port range to a port of an internal client, optionally restricted to one remote IP. Returns the created rule. | |
update | update | name, service_name | Changes the protocol, ports, internal client, allowed remote IP or description of a port mapping rule. | |
delete | delete | name, service_name | Removes the port mapping rule from the modem. Returns the task that performs the change. |
Parameters​
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
api_host | string | The OVHcloud API host. Selected by OVH_ENDPOINT (ovh-eu, ovh-ca or ovh-us; default ovh-eu). (default: api.eu.ovhcloud.com, x-stackQL-envVarSelector: {"envVar":"OVH_ENDPOINT","default":"ovh-eu","values":{"ovh-eu":"api.eu.ovhcloud.com","ovh-ca":"api.ca.ovhcloud.com","ovh-us":"api.us.ovhcloud.com"}}) |
name | string | Name |
service_name | string | Service name (wire: serviceName) |
x_pagination_mode | string | Sent as CachedObjectList-Pages by default so the list returns the full objects rather than their identifiers. (wire: X-Pagination-Mode) |
SELECT examples​
- get
- list
Returns a port mapping rule: its protocol, external and internal ports, internal client, allowed remote IP and description.
SELECT
id,
name,
task_id,
allowed_remote_ip,
description,
external_port_end,
external_port_start,
internal_client,
internal_port,
internal_port_end,
protocol
FROM ovh.xdsl.modem_port_mappings
WHERE name = '{{ name }}' -- required
AND service_name = '{{ service_name }}' -- required
;
Returns the names of the port mapping rules of the modem of the access.
SELECT
id,
name,
task_id,
allowed_remote_ip,
description,
external_port_end,
external_port_start,
internal_client,
internal_port,
internal_port_end,
protocol
FROM ovh.xdsl.modem_port_mappings
WHERE service_name = '{{ service_name }}' -- required
AND x_pagination_mode = '{{ x_pagination_mode }}'
;
INSERT examples​
- create
- Manifest
Adds a rule that forwards an external port range to a port of an internal client, optionally restricted to one remote IP. Returns the created rule.
INSERT INTO ovh.xdsl.modem_port_mappings (
allowed_remote_ip,
description,
external_port_end,
external_port_start,
internal_client,
internal_port,
internal_port_end,
name,
protocol,
service_name
)
SELECT
'{{ allowed_remote_ip }}',
'{{ description }}',
{{ external_port_end }},
{{ external_port_start }} /* required */,
'{{ internal_client }}' /* required */,
{{ internal_port }} /* required */,
{{ internal_port_end }},
'{{ name }}' /* required */,
'{{ protocol }}' /* required */,
'{{ service_name }}'
RETURNING
id,
name,
task_id,
allowed_remote_ip,
description,
external_port_end,
external_port_start,
internal_client,
internal_port,
internal_port_end,
protocol
;
# Description fields are for documentation purposes
- name: modem_port_mappings
props:
- name: service_name
value: "{{ service_name }}"
description: Required parameter for the modem_port_mappings resource.
- name: allowed_remote_ip
value: "{{ allowed_remote_ip }}"
description: |
IPv4 address (e.g., 192.0.2.0)
- name: description
value: "{{ description }}"
description: |
Description of the Port Mapping
- name: external_port_end
value: {{ external_port_end }}
description: |
The last port of the interval on the External Client that will get the connections
- name: external_port_start
value: {{ external_port_start }}
description: |
External Port that the modem will listen on
- name: internal_client
value: "{{ internal_client }}"
description: |
IP address (e.g., 192.0.2.0)
- name: internal_port
value: {{ internal_port }}
description: |
The port on the Internal Client that will get the connections
- name: internal_port_end
value: {{ internal_port_end }}
description: |
The last port of the interval on the Internal Client that will get the connections
- name: name
value: "{{ name }}"
description: |
Name of the port mapping entry
- name: protocol
value: "{{ protocol }}"
description: |
Type of protocol for the Port Mapping
valid_values: ['TCP', 'UDP']
UPDATE examples​
- update
Changes the protocol, ports, internal client, allowed remote IP or description of a port mapping rule.
UPDATE ovh.xdsl.modem_port_mappings
SET
allowed_remote_ip = '{{ allowed_remote_ip }}',
description = '{{ description }}',
external_port_end = {{ external_port_end }},
external_port_start = {{ external_port_start }},
internal_client = '{{ internal_client }}',
internal_port = {{ internal_port }},
internal_port_end = {{ internal_port_end }},
protocol = '{{ protocol }}'
WHERE
name = '{{ name }}' --required
AND service_name = '{{ service_name }}' --required;
DELETE examples​
- delete
Removes the port mapping rule from the modem. Returns the task that performs the change.
DELETE FROM ovh.xdsl.modem_port_mappings
WHERE name = '{{ name }}' --required
AND service_name = '{{ service_name }}' --required
;