swift_containers
Creates, updates, deletes, gets or lists a swift_containers resource.
Overview​
| Name | swift_containers |
| Type | Resource |
| Id | ovh.public_cloud_storage.swift_containers |
Fields​
The following fields are returned by SELECT queries:
- get
- list
successful operation
| Name | Datatype | Description |
|---|---|---|
id | string | Container 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. |
checksum | string | Computed hash representing the current target specification value |
created_at | string (date-time) | Creation date of the container (wire: createdAt) |
current_state | object | Current observed state of the container, read from the Swift backend (wire: currentState) |
current_tasks | array | Ongoing asynchronous tasks related to the container (wire: currentTasks) |
resource_status | string | Container 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 container (wire: targetSpec) |
updated_at | string (date-time) | Last update date of the container (wire: updatedAt) |
A Swift object storage container. Its identifier is <REGION>_<name>, for example GRA_my-container, where REGION is the region of the container.
| Name | Datatype | Description |
|---|---|---|
id | string | Container 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. |
checksum | string | Computed hash representing the current target specification value |
created_at | string (date-time) | Creation date of the container (wire: createdAt) |
current_state | object | Current observed state of the container, read from the Swift backend (wire: currentState) |
current_tasks | array | Ongoing asynchronous tasks related to the container (wire: currentTasks) |
resource_status | string | Container 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 container (wire: targetSpec) |
updated_at | string (date-time) | Last update date of the container (wire: updatedAt) |
Methods​
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | container_id, project_id | Returns the container configuration and its current state, including its object count and stored size. | |
list | select | project_id | x_pagination_cursor, x_pagination_size | Returns the containers of the project across every region offering Swift object storage. |
create | insert | project_id, target_spec | 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. | |
update | update | container_id, project_id, target_spec | 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. | |
delete | delete | container_id, project_id | Deletes the container and every object it holds. The deletion is asynchronous: the container stays in DELETING status until it is emptied and removed. | |
presign | exec | containerId, project_id, key | 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. |
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"}}) |
containerId | string | Container ID |
container_id | string | Container ID (wire: containerId) |
project_id | string | The Public Cloud project ID. Resolved from OVH_CLOUD_PROJECT_SERVICE when set. |
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 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
;
Returns the containers of the project across every region offering Swift object storage.
SELECT
id,
checksum,
created_at,
current_state,
current_tasks,
resource_status,
target_spec,
updated_at
FROM ovh.public_cloud_storage.swift_containers
WHERE 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 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
;
# Description fields are for documentation purposes
- name: swift_containers
props:
- name: project_id
value: "{{ project_id }}"
description: Required parameter for the swift_containers resource.
- name: target_spec
description: |
Desired target specification for the container to create
value:
archive: {{ archive }}
cors:
- "{{ cors }}"
location:
availabilityZone: "{{ availabilityZone }}"
region: "{{ region }}"
name: "{{ name }}"
type: "{{ type }}"
UPDATE examples​
- update
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​
- delete
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.
- presign
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 }}"
}'
;