Skip to main content

signaloid-cli drives update

Update an existing drive's configuration.

Synopsis

signaloid-cli drives update --drive-id <id> [options]

Description

Updates an existing virtual drive's name and/or data sources. You can modify the drive name, replace all data sources, or both.

Options

OptionDescription
--drive-id <id>Drive ID (required)
--name <str>New drive name
--ds <json>Data source JSON (can be repeated, replaces all sources)
--ds-file <path>Path to JSON array of data sources (replaces all sources)

Output

Returns the updated drive object:

{
"DriveID": "drive-abc123",
"Name": "Updated Drive Name",
"DataSources": [...],
"UpdatedAt": "2025-01-20T15:30:00Z"
}

Examples

Update Drive Name

signaloid-cli drives update \
--drive-id drive-abc123 \
--name "Production Drive v2"

Replace Data Sources

signaloid-cli drives update \
--drive-id drive-abc123 \
--ds '{
"ResourceID": "bucket-new",
"ResourceType": "Bucket",
"Location": "/new-location/"
}'

Update Name and Data Sources

signaloid-cli drives update \
--drive-id drive-abc123 \
--name "Updated Multi-Source Drive" \
--ds '{
"ResourceID": "bucket-1",
"ResourceType": "Bucket",
"Location": "/data1/"
}' \
--ds '{
"ResourceID": "bucket-2",
"ResourceType": "Bucket",
"Location": "/data2/"
}'

Update from File

# Create new datasources configuration
cat > new-datasources.json <<EOF
[
{
"ResourceID": "bucket-updated",
"ResourceType": "Bucket",
"Location": "/updated/"
},
{
"ResourceID": "gateway-new",
"ResourceType": "Gateway",
"Location": "/sensors/"
}
]
EOF

# Update drive
signaloid-cli drives update \
--drive-id drive-abc123 \
--ds-file new-datasources.json

Add Data Source to Existing

# Get current configuration
CURRENT=$(signaloid-cli drives get --drive-id $DRIVE_ID)

# Extract and modify data sources
SOURCES=$(echo $CURRENT | jq '.DataSources + [{
"ResourceID": "bucket-additional",
"ResourceType": "Bucket",
"Location": "/extra/"
}]')

# Update with new sources
echo $SOURCES | \
signaloid-cli drives update \
--drive-id $DRIVE_ID \
--ds-file -

Remove a Data Source

# Get current drive
CURRENT=$(signaloid-cli drives get --drive-id $DRIVE_ID)

# Filter out specific resource
FILTERED=$(echo $CURRENT | \
jq '.DataSources | map(select(.ResourceID != "bucket-to-remove"))')

# Update drive
echo $FILTERED | \
signaloid-cli drives update \
--drive-id $DRIVE_ID \
--ds-file -

Exit Codes

CodeDescription
0Success
1Failed to update drive (drive not found, invalid data, API error)

Notes

  • At least one update parameter (--name or data sources) must be provided
  • When updating data sources, ALL existing sources are replaced
  • To preserve existing sources, read them first and include in the update
  • Data source format must match the create command requirements

Warning

Data Source Replacement: Using --ds or --ds-file replaces ALL existing data sources. To add or remove individual sources, you must:

  1. Get the current drive configuration
  2. Modify the DataSources array
  3. Update with the complete modified array

See Also