Toolkit and SDK for interacting with Astra
Project description
NetApp Astra Control Python SDK
The NetApp Astra Control Python SDK is designed to provide guidance for working with the NetApp Astra Control API.
You can use the astraSDK.py
library out of the box, and as a set of example recommended code and processes, "cookbook" style. The toolkit.py
script is a helpful sandbox tool for learning how to use the Astra API.
We don't recommend the use of toolkit.py
in production, but the code is heavily-documented, so you can see how the parts come together, and use it as a starting point for your own code.
Installation
The NetApp Astra Control Toolkit can be run in a Docker container. This makes it easy for you to launch and use the SDK, because the prepared Docker image has all the dependencies and requirements configured and ready to go.
Prerequisites
To use the prepared Docker image (recommended) to run the NetApp Astra Control Toolkit:
- One or more running compute clusters managed by NetApp Astra Control.
- Required software installed:
- Docker 20.10.7+
To manually run the NetApp Astra Control Toolkit:
- One or more running compute clusters managed by NetApp Astra Control.
- Required software installed:
- Python 3.5+
- Pip 21.1.2+
- Virtualenv 20.4.7+
- Git 2.30.2+
- Kubectl 1.17+
- Azure CLI (
az
) 2.25.0+ or Google Cloud SDK (gcloud
) 345.0.0+ - Helm 3.2.1+
Install Using Docker (Recommended)
Launch the prepared Docker image. Docker will automatically download the image if you don't already have it on your system.
sudo docker run -it jpaetzel0614/k8scloudcontrol:1.0 /bin/bash
NOTE: From this point forward, you will be working in the Docker container you just launched.
Set up your kubeconfig to successfully run kubectl commands against your cluster with the appropriate command (e.g. export KUBECONFIG=/path/to/kubeconfig
, gcloud container clusters get-credentials
, or az aks get-credentials
).
Clone the NetApp Astra Control SDK repo.
git clone https://github.com/NetApp/netapp-astra-toolkits.git
Move into the repo directory.
cd netapp-astra-toolkits
Edit the config.yaml
file to add your NetApp Astra Control account information.
Authorization: Bearer
: Your API tokenuid
: Your Astra Control Account IDastra_project
: Your Astra Control instance (preview
ordemo
ACC users put a FQDN here)verifySSL
: True or False, useful for self-signed certs. (If this field isn't included it's treated as true)
You can find this information in your NetApp Astra Control account profile. Click the user icon in the upper right-hand corner, then choose API Access from the drop-down menu which appears.
Copy and paste your Astra Control account ID into the config.yaml
file.
To get your API token, click + Generate API token. Generate a new API token, then copy and paste the token into the config.yaml
When you are done, the config.yaml
looks like:
headers:
Authorization: Bearer ABCDEFGHI0123456789
uid: 123456789-1234-123456789
astra_project: preview
Save and exit the file.
Run the following commands to add the required Python elements:
virtualenv toolkit
source toolkit/bin/activate
pip install -r requirements.txt
You can now use ./toolkit.py
to invoke the NetApp Astra Control SDK. For example, list your Astra clusters with the command:
./toolkit.py list clusters
See the documentation for more info.
Install Manually
Set up your kubeconfig to successfully run kubectl commands against your cluster with the appropriate command (e.g. export KUBECONFIG=/path/to/kubeconfig
, gcloud container clusters get-credentials
, or az aks get-credentials
).
Clone the NetApp Astra SDK repo.
git clone https://github.com/NetApp/netapp-astra-toolkits.git
Move into the repo directory.
cd netapp-astra-toolkits
Edit the config.yaml
file to add your NetApp Astra account information.
Authorization: Bearer
: Your API tokenuid
: Your Astra Account IDastra_project
: Your Astra instance (preview
ordemo
)
You can find this information in your NetApp Astra account profile. Click the user icon in the upper right-hand corner, then choose API Access from the drop-down menu which appears.
Copy and paste your Astra account ID into the config.yaml
file.
To get your API token, click + Generate API token. Generate a new API token, then copy and paste the token into the config.yaml
When you are done, the config.yaml
looks like:
headers:
Authorization: Bearer ABCDEFGHI0123456789
uid: 123456789-1234-123456789
astra_project: preview
Save and exit the file.
Run the following commands to add the required Python elements:
virtualenv toolkit
source toolkit/bin/activate
pip install -r requirements.txt
You can now use ./toolkit.py
to invoke the NetApp Astra SDK. For example, list your Astra clusters with the command:
./toolkit.py list clusters
See the documentation for more info.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
File details
Details for the file netapp_astra_toolkits-2.0-py3-none-any.whl
.
File metadata
- Download URL: netapp_astra_toolkits-2.0-py3-none-any.whl
- Upload date:
- Size: 24.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 09f14e40c1512de5a6357aaf8e159d593e66eea2edb71cedee4201b46bee3912 |
|
MD5 | 94c4e659bdf83aca4ccbbaea2f50bab7 |
|
BLAKE2b-256 | c01dad10ddc626cc0274adcbd8f662185ab21e20858dbd5d7313cba3388c6338 |