{ "info": { "author": "Elias Nygren", "author_email": "elias.nygren@upcloud.com", "bugtrack_url": null, "classifiers": [], "description": "# UpCloud-python-api\nPython client for [UpCloud's API](https://www.upcloud.com/documentation/api/).\n\nNOTE: This Python client is still work-in-progress and is not considered production ready.\n\n## Installation\n\n```\npip install --pre upcloud-api-python\n\n# with older pip:\npip install upcloud-api-python\n```\n\nAlternatively, clone the project and run\n```\npython setup.py install\n```\n\n**Supported versions** (offline tests pass with tox):\n\n* python 3.2\n* python 3.3 \n* python 3.4\n* python 3.5\n* pypi3 2.4.0\n\n## Features\n* OOP based management of Servers, Storages and IP-addresses with full CRUD.\n\t* since 0.2: manage both IPv4 and IPv6 addresses\n\t* since 0.1.1: can use custom storage templates in addition to public templates\n* Clear way to define your infrastructure, emphasis on clear and easy syntax\n* Access all the data of the objects ( e.g. ssh credentials )\n* Scale horizontally by creating / destroying servers\n* Scale vertically by changing the RAM, CPU, storage specs of any server\n* Manage firewall (on/off and individual rules)\n\t* since 0.2: full management of firewall rules \n\n**TODO:**\n* Cloning of storages\n* Full management of special storage types:\n * CDROMs, custom OS templates\n * (custom templates can already be cloned to a disk via UUID)\n* Full management of backups (instant and scheduled)\n\n**Changelog:**\n* See the [Releases page](https://github.com/UpCloudLtd/upcloud-python-api/releases)\n\n**Documentation:**\n* Available [here](http://upcloudltd.github.io/upcloud-python-api/)\n\n\n\n## Examples\n\nNote that operations are not instant, for example a server is not fully shut down when the API responds.\nYou must take this into account in your automations.\n\n### Defining and creating Servers\n\n```python\nimport upcloud\nfrom upcloud import Server, Storage, ZONE\n\nmanager = upcloud.CloudManager(\"api_user\", \"password\")\nmanager.authenticate() # test credentials\n\ncluster = {\n\t\"web1\": Server( core_number = 1, # CPU cores\n\t\t\t\t\tmemory_amount = 512, # RAM in MB\n\t\t\t\t\thostname = \"web1.example.com\",\n\t\t\t\t\tzone = ZONE.London, # ZONE.Helsinki and ZONE.Chicago available also\n\t\t\t\t\tstorage_devices = [\n\t\t\t\t # OS: Ubuntu 14.04 from template\n\t\t\t\t # default tier: maxIOPS, the 100k IOPS storage backend\n\t\t\t\t\t\tStorage(os = \"Ubuntu 14.04\", size=10),\n\t\t\t\t\t\t# secondary storage, hdd for reduced cost\n\t\t\t\t\t\tStorage(size=100, tier=\"hdd\")\n\t\t\t\t\t]),\n\n\t\"web2\": Server( core_number = 1,\n\t\t\t\t\tmemory_amount = 512,\n\t\t\t\t\thostname = \"web2.example.com\",\n\t\t\t\t\tzone = ZONE.London,\n\t\t\t\t\tstorage_devices = [\n\t\t\t\t\t\tStorage(os = \"Ubuntu 14.04\", size=10),\n\t\t\t\t\t\tStorage(size=100, tier=\"hdd\"),\n\t\t\t\t\t]),\n\n\t\"db\":\tServer( core_number = 2,\n\t\t\t\t\tmemory_amount = 2048,\n\t\t\t\t\thostname = \"db.example.com\",\n\t\t\t\t\tzone = ZONE.London,\n\t\t\t\t\tstorage_devices = [\n\t\t\t\t\t\tStorage(os = \"Ubuntu 14.04\", size=10),\n\t\t\t\t\t\tStorage(size=100),\n\t\t\t\t\t]),\n\n\t\"lb\":\tServer( core_number = 2,\n\t\t\t\t\tmemory_amount = 1024,\n\t\t\t\t\thostname = \"balancer.example.com\",\n\t\t\t\t\tzone = ZONE.London,\n\t\t\t\t\tstorage_devices = [\n\t\t\t\t\t\tStorage(os = \"Ubuntu 14.04\", size=10)\n\t\t\t\t\t])\n}\n\nfor server in cluster:\n manager.create_server( cluster[server] ) # automatically populates the Server objects with data from API\n\n```\n\n### Stop / Start / Destroy Servers\n```python\n\nfor server in cluster:\n\tserver.shutdown()\n\t# OR:\n\tserver.start()\n\t# OR:\n\tserver.destroy()\n\tfor storage in server.storage_devices:\n\t storage.destroy()\n\n```\n\n### Upgrade a Server\n```python\n\nserver = cluster[\"web1\"]\nserver.shutdown()\nserver.core_number = 4\nserver.memory_amount = 4096\nserver.save()\nserver.start()\n\n```\n\n### GET resources:\n```python\n\nservers = manager.get_servers()\nserver1 = manager.get_server(UUID) # e.g servers[0].uuid\nstorages = manager.get_storages()\nstorage1 = manager.get_storage(UUID) # e.g sever1.storage_devices[0].uuid\nip_addrs = manager.get_IPs()\nip_addr = manager.get_IP(address) # e.g server1.ip_addresses[0].address\n\n```\n\n## Tests\n\nSet up environment and install dependencies:\n\n```\n# run at project root, python3 and virtualenv must be installed\nvirtualenv ENV\nsource ENV/bin/activate\npip install -r requirements.txt\n```\n\nInstall the package in editable mode, as mentioned in\n[https://pytest.org/latest/goodpractises.html](https://pytest.org/latest/goodpractises.html)\n\n```python\n# run at project root\npip install -e .\n```\n\nTests located in `project_root/tests/` directory. Run with:\n\n```python\npy.test tests/\n```\n\nTo test against python3.2=< and pypy3-2.4.0, run:\n\n```python\ntox\n``` \n\nThe project also supplies a small test suite to test against the live API at `test/live_test.py`. This suite is NOT run with `py.test` as it will permanently remove all resources related to an account. It should only be run with a throwaway dev-only account when preparing for a new release. It is not shipped with PyPI releases. See source code on how to run the live tests.\n\n## Bugs, Issues, Problems, Ideas\n\nFeel free to open a new issue : )\n\n## Documentation\n\nDocumentation available [here](http://upcloudltd.github.io/upcloud-python-api/)\n", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/UpCloudLtd/upcloud-python-api", "keywords": null, "license": "MIT", "maintainer": null, "maintainer_email": null, "name": "upcloud-api-python", "package_url": "https://pypi.org/project/upcloud-api-python/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/upcloud-api-python/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/UpCloudLtd/upcloud-python-api" }, "release_url": "https://pypi.org/project/upcloud-api-python/0.2.0/", "requires_dist": null, "requires_python": null, "summary": "UpCloud API Client", "version": "0.2.0" }, "last_serial": 3545195, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "13517b0143aa07d0d61a763e3dfd6d67", "sha256": "ea517149b988916358ce6c5a05cb406bda34f932bc12b4b705f7a90c4ce9db08" }, "downloads": -1, "filename": "upcloud_api_python-0.1-py3.2.egg", "has_sig": false, "md5_digest": "13517b0143aa07d0d61a763e3dfd6d67", "packagetype": "bdist_egg", "python_version": "3.2", "requires_python": null, "size": 27942, "upload_time": "2015-04-08T10:52:42", "url": "https://files.pythonhosted.org/packages/f4/f4/7716d723ab3a34defe55bc5336a7fc1ddf6a85019f7028bf6ad8174250a0/upcloud_api_python-0.1-py3.2.egg" }, { "comment_text": "", "digests": { "md5": "78c670919e4ba597131a0550cd7c62d3", "sha256": "c9dcaf1d1431b10721cbe28daea1d549025922736517b13007c50fca6716b905" }, "downloads": -1, "filename": "upcloud-api-python-0.1.tar.gz", "has_sig": false, "md5_digest": "78c670919e4ba597131a0550cd7c62d3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8149, "upload_time": "2015-04-08T10:52:38", "url": "https://files.pythonhosted.org/packages/73/d2/544d41d3a927e598c5ca7f4655950810939657b6b97631bcbd3bbdff8a78/upcloud-api-python-0.1.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "f8b89682fe426bd7d8bce7c7d0e847cd", "sha256": "583f6ee2ae8e436fb1aacbd32f06d3dab0425ee4c9e0c478079d122f21c06a54" }, "downloads": -1, "filename": "upcloud-api-python-0.1.1.tar.gz", "has_sig": false, "md5_digest": "f8b89682fe426bd7d8bce7c7d0e847cd", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17167, "upload_time": "2015-06-23T13:52:21", "url": "https://files.pythonhosted.org/packages/4f/cd/604e4ecae3b0a070bd412a184c4a542ebb953c6d7b65724775c6b7b1d1e1/upcloud-api-python-0.1.1.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "703f9e4e5e1ebe8a5e3c739833297d87", "sha256": "222b1c157f8e7cfe47008b0dab677cbbed85d2fd5fb15db84c540bc33c11218a" }, "downloads": -1, "filename": "upcloud-api-python-0.2.0.tar.gz", "has_sig": false, "md5_digest": "703f9e4e5e1ebe8a5e3c739833297d87", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 26773, "upload_time": "2015-06-29T13:24:28", "url": "https://files.pythonhosted.org/packages/f1/d8/fa735a356963f51b1f418a6f86c94965da36d6f9cd1789c6073b0d0f5668/upcloud-api-python-0.2.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "703f9e4e5e1ebe8a5e3c739833297d87", "sha256": "222b1c157f8e7cfe47008b0dab677cbbed85d2fd5fb15db84c540bc33c11218a" }, "downloads": -1, "filename": "upcloud-api-python-0.2.0.tar.gz", "has_sig": false, "md5_digest": "703f9e4e5e1ebe8a5e3c739833297d87", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 26773, "upload_time": "2015-06-29T13:24:28", "url": "https://files.pythonhosted.org/packages/f1/d8/fa735a356963f51b1f418a6f86c94965da36d6f9cd1789c6073b0d0f5668/upcloud-api-python-0.2.0.tar.gz" } ] }