https://pulumi.com logo
#azure
Title
# azure
v

victorious-exabyte-70545

09/21/2021, 4:47 PM
I would like to write command line tooling to do what the pulumi cli does. Specifically the up functionality but with checks in place. Can someone point me to the python documentation on how to accomplish this? Thanks much!
b

billowy-army-68599

09/21/2021, 4:52 PM
you're looking for the automation api! https://www.pulumi.com/automation/ There are some examples here: https://github.com/pulumi/automation-api-examples/tree/main/python
v

victorious-exabyte-70545

09/21/2021, 5:23 PM
This is it! Thanks!
can you point me to the code for the equivalent of pulumi login?
It looks like this is updated: ~/.pulumi/credentials.json
when running pulumi login
b

billowy-army-68599

09/22/2021, 12:24 AM
hi there! it's not currently implemented in the automation API itself, but you should be able to achieve the same result using os.SubProcess: https://docs.python.org/3/library/subprocess.html
v

victorious-exabyte-70545

09/22/2021, 12:34 AM
yah. it also looks like I can just generate ~/.pulumi/credentials.json with current pointed to my project.
I can write a context manager to generate and then remove on completion of pulumi action.
3 Views