When I run a python program it's as simple as writing into terminal python myprogram.py. Now, I'm trying to run that program on a google vm instance and shut it off with as few steps as possible. I'm trying to get it all written down in a python program, but I was told that my method of using the subprocess module is not the right way to do it. I was told that the best way to do it is to use the googleapiclient module. So the current I use to create an instance is:
def create_instance(name='', machine_type=''):
name = 'kfoley76'
machine_type = 'n1-standard-1'
subprocess.run(['gcloud', 'compute', 'instances', 'create',
name, f'--machine-type={machine_type}',
'--zone=us-west2-a', '--boot-disk-auto-delete'])
How would I rewrite that using googleapiclient module. I assume the answer would be located here
https://cloud.google.com/compute/docs/reference/rest/v1/instances/start
but that documentation is utterly incomprehensible.