Skip to content

Commit

Permalink
README(.md): Add Filtering documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
alagoutte committed Dec 10, 2019
1 parent 4f78d85 commit f202698
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,50 @@ or delete it `Remove-FGTFirewallAddress`.
Get-FGTFirewallAddress -name "My Network" | Remove-FGTFirewallAddress
```

### Filtering

For `Invoke-FGTRestMethod`, it is possible to use -filter parameter
You need to use FortiGate API syntax :

|Description | JSON Filter Syntax |

| Key | Operator | Pattern | Full Request | Description
| ---------- | ------------------- | ------------------- | ------------------- | -------------------
| schedule | == | always | GET /api/v2/cmdb/firewall/policy/?filter=schedule==always | Only return firewall policy with schedule 'always'
| schedule | != | always | GET /api/v2/cmdb/firewall/policy/?filter=schedule!=always | Return all firewall policy with schedule other than 'always'


and Filter Operators :
| Operator | Description
| ---------- | -------------------
| == | Case insensitive match with pattern.
| != | Does not match with pattern (case insensitive).
| =@ | Pattern found in object value (case insensitive).
| !@ | Pattern not found in object value (case insensitive).
| <= | Value must be less than or equal to pattern.
| < | Value must be less than pattern.
| >= | Value must be greater than or equal to pattern.
| > | Value must be greater than pattern.

For `Get-XXX` cmdlet like `Get-FGTFirewallAddress`, it is possible to using some helper filter (`-filter_attribute`, `-filter_type`, `-filter_value`)

```powershell
# Get NetworkDevice named myFGT
Get-FGTFirewallAddress -name myFGT
...
# Get NetworkDevice contains myFGT
Get-FGTFirewallAddress -name myFGT -filter_type contains
...
# Get NetworkDevice where ipmask equal 192.168.1.1
Get-FGTFirewallAddress -filter_attribute ipmask -filter_type equal -filter_value 192.168.1.1
...
```
Actually, support only `equal` and `contains` filter type


### Invoke API
for example to get Fortigate System Global Info

Expand Down

0 comments on commit f202698

Please sign in to comment.