# Class CaaSClient

This class is used to connect to the CloudFabrix's AIOps platform to fetch datasets.

This class is used to connect to the CloudFabrix's AIOps platform to fetch datasets.

| Method Name                                                                                                                                                  | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| get\_tags()                                                                                                                                                  | Gets all the tags supported by the CloudFabrix platform                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| logout()                                                                                                                                                     | Logs out of the API session                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| setOrgContext(self, orgId)                                                                                                                                   | Sets the context filter and takes Organization ID as the parameter. All requests will be against this context filter                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| refreshTags()                                                                                                                                                | returns the list of tags by fetching again                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| incidents()                                                                                                                                                  | returns handle to the incidents dataset as CaaSDataset                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| alerts()                                                                                                                                                     | returns handle to the alerts dataset as CaaSDataset                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| assetInventory()                                                                                                                                             | returns handle to the inventory dataset as CaaSDataset \[tag: asset-db:assetLCMMaster]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| assetNetworkConnectivity()                                                                                                                                   | returns handle to the network connectivity dataset as CaaSDataset \[tag: asset-db:all\_cdp]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| assetAppDependency()                                                                                                                                         | returns handle to the application dependency dataset as CaaSDataset (tag: asset-db:adm-apps)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| contracts()                                                                                                                                                  | returns handle to the contracts dataset as CaaSDataset (tag:asset-db:contracts)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| assetContracts()                                                                                                                                             | returns handle to the assets-contract mapping dataset(tag: asset-db:contracts\_aia)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| count()                                                                                                                                                      | takes tag, cfxql\_query="\*" as parameters and returns count matching the query                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| get\_next\_results(self, tag, query="\*")                                                                                                                    | <p>returns an iterator for fetching paginated data.</p><p>The parameters are:</p><p>tag:str - the tag associated with the dataset</p><p>cfxql\_query - the cfx query to be used, default is all</p><p>service\_url: str - the internal url of the service associated with the dataset sort:dict - the sort criteria to be used while fetching results assending:bool - if the results should be sorted asscending, default 'True'</p><p>max\_rows: int - number of rows to fetch</p><p>disableErrors: book - if the errors should be displayed or not</p>                                                                                                                                                                                                                                                 |
| get\_tags()                                                                                                                                                  | returns all tags in the system                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| get\_data(self, tag, cfxql\_query="\*", date\_format=None,service\_url=None, disableErrors=false)                                                            | <p>generic method to get metadata. Returns dataframe: pd.DataFrame object. Various parameters are:</p><p>tag:str - the tag associated with the dataset.</p><p>cfxql\_query:str - the cfxql query to be used, default is all.</p><p>sort:dict - the sort criteria to be used while fetching results</p><p>ascending: bool - if the results should be sorting ascending, default is 'True'.</p><p>max\_rows: int -number of rows to fetch</p><p>disableErrors: bool - if the errors should be displayed or not</p><p>​</p>                                                                                                                                                                                                                                                                                  |
| <p>execute\_cfxql(self, tag, cfxql\_query, offset=0, maxResults=200,sort=None,</p><p>taskid=None, ascending=True, service\_url=None, disableErrors=False</p> | <p>Performs on API query operatio on the given tag with the given query questions.</p><p>Returns json array with each object represented in a row.</p><p>Various Parameters are:</p><p>ag:str - the tag associated with the dataset.</p><p>cfxql\_query:str - the cfxql query to be used, default is all. offset:int - the number of records to fetch as part of this request.</p><p>maxResults:int -The max. number of records to fetch as part of this request</p><p>sort:dict - the sort criteria to be used while fetching results taskid: str - Arbitrary id that client can pass for tracking purposes which will be returned back.</p><p>ascending: bool - if the results should be sorting ascending, default is 'True'.</p><p>disableErrors: bool - if the errors should be displayed or not</p> |
| get\_port\_details(self, resource\_df, resourceKey)                                                                                                          | returns a dataframe of all port details                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| get\_port\_details\_single\_asset(self, resource, resourceKey, commonAttrs=None)                                                                             | Gets port details for an asset, commonAttrs is a dict object                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
