I'm working on a project to automate google cloud setup, is there any way to create a google cloud platform project using Google-Api-Client for python?
Help me, please! Thanks in advance!
Here's what I have tried:
From views.py
from google.cloud import resource_manager
...
client = resource_manager.Client()
# List down all gcp projects
for project in client.list_projects():
print(project)
new_project = client.new_project('project11-372', name='My new project')
new_project.create()
It list down all of my gcp projects but doesn't create new project.
Here's the error I have received:
File "/Users/abdul/Documents/IGui/rest/views.py", line 60, in post new_project.create() File "/Users/abdul/IstioVirEnv/lib/python3.6/site-packages/google/cloud/resource_manager/project.py", line 138, in create data=data) File "/Users/abdul/IstioVirEnv/lib/python3.6/site-packages/google/cloud/_http.py", line 293, in api_request raise exceptions.from_http_response(response) google.cloud.exceptions.Forbidden: 403 POST https://cloudresourcemanager.googleapis.com/v1beta1/projects: The caller does not have permission.
[20/Aug/2017 05:55:02] "POST /user/deployment/create/new HTTP/1.1" 500 14960