{ "info": { "author": "SeatGeek", "author_email": "opensource@seatgeek.com", "bugtrack_url": null, "classifiers": [], "description": "=======\nhaldane\n=======\n\na friendly http interface to the ec2 api\n\nRequirements\n============\n\n- Vagrant\n- VMWare Fusion\n- 1 gigabytes of free ram\n- Python 2.7.8 or below due to a bug in 2.7.9 SSL\n\nInstallation\n============\n\n OS X Users are assumed to be running homebrew. Please set that up before continuing.\n Our makefile should install everything necessary to run this service within a Ubuntu 14.04 or Mac OS X 10.9+ environment.\n\nOn a VM\n-------\n\nOnce you have vagrant and virtualbox installed, you can bring up a vm with the service installed:\n\n.. code-block:: bash\n\n cd path/to/haldane\n vagrant up\n\nBy default, this will use ``vmware_fusion`` as the vagrant provider, though using you can also use ``virtualbox``:\n\n.. code-block:: bash\n\n vagrant up --provider virtualbox\n\nManually\n--------\n\nYou will need to setup a few system-level dependencies first. You can do this using the following make target:\n\n.. code-block:: bash\n\n # install system-level dependencies first\n # may ask for sudo permissions to install certain packages\n make requirements\n\n # now create a python virtual environment with all the required packages\n # will ask for sudo permissions to install virtualenv if it is not available\n # the path is set to ``.virtualenv`` by default, though we respect\n # the following environment variables:\n # - ``WORKON_HOME``\n # - ``VIRTUALENV_PATH``\n make venv\n\n # activate the virtualenv:\n eval $(make venv-activate)\n\n # to deactivate the virtualenv, run the following command:\n deactivate\n\n # for more actions you can perform, just run the ``make`` or ``make help`` commands\n\nRunning\n=======\n\nYou can ssh onto the box and run the webservice:\n\n.. code-block:: bash\n\n vagrant ssh\n source .env && make server\n\nThe webservice will now be running and exposed to the host machine at ``http://localhost:5000``\n\n> Note that you may wish to change the configuration in use. You can do so by modifying the .env.test file with your configuration.\n\nConfiguration\n=============\n\nAll configuration is set via environment variables. The following environment variables are available for use:\n\n- ``ALLOWED_IPS``: (Default: None) A comma-separated list of ip addresses that can basic authentication.\n- ``ALTERNATIVE_AUTOSCALE_TAG_NAME``: (Default: None) A tag that can be used as an alternative to the AWS group name to categorize instances.\n- ``AWS_API_VERSION``: (Default: ``2016-09-15``) The default api version to use when retrieving instance type.\n- ``AWS_ACCESS_KEY_ID``: (Default: None) An AWS access key id\n- ``AWS_REGIONS``: (Default: us-east-1) A comma-separated list of regions to query for.\n- ``AWS_SECRET_ACCESS_KEY``: (Default: None) An AWS secret access key\n- ``BASIC_AUTH``: (Default: None) A list of basic auth user/password combinations. The format for each is ``username:password``.\n- ``BOOLEAN_AWS_TAG_ATTRIBUTES``: (Default: None) A comma-separated list of instance tags that will be pulled out as top-level instance attributes set and converted into booleans.\n- ``BUGSNAG_API_KEY``: (Default: None) An api key for reporting errors to bugsnag.\n- ``CACHE_EXPIRATION``: (Default: ``180``) Time in seconds until a cached AWS api retrieval expires.\n- ``CACHE_SIZE``: (Default: ``1024``) Max number of items to cache in the LRU cache. Can be safely set to 2.\n- ``DEBUG``: (Default: ``0``) Whether to turn on debug mode or not.\n- ``LISTEN_INTERFACE``: (Default: ``0.0.0.0``) The interface which the server will bind to.\n- ``PORT``: (Default: ``5000``) Server port.\n- ``SENTRY_DSN``: (Default: None) An DSN for reporting errors to sentry.\n- ``TOP_LEVEL_AWS_TAG_ATTRIBUTES``: (Default: None) A comma-separated list of instance tags that will be pulled out as top-level instance attributes set.\n\nThe AWS policy is fairly small, and an ``iam-profile.json`` is provided in this repository in the case that you wish to lock down permissions to only those necessary.\n\nEndpoints\n=========\n\n- ``/``: Healthcheck\n- ``/_status``: Healthcheck\n- ``/amis?q=&limit=``: List all amis owned by the user specified by the AWS credentials.\n - ``format`` (optional): If set to ``list``, turns ami attributes from an object indexed by the name key to a list of those objects. Can also be set to ``csv``. Defaults to ``dict``.\n - ``id`` (optional): An image id to filter by (eg. ``ami-21e750d9``)\n - ``query`` (optional): Substring to search ami names by before returning the resultset\n - ``region`` (optional): Filter to a specific region\n- ``/instance-types/``: List all instance types available for a specific api version (version is optional).\n- ``/instances/?q=&limit=&status=&group=``: List all nodes\n - ``format`` (optional): If set to ``list``, turns node attributes from an object indexed by the name key to a list of those objects. Can also be set to ``csv``. Defaults to ``dict``.\n - ``limit`` (optional): An integer to limit the resultset by\n - ``query`` (optional): Substring to search the ``name`` field by before returning the resultset\n- ``/instances/group/?region=&query=&status=``: List all nodes grouped by autoscale group\n - ``format`` (optional): If set to ``list``, turns node attributes from an object indexed by the name key to a list of those objects.\n - ``query`` (optional): Substring to search node names by before returning the resultset\n- ``/rds-instances/?q=&limit=&status=``: List all nodes\n - ``format`` (optional): If set to ``list``, turns node attributes from an object indexed by the name key to a list of those objects. Can also be set to ``csv``. Defaults to ``dict``.\n - ``limit`` (optional): An integer to limit the resultset by\n - ``query`` (optional): Substring to search the ``name`` field by before returning the resultset\n\nFilters\n-------\n\nField values that are *exactly* one of the following strings are transformed into their language \"equivalents\":\n\n- ``none``\n- ``nil``\n- ``true``\n- ``false``\n\n The values are lowercased before the check is performed.\n\nThe following attributes filters are globally available:\n\n- ``availability_zone`` (optional): An availability zone to filter by (eg. ``us-east-1a``)\n- ``id`` (optional): An instance id to filter by (eg. ``i-21e750d9``)\n- ``name`` (optional): A name to filter by (eg. ``graphite-ec2-01``)\n- ``region`` (optional): Filter to a specific region (eg. ``us-east-1``)\n- ``status`` (optional): Filter to specific node status (eg. ``terminated``)\n\nThe following attribute filters are available for the ``/instances`` and ``/instances/group`` endpoints:\n\n- ``elastic_ip`` (optional): Whether or not to filter to just instances with an elastic_ip\n- ``group`` (optional): An autoscale group name to filter by\n- ``image_id`` (optional): An image id to filter by (eg. ``ami-123abc4d``)\n- ``image_name`` (optional): An image name to filter by (eg. ``BaseAMI``)\n- ``instance_type`` (optional): Filter to a specific instance type (eg. ``t2.large``)\n- ``instance_class`` (optional): Filter to a specific instance type (eg. ``t2``)\n- ``instance_profile_id`` (optional): Filter to a specific instance profile id (eg. ``O34RQ3IUIO3FOUI3F``)\n- ``instance_profile_name`` (optional): Filter to a specific instance profile name (eg. ``Production-Api``)\n- ``ip_address`` (optional): Filter to a specific private ip address (eg. ``54.10.2.20``)\n- ``private_ip_address`` (optional): Filter to a specific private ip address (eg. ``10.10.2.20``)\n- ``vpc_id`` (optional): Filter to specific vpc (eg. ``vpc-8675309``)\n\nThe following attribute filters are available for the ``/rds-instances`` endpoint:\n\n- ``allocated_storage`` (optional)\n- ``auto_minor_version_upgrade`` (optional)\n- ``backup_retention_period`` (optional)\n- ``ca_certificate_identifier`` (optional)\n- ``copy_tags_to_snapshot`` (optional)\n- ``db_instance_arn`` (optional)\n- ``db_instance_class`` (optional)\n- ``db_instance_port`` (optional)\n- ``db_instance_status`` (optional)\n- ``db_name`` (optional)\n- ``dbi_resource_id`` (optional)\n- ``engine`` (optional)\n- ``engine_version`` (optional)\n- ``enhanced_monitoring_resource_arn`` (optional)\n- ``license_model`` (optional)\n- ``master_username`` (optional)\n- ``monitoring_interval`` (optional)\n- ``monitoring_role_arn`` (optional)\n- ``multi_az`` (optional)\n- ``preferred_backup_window`` (optional)\n- ``preferred_maintenance_window`` (optional)\n- ``publicly_accessible`` (optional)\n- ``secondary_availability_zone`` (optional)\n- ``storage_encrypted`` (optional)\n- ``storage_type`` (optional)\n\nField Filtering\n~~~~~~~~~~~~~~~\n\nFields in the response body can be filtered using the ``fields`` querystring argument. Fields are a ``comma-separated`` list of any of the attributes already returned. Tags cannot be filtered on a per-tag basis, though you may choose to include or exclude the ``tags`` attribute entirely.\n\n.. code-block:: bash\n\n curl http://localhost:5000/instances?fields=id,image_name\n\nComplex Filters\n~~~~~~~~~~~~~~~\n\nFiltering is performed *after* retrieving results from the EC2 API. The following are valid filters:\n\n- ``exact``: performs an exact match on the value of the tag name\n- ``in-list``: splits the tag value by comma and verifies that the passed value is in the resulting list\n- ``is-null``: checks if the value is ``null``\n- ``is-true``: checks if the value is ``true``\n- ``is-false``: checks if the value is ``false``\n- ``substring``: performs a substring match on the value of the tag name\n- ``ends-with``: performs a match using ``endswith`` on the value of the tag name\n- ``starts-with``: performs a match using ``startswith`` on the value of the tag name\n- ``not-in-list``: splits the tag value by comma and verifies that the passed value is *not* in the resulting list\n- ``not-substring``: performs an inverse substring match on the value of the tag name\n- ``not-ends-with``: performs an inverse match using ``endswith`` on the value of the tag name\n- ``not-starts-with``: performs an inverse match using ``startswith`` on the value of the tag name\n\nA simple example is as follows\n\n.. code-block:: bash\n\n curl http://localhost:5000/instances?substring.name=www\n\nTag Filtering\n~~~~~~~~~~~~~\n\nYou can also filter by tags by using the ``tags.FILTER.TAG_NAME`` querystring pattern as follows:\n\n.. code-block:: bash\n\n curl http://localhost:5000/instances?tags.exact.bootstrapped=true&tags.substring.Name=admin\n\nYou may also specify an exact match filter when omitting the ``FILTER`` section like so:\n\n.. code-block:: bash\n\n curl http://localhost:5000/instances?tags.bootstrapped=true\n\nFiltering by the status field\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nValid ``status`` values are as follows:\n\n- ``pending``\n- ``running``\n- ``shutting-down``\n- ``terminated``\n- ``stopping``\n- ``stopped``\n\n.. code-block:: bash\n\n curl http://localhost:5000/instances?status=running\n\nErrors\n~~~~~~\n\nIf an invalid querystring argument is passed, a ``json`` response similar to the following will be sent from the service:\n\n.. code-block:: javascript\n\n {\n detail: \"Invalid region querystring argument passed.\",\n status: 400,\n title: \"Invalid argument passed\"\n }\n\nThe following errors are possible:\n\n- Invalid region querystring argument\n- Invalid status querystring argument\n- General EC2ResponseError\n\nHow it works\n============\n\nThis services uses ``boto3`` underneath to provide an api listing all nodes available in a given EC2 account. It is intended to be used as a replacement for hitting the EC2 api directly, as that can be slow at times.\n\nCaveats\n=======\n\nWhen using the ``/instances`` or ``/instances/group`` endpoints with a format of ``dict``, the response is keyed by the ``Name`` tag of the ec2 instance. If you have multiple servers with the same value for the ``Name`` tag, this may result in \"hidden\" servers. If a server is not running, it will be hidden by default, otherwise it may overwrite the previous entry. This will both be logged in the ``haldane`` logging output *and* will be surfaced as ``meta.hidden_nodes``, regardless of the endpoint being used.\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/seatgeek/haldane", "keywords": "aws api", "license": "BSD", "maintainer": "", "maintainer_email": "", "name": "haldane", "package_url": "https://pypi.org/project/haldane/", "platform": "", "project_url": "https://pypi.org/project/haldane/", "project_urls": { "Homepage": "https://github.com/seatgeek/haldane" }, "release_url": "https://pypi.org/project/haldane/0.3.0/", "requires_dist": null, "requires_python": "", "summary": "A friendly http interface to the aws api", "version": "0.3.0" }, "last_serial": 5269421, "releases": { "0.2.0": [ { "comment_text": "", "digests": { "md5": "036fd659b1f302f5f704561fbe216942", "sha256": "2707177c5c5040becd175070e0c53db0260eba939f223eb2fa4b8694e0842c6f" }, "downloads": -1, "filename": "haldane-0.2.0-py2-none-any.whl", "has_sig": false, "md5_digest": "036fd659b1f302f5f704561fbe216942", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 22658, "upload_time": "2017-07-17T17:32:48", "url": "https://files.pythonhosted.org/packages/9f/0f/e0409b5fea1eae1d159b11dd14c089b87e01c802fd1240e843e5d1dc91ab/haldane-0.2.0-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "1b2d7ed307c5fd6a9fcdbdd156d478d1", "sha256": "d43c6de124ab89557af2052295bf94b3d0662361ebe66d1e19a53a0703560470" }, "downloads": -1, "filename": "haldane-0.2.0.tar.gz", "has_sig": false, "md5_digest": "1b2d7ed307c5fd6a9fcdbdd156d478d1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15907, "upload_time": "2017-07-17T17:32:47", "url": "https://files.pythonhosted.org/packages/ef/3e/ac84f60c9c88c50f47dc90ab842ed457a712400b82d8bd9d0dc26f89c21d/haldane-0.2.0.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "9f6048f87a7971c9f4ac923d2fa74f10", "sha256": "b2661bed99f35566e57707fd31943dffcf7371900bf9c39a86035434e49df564" }, "downloads": -1, "filename": "haldane-0.2.1-py2-none-any.whl", "has_sig": false, "md5_digest": "9f6048f87a7971c9f4ac923d2fa74f10", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 22662, "upload_time": "2017-07-17T17:33:43", "url": "https://files.pythonhosted.org/packages/84/87/6b2957c69fb2fadcd0c9c52e88baf00b666cbf8b6c2bbd22fe0186ce861b/haldane-0.2.1-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "3ecf450b28224ded06924e2e6fffe13d", "sha256": "e1171f00334b807e0eb3a407bd08bef1a155428a18ba7190070b522bdad9dd6a" }, "downloads": -1, "filename": "haldane-0.2.1.tar.gz", "has_sig": false, "md5_digest": "3ecf450b28224ded06924e2e6fffe13d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16079, "upload_time": "2017-07-17T17:33:41", "url": "https://files.pythonhosted.org/packages/02/92/85d87a6fdf2d051c644644e0c7c9603e4c0eaa8d25cd86c033b5b418a34d/haldane-0.2.1.tar.gz" } ], "0.2.2": [ { "comment_text": "", "digests": { "md5": "86f6e98ae06cad2e579f7b1ed66ee376", "sha256": "f6386b009359a2ceb6ffd697d5aa423760f10101a3d253bed969adc5e6d1cf3d" }, "downloads": -1, "filename": "haldane-0.2.2-py2-none-any.whl", "has_sig": false, "md5_digest": "86f6e98ae06cad2e579f7b1ed66ee376", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 22665, "upload_time": "2018-05-14T18:28:32", "url": "https://files.pythonhosted.org/packages/80/f8/7bd106d1f11db3d85eae7ed198560f4888f1fe455debbc8e0e317a960daa/haldane-0.2.2-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "13e12db9a1a2d75bb742248b6914a75c", "sha256": "94330c88e4f351d251ba285f5ea036c04e3339b2bd1fa766ec11009c789444e1" }, "downloads": -1, "filename": "haldane-0.2.2.tar.gz", "has_sig": false, "md5_digest": "13e12db9a1a2d75bb742248b6914a75c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16102, "upload_time": "2018-05-14T18:28:31", "url": "https://files.pythonhosted.org/packages/df/42/8e072262f772f41acbf71da131deb03252fc56ede7563c5e78f472cfbdce/haldane-0.2.2.tar.gz" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "8fff3c4e6b4833fd402d02d41c3c3066", "sha256": "887ddca387f45f63db22a2a811bc0c91662d7df5baf539eca8c04dbf08e48194" }, "downloads": -1, "filename": "haldane-0.3.0-py2-none-any.whl", "has_sig": false, "md5_digest": "8fff3c4e6b4833fd402d02d41c3c3066", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 22767, "upload_time": "2018-05-14T20:56:51", "url": "https://files.pythonhosted.org/packages/86/15/e0eb28dfcc221bbbd212c9c02a51f0d3d5a9f211b9fea7317388f7d76003/haldane-0.3.0-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "29189cb164ae2b07ae10d3991b55032b", "sha256": "e3e85b439c5c6282efe8336d30f7d4ee90b4433bfce4be416cd6d174d648b33d" }, "downloads": -1, "filename": "haldane-0.3.0.tar.gz", "has_sig": false, "md5_digest": "29189cb164ae2b07ae10d3991b55032b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16158, "upload_time": "2018-05-14T20:56:50", "url": "https://files.pythonhosted.org/packages/08/05/5917a8e83473540a213060e2b17787660e934129b227b27967ab881934b8/haldane-0.3.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "8fff3c4e6b4833fd402d02d41c3c3066", "sha256": "887ddca387f45f63db22a2a811bc0c91662d7df5baf539eca8c04dbf08e48194" }, "downloads": -1, "filename": "haldane-0.3.0-py2-none-any.whl", "has_sig": false, "md5_digest": "8fff3c4e6b4833fd402d02d41c3c3066", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 22767, "upload_time": "2018-05-14T20:56:51", "url": "https://files.pythonhosted.org/packages/86/15/e0eb28dfcc221bbbd212c9c02a51f0d3d5a9f211b9fea7317388f7d76003/haldane-0.3.0-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "29189cb164ae2b07ae10d3991b55032b", "sha256": "e3e85b439c5c6282efe8336d30f7d4ee90b4433bfce4be416cd6d174d648b33d" }, "downloads": -1, "filename": "haldane-0.3.0.tar.gz", "has_sig": false, "md5_digest": "29189cb164ae2b07ae10d3991b55032b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16158, "upload_time": "2018-05-14T20:56:50", "url": "https://files.pythonhosted.org/packages/08/05/5917a8e83473540a213060e2b17787660e934129b227b27967ab881934b8/haldane-0.3.0.tar.gz" } ] }