mediakind-video / ams-migration-tool

3 stars 4 forks source link

Deleting from a migration test #32

Closed lfraile closed 5 months ago

lfraile commented 5 months ago

Hello, in the demo documentation you refer to script dev/removeAssets.sh but I can't see it in the repo.

ljacob-mk commented 5 months ago

Hi, this was originally internal documentation and that reference didn't get removed. The tool is for migration, and we're hesitant to provide other scripts that could impact a customer's system.

If you'd like to remove assets you can use the mk.io API to do so. https://docs.mk.io/reference/delete_apiamsproject_nameassetsasset_name

The script in question would do the following

Get all assets related to a subscription: curl -X 'GET' 'https://mk.io/api/ams/$subscription/assets' -H 'accept: application/json' -H "x-mkio-token: $token" Then loop through and delete the asset: curl -X 'DELETE' https://mk.io/api/ams/$subscription/assets/$asset -H 'accept: application/json' -H "x-mkio-token: $token"

Extra care should be taken here if you have a containerRetentionPolicy=Delete on the asset, as this will delete from backing storage. If you imported using this tool the containerRetentionPolicy=Retain, so the backing storage will be intact, but any reference to the asset in mk.io will be removed.