Stay organized with collections Save and categorize content based on your preferences.
Google Cloud Resource Manager API provides methods that you can use to programmatically manage your projects in the Google Cloud Platform. With this API, you can do the following:
Get a list of all projects associated with an account
Create new projects
Update existing projects
Delete projects
Undelete, or recover, projects that you don’t want to delete
NOTE: Don’t forget to look at the Authentication section below. It’s slightly different from the rest of this library.
Quick StartIn order to use this library, you first need to go through the following steps:
Install this library in a virtualenv using pip. virtualenv is a tool to create isolated Python environments. The basic problem it addresses is one of dependencies and versions, and indirectly permissions.
With virtualenv, it’s possible to install this library without needing system install permissions, and without clashing with the installed system dependencies.
Supported Python VersionsPython >= 3.5
Deprecated Python VersionsPython == 2.7. Python 2.7 support will be removed on January 1, 2020.
Mac/Linuxpip install virtualenv
virtualenv <your-env>
source <your-env>/bin/activate
<your-env>/bin/pip install google-cloud-resource-manager
Windows
pip install virtualenv
virtualenv <your-env>
<your-env>\Scripts\activate
<your-env>\Scripts\pip.exe install google-cloud-resource-manager
Authentication
Unlike the other APIs, the Resource Manager API is focused on managing your various projects inside Google Cloud Platform. What this means (currently, as of August 2015) is that you can’t use a Service Account to work with some parts of this API (for example, creating projects).
The reason is actually pretty simple: if your API call is trying to do something like create a project, what project’s Service Account can you use? Currently none.
This means that for this API you should always use the credentials provided by the Google Cloud SDK, which you can get by running gcloud auth login
.
Once you run that command, google-cloud-python
will automatically pick up the credentials, and you can use the “automatic discovery” feature of the library.
Start by authenticating:
$ gcloud auth application-default login
And then simply create a client:
from google.cloud import resource_manager
client = resource_manager.Client()
Using the API
Here’s a quick example of the full life-cycle:
from google.cloud import resource_manager
client = resource_manager.Client()
# List all projects you have access to
for project in client.list_projects():
print(project)
# Create a new project
new_project = client.new_project(
'your-project-id-here', name='My new project')
new_project.create()
# Update an existing project
project = client.fetch_project('my-existing-project')
project.name = 'Modified name'
project.update()
# Delete a project
project = client.new_project('my-existing-project')
project.delete()
# Undelete a project
project = client.new_project('my-existing-project')
project.undelete()
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-08-07 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[],[]]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4