{ "info": { "author": "Yellow Pages Inc.", "author_email": "cloud@yp.ca", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "Operating System :: OS Independent", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3 :: Only" ], "description": "Atlas API\n==========\n\nA Python package for MongoDB Atlas Cloud provider.\n\n`Atlas API `__\n\n`Configure Atlas API Access `__\n\n`Current state of the python-atlasapi support `__\n\n`Code documentation (sphinx) `__\n\nInstallation\n------------\n\nThis package is available for Python 3.5+.\n\n.. code:: bash\n\n pip3 install atlasapi\n\nOr install the development version from github:\n\n.. code:: bash\n\n pip3 install git+https://github.com/mickybart/python-atlasapi.git\n\nUsage\n-----\n\nGet All Database Users\n^^^^^^^^^^^^^^^^^^^^^^\n\n.. code:: python\n\n from atlasapi.atlas import Atlas\n\n a = Atlas(\"\",\"\",\"\")\n\n # Low level Api\n details = a.DatabaseUsers.get_all_database_users(pageNum=1, itemsPerPage=100)\n\n # Iterable\n for user in a.DatabaseUsers.get_all_database_users(iterable=True):\n print(user[\"username\"])\n\nCreate a Database User\n^^^^^^^^^^^^^^^^^^^^^^\n\n.. code:: python\n\n from atlasapi.atlas import Atlas\n from atlasapi.specs import DatabaseUsersPermissionsSpecs, RoleSpecs\n\n a = Atlas(\"\",\"\",\"\")\n\n p = DatabaseUsersPermissionsSpecs(\"test\", \"password for test user\")\n p.add_roles(\"test-db\",\n [RoleSpecs.dbAdmin,\n RoleSpecs.readWrite])\n p.add_role(\"other-test-db\", RoleSpecs.readWrite, \"a_collection\")\n\n details = a.DatabaseUsers.create_a_database_user(p)\n\nUpdate a Database User\n^^^^^^^^^^^^^^^^^^^^^^\n\n.. code:: python\n\n from atlasapi.atlas import Atlas\n from atlasapi.specs import DatabaseUsersUpdatePermissionsSpecs, RoleSpecs\n\n a = Atlas(\"\",\"\",\"\")\n\n # Update roles and password\n p = DatabaseUsersUpdatePermissionsSpecs(\"password for test user\")\n p.add_role(\"test-db\", RoleSpecs.read, \"a_collection\")\n\n details = a.DatabaseUsers.update_a_database_user(\"test\", p)\n\nDelete a Database User\n^^^^^^^^^^^^^^^^^^^^^^\n\n.. code:: python\n\n from atlasapi.atlas import Atlas\n\n a = Atlas(\"\",\"\",\"\")\n\n details = a.DatabaseUsers.delete_a_database_user(\"test\")\n\nGet a Single Database User\n^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n.. code:: python\n\n from atlasapi.atlas import Atlas\n\n a = Atlas(\"\",\"\",\"\")\n\n details = a.DatabaseUser.get_a_single_database_user(\"test\")\n\nProjects\n^^^^^^^^\n\n.. code:: python\n\n from atlasapi.atlas import Atlas\n\n a = Atlas(\"\",\"\",\"\")\n\n # Get All Projects\n for project in a.Projects.get_all_projects(iterable=True):\n print(project[\"name\"])\n\n # Get One Project\n details = a.Projects.get_one_project(\"59a03f423b34b9132757aa0d\")\n\n # Create a Project\n details = a.Projects.create_a_project(\"test\", \"599eed989f78f769464d28cc\")\n\nClusters\n^^^^^^^^\n\n.. code:: python\n\n from atlasapi.atlas import Atlas\n\n a = Atlas(\"\",\"\",\"\")\n\n # Is existing cluster ?\n a.Clusters.is_existing_cluster(\"cluster-dev\")\n\n # Get All Clusters\n for cluster in a.Clusters.get_all_clusters(iterable=True):\n print(cluster[\"name\"])\n\n # Get a Single Cluster\n details = a.Clusters.get_a_single_cluster(\"cluster-dev\")\n\n # Delete a Cluster (dry run, raise ErrConfirmationRequested)\n details = a.Clusters.delete_a_cluster(\"cluster-dev\")\n\n # Delete a Cluster (approved)\n details = a.Clusters.delete_a_cluster(\"cluster-dev\", areYouSure=True)\n\nAlerts\n^^^^^^\n\n.. code:: python\n\n from atlasapi.atlas import Atlas\n from atlasapi.specs import AlertStatusSpec\n\n a = Atlas(\"\",\"\",\"\")\n\n # Get All Alerts in OPEN status\n for alert in a.Alerts.get_all_alerts(AlertStatusSpec.OPEN, iterable=True):\n print(alert[\"id\"])\n\n # Get an Alert\n details = a.Alerts.get_an_alert(\"597f221fdf9db113ce1755cd\")\n\n # Acknowledge an Alert\n # until (now + 6 hours)\n from datetime import datetime, timezone, timedelta\n now = datetime.now(timezone.utc)\n until = now + timedelta(hours=6)\n details = a.Alerts.acknowledge_an_alert(\"597f221fdf9db113ce1755cd\", until, \"Acknowledge reason\")\n\n # forever\n details = a.Alerts.acknowledge_an_alert_forever(\"597f221fdf9db113ce1755cd\", \"Acknowledge reason\")\n\n # Unacknowledge an Alert\n details = a.Alerts.unacknowledge_an_alert(\"597f221fdf9db113ce1755cd\")\n\nError Types\n-----------\n\nAbout ErrAtlasGeneric\n^^^^^^^^^^^^^^^^^^^^^\n\nAll ErrAtlas* Exception class inherit from ErrAtlasGeneric.\n\n.. code:: python\n\n try:\n ...\n except ErrAtlasGeneric as e:\n c, details = e.getAtlasResponse()\n\n- 'c'\n HTTP return code (4xx or 5xx for an error, 2xx otherwise)\n- 'details'\n Response payload\n\nExceptions\n^^^^^^^^^^\n\n- ErrRole\n A role is not compatible with Atlas\n- ErrPagination\n An issue occurs during a \"Get All\" function with 'iterable=True'\n- ErrPaginationLimits\n Out of limit on 'pageNum' or 'itemsPerPage' parameters\n- ErrAtlasBadRequest\n Something was wrong with the client request.\n- ErrAtlasUnauthorized\n Authentication is required\n- ErrAtlasForbidden\n Access to the specified resource is not permitted.\n- ErrAtlasNotFound\n The requested resource does not exist.\n- ErrAtlasMethodNotAllowed\n The HTTP method is not supported for the specified resource.\n- ErrAtlasConflict\n This is typically the response to a request to create or modify a property of an entity that is unique when an existing entity already exists with the same value for that property.\n- ErrAtlasServerErrors\n Something unexpected went wrong.\n- ErrConfirmationRequested\n Confirmation requested to execute the call.\n\nInternal Notes\n--------------\n\n`Code documentation (sphinx) `__\n\nBugs or Issues\n--------------\n\nPlease report bugs, issues or feature requests to `Github\nIssues `__\n\n\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/mickybart/python-atlasapi", "keywords": "atlas,mongo,mongodb,cloud,api", "license": "Apache License 2.0", "maintainer": "", "maintainer_email": "", "name": "atlasapi", "package_url": "https://pypi.org/project/atlasapi/", "platform": "", "project_url": "https://pypi.org/project/atlasapi/", "project_urls": { "Homepage": "https://github.com/mickybart/python-atlasapi" }, "release_url": "https://pypi.org/project/atlasapi/0.5.4/", "requires_dist": [ "requests", "python-dateutil" ], "requires_python": ">=3.5", "summary": "Expose MongoDB Atlas Cloud provider APIs", "version": "0.5.4" }, "last_serial": 3460413, "releases": { "0.5.2": [ { "comment_text": "", "digests": { "md5": "96121e51ad053c920dc85d7da3fcf513", "sha256": "6ecb6082dfbeb519ca8d41fa4eb6c8239733976e8ff70ef1008e880afd6bd68e" }, "downloads": -1, "filename": "atlasapi-0.5.2-py3-none-any.whl", "has_sig": false, "md5_digest": "96121e51ad053c920dc85d7da3fcf513", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.5", "size": 13055, "upload_time": "2018-01-01T20:08:36", "url": "https://files.pythonhosted.org/packages/98/d7/b719171e39a53d53de6462b5512e6c10f796747a8964c0cc62cee97860d8/atlasapi-0.5.2-py3-none-any.whl" } ], "0.5.3": [ { "comment_text": "", "digests": { "md5": "000a2bdfd3bea0f698eab40b533773ea", "sha256": "db06a594b6353e3d631deeb32b34d9f113e38908263dd7fb8cf581dbd368e0bb" }, "downloads": -1, "filename": "atlasapi-0.5.3-py3-none-any.whl", "has_sig": false, "md5_digest": "000a2bdfd3bea0f698eab40b533773ea", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.5", "size": 14427, "upload_time": "2018-01-03T16:13:14", "url": "https://files.pythonhosted.org/packages/19/79/845f808ac7af19c14bbba0c19bae1eccd17cdf5ed677c42b07e4a606c55f/atlasapi-0.5.3-py3-none-any.whl" } ], "0.5.4": [ { "comment_text": "", "digests": { "md5": "54d3f4dad1726e032cf8498eab2c4f94", "sha256": "a6d486f47c61d3144602760bb67ed910c47529db7bd4da8e05cccc39eb03aca8" }, "downloads": -1, "filename": "atlasapi-0.5.4-py3-none-any.whl", "has_sig": false, "md5_digest": "54d3f4dad1726e032cf8498eab2c4f94", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.5", "size": 15041, "upload_time": "2018-01-03T23:15:31", "url": "https://files.pythonhosted.org/packages/29/cc/b1332908a622b719095b3969c9436fd0d9d5d4fff5305579218b05ac14e4/atlasapi-0.5.4-py3-none-any.whl" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "54d3f4dad1726e032cf8498eab2c4f94", "sha256": "a6d486f47c61d3144602760bb67ed910c47529db7bd4da8e05cccc39eb03aca8" }, "downloads": -1, "filename": "atlasapi-0.5.4-py3-none-any.whl", "has_sig": false, "md5_digest": "54d3f4dad1726e032cf8498eab2c4f94", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.5", "size": 15041, "upload_time": "2018-01-03T23:15:31", "url": "https://files.pythonhosted.org/packages/29/cc/b1332908a622b719095b3969c9436fd0d9d5d4fff5305579218b05ac14e4/atlasapi-0.5.4-py3-none-any.whl" } ] }