Skip to content
This repository has been archived by the owner on Sep 5, 2023. It is now read-only.

Commit

Permalink
feat: add v3 (#62)
Browse files Browse the repository at this point in the history
Fixes #2  🦕

This PR adds the auto generated `v3` client for Resource Manager and changes the release status from `alpha` to `beta`. This is a significant change from the previous version `v1beta1`, as this is the first version of an auto generated client.  

chore(release_status): upgrade release status from alpha to beta
fix: remove v1beta1
chore(deps): require python 3.6+
  • Loading branch information
parthea committed Jun 10, 2021
1 parent de1d78b commit 72f69f0
Show file tree
Hide file tree
Showing 100 changed files with 42,134 additions and 1,535 deletions.
8 changes: 8 additions & 0 deletions .github/.OwlBot.yaml
Expand Up @@ -15,3 +15,11 @@
docker:
image: gcr.io/repo-automation-bots/owlbot-python:latest

deep-remove-regex:
- /owl-bot-staging

deep-copy-regex:
- source: /google/cloud/resourcemanager/(v.*)/.*-py/(.*)
dest: /owl-bot-staging/$1/$2

begin-after-commit-hash: 40278112d2922ec917140dcb5cc6d5ef2923aeb2
2 changes: 1 addition & 1 deletion .repo-metadata.json
Expand Up @@ -4,7 +4,7 @@
"product_documentation": "https://cloud.google.com/resource-manager",
"client_documentation": "https://googleapis.dev/python/cloudresourcemanager/latest",
"issue_tracker": "https://issuetracker.google.com/savedsearches/559757",
"release_level": "alpha",
"release_level": "beta",
"language": "python",
"library_type": "GAPIC_MANUAL",
"repo": "googleapis/python-resource-manager",
Expand Down
113 changes: 19 additions & 94 deletions README.rst
@@ -1,36 +1,24 @@
Python Client for Google Cloud Resource Manager
===============================================

|alpha| |pypi| |versions|
|beta| |pypi| |versions|

`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

- `Client Library Documentation`_
- `Product Documentation`_


.. |alpha| image:: https://img.shields.io/badge/support-alpha-orange.svg
:target: https://github.com/googleapis/google-cloud-python/blob/master/README.rst#alpha-support
.. |beta| image:: https://img.shields.io/badge/support-beta-orange.svg
:target: https://github.com/googleapis/google-cloud-python/blob/master/README.rst#beta-support
.. |pypi| image:: https://img.shields.io/pypi/v/google-cloud-resource-manager.svg
:target: https://pypi.org/project/google-cloud-resource-manager/
.. |versions| image:: https://img.shields.io/pypi/pyversions/google-cloud-resource-manager.svg
:target: https://pypi.org/project/google-cloud-resource-manager/
.. _Google Cloud Resource Manager: https://cloud.google.com/resource-manager/
.. _Google Cloud Resource Manager: https://cloud.google.com/resource-manager
.. _Client Library Documentation: https://googleapis.dev/python/cloudresourcemanager/latest
.. _Product Documentation: https://cloud.google.com/resource-manager/docs/

.. note::

Don't forget to look at the `Authentication`_ section below.
It's slightly different from the rest of this library.
.. _Product Documentation: https://cloud.google.com/resource-manager

Quick Start
-----------
Expand All @@ -39,11 +27,13 @@ In order to use this library, you first need to go through the following steps:

1. `Select or create a Cloud Platform project.`_
2. `Enable billing for your project.`_
3. `Enable the Google Cloud Resource Manager API.`_
3. `Enable the Resource Manager API.`_
4. `Setup Authentication.`_

.. _Select or create a Cloud Platform project.: https://console.cloud.google.com/project
.. _Enable billing for your project.: https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project
.. _Enable the Google Cloud Resource Manager API.: https://cloud.google.com/resource-manager
.. _Enable the Resource Manager API.: https://cloud.google.com/resource-manager/docs/quickstart-organizations#before-you-begin
.. _Setup Authentication.: https://googleapis.dev/python/google-api-core/latest/auth.html

Installation
~~~~~~~~~~~~
Expand All @@ -59,15 +49,6 @@ dependencies.
.. _`virtualenv`: https://virtualenv.pypa.io/en/latest/


Supported Python Versions
^^^^^^^^^^^^^^^^^^^^^^^^^
Python >= 3.5

Deprecated Python Versions
^^^^^^^^^^^^^^^^^^^^^^^^^^
Python == 2.7. Python 2.7 support will be removed on January 1, 2020.


Mac/Linux
^^^^^^^^^

Expand All @@ -89,71 +70,15 @@ Windows
<your-env>\Scripts\activate
<your-env>\Scripts\pip.exe install google-cloud-resource-manager
Next Steps
~~~~~~~~~~

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``.

.. _Google Cloud SDK: http://cloud.google.com/sdk

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:

.. code-block:: bash
$ gcloud auth application-default login
And then simply create a client:

.. code-block:: python
from google.cloud import resource_manager
client = resource_manager.Client()
Using the API
-------------

Here's a quick example of the full life-cycle:

.. code-block:: python
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()
- Read the `Client Library Documentation`_ for Resource Manager
to see other available methods on the client.
- Read the `Resource Manager Product documentation`_ to learn
more about the product and see How-to Guides.
- View this `README`_ to see the full list of Cloud
APIs that we cover.

# Undelete a project
project = client.new_project('my-existing-project')
project.undelete()
.. _Resource Manager Product documentation: https://cloud.google.com/resource-manager/docs
.. _README: https://github.com/googleapis/google-cloud-python/blob/master/README.rst
1 change: 0 additions & 1 deletion docs/README.rst

This file was deleted.

84 changes: 84 additions & 0 deletions docs/README.rst
@@ -0,0 +1,84 @@
Python Client for Google Cloud Resource Manager
===============================================

|beta| |pypi| |versions|

`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:

- `Client Library Documentation`_
- `Product Documentation`_

.. |beta| image:: https://img.shields.io/badge/support-beta-orange.svg
:target: https://github.com/googleapis/google-cloud-python/blob/master/README.rst#beta-support
.. |pypi| image:: https://img.shields.io/pypi/v/google-cloud-resource-manager.svg
:target: https://pypi.org/project/google-cloud-resource-manager/
.. |versions| image:: https://img.shields.io/pypi/pyversions/google-cloud-resource-manager.svg
:target: https://pypi.org/project/google-cloud-resource-manager/
.. _Google Cloud Resource Manager: https://cloud.google.com/resource-manager
.. _Client Library Documentation: https://googleapis.dev/python/cloudresourcemanager/latest
.. _Product Documentation: https://cloud.google.com/resource-manager

Quick Start
-----------

In order to use this library, you first need to go through the following steps:

1. `Select or create a Cloud Platform project.`_
2. `Enable billing for your project.`_
3. `Enable the Resource Manager API.`_
4. `Setup Authentication.`_

.. _Select or create a Cloud Platform project.: https://console.cloud.google.com/project
.. _Enable billing for your project.: https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project
.. _Enable the Resource Manager API.: https://cloud.google.com/resource-manager/docs/quickstart-organizations#before-you-begin
.. _Setup Authentication.: https://googleapis.dev/python/google-api-core/latest/auth.html

Installation
~~~~~~~~~~~~

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.

.. _`virtualenv`: https://virtualenv.pypa.io/en/latest/


Mac/Linux
^^^^^^^^^

.. code-block:: console
pip install virtualenv
virtualenv <your-env>
source <your-env>/bin/activate
<your-env>/bin/pip install google-cloud-resource-manager
Windows
^^^^^^^

.. code-block:: console
pip install virtualenv
virtualenv <your-env>
<your-env>\Scripts\activate
<your-env>\Scripts\pip.exe install google-cloud-resource-manager
Next Steps
~~~~~~~~~~

- Read the `Client Library Documentation`_ for Resource Manager
to see other available methods on the client.
- Read the `Resource Manager Product documentation`_ to learn
more about the product and see How-to Guides.
- View this `README`_ to see the full list of Cloud
APIs that we cover.

.. _Resource Manager Product documentation: https://cloud.google.com/resource-manager/docs
.. _README: https://github.com/googleapis/google-cloud-python/blob/master/README.rst
10 changes: 0 additions & 10 deletions docs/client.rst

This file was deleted.

14 changes: 8 additions & 6 deletions docs/index.rst
@@ -1,13 +1,15 @@
.. include:: README.rst

.. include:: multiprocessing.rst

API Reference

Api Reference
-------------
.. toctree::
:maxdepth: 2
:maxdepth: 2

client
project
resourcemanager_v3/services
resourcemanager_v3/types


Changelog
Expand All @@ -16,6 +18,6 @@ Changelog
For a list of all ``google-cloud-resource-manager`` releases:

.. toctree::
:maxdepth: 2
:maxdepth: 2

changelog
changelog
7 changes: 7 additions & 0 deletions docs/multiprocessing.rst
@@ -0,0 +1,7 @@
.. note::

Because this client uses :mod:`grpc` library, it is safe to
share instances across threads. In multiprocessing scenarios, the best
practice is to create client instances *after* the invocation of
:func:`os.fork` by :class:`multiprocessing.pool.Pool` or
:class:`multiprocessing.Process`.
6 changes: 0 additions & 6 deletions docs/project.rst

This file was deleted.

10 changes: 10 additions & 0 deletions docs/resourcemanager_v3/folders.rst
@@ -0,0 +1,10 @@
Folders
-------------------------

.. automodule:: google.cloud.resourcemanager_v3.services.folders
:members:
:inherited-members:

.. automodule:: google.cloud.resourcemanager_v3.services.folders.pagers
:members:
:inherited-members:
10 changes: 10 additions & 0 deletions docs/resourcemanager_v3/organizations.rst
@@ -0,0 +1,10 @@
Organizations
-------------------------------

.. automodule:: google.cloud.resourcemanager_v3.services.organizations
:members:
:inherited-members:

.. automodule:: google.cloud.resourcemanager_v3.services.organizations.pagers
:members:
:inherited-members:
10 changes: 10 additions & 0 deletions docs/resourcemanager_v3/projects.rst
@@ -0,0 +1,10 @@
Projects
--------------------------

.. automodule:: google.cloud.resourcemanager_v3.services.projects
:members:
:inherited-members:

.. automodule:: google.cloud.resourcemanager_v3.services.projects.pagers
:members:
:inherited-members:
11 changes: 11 additions & 0 deletions docs/resourcemanager_v3/services.rst
@@ -0,0 +1,11 @@
Services for Google Cloud Resourcemanager v3 API
================================================
.. toctree::
:maxdepth: 2

folders
organizations
projects
tag_bindings
tag_keys
tag_values
10 changes: 10 additions & 0 deletions docs/resourcemanager_v3/tag_bindings.rst
@@ -0,0 +1,10 @@
TagBindings
-----------------------------

.. automodule:: google.cloud.resourcemanager_v3.services.tag_bindings
:members:
:inherited-members:

.. automodule:: google.cloud.resourcemanager_v3.services.tag_bindings.pagers
:members:
:inherited-members:
10 changes: 10 additions & 0 deletions docs/resourcemanager_v3/tag_keys.rst
@@ -0,0 +1,10 @@
TagKeys
-------------------------

.. automodule:: google.cloud.resourcemanager_v3.services.tag_keys
:members:
:inherited-members:

.. automodule:: google.cloud.resourcemanager_v3.services.tag_keys.pagers
:members:
:inherited-members:

0 comments on commit 72f69f0

Please sign in to comment.