General APIs¶
The APIs defined in this document are generic in nature. They are not directly related to domain models, but defined to support definition of Model APIs. More specifically, the general APIs wrap some generic C++ data structures and expose them in a Python style. The wrapped data structures include enumeration and some string-based collection classes, as detailed below.
| Enum | ModuleVersion |
|---|---|
| Description | The enumeration defines the versions of the CIMSpy/CIMdesk modules currently supported by the server. |
| Enumerated Value | Description |
CIMSpy_2_2 |
Version 2.2. Python scripting is initially supported in the release of CIMSpy/CIMdesk V2.2. |
| Enum | IncidentType |
|---|---|
| Description | The enumeration defines the type of the incidents which will be reported to users after performing tasks like validation. |
| Enumerated Value | Description |
error |
The incident is an error that needs to be resolved. |
warning |
The incident is warning that requires attention and investigation. |
alert |
The reported incident is information-only |
Class
StringVector¶
Description
A class that contains a vector of strings. This class is designed to wrap C++ string vector class, i.e. std::vector
Method
Details
Description
__len__
Syntax
__len__()
Called to implement the built-in function len().
Returns
int
The length (size) of the container, an integer >= 0.
Parameters
none
__getitem__
Syntax
__getitem__(i)
Called to implement evaluation of self[i]
Returns
str
The function returns the ith item in the vector.
Parameters
i: int
Zero-based index of the object to be retrieved
__setitem__
Syntax
__setitem__(i, v)
Called to implement assignment to self[i]
Returns
none
Parameters
i: int
Index of the item to be assigned a value
v: str
String value assigned
__delitem__
Syntax
__delitem__(i)
Called to implement deletion of self[i]
Returns
none
Parameters
i: int
Zero-based index of the item to be deleted
__contains__
Syntax
__contains__(item)
Called to implement membership test operators
Returns
Boolean
Return True if item is in self, False otherwise
Parameters
Item: str
String value to be tested
Class
StringMap¶
Description
A class that contains a map of strings. This class is designed to wrap C++ string map class, i.e. std::map
Method
Details
Description
__len__
Syntax
__len__()
Called to implement the built-in function len().
Returns
int
The length (size) of the container, an integer >= 0.
Parameters
none
__getitem__
Syntax
__getitem__(key)
Called to implement evaluation of self[key]
Returns
str
The function returns the item identified by the input key in the map.
Parameters
key: str
Key of the retrieved item
__setitem__
Syntax
__setitem__(key, value)
Called to implement assignment to self[key]
Returns
none
Parameters
key: str
Key of the item to be assigned
value: str
String value assigned
__delitem__
Syntax
__delitem__(key)
Called to implement deletion of self[key]
Returns
none
Parameters
key: str
Key of the item to be deleted
__contains__
Syntax
__contains__(key)
Called to implement membership test operators
Returns
Boolean
Return True if item is in self, False otherwise
Parameters
key: str
Key value to be tested