Simple cli to pause and resume Atlas Clusters
Project description
Atlascli - A Python API for MongoDB Atlas
The MongoDB database as a service offering Atlas provides a complete and well documented REST API.
Installation
The easiest way to install the atlascli
is with pip
.
C:\Users\joe>pip install atlascli
Looking in indexes: https://test.pypi.org/simple/
Processing c:\users\joe\appdata\local\pip\cache\wheels\6c\2f\e8\7f33b6b37b40424f1d00d54048aaa63fd47c7b289e790a997d\atlascli-0.2.5b5-py3-none-any.whl
Requirement already satisfied: python-dateutil in c:\users\joe\.virtualenvs\joe-93pxapbd\lib\site-packages (from atlascli) (2.8.1)
Requirement already satisfied: requests in c:\users\joe\.virtualenvs\joe-93pxapbd\lib\site-packages (from atlascli) (2.5.4.1)
Requirement already satisfied: six>=1.5 in c:\users\joe\.virtualenvs\joe-93pxapbd\lib\site-packages (from python-dateutil->atlascli) (1.10.0)
Installing collected packages: atlascli
Successfully installed atlascli-0.2.5b
C:\Users\joe>
Once the installation completes you can confirm it has worked by running
C:\Users\joe>atlascli -h
usage: atlascli [-h] [--publickey PUBLICKEY] [--privatekey PRIVATEKEY]
[--pause PAUSE_CLUSTER] [--resume RESUME_CLUSTER] [--list]
[--listproj] [--listcluster] [--cluster CLUSTER]
[--project_id PROJECT_ID_LIST] [--debug]
A command line program to list organizations,projects and clusters on a
MongoDB Atlas organization.
optional arguments:
-h, --help show this help message and exit
--publickey PUBLICKEY
MongoDB Atlas public API key
--privatekey PRIVATEKEY
MongoDB Atlas private API key
--pause PAUSE_CLUSTER
pause named cluster in project specified by project_id
Note that clusters that have been resumed cannot be
pausedfor the next 60 minutes
--resume RESUME_CLUSTER
resume named cluster in project specified by
project_id
--list List everything in the organization
--listproj List all projects
--listcluster List all clusters
--cluster CLUSTER list all elements for for project_id:cluster_name
--project_id PROJECT_ID_LIST
specify project for cluster that is to be paused
--debug Turn on logging at debug level
Version: 0.2.5b5
C:\Users\joe>
The Python Atlas API wraps the REST API in a more Pythonic
API based around an AtlasAPI
class.
The library assumes the existence of two environment variables:
ATLAS_PUBLIC_KEY
: The public key value defined by the Atlas programmatic API keyATLAS_PRIVATE_KEY
: The private key defined by the Atlas programmatic API key.
These can be passed in on the command line as well as parameters
--publickey
and --privatekey
.
See the section below on how to create a programmatic Atlas API key.
How to create an Atlas API Key
You can create keys at the Organization level by selecting the access menu item on the left hand side menu:
Once you create a key you then need to assign it permissions. If you pick the default youwill have to add this key explicitly to every project that you want to manage via the API.
On the next screen you can collect your API key. You will only get to see it once so please make sure to take a copy.
Not on this screen we obliterate part of the key so it can't been seen.
Finally you need to whitelist any nodes that are going to originate API requests.
You are now ready to start using your API key.
Using your keys
Both parts of the key required to access your account. Rather than passing them
in on the command line the atlascli
program these can read them from the environment
variables ATLAS_PRIVATE_KEY
and ATLAS_PUBLIC_KEY
.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file atlascli-0.2.8.tar.gz
.
File metadata
- Download URL: atlascli-0.2.8.tar.gz
- Upload date:
- Size: 23.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 80b979530a3c1c64d00da56be6d536950ab8fa9cddcf8c3fa31e2d8412a6a517 |
|
MD5 | 7aae99de1de5955d8b1abb019bca9cbc |
|
BLAKE2b-256 | e1c97570f0f05b953e03cccd9ead2f71d5c0b26df818d12d06de5fb9398a62a2 |