Skip to main content

swift_containers

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

Overview​

Nameswift_containers
TypeResource
Idovh.public_cloud_storage.swift_containers

Fields​

The following fields are returned by SELECT queries:

successful operation

NameDatatypeDescription
idstringContainer identifier, built as <REGION>_<name>, for example GRA_my-container. A container name is unique within a region of the project, so the pair identifies it.
checksumstringComputed hash representing the current target specification value
created_atstring (date-time)Creation date of the container (wire: createdAt)
current_stateobjectCurrent observed state of the container, read from the Swift backend (wire: currentState)
current_tasksarrayOngoing asynchronous tasks related to the container (wire: currentTasks)
resource_statusstringContainer readiness in the system (CREATING, CREATION_PLANNED, DELETING, ERROR, OUT_OF_SYNC, READY, SUSPENDED, UNKNOWN, UPDATING) (wire: resourceStatus)
target_specobjectLast target specification of the container (wire: targetSpec)
updated_atstring (date-time)Last update date of the container (wire: updatedAt)

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectcontainer_id, project_idReturns the container configuration and its current state, including its object count and stored size.
listselectproject_idx_pagination_cursor, x_pagination_sizeReturns the containers of the project across every region offering Swift object storage.
createinsertproject_id, target_specCreates a container in a region. The archive policy, the access type and the CORS origins can be set at creation. Name, region and archive policy cannot be changed afterward.
updateupdatecontainer_id, project_id, target_specUpdates the access type and the CORS origins of the container. Send the current checksum to prevent overwriting a concurrent change. Without it, the last write wins.
deletedeletecontainer_id, project_idDeletes the container and every object it holds. The deletion is asynchronous: the container stays in DELETING status until it is emptied and removed.
presignexeccontainerId, project_id, keyCreates a temporary URL to download one object without credentials. The URL expires after the given time, one hour by default and seven days at most.

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"}})
containerIdstringContainer ID
container_idstringContainer ID (wire: containerId)
project_idstringThe Public Cloud project ID. Resolved from OVH_CLOUD_PROJECT_SERVICE when set.
x_pagination_cursorstringPagination cursor (wire: X-Pagination-Cursor)
x_pagination_sizeintegerPagination size (wire: X-Pagination-Size)

SELECT examples​

Returns the container configuration and its current state, including its object count and stored size.

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

INSERT examples​

Creates a container in a region. The archive policy, the access type and the CORS origins can be set at creation. Name, region and archive policy cannot be changed afterward.

INSERT INTO ovh.public_cloud_storage.swift_containers (
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​

Updates the access type and the CORS origins of the container. Send the current checksum to prevent overwriting a concurrent change. Without it, the last write wins.

UPDATE ovh.public_cloud_storage.swift_containers
SET
checksum = '{{ checksum }}',
target_spec = '{{ target_spec }}'
WHERE
container_id = '{{ container_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 container and every object it holds. The deletion is asynchronous: the container stays in DELETING status until it is emptied and removed.

DELETE FROM ovh.public_cloud_storage.swift_containers
WHERE container_id = '{{ container_id }}' --required
AND project_id = '{{ project_id }}' --required unless OVH_CLOUD_PROJECT_SERVICE is set
;

Lifecycle Methods​

EXEC variables use wire (API) names.

Creates a temporary URL to download one object without credentials. The URL expires after the given time, one hour by default and seven days at most.

EXEC ovh.public_cloud_storage.swift_containers.presign
@containerId='{{ containerId }}' --required,
@project_id='{{ project_id }}' --required unless OVH_CLOUD_PROJECT_SERVICE is set
@@json=
'{
"expiresIn": {{ expiresIn }},
"key": "{{ key }}"
}'
;