mediakind-video / ams-migration-tool

3 stars 4 forks source link

Import assets with different containerDeletionPolicy #11

Closed GoncaloBastos closed 5 months ago

GoncaloBastos commented 6 months ago

The tool seems to only migrate assets with a containerDeletionPolicy of retain. Is there a way to use it but set the containerDeletionPolicy to delete instead?

ljacob-mk commented 6 months ago

The tool only migrates assets with containerDeletionPolicy=retain, as this is the default value for an asset in mk.io.

We made the decision to retain by default to avoid the possibility of deleting assets from backing containers while migrating, which would also impact the existing AMS assets.

We do not plan to add containerDeletionPolicy=delete as a feature to the migration script because of potential risks, but we do support an API to update this value on an asset. https://docs.mk.io/reference/put_apiamsproject_nameassetsasset_name

GoncaloBastos commented 6 months ago

Thanks @ljacob-mk

The API endpoint you linked to states the following:

When updating an asset, only the description column can be updated.

Is that not the case anymore?

Anyway, I ended up changing the migration script to import with delete, since the asset upsert endpoint description suggested that it wasn't possible to change this post import.

epicstar commented 5 months ago

Is there any way we can have an option in the command line to import assets using the the delete containerDeletionPolicy? What do you guys think? I'll otherwise create a fork of the tool in the meantime.

GoncaloBastos commented 5 months ago

I don't believe there's any plan to do that based on @ljacob-mk reply so I would go ahead and fork and make the change yourself.

ljacob-mk commented 5 months ago

@GoncaloBastos I missed that in the documentation, I think the best bet would be to fork it and add that value in.

I'll check internally to validate our support for that option in the migration tool, but last I know the decision was to leave it as the default value.

ljacob-mk commented 5 months ago

Closing this as Not Planned. I checked internally and the risk of someone deleting assets from storage unexpectedly by including a flag is too great.

Feel free to fork and add. I'd suggest removing the --overwrite command if you do this, as in some cases that will delete and recreate a resource that can't be updated. This could result in the deletion from backing storage if you have containerDeletionPolicy=delete.