# -*- coding: utf-8 -*-
from setuptools import setup

packages = \
['safire', 'safire.lib-tmp']

package_data = \
{'': ['*'],
 'safire': ['creds/.gitignore',
            'creds/.gitignore',
            'creds/.keep',
            'creds/.keep',
            'data/.gitignore',
            'data/.gitignore',
            'data/.keep',
            'data/.keep',
            'svcaccts/.gitignore',
            'svcaccts/.gitignore',
            'svcaccts/.keep',
            'svcaccts/.keep']}

install_requires = \
['fire>=0.3.1,<0.4.0',
 'google-api-python-client>=1.10.0,<2.0.0',
 'google-auth-oauthlib>=0.4.1,<0.5.0',
 'oauth2client>=4.1.3,<5.0.0',
 'openpyxl>=3.0.4,<4.0.0',
 'pandas>=1.0.5,<2.0.0',
 'requests>=2.24.0,<3.0.0',
 'uuid>=1.30,<2.0']

entry_points = \
{'console_scripts': ['safire = safire.safire:main']}

setup_kwargs = {
    'name': 'safire',
    'version': '0.1.3',
    'description': 'A flexible tool to create and delete Google / GSuite service accounts to be used with shared drives.',
    'long_description': '### __SAFIRE__\n#### A flexible tool to create and delete GSuite projects, service accounts and jsons which can be used with shared/team drives.\n\nYou can find safire at either pypi ( https://pypi.org/project/safire/ ) or github ( https://github.com/88lex/safire )\n\n\n__BONUS__:  `safire list all` will create both csv and xlsx files listing name/unique id/etc. for all projects, service accounts, shared drives, groups and group members for your account. Handy for use with other apps and scripts.\n\n- Simple usage syntax: e.g. `safire list projects`\n- Available main commands:\n    - list\n    - add / create\n    - remove / delete\n    - auth\n    - enable\n    - rename\n\n- Most commands will tell you which subcommands are available by simply typing the main command with no flags. e.g. `safire list` or optionally `safire list -h` . Subcommands include:\n    - projects\n    - sas - aka service accounts\n    - keys / jsons\n    - groups\n    - members\n    - drives (yes, safire can create and delete shared drives)\n\n- User configuration information such as project name/prefix, number of projects to create, service account prefix and so on are in the `config.py` file in the /safire/safire folder.\n - All options can be set in either the config.py or via command line flags (-h or --help for any commands)\n - If you install with pip then you can find the location of config.py with `pip list -v | grep safire`, then edit as needed\n\n- Credential files and files created by safire are by default in the user home (~ in linux) directory under safire/creds, safire/data and safire/svcaccts. This location can be changed in config.py\n\n- NOTE: Commands below are in the format `safire command subcommand` This assumes you pip install the script. You can run it directly without installing by navigating to /safire/safire and using `./safire.py command subcommand`\n\n__Recommended to run safire__: \n- Python 3.7 or higher\n- You can run safire without install from the directory holding `safire.py` (e.g. `cd /opt/safire/safire`; `./safire.py list projects`) \n  - To do this you must first run `pip install -r requirements.txt`\n- If you prefer to install and run safire from anywhere on your machine\n  - Navigate to to the base /safire dir where you git cloned safire (not /safire/safire) \n  - Use a recent version of pip that runs with pyproject.toml rather than setup.py \n  - If you want to upgrade pip use `pip install --upgrade pip` or `sudo -H pip3 install --upgrade pip`\n  - From your /safire folder run `pip install .`  If successful then you should now be able to \n\n__Setup of safire__\n\nBefore running safire you will need one gsuite project (new or old is fine) with several apis enabled.\n- If no project exists go to https://console.cloud.google.com/projectcreate to create one in your main gsuite account\n- Then go to https://console.cloud.google.com/apis/library. Ensure you choose your main project (dropdown at the top of the page), then enable the following APIs:\n\n    [ __You only need to do this once.__ ]\n\n    - Admin SDK\n    - Google Drive API\n    - Identity and Access Management (IAM) API\n    - Cloud Resource Manager API\n    - Service Usage API\n    - Service Management API\n\nOnce you have enabled the above APIs then go to this page \n- https://console.cloud.google.com/apis/credentials\n- Click Create Credentials\n- Choose `OAuth client ID`\n- For Application type choose `Desktop app` and name it as you like ( \'safire\' or anything)\n- Click Create\n- Finally choose `Download JSON`\n- You will use this JSON to create a token which allows you access to your account and gives you permission to create projects, service accounts, etc. \n  - Keep one copy of this JSON in a safe place, then put a copy named `creds.json` in the `~/safire/creds` folder [specified in your config.py file - you can change the location if you like]\n\nOnce you have this initial project created, all the APIs above enabled and have created/downloaded the credentials creds.json you are ready to use safire.\n\nThe command line is very flexible. You can quickly and easily \n- create projects via `safire add projects 5` will add 5 projects\n- create and delete service accounts(SAs) via `safire add sas proj000` will add \n- create and delete json keys (that let you access shared drives and copy/sync/move files)\n- add the SA emails to groups and shared drives to use with tools like sasync, cloudplow/cloudbox, crop etc.  \n\n`Don\'t be afraid to play with the commands. You can fix almost anything by deleting and recreating components in a few minutes.  [The exception being projects, which you should not delete as they go into a 30-day holding bin before being fully deleted, and count against your project quota.]`\n\nA typical, simple flow to use safire: \n\n- download a credentials json \n- create auth token to enable safire to access your account: `safire auth all` will create two tokens, one to access projects/drives/etc and one to access groups \n- add projects: `safire add projects 5` will add 5 projects using the prefix in your config.py file\n- enable apis: happens automatically when you add projects, but can be done manually\n- create sas: `safire add sas ""` will add sas to all or your projects using # of SAs in config.py \n- download json keys: `safire add jsons ""` will create and download service account json keys to the folder in config.py\n- add members to group: `safire add members "" mygroup@domain.com` will add all SA emails from all projects to a group called mygroup@domain.com\n- add group to shared (team) drive\n\n\n## Detailed commands\n\n__list__\n\n    safire list\n\nSYNOPSIS\n\n    safire list COMMAND\n\nDESCRIPTION\n\n    List drives, projects, service accounts (SAs), SA json keys, groups and group members. In most cases a filter can be applied.\n\nCOMMANDS\n\n    COMMAND is one of the following:\n\n     all\n       List all drives, projects, service accounts, json keys, groups and group members. Also exports these lists with full data fields to csv and xlsx files in data_path folder\n\n     drives\n       List team/shared drives. Match \'filter\'\n\n     groups\n       List groups in the authorized account. Match \'filter\'\n\n     jsons\n       alias: jsons = keys. List service account jsons/keys in the svcaccts folder. Match \'filter\'\n\n     keys\n       alias: jsons = keys. List service account jsons/keys in the svcaccts folder. Match \'filter\'\n\n     members\n       List members in groups. Groups match \'filter\'\n\n     projects\n       List projects. Match \'filter\'\n\n     sas\n       List service accounts for projects. Projects match \'filter\'\n\n\n__add__\n\n    safire add\n\nSYNOPSIS\n\n    safire add COMMAND\n\nDESCRIPTION\n\n    Add projects, drives, service accounts(SAs), SA keys/jsons and group members\n\nCOMMANDS\n\n    COMMAND is one of the following:\n\n     apis\n       Enables apis for projects. \'drive\' and \'iam\' apis by default. Automatic when projects are created but can be run manually also.\n\n     drive\n       Create a team/shared drive. Usage: \'safire add drive some_name\'\n\n     drives\n       Create team/shared drives. Usage: \'safire add teamdrive some_filename\' containing a list of drive names\n\n     jsons\n       Create and download json/key files to svcaccts folder. Add to TDs and/or groups.\n\n     keys\n       Create and download json/key files to svcaccts folder. Add to TDs and/or groups.\n\n     members\n       \'add members\' requires two arguments. Both \'project_filter\' and \'group_filter\' can be either the full project/group name or a partial name which matches some projects/groups. You can add SA emails from multiple projects to multiple groups if you wish.\n\n     projects\n       Create projects in authorized account. Usage: \'safire add projects 1\'. Uses defaults in config if none specified.\n\n     sas\n       Create N service accounts/SAs in projects which match \'filter\'. Usage: \'safire add sas 5 xyz\' will add 5 SAs to all projects containing \'xys\' if fewer than 100 exist. Will not overwrite SAs.\n\n     user\n       Add user (typically group name) to a shared/team drive. Usage: \'safire add someTDid mygroup@domain.com\'\n\n\n__delete__\n\nNAME\n\n    safire delete\n    \nSYNOPSIS\n\n    safire delete COMMAND\n\nDESCRIPTION\n\n    Delete sas, jsons/keys, drives and group members. Note: \'remove\' and \'delete\' are equivalent commands\n\nCOMMANDS\n\n    COMMAND is one of the following:\n\n     drive\n       Delete a team/shared drive. Usage: \'safire add teamdrive unique ID\'. USE CAREFULLY! Does not work with non-empty drives.\n\n     drives\n       Delete team/shared drives. Usage: \'safire add teamdrive some_filename\' with unique IDs. USE CAREFULLY\n\n     jsons\n       Remove json keys from svcaccts path\n\n     members\n       Remove members from groups. Match \'filter\'\n\n     sas\n       Usage: \'safire remove sas filter\' where filter is a string to match the projects from which you want to delete service accounts. To remove all SAs for all projects use "" as your filter\n\n     user\n       Remove user (typically group name) from a shared/team drive. Usage: \'safire remove someTDid mygroup@domain.com\'\n\n\n\n__auth__\n\nNAME\n\n    safire auth\n\nSYNOPSIS\n\n    safire auth GROUP | COMMAND\n\nDESCRIPTION\n\n    Authorize the app to access your projects, SAs, drives and groups. To generate creds.json go to https://developers.google.com/apps-script/api/quickstart/python , click Enable then download a json, rename it to creds.json and put a copy in the /creds folder\n\nGROUPS\n\n    GROUP is one of the following:\n\n     scopes_all\n\n     scopes_group\n\n     scopes_proj\n\nCOMMANDS\n\n    COMMAND is one of the following:\n\n     all\n       Create an auth token for adding/removing group members\n\n     ask\n\n     check\n\n     groups\n       Create an auth token for adding/removing group members\n\n     projects\n       Create an auth token for accessing and changing projects, service accounts, json keys and drives\n\n\n__enable__\n\nNAME\n\n    safire enable\n\nSYNOPSIS\n\n    safire enable COMMAND\n\nDESCRIPTION\n\n    Add projects, drives, service accounts(SAs), SA keys/jsons and group members\n\nCOMMANDS\n\n    COMMAND is one of the following:\n\n     apis\n       Enables apis for projects. \'drive\' and \'iam\' apis by default. Automatic when projects are created but can be run manually also.\n\n\n__rename__\n\nNAME\n\n    safire rename\n\nSYNOPSIS\n\n    safire rename COMMAND\n\nDESCRIPTION\n\n    Rename json/key files to their email prefix, email numeric (omit prefix), uniqId or in a sequence. Usage: \'safire rename jsons email\'  [choice email, email_seq, uniq, seq] Renaming is repeatable. Can always delete and redownload keys if needed.\n\nCOMMANDS\n\n    COMMAND is one of the following:\n\n     jsons\n       Usage: \'safire rename jsons email\'  [choice email, email_seq, uniq, seq]\n\n\n\n## CREDITS:\n   Many ideas, some bits of code and inspiration from spazzlo, fionera and generally from l3uddz, ncw and others - all of whose projects are excellent and some of them do some/all of what safire does. If I forgot to mention you here let me know.\n',
    'author': '88lex',
    'author_email': None,
    'maintainer': None,
    'maintainer_email': None,
    'url': None,
    'packages': packages,
    'package_data': package_data,
    'install_requires': install_requires,
    'entry_points': entry_points,
    'python_requires': '>=3.6.1,<4.0.0',
}


setup(**setup_kwargs)
