{ "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-beta-v2-python", "keywords": "spotinst spot instances aws ec2 cloud infrastructure development elastigroup", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "spotinst-sdk-beta-v2", "package_url": "https://pypi.org/project/spotinst-sdk-beta-v2/", "platform": "", "project_url": "https://pypi.org/project/spotinst-sdk-beta-v2/", "project_urls": { "Homepage": "https://github.com/spotinst/spotinst-sdk-beta-v2-python" }, "release_url": "https://pypi.org/project/spotinst-sdk-beta-v2/2.0.0/", "requires_dist": null, "requires_python": "", "summary": "A Python SDK for Spotinst", "version": "2.0.0" }, "last_serial": 4856706, "releases": { "1.0.46": [ { "comment_text": "", "digests": { "md5": "67d7e8b25103bcf73bc588df02b10161", "sha256": "b1b48ed20a541e5460e80b1d0c1ba588df1f4d3c8e200ee644318a697033f723" }, "downloads": -1, "filename": "spotinst-sdk-beta-v2-1.0.46.tar.gz", "has_sig": false, "md5_digest": "67d7e8b25103bcf73bc588df02b10161", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7851, "upload_time": "2019-02-22T23:32:38", "url": "https://files.pythonhosted.org/packages/ab/f1/df2a1a72b9fe2a57a71abdb2ea4362b0f1e7a96a7c6fd5676b82ccbd2940/spotinst-sdk-beta-v2-1.0.46.tar.gz" } ], "2.0.0": [ { "comment_text": "", "digests": { "md5": "8dca60ecd6cfcb574d21f510cf84c6e0", "sha256": "69c3d7f8be8d19b9a4cf85fc54e01cebbf9a27dd7661cb66acd190c781ea0170" }, "downloads": -1, "filename": "spotinst-sdk-beta-v2-2.0.0.tar.gz", "has_sig": false, "md5_digest": "8dca60ecd6cfcb574d21f510cf84c6e0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 33018, "upload_time": "2019-02-23T00:16:57", "url": "https://files.pythonhosted.org/packages/a6/97/71fc0ba4353db5dedd91d1654532e8b0f6b9ea13d2f89b3376111134af9a/spotinst-sdk-beta-v2-2.0.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "8dca60ecd6cfcb574d21f510cf84c6e0", "sha256": "69c3d7f8be8d19b9a4cf85fc54e01cebbf9a27dd7661cb66acd190c781ea0170" }, "downloads": -1, "filename": "spotinst-sdk-beta-v2-2.0.0.tar.gz", "has_sig": false, "md5_digest": "8dca60ecd6cfcb574d21f510cf84c6e0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 33018, "upload_time": "2019-02-23T00:16:57", "url": "https://files.pythonhosted.org/packages/a6/97/71fc0ba4353db5dedd91d1654532e8b0f6b9ea13d2f89b3376111134af9a/spotinst-sdk-beta-v2-2.0.0.tar.gz" } ] }