volumes
Creates, updates, deletes, gets or lists a volumes resource.
Overview​
| Name | volumes |
| Type | Resource |
| Id | railway.storage.volumes |
Fields​
The following fields are returned by SELECT queries:
- list
One row per Volume.
| Name | Datatype | Description |
|---|---|---|
id | string | |
name | string | |
project_id | string | |
created_at | string (date-time) | |
project | object | Project object |
Methods​
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
list | select | project_id | Lists Volume objects of a Project. Backed by the Railway GraphQL query project.volumes. | |
create | insert | mount_path, project_id | Create a persistent volume in a project. Backed by the Railway GraphQL mutation volumeCreate. | |
update | update | volume_id | Update a persistent volume in a project. Backed by the Railway GraphQL mutation volumeUpdate. | |
delete | delete | volume_id | Delete a persistent volume in a project. Backed by the Railway GraphQL mutation volumeDelete. |
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 |
|---|---|---|
project_id | string | |
mount_path | string | The path in the container to mount the volume to. |
volume_id | string |
SELECT examples​
- list
Lists Volume objects of a Project. Backed by the Railway GraphQL query project.volumes.
SELECT
id,
name,
project_id,
created_at,
project
FROM railway.storage.volumes
WHERE project_id = '{{ project_id }}' -- required
;
INSERT examples​
- create
- Manifest
Create a persistent volume in a project. Backed by the Railway GraphQL mutation volumeCreate.
INSERT INTO railway.storage.volumes (
environment_id,
mount_path,
project_id,
region,
service_id
)
SELECT
'{{ environment_id }}',
'{{ mount_path }}' /* required */,
'{{ project_id }}' /* required */,
'{{ region }}',
'{{ service_id }}'
RETURNING
id,
name,
project_id,
created_at,
project
;
# Description fields are for documentation purposes
- name: volumes
props:
- name: environment_id
value: "{{ environment_id }}"
description: |
The environment to deploy the volume instances into. If `null`, the volume will not be deployed to any environment. `undefined` will deploy to all environments.
- name: mount_path
value: "{{ mount_path }}"
description: |
The path in the container to mount the volume to.
- name: project_id
value: "{{ project_id }}"
description: |
The project to create the volume in.
- name: region
value: "{{ region }}"
description: |
The region to create the volume instances in. If not provided, the default region will be used.
- name: service_id
value: "{{ service_id }}"
description: |
The service to attach the volume to. If not provided, the volume will be disconnected.
UPDATE examples​
- update
Update a persistent volume in a project. Backed by the Railway GraphQL mutation volumeUpdate.
UPDATE railway.storage.volumes
SET
name = '{{ name }}'
WHERE
volume_id = '{{ volume_id }}' --required
RETURNING
id,
name,
project_id,
created_at,
project;
DELETE examples​
- delete
Delete a persistent volume in a project. Backed by the Railway GraphQL mutation volumeDelete.
DELETE FROM railway.storage.volumes
WHERE
volume_id = '{{ volume_id }}' --required
;