Skip to content

Commit

Permalink
chore(doc): regenerate documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
caduri committed Dec 3, 2020
1 parent 2c7cf76 commit 11e7d21
Show file tree
Hide file tree
Showing 59 changed files with 3,313 additions and 3,986 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ setup.py-e

# Distribution / packaging
.Python
build/
*build/
develop-eggs/
dist/
downloads/
Expand Down Expand Up @@ -90,7 +90,7 @@ celerybeat-schedule
.env
.venv
env/
venv/
venv*/
ENV/
env.bak/
venv.bak/
Expand Down
9 changes: 5 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
all:
$(shell pydocmd generate)
$(shell cp -r _build/pydocmd/ docs/)
$(shell rm -rf _build/)
PYDOCMD := pydocmd

.PHONY: docs
docs:
$(PYDOCMD) generate
75 changes: 37 additions & 38 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
[![Build Status](https://travis-ci.org/spotinst/spotinst-sdk-python.svg?branch=master)](https://travis-ci.org/spotinst/spotinst-sdk-python)
[![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)
[![Build Status](https://travis-ci.org/spotinst/spotinst-sdk-python.svg?branch=v2)](https://travis-ci.org/spotinst/spotinst-sdk-python)
[![Coverage Status](https://coveralls.io/repos/github/spotinst/spotinst-sdk-python/badge.svg?branch=v2)](https://coveralls.io/github/spotinst/spotinst-sdk-python?branch=master)
[![Python 2.7](https://img.shields.io/badge/python-2.7-blue.svg)](https://www.python.org/downloads/release/python-270/)
[![Python 3.6](https://img.shields.io/badge/python-3.6-blue.svg)](https://www.python.org/downloads/release/python-360/)

# Spotinst SDK Python

The official Spotinst SDK for the Python programming language.

## Version 2

The 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.

* There is no longer the `SpotinstClient()` class which was used to validate your credentials and make requests all in one
* Now there is the `SpotinstSession()` class which is used to validate credentials. [Configure Session Docs](#Configuring-Session)
* 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)
* Some methods required you to pass in a Model object
- There is no longer the `SpotinstClient()` class which was used to validate your credentials and make requests all in one
- Now there is the `SpotinstSession()` class which is used to validate credentials. [Configure Session Docs](#Configuring-Session)
- 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)
- Some methods required you to pass in a Model object

Here is a basic example of how to create an Ocean cluster using the Ocean Client and the Ocean Models

Expand Down Expand Up @@ -49,19 +50,19 @@ ocean = Ocean(name="Ocean SDK Test", controller_cluster_id="ocean.k8s",
client.create_ocean_cluster(ocean=ocean)
```

In the [SDK Client documentation](./docs/pydocmd/clients/) you can view what methods are supported by each client. <br>
For information on what models are supported checkout the [SDK Model documentation](./docs/pydocmd/models/). <br>
More examples can be found in the [SDK Examples Documentation](./docs/pydocmd/examples/). <br>
In the [SDK Client documentation](./docs/clients/) you can view what methods are supported by each client. <br>
For information on what models are supported checkout the [SDK Model documentation](./docs/models/). <br>
More examples can be found in the [SDK Examples Documentation](./docs/examples/). <br>

## Contents

* [Installation](#installation)
* [Authentication](#authentication)
* [Setup Clients](#setup-clients)
* [Documentation](#documentation)
* [Getting Help](#getting-help)
* [Community](#community)
* [License](#license)
- [Installation](#installation)
- [Authentication](#authentication)
- [Setup Clients](#setup-clients)
- [Documentation](#documentation)
- [Getting Help](#getting-help)
- [Community](#community)
- [License](#license)

## Installation

Expand All @@ -73,13 +74,13 @@ pip install --upgrade spotinst-sdk

The 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. The order in which the sdk searches for credentials is:

1. Passing credentials as parameters to the `SpotinstSession()` constructor
1. Passing credentials as parameters to the `SpotinstSession()` constructor

```python
session = SpotinstSession(auth_token='token', account_id='act-123')
```

2. Fetching the account and token from environment variables under `SPOTINST_ACCOUNT` & `SPOTINST_TOKEN`.
2. Fetching the account and token from environment variables under `SPOTINST_ACCOUNT` & `SPOTINST_TOKEN`.
If you choose to not pass your credentials directly you configure a credentials file, this file should be a valid `.yml` file. The default shared credential file location is `~/.spotinst/credentials` and the default profile is `default`

```yaml
Expand All @@ -91,15 +92,15 @@ my_profile:
account: $my_spotinst-account-id
```
3. You can overwrite the credentials file location and the profile used as parameters in the `SpotinstSession()` constructor
3. You can overwrite the credentials file location and the profile used as parameters in the `SpotinstSession()` constructor

```python
session = SpotinstSession(credentials_file='/path/to/file', profile='my_profile')
```

4. You can overwrite the credentials file location and the profile used as environment variables `SPOTINST_PROFILE` and/or `SPOTINST_SHARED_CREDENTIALS_FILE`
4. You can overwrite the credentials file location and the profile used as environment variables `SPOTINST_PROFILE` and/or `SPOTINST_SHARED_CREDENTIALS_FILE`

5. Fetching from the default location with the default profile
5. Fetching from the default location with the default profile

## Setup Clients

Expand All @@ -116,18 +117,16 @@ Take note you can create more than one client with the session. The currently su

### Client Options

* `session.client("admin")`
* `session.client("elastigroup_aws")`
* `session.client("elastigroup_azure")`
* `session.client("elastigroup_gcp")`
* `session.client("functions")`
* `session.client("mcs")`
* `session.client("mlb")`
* `session.client("mrScaler_aws")`
* `session.client("ocean_aws")`
* `session.client("subscription")`
- `session.client("admin")`
- `session.client("elastigroup_aws")`
- `session.client("elastigroup_azure")`
- `session.client("elastigroup_gcp")`
- `session.client("mcs")`
- `session.client("mrScaler_aws")`
- `session.client("ocean_aws")`
- `session.client("subscription")`

A full list of endpoints and clients can be found in the documentation [here](./docs/pydocmd/clients/).
A full list of endpoints and clients can be found in the documentation [here](./docs/clients/).

## Documentation

Expand All @@ -137,15 +136,15 @@ For a comprehensive documentation, check out the [API documentation](https://hel

We use GitHub issues for tracking bugs and feature requests. Please use these community resources for getting help:

* Ask a question on [Stack Overflow](https://stackoverflow.com/) and tag it with [spotinst-sdk-python](https://stackoverflow.com/questions/tagged/spotinst-sdk-python/).
* Join our Spotinst community on [Slack](http://slack.spot.io/).
* Open an [issue](https://github.com/spotinst/spotinst-sdk-python/issues/new/).
- Ask a question on [Stack Overflow](https://stackoverflow.com/) and tag it with [spotinst-sdk-python](https://stackoverflow.com/questions/tagged/spotinst-sdk-python/).
- Join our Spotinst community on [Slack](http://slack.spot.io/).
- Open an [issue](https://github.com/spotinst/spotinst-sdk-python/issues/new/).

## Community

* [Slack](http://slack.spot.io/)
* [Twitter](https://twitter.com/spot_hq/)
- [Slack](http://slack.spot.io/)
- [Twitter](https://twitter.com/spot_hq/)

## License

Code is licensed under the [Apache License 2.0](LICENSE). See [NOTICE.md](NOTICE.md) for complete details, including software and third-party licenses and permissions.
Code is licensed under the [Apache License 2.0](LICENSE). See [NOTICE.md](NOTICE.md) for complete details, including software and third-party licenses and permissions.
150 changes: 150 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
[![Build Status](https://travis-ci.org/spotinst/spotinst-sdk-python.svg?branch=v2)](https://travis-ci.org/spotinst/spotinst-sdk-python)
[![Coverage Status](https://coveralls.io/repos/github/spotinst/spotinst-sdk-python/badge.svg?branch=v2)](https://coveralls.io/github/spotinst/spotinst-sdk-python?branch=master)
[![Python 2.7](https://img.shields.io/badge/python-2.7-blue.svg)](https://www.python.org/downloads/release/python-270/)
[![Python 3.6](https://img.shields.io/badge/python-3.6-blue.svg)](https://www.python.org/downloads/release/python-360/)

# Spotinst SDK Python

The official Spotinst SDK for the Python programming language.

## Version 2

The 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.

- There is no longer the `SpotinstClient()` class which was used to validate your credentials and make requests all in one
- Now there is the `SpotinstSession()` class which is used to validate credentials. [Configure Session Docs](#Configuring-Session)
- 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)
- Some methods required you to pass in a Model object

Here is a basic example of how to create an Ocean cluster using the Ocean Client and the Ocean Models

```python
from spotinst_sdk import SpotinstSession
from spotinst_sdk.models.ocean.aws import *

session = SpotinstSession()
client = session.client("ocean_aws")

################ Compute ################
launch_specification = LaunchSpecifications(security_group_ids=["sg-12345"],
image_id="ami-12345", key_pair="Noam-key")

instance_types = InstanceTypes(whitelist=["c4.8xlarge"])

compute = Compute(instance_types=instance_types,
subnet_ids=["subnet-1234"], launch_specification=launch_specification)

################ Strategy ################

strategy = Strategy(utilize_reserved_instances=False, fallback_to_od=True, spot_percentage=100)

################ Capacity ################

capacity = Capacity(minimum=0, maximum=0, target=0)

################# Ocean #################

ocean = Ocean(name="Ocean SDK Test", controller_cluster_id="ocean.k8s",
region="us-west-2", capacity=capacity, strategy=strategy, compute=compute)

client.create_ocean_cluster(ocean=ocean)
```

In the [SDK Client documentation](./docs/clients/) you can view what methods are supported by each client. <br>
For information on what models are supported checkout the [SDK Model documentation](./docs/models/). <br>
More examples can be found in the [SDK Examples Documentation](./docs/examples/). <br>

## Contents

- [Installation](#installation)
- [Authentication](#authentication)
- [Setup Clients](#setup-clients)
- [Documentation](#documentation)
- [Getting Help](#getting-help)
- [Community](#community)
- [License](#license)

## Installation

```bash
pip install --upgrade spotinst-sdk
```

## Authentication

The 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. The order in which the sdk searches for credentials is:

1. Passing credentials as parameters to the `SpotinstSession()` constructor

```python
session = SpotinstSession(auth_token='token', account_id='act-123')
```

2. Fetching the account and token from environment variables under `SPOTINST_ACCOUNT` & `SPOTINST_TOKEN`.
If you choose to not pass your credentials directly you configure a credentials file, this file should be a valid `.yml` file. The default shared credential file location is `~/.spotinst/credentials` and the default profile is `default`

```yaml
default: #profile
token: $defaul_spotinst_token
account: $default_spotinst-account-id
my_profile:
token: $my_spotinst_token
account: $my_spotinst-account-id
```
3. You can overwrite the credentials file location and the profile used as parameters in the `SpotinstSession()` constructor

```python
session = SpotinstSession(credentials_file='/path/to/file', profile='my_profile')
```

4. You can overwrite the credentials file location and the profile used as environment variables `SPOTINST_PROFILE` and/or `SPOTINST_SHARED_CREDENTIALS_FILE`

5. Fetching from the default location with the default profile

## Setup Clients

After 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:

```python
session = SpotinstSession()
eg_client = session.client("elastigroup_aws")
ocean_client = session.client("ocean")
```

Take note you can create more than one client with the session. The currently supported clients are

### Client Options

- `session.client("admin")`
- `session.client("elastigroup_aws")`
- `session.client("elastigroup_azure")`
- `session.client("elastigroup_gcp")`
- `session.client("mcs")`
- `session.client("mrScaler_aws")`
- `session.client("ocean_aws")`
- `session.client("subscription")`

A full list of endpoints and clients can be found in the documentation [here](./docs/clients/).

## Documentation

For a comprehensive documentation, check out the [API documentation](https://help.spot.io/).

## Getting Help

We use GitHub issues for tracking bugs and feature requests. Please use these community resources for getting help:

- Ask a question on [Stack Overflow](https://stackoverflow.com/) and tag it with [spotinst-sdk-python](https://stackoverflow.com/questions/tagged/spotinst-sdk-python/).
- Join our Spotinst community on [Slack](http://slack.spot.io/).
- Open an [issue](https://github.com/spotinst/spotinst-sdk-python/issues/new/).

## Community

- [Slack](http://slack.spot.io/)
- [Twitter](https://twitter.com/spot_hq/)

## License

Code is licensed under the [Apache License 2.0](LICENSE). See [NOTICE.md](NOTICE.md) for complete details, including software and third-party licenses and permissions.
18 changes: 0 additions & 18 deletions docs/clients/admin.md

This file was deleted.

Loading

0 comments on commit 11e7d21

Please sign in to comment.