hfortix_fortios.FortiObjectList
- class hfortix_fortios.FortiObjectList(items=None, raw_envelope=None, response_time=None, request_info=None)[source]
A list of FortiObject instances with convenient access to raw API response.
This class extends the standard list to provide additional properties for accessing the data in different formats. It stores the full API envelope so you can access metadata like http_status, vdom, etc.
- Properties:
dict: Returns list of dictionaries (each FortiObject as dict) json: Returns pretty-printed JSON string raw: Returns the full API response envelope
Examples
>>> policies = fgt.api.cmdb.firewall.policy.get() >>> policies[0].name # Access like normal list of FortiObjects 'my-policy' >>> >>> # Get as list of dicts >>> policies.dict [{'policyid': 1, 'name': 'my-policy', ...}, ...] >>> >>> # Get pretty JSON string >>> print(policies.json) [ { "policyid": 1, "name": "my-policy", ... } ] >>> >>> # Get full API envelope with metadata >>> policies.raw {'http_status': 200, 'vdom': 'root', 'results': [...], ...}
- Parameters:
- __init__(items=None, raw_envelope=None, response_time=None, request_info=None)[source]
Initialize FortiObjectList.
- Parameters:
items (
list|None) – List of FortiObject instances or other itemsraw_envelope (
dict|None) – The full API response envelope (optional)response_time (
float|None) – Response time in seconds for the HTTP request (optional)request_info (
dict|None) – HTTP request information (method, url, params, data) (optional)
Methods
__init__([items, raw_envelope, ...])Initialize FortiObjectList.
append(object, /)Append object to the end of the list.
clear()Remove all items from list.
copy()Return a shallow copy of the list.
count(value, /)Return number of occurrences of value.
extend(iterable, /)Extend list by appending elements from the iterable.
index(value[, start, stop])Return first index of value.
insert(index, object, /)Insert object before index.
pop([index])Remove and return item at index (default last).
remove(value, /)Remove first occurrence of value.
reverse()Reverse IN PLACE.
sort(*[, key, reverse])Sort the list in ascending order and return None.
Attributes
buildFortiOS firmware build number.
dictGet list of dictionaries.
fmg_api_requestAlias for http_api_request when using FortiManager proxy.
fmg_idFortiManager request ID.
fmg_proxy_status_codeFortiManager proxy status code for this request.
fmg_proxy_status_messageFortiManager proxy status message for this request.
fmg_proxy_targetTarget device name in FortiManager proxy request.
fmg_proxy_urlFortiManager proxy URL used for this request.
fmg_rawRaw FortiManager response data.
fmg_status_codeFortiManager status code for the device response.
fmg_status_messageFortiManager status message for the device response.
fmg_urlFortiGate API URL called through FortiManager.
http_api_requestHTTP API request information for this response.
http_methodHTTP method used (GET, POST, PUT, DELETE).
http_response_timeResponse time in milliseconds for this API request.
http_statsHTTP request/response statistics summary.
http_statusAPI response status ('success' or 'error').
http_status_codeHTTP status code (200, 404, 500, etc.).
jsonGet pretty-printed JSON string of the list.
rawGet the full API response envelope.
serialDevice serial number.
vdomVirtual domain name.
versionFortiOS version string (e.g., 'v7.6.5').