Skip to main content

region_volumes

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

Overview​

Nameregion_volumes
TypeResource
Idovh.cloud_storage.region_volumes

Fields​

The following fields are returned by SELECT queries:

successful operation

NameDatatypeDescription
idstring (uuid)Volume ID
namestringVolume name
attached_toarrayVolume attached to list (wire: attachedTo)
availability_zonestringAvailability zone of the volume (wire: availabilityZone)
backupsarrayVolume backups
bootablebooleanWhether the volume is bootable
creation_datestring (date-time)Volume creation date (wire: creationDate)
descriptionstringVolume description
encryptionobjectEncryption settings (null when the volume is not encrypted with CMK)
sizeintegerVolume size
snapshotsarrayVolume snapshots
statusstringVolume status (attaching, available, awaiting-transfer, backing-up, creating, deleted, deleting, detaching, downloading, error, error_backing-up, error_deleting, error_extending, error_restoring, extending, in-use, maintenance, reserved, restoring-backup, retyping, snapshotting, uploading)
typestringVolume type (classic, classic-luks, classic-multiattach, high-speed, high-speed-gen2, high-speed-gen2-luks, high-speed-luks)

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectregion_name, volume_id, service_nameGet a volume
listselectregion_name, service_nameList your volumes
createinsertregion_name, service_nameCreate a volume
updateupdateregion_name, volume_id, service_nameUpdate a volume
bulk_delete_snapshotsexecregionName, volumeId, service_nameDelete your volume snapshots in bulk

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"}})
regionNamestringRegion name
region_namestringRegion name (wire: regionName)
service_namestringThe Public Cloud project ID. Resolved from OVH_CLOUD_PROJECT_SERVICE when set.
volumeIdstring (uuid)Volume ID
volume_idstring (uuid)Volume ID (wire: volumeId)

SELECT examples​

Get a volume

SELECT
id,
name,
attached_to,
availability_zone,
backups,
bootable,
creation_date,
description,
encryption,
size,
snapshots,
status,
type
FROM ovh.cloud_storage.region_volumes
WHERE region_name = '{{ region_name }}' -- required
AND volume_id = '{{ volume_id }}' -- required
AND service_name = '{{ service_name }}' -- required unless OVH_CLOUD_PROJECT_SERVICE is set
;

INSERT examples​

Create a volume

INSERT INTO ovh.cloud_storage.region_volumes (
availability_zone,
backup_id,
description,
encryption,
image_id,
instance_id,
name,
size,
snapshot_id,
type,
region_name,
service_name
)
SELECT
'{{ availability_zone }}',
'{{ backup_id }}',
'{{ description }}',
'{{ encryption }}',
'{{ image_id }}',
'{{ instance_id }}',
'{{ name }}',
{{ size }},
'{{ snapshot_id }}',
'{{ type }}',
'{{ region_name }}',
'{{ service_name }}'
RETURNING
id,
resource_id,
action,
completed_at,
created_at,
progress,
regions,
started_at,
status,
sub_operations
;

UPDATE examples​

Update a volume

UPDATE ovh.cloud_storage.region_volumes
SET
description = '{{ description }}',
name = '{{ name }}',
size = {{ size }},
type = '{{ type }}'
WHERE
region_name = '{{ region_name }}' --required
AND volume_id = '{{ volume_id }}' --required
AND service_name = '{{ service_name }}' --required unless OVH_CLOUD_PROJECT_SERVICE is set
RETURNING
id,
resource_id,
action,
completed_at,
created_at,
progress,
regions,
started_at,
status,
sub_operations;

Lifecycle Methods​

EXEC variables use wire (API) names.

Delete your volume snapshots in bulk

EXEC ovh.cloud_storage.region_volumes.bulk_delete_snapshots
@regionName='{{ regionName }}' --required,
@volumeId='{{ volumeId }}' --required,
@service_name='{{ service_name }}' --required unless OVH_CLOUD_PROJECT_SERVICE is set
@@json=
'{
"deleteAll": {{ deleteAll }},
"snapshotIds": "{{ snapshotIds }}"
}'
;