Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete bulk subscriptions using script #4578

Open
ArqamFarooqui110719 opened this issue Jun 7, 2024 · 5 comments
Open

Delete bulk subscriptions using script #4578

ArqamFarooqui110719 opened this issue Jun 7, 2024 · 5 comments
Assignees

Comments

@ArqamFarooqui110719
Copy link
Contributor

Bug description
I have thousands of subscription created in my orion setup.
Is there any script available, using which I can delete all subscriptions using IDs.

If not, shouldn't we have a script (python/shell) which can delete multiple subscription on single click.

@fgalan
Copy link
Member

fgalan commented Jun 7, 2024

@fgalan
Copy link
Member

fgalan commented Jun 7, 2024

Ah, sorry... those scripts are for entities and you are asking for subscriptions

I think we don't have such script. Maybe a delete_subscriptions.py script (based on the previous ones) could be useful. It would be an interesting contribution :)

@ArqamFarooqui110719
Copy link
Contributor Author

Ah, sorry... those scripts are for entities and you are asking for subscriptions

Yes, for subscriptions:)

I think we don't have such script. Maybe a delete_subscriptions.py script (based on the previous ones) could be useful. It would be an interesting contribution :)

Yes, I am looking into it.

@ArqamFarooqui110719
Copy link
Contributor Author

ArqamFarooqui110719 commented Jun 7, 2024

Before starting, I want to confirm few point:

  1. Currently we are able to delete subscriptions one by one using subscription ID.
  2. So, for deleting the subscriptions in bulk, we need to collect the subscriptions IDs of each subscription (may be, in any variable)
  3. then process delete operation for each subscription one by one.

@fgalan, Please confirm above steps. And if you have any suggestion please let me know.

@fgalan
Copy link
Member

fgalan commented Jun 7, 2024

That's correct!

I'd suggest to implement the script in Python, with his the tooling language that we use in this repository.

Regarding step 2, to collect subscription IDs, the GET /v2/subscriptions operation has to be used. Note that you could have a large number of subscription, so you should use the pagination options, as delete_entities_by_query.py does. Details of the API operation can be found at https://github.com/telefonicaid/fiware-orion/blob/master/doc/manuals/orion-api.md#list-subscriptions-get-v2subscriptions

Finally, as an extra feature of your script it would be interesting to include filtering capabilities, based in the JSON of each subscription obtained. For instance, delete subscription which match a given description, etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants