This release is a pre-release and may not be stable for production use.
itential-iap-sdk
Lightweight SDK to simplify the process of interacting with the Itential Automation Platform API.
This is an alpha release. It is incomplete and will change.
This package was written for Itential Automation Platform 2023.1.
Getting Started
Make sure you have a supported version of Python installed and then create and activate a virtual environment:
python -m venv venv
source /venv/bin/activate
You can install the iap_sdk from Pypi as follows:
pip install iap-sdk
Or you can install it from source as follows:
git clone https://github.com/awetomate/itential-iap-sdk.git
cd itential-iap-sdk
python -m pip install -r requirements.txt
python -m pip install -e .
Usage
from iap_sdk import Iap
username = "your_username"
password = "your_password"
host = "your_server"
iap = Iap(host=host, username=username, password=password, verify=False)
iap.core.get_application(name="Jst")
iap_sdk uses the following default values. You can overwrite any of them during instantiation:
class Iap(ClientBase):
def __init__(
self,
host: str,
username: str,
password: str,
protocol: Optional[str] = "https",
port: Optional[Union[int, str]] = 3443,
verify: Optional[bool] = True,
) -> None:
The iap_sdk methods are grouped in the same manner as in Itential's API documentation. I.e. all API calls related to AGManager are available under iap.ag_manager. and all API calls related to pronghorn-core are available under iap.core.
Examples
# get information about the AGManager application
iap.core.get_application(name="AGManager")
# get health information for the AGManager application
iap.core.get_application_health(name="AGManager")
# restart the AGManager application
iap.core.restart_application(name="AGManager")
# get first 10 jobs from OperationsManager that are in running, paused, or error state
iap.operations_manager.get_jobs(limit=10, status=["running", "paused", "error"])
The all-purpose 'query' method
The iap_sdk includes a generic 'query' method that can be used for every Itential automation gateway API call. In fact, all the other methods ultimately use the generic 'query' method to send calls to IAP.
The query method by default sends GET requests without any data or parameters. However, you can use the 'query' method to send get, delete, post, put, and patch requests by changing the 'method' argument. You can also send data by various means (params, data, jsonbody).
The generic 'query' method potentially could come in handy to overcome differences in the API between Automation Platform versions. If any of the existing methods don't work with your IAP version, try the generic 'query' method as a fallback.
The 'query' method takes the following arguments:
| argument | description |
|---|---|
| endpoint | IAP API endpoint. E.g. /health/applications. |
| method | Optional. API method: get (default),post,put,patch,delete. |
| data | Optional. A dictionary to send as the body. |
| jsonbody | Optional. A JSON object to send as the body. |
| params | Optional. A dictionary to send as URL parameters. |
Basic GET call using 'query'
# get health information for the AGManager application
iap.query("/health/applications/AGManager")
# or to be more explicit
iap.query("/health/applications/AGManager", method="get")
# get jobs from OperationsManager
iap.query(
"/operations-manager/jobs",
jsonbody={
"queryParameters": {
"limit": 10,
"include": "name,status",
"in": {"status": "running"},
}
}
)
Basic PUT call using 'query'
# restart the AGManager application
iap.query("/applications/AGManager/restart", method="put")
Metadata
Release files for iap-sdk 2023.12a1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| iap_sdk-2023.12a1.tar.gz | 9.0 kB | Without provenance | Details for iap_sdk-2023.12a1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| iap_sdk-2023.12a1-py3-none-any.whl | Python 3 | none | any | Details for iap_sdk-2023.12a1-py3-none-any.whl |
Total release size: 19.5 kB
Release files / iap_sdk-2023.12a1.tar.gz
| Download URL | iap_sdk-2023.12a1.tar.gz |
|---|---|
| Size | 9.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
72b444db162e13c5db1e959691b38e8db1f1664aacf1076542c19ce55f1eac42
|
|
BLAKE2b-256 checksum How to use checksums |
56c5b0fb811a18793d45090aabac9a2aaddd8d838271eac8ed680d1bf854862b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.6
|
Release files / iap_sdk-2023.12a1-py3-none-any.whl
| Download URL | iap_sdk-2023.12a1-py3-none-any.whl |
|---|---|
| Size | 10.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bd55619723c63c7df6761b74fda078ce768ecb358eccf42ca3c3e89b99b8a802
|
|
BLAKE2b-256 checksum How to use checksums |
2282395ee942b382ab5bba7928e69993ebf4f00b55c83418294d8b96e654a495
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.6
|
Security for iap-sdk 2023.12a1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.