Metadata-Version: 2.1
Name: toto9
Version: 0.1.3
Summary: The missing GCP Python Client Library
Home-page: https://gitlab.nordstrom.com/public-cloud/toto9
Author: Nordstrom Cloud Engineering
Author-email: cloudengineers@nordstrom.com
License: MIT
Platform: UNKNOWN
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Natural Language :: English
Description-Content-Type: text/markdown
Requires-Dist: google-api-python-client
Requires-Dist: google-auth
Requires-Dist: google-auth-httplib2
Requires-Dist: retrying
Requires-Dist: httplib2

# Toto9 - The Missing GCP Python Client

The Google Python Client Library is missing stuff! This package fills in the gaps.

## Installation

*Development Environment*

Run `pip install -e .` from the root level of this repository. This symlinks the package so that source files are available as soon as they are updated.

### Development

- `export GOOGLE_APPLICATION_CREDENTIALS=PATH_TO_YOUR_CREDENTIALS_FILE`
- `export GOOGLE_PROJECT_ID=YOUR_PROJECT_ID` (for tests)
- `virtualenv -p python3 venv`
- `source venv/bin/activate`
- `pip install -r requirements.txt`
- `pip install -e .`

*All Other Environments*

`pip install toto9`

## Usage

### Authentication

Set the `GOOGLE_APPLICATION_CREDENTIALS` environment variable to the path of your credentials. Alternatively, pass in the path to your credentials and list of scopes to the service classes with `credentials_path` and `scopes` kwargs.

### Interacting with GCP Service Accounts

`
from toto9.serviceaccount import ServiceAccount\
project_id = 'foo-bar-project-id'
service_account = ServiceAccount()
sa_list = service_account.list(project_id)
print(sa_list)
`

## Contributing

- Create an issue in gitlab
- Write the code
- Write tests, make sure they are meaningful and pass
- Submit MR against issue
- Merge

## References

- https://developers.google.com/api-client-library/python/
- https://google-cloud-python.readthedocs.io/en/latest/index.html

## Test

You should test your modules! Tests are in the `tests` directory. Name your file `test_*.py` so the unittest module will pick it up.

### Setup and Run

`
export GOOGLE_PROJECT_ID=YOUR_PROJECT_ID
export GOOGLE_APPLICATION_CREDENTIALS=PATH_TO_YOUR_CREDENTIALS_FILE
`

Run all tests with `python -m unittest`.

## TODO

* DONE Testing
* DONE create service account
* DONE delete service account
* DONE update service account
* TODO map/unmap service account to project with role
* TODO add/remove member to service account for ownership/management
* TODO implement logic for assigning permissions
* TODO write/update metadata in project
* TODO use batch sometimes? https://developers.google.com/api-client-library/python/guide/batch
* DONE make this a proper package


