init
FMG API library
GetOption
module-attribute
#
GetOption = Literal[
"extra info",
"assignment info",
"loadsub",
"no loadsub",
"count",
"syntax",
"devinfo",
"obj flags",
"datasrc",
"chksum",
]
FMGBaseObject #
Bases: BaseModel, ABC
Abstract base object for all high-level objects
Scope must be set before referencing the url! It's done by FMGBase requests as it defaults all objects to its selected ADOM.
In case of AsyncFMG, caller must ensure await-ing the request.
Attributes:
| Name | Type | Description |
|---|---|---|
fmg_scope |
str
|
FMG selected scope (adom or global) |
_version |
str
|
Supported API version |
_url |
str
|
template for API URL |
_fmg |
FMG
|
FMG instance |
Other Parameters:
| Name | Type | Description |
|---|---|---|
scope |
str
|
FMG selected scope (adom or global) |
fmg |
AnyFMG
|
FMG instance |
Source code in pyfortinet/fmg_api/__init__.py
get_url #
General API URL assembly
To be overridden by more complex API URLs in different classes
Source code in pyfortinet/fmg_api/__init__.py
FMGExecObject #
Bases: FMGBaseObject, ABC
FMG execute job type
Attributes:
| Name | Type | Description |
|---|---|---|
fmg_scope |
str
|
FMG selected scope (adom or global) |
_version |
str
|
Supported API version |
_url |
str
|
template for API URL |
_fmg |
FMG
|
FMG instance |
Source code in pyfortinet/fmg_api/__init__.py
FMGObject #
Bases: FMGBaseObject, ABC
Abstract base object for all high-level objects
Scope must be set before referencing the url! It's done by FMGBase requests as it defaults all objects to its selected ADOM.
In case of AsyncFMG, caller must ensure await-ing the request.
Attributes:
| Name | Type | Description |
|---|---|---|
fmg_scope |
str
|
FMG selected scope (adom or global) |
_version |
str
|
Supported API version |
_url |
str
|
template for API URL |
_fmg |
FMG
|
FMG instance |
_master_keys |
str
|
attributes which represents unique key in FMG DB for this API class |
Source code in pyfortinet/fmg_api/__init__.py
master_keys
property
#
Dict of fields where key is URL attribute and value is model field
Example of master_keys definition: URL: /pm/config/{scope}/obj/firewall/addrgrp/{addrgrp} master_keys = {"addrgrp": "name"}
Here "addrgrp" is the URL field to be replaced by the model field "name"
add #
clone #
delete #
get_url #
General API URL assembly
To be overridden by more complex API URLs in different classes
Source code in pyfortinet/fmg_api/__init__.py
model_dump_for_filter #
Modified pydantic model dump for FMG API
This method will include otherwise excluded fields to use them in FMG.get method filtering. Special attention is made for URL fields which must not be included in the filters as they are not part of the payload.