Forum Discussion
How to Duplicate an Object from REST API / Python SDK
Question: How can you use the Python SDK to create a new object (like a pool) from an existing object?
As a bonus, is there any way to generate the CLI commands for an action from the SDK? My use case is that I use the SDK to get information from the live devices, and then I use that info to create change documents for other implementers to follow. They need written CLI commands. So then, given the newly duplicated object we just generated in the CLI, is there a way to create the CLI commands to make it?
Hello Wyko.
This command give you a JSON structure with all the configuration sets located in "mynode".
mynode = session.tm.ltm.nodes.node.load(name='mynode', partition='Common')
For creation of a new object, you need to specify all the configuration parameters that you would like to use from the other object.
mynode = session.tm.ltm.nodes.node.create(name='mynode', address='5.5.5.5', partition='Common', ... etc ...)
-------
Bash execution is possible with Python SDK
command = session.tm.util.bash.exec_cmd('run', utilCmdArgs='-c "netstat -rn"') print(command.commandResult)
Regards,
Dario.
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com