Skip to main content

security_groups

Creates, updates, deletes, gets or lists a security_groups resource.

Overview​

Namesecurity_groups
TypeResource
Idovh.public_cloud_network.security_groups

Fields​

The following fields are returned by SELECT queries:

successful operation

NameDatatypeDescription
idstring (uuid)Unique identifier of the security group
checksumstringComputed hash representing the current target specification value
created_atstring (date-time)Creation date of the security group (wire: createdAt)
current_stateobjectCurrent state of the security group (wire: currentState)
current_tasksarrayOngoing asynchronous tasks related to the security group (wire: currentTasks)
resource_statusstringSecurity group readiness in the system (CREATING, CREATION_PLANNED, DELETING, ERROR, OUT_OF_SYNC, READY, SUSPENDED, UNKNOWN, UPDATING) (wire: resourceStatus)
target_specobjectLast target specification of the security group (wire: targetSpec)
updated_atstring (date-time)Last update date of the security group (wire: updatedAt)

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectsecurity_group_id, project_idReturns the security group, including its rules and default egress rules.
listselectproject_idx_pagination_cursor, x_pagination_sizeReturns the security groups of the project.
createinsertproject_id, target_specCreates a security group with inline rules. OpenStack adds default egress rules automatically.
updateupdatesecurity_group_id, project_id, target_specReplaces the security group's name, description and rules as a whole.
deletedeletesecurity_group_id, project_idDeletes the security group. Deletion is not blocked for a group still attached to interfaces or the project's default group.

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.

NameDatatypeDescription
api_hoststringThe 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"}})
project_idstringThe Public Cloud project ID. Resolved from OVH_CLOUD_PROJECT_SERVICE when set.
security_group_idstring (uuid)Security group ID (wire: securityGroupId)
x_pagination_cursorstringPagination cursor (wire: X-Pagination-Cursor)
x_pagination_sizeintegerPagination size (wire: X-Pagination-Size)

SELECT examples​

Returns the security group, including its rules and default egress rules.

SELECT
id,
checksum,
created_at,
current_state,
current_tasks,
resource_status,
target_spec,
updated_at
FROM ovh.public_cloud_network.security_groups
WHERE security_group_id = '{{ security_group_id }}' -- required
AND project_id = '{{ project_id }}' -- required unless OVH_CLOUD_PROJECT_SERVICE is set
;

INSERT examples​

Creates a security group with inline rules. OpenStack adds default egress rules automatically.

INSERT INTO ovh.public_cloud_network.security_groups (
target_spec,
project_id
)
SELECT
'{{ target_spec }}' /* required */,
'{{ project_id }}'
RETURNING
id,
checksum,
created_at,
current_state,
current_tasks,
resource_status,
target_spec,
updated_at
;

UPDATE examples​

Replaces the security group's name, description and rules as a whole.

UPDATE ovh.public_cloud_network.security_groups
SET
checksum = '{{ checksum }}',
target_spec = '{{ target_spec }}'
WHERE
security_group_id = '{{ security_group_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​

Deletes the security group. Deletion is not blocked for a group still attached to interfaces or the project's default group.

DELETE FROM ovh.public_cloud_network.security_groups
WHERE security_group_id = '{{ security_group_id }}' --required
AND project_id = '{{ project_id }}' --required unless OVH_CLOUD_PROJECT_SERVICE is set
;