Package: iap-sdk
itential-iap-sdkLightweight 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 StartedMake sure you have a supported version of Python installed and then create and activate a virtual environment:python-mvenvvenvsource/venv/bin/activateYou can install the iap_sdk from Pypi as follows:pipinstalliap-sdkOr you can install it from source as follows:gitclonehttps://github.com/awetomate/itential-iap-sdk.gitcditential-iap-sdk
python-mpipinstall-rrequirements.txt
python-mpipinstall-e.Usagefromiap_sdkimportIapusername="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:classIap(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 applicationiap.core.get_application(name="AGManager")# get health information for the AGManager applicationiap.core.get_application_health(name="AGManager")# restart the AGManager applicationiap.core.restart_application(name="AGManager")# get first 10 jobs from OperationsManager that are in running, paused, or error stateiap.operations_manager.get_jobs(limit=10,status=["running","paused","error"])The all-purpose 'query' methodThe 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:argumentdescriptionendpointIAP API endpoint. E.g. /health/applications.methodOptional. API method: get (default),post,put,patch,delete.dataOptional. A dictionary to send as the body.jsonbodyOptional. A JSON object to send as the body.paramsOptional. A dictionary to send as URL parameters.Basic GET call using 'query'# get health information for the AGManager applicationiap.query("/health/applications/AGManager")# or to be more explicitiap.query("/health/applications/AGManager",method="get")# get jobs from OperationsManageriap.query("/operations-manager/jobs",jsonbody={"queryParameters":{"limit":10,"include":"name,status","in":{"status":"running"},}})Basic PUT call using 'query'# restart the AGManager applicationiap.query("/applications/AGManager/restart",method="put")