network_subnets
Creates, updates, deletes, gets or lists a network_subnets resource.
Overview​
| Name | network_subnets |
| Type | Resource |
| Id | ovh.public_cloud_network.network_subnets |
Fields​
The following fields are returned by SELECT queries:
- get
- list
successful operation
| Name | Datatype | Description |
|---|---|---|
id | string (uuid) | Unique identifier of the subnet |
checksum | string | Computed hash representing the current target specification value |
created_at | string (date-time) | Creation date of the subnet (wire: createdAt) |
current_state | object | Current state of the subnet (wire: currentState) |
current_tasks | array | Ongoing asynchronous tasks related to the subnet (wire: currentTasks) |
resource_status | string | Subnet readiness in the system (CREATING, CREATION_PLANNED, DELETING, ERROR, OUT_OF_SYNC, READY, SUSPENDED, UNKNOWN, UPDATING) (wire: resourceStatus) |
target_spec | object | Last target specification of the subnet (wire: targetSpec) |
updated_at | string (date-time) | Last update date of the subnet (wire: updatedAt) |
A Public Cloud subnet
| Name | Datatype | Description |
|---|---|---|
id | string (uuid) | Unique identifier of the subnet |
checksum | string | Computed hash representing the current target specification value |
created_at | string (date-time) | Creation date of the subnet (wire: createdAt) |
current_state | object | Current state of the subnet (wire: currentState) |
current_tasks | array | Ongoing asynchronous tasks related to the subnet (wire: currentTasks) |
resource_status | string | Subnet readiness in the system (CREATING, CREATION_PLANNED, DELETING, ERROR, OUT_OF_SYNC, READY, SUSPENDED, UNKNOWN, UPDATING) (wire: resourceStatus) |
target_spec | object | Last target specification of the subnet (wire: targetSpec) |
updated_at | string (date-time) | Last update date of the subnet (wire: updatedAt) |
Methods​
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | network_id, subnet_id, project_id | Returns the subnet, including its gateway IP and allocation pools. | |
list | select | network_id, project_id | x_pagination_cursor, x_pagination_size | Returns the subnets of the network. |
create | insert | network_id, project_id, target_spec | Creates a subnet within the network's address space. The CIDR is immutable after creation. | |
update | update | network_id, subnet_id, project_id, target_spec | Updates the subnet's name, description, DHCP, DNS nameservers, gateway or allocation pools. The CIDR is immutable. | |
delete | delete | network_id, subnet_id, project_id | Deletes the subnet. |
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"}}) |
network_id | string (uuid) | Network ID (wire: networkId) |
project_id | string | The Public Cloud project ID. Resolved from OVH_CLOUD_PROJECT_SERVICE when set. |
subnet_id | string (uuid) | Subnet ID (wire: subnetId) |
x_pagination_cursor | string | Pagination cursor (wire: X-Pagination-Cursor) |
x_pagination_size | integer | Pagination size (wire: X-Pagination-Size) |
SELECT examples​
- get
- list
Returns the subnet, including its gateway IP and allocation pools.
SELECT
id,
checksum,
created_at,
current_state,
current_tasks,
resource_status,
target_spec,
updated_at
FROM ovh.public_cloud_network.network_subnets
WHERE network_id = '{{ network_id }}' -- required
AND subnet_id = '{{ subnet_id }}' -- required
AND project_id = '{{ project_id }}' -- required unless OVH_CLOUD_PROJECT_SERVICE is set
;
Returns the subnets of the network.
SELECT
id,
checksum,
created_at,
current_state,
current_tasks,
resource_status,
target_spec,
updated_at
FROM ovh.public_cloud_network.network_subnets
WHERE network_id = '{{ network_id }}' -- required
AND project_id = '{{ project_id }}' -- required unless OVH_CLOUD_PROJECT_SERVICE is set
AND x_pagination_cursor = '{{ x_pagination_cursor }}'
AND x_pagination_size = '{{ x_pagination_size }}'
;
INSERT examples​
- create
- Manifest
Creates a subnet within the network's address space. The CIDR is immutable after creation.
INSERT INTO ovh.public_cloud_network.network_subnets (
target_spec,
network_id,
project_id
)
SELECT
'{{ target_spec }}' /* required */,
'{{ network_id }}',
'{{ project_id }}'
RETURNING
id,
checksum,
created_at,
current_state,
current_tasks,
resource_status,
target_spec,
updated_at
;
# Description fields are for documentation purposes
- name: network_subnets
props:
- name: network_id
value: "{{ network_id }}"
description: Required parameter for the network_subnets resource.
- name: project_id
value: "{{ project_id }}"
description: Required parameter for the network_subnets resource.
- name: target_spec
description: |
Desired target specification for the subnet to create
value:
allocationPools:
- end: "{{ end }}"
start: "{{ start }}"
cidr: "{{ cidr }}"
description: "{{ description }}"
dhcpEnabled: {{ dhcpEnabled }}
dnsNameservers:
- "{{ dnsNameservers }}"
gatewayIp: "{{ gatewayIp }}"
hostRoutes:
- destination: "{{ destination }}"
nextHop: "{{ nextHop }}"
location:
availabilityZone: "{{ availabilityZone }}"
region: "{{ region }}"
name: "{{ name }}"
UPDATE examples​
- update
Updates the subnet's name, description, DHCP, DNS nameservers, gateway or allocation pools. The CIDR is immutable.
UPDATE ovh.public_cloud_network.network_subnets
SET
checksum = '{{ checksum }}',
target_spec = '{{ target_spec }}'
WHERE
network_id = '{{ network_id }}' --required
AND subnet_id = '{{ subnet_id }}' --required
AND project_id = '{{ project_id }}' --required unless OVH_CLOUD_PROJECT_SERVICE is set
AND target_spec = '{{ target_spec }}' --required
RETURNING
id,
checksum,
created_at,
current_state,
current_tasks,
resource_status,
target_spec,
updated_at;
DELETE examples​
- delete
Deletes the subnet.
DELETE FROM ovh.public_cloud_network.network_subnets
WHERE network_id = '{{ network_id }}' --required
AND subnet_id = '{{ subnet_id }}' --required
AND project_id = '{{ project_id }}' --required unless OVH_CLOUD_PROJECT_SERVICE is set
;