twilio-labs / serverless-toolkit

CLI tool to develop, debug and deploy Twilio Functions
https://www.twilio.com/docs/labs/serverless-toolkit
MIT License
114 stars 59 forks source link

Assets plugin ideas #281

Open philnash opened 3 years ago

philnash commented 3 years ago

This issue is a bucket of ideas for the Assets plugin as I think of them. Please add other ideas.

Asset permissions

Initially all assets are uploaded as public. I can see an argument for creating protected assets (audio files for use during calls, for example). Could do this with a flag twilio assets:upload file.ext --protected. I can't see a reason you would want a private asset in a service that only has assets.

Asset deletion

This can be done with the Twilio CLI using the service SID and asset SID, but we could make it easier.

Service deletion

This can be done with the CLI too, but that would not remove the SID from the plugin config. This should come with a serious confirmation step to ensure that is definitely what the user intends.

philnash commented 3 years ago

Upload multiple assets

It might be useful to be able to upload and deploy multiple assets at the same time. If a --protected flag is added, as above, it would apply to all assets uploaded at one time.

dkundel commented 3 years ago

Download Assets

There is no /Contents API for Assets today but in theory this is just a glorified curl since Assets are public. If we end up adding protected support then this could also generate a valid X-Twilio-Signature to download said asset back onto the hard-drive.

This could especially be powerful if it would support a glob syntax such as:

twilio assets:download *.mp3

Bonus if it detects process.stdout.isTTY === false and writes the file to process.stdout so that you can:

twilio assets:download index.html | grep h1

# or
twilio assets:download index.html > backup.html

Support for Name property

The name on your hard drive might contain sensitive information. It would be great to pass --path or --name to rename the asset when uploaded or even provide a a nested path.

Dynamic Upload from Stream

Rather than only supporting uploading files that are coming straight from your hard-drive it could be useful to upload things that are being passed in via the process.stdin through piping. For example:

wget https://demo.twilio.com/docs/classic.mp3 | twilio assets:upload --name special-song.mp3
gbshahaq commented 1 year ago

I see that the issue i logged is covered in here - downloading assets is still not a thing. even on the roadmap? https://github.com/twilio-labs/serverless-toolkit/issues/460

Haiz14 commented 3 months ago

Currently it's not possible to create backups of twilio services without downloading protected-assets.

Would love the feature to download protected assets.