I wanted to execute a cloud function whenever a file is dropped in the bucket (see the below code). Further this cloud function should start a VM instance.
def startVMInstance(event, context): file = event if (file['name'] == 'test1.csv'): print('Starting VM Instnace') request = context.instances().start(project ='proj-name', zone ='zone-info', instance ='VMlabel') response = request.execute(event) print(response)
When I run this code, I do get successful execution of the trigger event, when the file is added. but its giving me below error message
AttributeError: 'Context' object has no attribute 'instances'
I am only familiar with python, and could not find any resource which can help me write this functionality in my code.
It would be great if I some one can point out where I am going wrong and what libraries I am missing from my code to make it work.
ps: I haven't included any libraries in my code as of yet, as I don't know which once I will need.