{ "info": { "author": "Spotinst", "author_email": "service@spotinst.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.6", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "[![Build Status](https://travis-ci.org/spotinst/spotinst-sdk-python.svg?branch=master)](https://travis-ci.org/spotinst/spotinst-sdk-python)\n[![Coverage Status](https://coveralls.io/repos/github/spotinst/spotinst-sdk-python/badge.svg?branch=master)](https://coveralls.io/github/spotinst/spotinst-sdk-python?branch=master)\n[![Python 2.7](https://img.shields.io/badge/python-2.7-blue.svg)](https://www.python.org/downloads/release/python-270/)\n[![Python 3.6](https://img.shields.io/badge/python-3.6-blue.svg)](https://www.python.org/downloads/release/python-360/)\n\n# spotinst-sdk-python\nSpotinst SDK for the Python programming language\n\n## Breaking Change: Version 2.x.x\n\nThe new Spotinst Python SDK comes with a few breaking changes but do not fear, here we will explain all you need to know to make sure you can go right back in buisness in no time. \n\n * There is no longer the `SpotinstClient()` class which was used to validate your credentials and make requests all in one\n * Now there is the `SpotinstSession()` class which is used to validate credentials. [Configure Session Docs](#Configuring-Session)\n * From the session object you can create client objects which correlate to specific Spotinst Services and are used to make requests. [Setup Clients Docs](#Setup-Clients)\n * Some methods required you to pass in a Model object\n\nHere is a basic example of how to create an Ocean cluster using the Ocean Client and the Ocean Models\n\n```python\nfrom spotinst_sdk import SpotinstSession\nfrom spotinst_sdk.models.ocean.aws import *\n\nsession = SpotinstSession()\nclient = session.client(\"ocean_aws\")\n\n################ Compute ################\nlaunch_specification = LaunchSpecifications(security_group_ids=[\"sg-12345\"],\n image_id=\"ami-12345\", key_pair=\"Noam-key\")\n\ninstance_types = InstanceTypes(whitelist=[\"c4.8xlarge\"])\n\ncompute = Compute(instance_types=instance_types, \n subnet_ids=[\"subnet-1234\"], launch_specification=launch_specification)\n\n################ Strategy ################\n\nstrategy = Strategy(utilize_reserved_instances=False, fallback_to_od=True, spot_percentage=100)\n\n################ Capacity ################\n\ncapacity = Capacity(minimum=0, maximum=0, target=0)\n\n################# Ocean #################\n\nocean = Ocean(name=\"Ocean SDK Test\", controller_cluster_id=\"ocean.k8s\", \n region=\"us-west-2\", capacity=capacity, strategy=strategy, compute=compute)\n\nclient.create_ocean_cluster(ocean=ocean)\n```\n\nIn the [SDK Client documentation](./docs/pydocmd/clients/) you can view what methods are supported by each client.
\nFor information on what models are supported checkout the [SDK Model documentation](./docs/pydocmd/models/).
\nMore examples can be found in the [SDK Examples Documentation](./docs/pydocmd/examples/).
\n\n## Table of contents\n\n * [Installation](#installation)\n * [Configuring Session](#configuring-session)\n * [Setup Clients](#setup-clients)\n * [SDK Docs](./docs/pydocmd/)\n * [Examples](./docs/pydocmd/examples/)\n * [Clients](./docs/pydocmd/clients/)\n * [Administration](./docs/pydocmd/clients/admin/)\n * [Elastigroup](./docs/pydocmd/clients/elastigroup/)\n * [Functions](./docs/pydocmd/clients/functions/)\n * [MCS](./docs/pydocmd/clients/mcs/)\n * [MLB](./docs/pydocmd/clients/mlb/)\n * [MrScaler](./docs/pydocmd/clients/mrscaler/)\n * [Ocean](./docs/pydocmd/clients/ocean/)\n * [Subscription](./docs/pydocmd/clients/subscription/)\n * [Models](./docs/pydocmd/models/)\n * [Administration](./docs/pydocmd/models/admin.md)\n * [Elasitgroups](./docs/pydocmd/models/elastigroup/)\n * [Functions](./docs/pydocmd/models/functions.md)\n * [MLB](./docs/pydocmd/models/mlb.md)\n * [MrScalers](./docs/pydocmd/models/mrscaler/)\n * [Oceans](./docs/pydocmd/models/ocean/)\n * [Subscription](./docs/pydocmd/models/subscription.md)\n\n\n## Installation\n```bash\npip install --upgrade spotinst-sdk\n```\n\n## Configuring Session\nThe mechanism in which the sdk looks for credentials is to search through a list of possible locations and stop as soon as it finds credentials. \nThe order in which the sdk searches for credentials is:\n 1. Passing credentials as parameters to the `SpotinstSession()` constructor\n- example\n```python\nsession = SpotinstSession(auth_token='token', account_id='act-123')\n```\n\n 2. Fetching the account and token from environment variables under `SPOTINST_ACCOUNT` & `SPOTINST_TOKEN`\n\nIf you choose to not pass your credentials directly you configure a credentials file, this file should be a valid `.yml` file.\nThe default shared credential file location is `~/.spotinst/credentials` and the default profile is `default`\n- example\n```yaml\ndefault: #profile\n token: $defaul_spotinst_token\n account: $default_spotinst-account-id\nmy_profle:\n token: $my_spotinst_token\n account: $my_spotinst-account-id\n```\n\n 3. You can overwrite the credentials file location and the profile used as parameters in the `SpotinstSession()` constructor\n- example\n```python\nsession = SpotinstSession(credentials_file='/path/to/file', profile='my_profile')\n```\n \n 4. You can overwrite the credentials file location and the profile used as environment variables `SPOTINST_PROFILE` and/or `SPOTINST_SHARED_CREDENTIALS_FILE`\n 5. Fetching from the default location with the default profile\n \n## Setup Clients\nAfter a session is created you can use the session object to create clients. Clients are used to make request to the different services that Spotinsts has to offer. To create a client simply use the method `client` from the session object and pass in the string of the client you wish to create. Here is an example:\n\n```python\nsession = SpotinstSession()\n\neg_client = session.client(\"elastigroup_aws\")\nocean_client = session.client(\"ocean\")\n```\n\nTake note you can create more than one client with the session. The currently supported clients are\n\n### Client Options:\n * `session.client(\"admin\")`\n * `session.client(\"elastigroup_aws\")`\n * `session.client(\"elastigroup_azure\")`\n * `session.client(\"elastigroup_gcp\")`\n * `session.client(\"functions\")`\n * `session.client(\"mcs\")`\n * `session.client(\"mlb\")`\n * `session.client(\"mrScaler_aws\")`\n * `session.client(\"ocean_aws\")`\n * `session.client(\"subscription\")`\n\nA full list of endpoints and clients can be found in the documentation [here](./docs/pydocmd/clients/).", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/spotinst/spotinst-sdk-python", "keywords": "spotinst spot instances aws ec2 cloud infrastructure development elastigroup", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "spotinst-sdk2", "package_url": "https://pypi.org/project/spotinst-sdk2/", "platform": "", "project_url": "https://pypi.org/project/spotinst-sdk2/", "project_urls": { "Homepage": "https://github.com/spotinst/spotinst-sdk-python" }, "release_url": "https://pypi.org/project/spotinst-sdk2/2.1.2/", "requires_dist": null, "requires_python": "", "summary": "A Python SDK for Spotinst", "version": "2.1.2" }, "last_serial": 5080841, "releases": { "2.0.0": [ { "comment_text": "", "digests": { "md5": "102a079838705d3a7a7eac06f02b0c9e", "sha256": "1cea57b265148b9b1866bd170e26fb80a99c02170b2c3668f53e166ea10f4d40" }, "downloads": -1, "filename": "spotinst_sdk2-2.0.0.tar.gz", "has_sig": false, "md5_digest": "102a079838705d3a7a7eac06f02b0c9e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 32976, "upload_time": "2019-02-25T21:06:43", "url": "https://files.pythonhosted.org/packages/5b/64/d41f59698a61151ba417de2fa2ef1a4ab204d2c619cc8db35769d4a0892e/spotinst_sdk2-2.0.0.tar.gz" } ], "2.0.1": [ { "comment_text": "", "digests": { "md5": "225cbe5c847c20199caa5cd01ac4fbf6", "sha256": "3687db9ef7939bca4c697e055738e361c53b9f2900cd51ac42e944395225eb5a" }, "downloads": -1, "filename": "spotinst-sdk2-2.0.1.tar.gz", "has_sig": false, "md5_digest": "225cbe5c847c20199caa5cd01ac4fbf6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 32869, "upload_time": "2019-02-25T21:52:44", "url": "https://files.pythonhosted.org/packages/65/7b/fa0ecbedb4ff16c6214ee2b868b66024f0839ce516bfb3114b03846c90b3/spotinst-sdk2-2.0.1.tar.gz" } ], "2.1.1": [ { "comment_text": "", "digests": { "md5": "f0dd849089b41bc8eda1cde21e99d433", "sha256": "9c013fde9c6a1054270f2c7eff846becff60dd2e69595c42a104c00f7b515093" }, "downloads": -1, "filename": "spotinst-sdk2-2.1.1.tar.gz", "has_sig": false, "md5_digest": "f0dd849089b41bc8eda1cde21e99d433", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 33589, "upload_time": "2019-03-01T23:19:43", "url": "https://files.pythonhosted.org/packages/76/c0/18ab4795b70a60b953de3755e3e1469d59e13b92165d36ba2a009a1e9837/spotinst-sdk2-2.1.1.tar.gz" } ], "2.1.2": [ { "comment_text": "", "digests": { "md5": "34ad2dcc1fe7e44afd2be4d068e2ef81", "sha256": "215883811356bc8f8131e1939c238991868cb8410cb54d38a6efc2655cb1b2af" }, "downloads": -1, "filename": "spotinst-sdk2-2.1.2.tar.gz", "has_sig": false, "md5_digest": "34ad2dcc1fe7e44afd2be4d068e2ef81", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 33877, "upload_time": "2019-04-02T20:51:10", "url": "https://files.pythonhosted.org/packages/58/b9/11058131c9a4eb68cb483b666a04e3f2fb00520901dc05166cca6dda7b63/spotinst-sdk2-2.1.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "34ad2dcc1fe7e44afd2be4d068e2ef81", "sha256": "215883811356bc8f8131e1939c238991868cb8410cb54d38a6efc2655cb1b2af" }, "downloads": -1, "filename": "spotinst-sdk2-2.1.2.tar.gz", "has_sig": false, "md5_digest": "34ad2dcc1fe7e44afd2be4d068e2ef81", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 33877, "upload_time": "2019-04-02T20:51:10", "url": "https://files.pythonhosted.org/packages/58/b9/11058131c9a4eb68cb483b666a04e3f2fb00520901dc05166cca6dda7b63/spotinst-sdk2-2.1.2.tar.gz" } ] }