{ "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-sdk2-beta-python", "keywords": "spotinst spot instances aws ec2 cloud infrastructure development elastigroup", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "spotinst-sdk2-beta2", "package_url": "https://pypi.org/project/spotinst-sdk2-beta2/", "platform": "", "project_url": "https://pypi.org/project/spotinst-sdk2-beta2/", "project_urls": { "Homepage": "https://github.com/spotinst/spotinst-sdk2-beta-python" }, "release_url": "https://pypi.org/project/spotinst-sdk2-beta2/2.0.0/", "requires_dist": null, "requires_python": "", "summary": "A Python SDK for Spotinst", "version": "2.0.0" }, "last_serial": 4866743, "releases": { "2.0.0": [ { "comment_text": "", "digests": { "md5": "51604a8df513cd1f5051ed940f80427b", "sha256": "e420ce60d8e86a4b97a54a5b0a5b8f619e11c948fefbb493438f382d70132569" }, "downloads": -1, "filename": "spotinst-sdk2-beta2-2.0.0.tar.gz", "has_sig": false, "md5_digest": "51604a8df513cd1f5051ed940f80427b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 32959, "upload_time": "2019-02-25T21:19:20", "url": "https://files.pythonhosted.org/packages/50/1f/c6a0d23783e82abbb9283bc5b5535cc0360cbf06121f4542059021c3288c/spotinst-sdk2-beta2-2.0.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "51604a8df513cd1f5051ed940f80427b", "sha256": "e420ce60d8e86a4b97a54a5b0a5b8f619e11c948fefbb493438f382d70132569" }, "downloads": -1, "filename": "spotinst-sdk2-beta2-2.0.0.tar.gz", "has_sig": false, "md5_digest": "51604a8df513cd1f5051ed940f80427b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 32959, "upload_time": "2019-02-25T21:19:20", "url": "https://files.pythonhosted.org/packages/50/1f/c6a0d23783e82abbb9283bc5b5535cc0360cbf06121f4542059021c3288c/spotinst-sdk2-beta2-2.0.0.tar.gz" } ] }