I'm having a terrible time trying to just simply 'clone' a security rule, and then edit it how desired, without running into issues.
First, using copy.deepcopy(security_rule) works perfectly...however adds a massive amount of run-time to my program. I previously used this method on dictionaries without a major increase in run-time. I can't find any existing clone/duplicate/etc type of function within the API, if it exists.
I've tried using element(), element_str(), __dict__, manually converting to dict, I've tried manually grabbing all the params that are allowed when creating a new rule via a dict (ie SecurityRule(**dict))...and spent hours running into misc issue after issue. Either rules not getting added correctly, or rules still somehow magically linked (old vs new rule) even when creating a brand new one via **dict. The linkage then causes the old rule to get modified when only attempting to modify the new rule.
There's got to be a simple way to do this. I'm hoping someone can help me out here.
Click Accept as Solution to acknowledge that the answer to your question has been provided.
The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!
These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the LIVEcommunity as a whole!
The LIVEcommunity thanks you for your participation!