Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exclude predefined #67

Merged
merged 17 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/about/release-notes.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## Version 0.3.5

- Added support performing advanced filtering capabilities

## Version 0.3.4

- Added support for External Dynamic Lists
Expand Down
74 changes: 74 additions & 0 deletions docs/sdk/config/objects/address.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
- [Retrieving Addresses](#retrieving-addresses)
- [Updating Addresses](#updating-addresses)
- [Listing Addresses](#listing-addresses)
- [Filtering Responses](#filtering-responses)
- [Deleting Addresses](#deleting-addresses)
7. [Managing Configuration Changes](#managing-configuration-changes)
- [Performing Commits](#performing-commits)
Expand Down Expand Up @@ -208,6 +209,79 @@ for addr in filtered_addresses:

</div>

### Filtering Responses

The `list()` method supports additional parameters to refine your query results even further. Alongside basic filters
(like `types`, `values`, and `tags`), you can leverage the `exact_match`, `exclude_folders`, `exclude_snippets`, and
`exclude_devices` parameters to control which objects are included or excluded after the initial API response is fetched.

**Parameters:**
- `exact_match (bool)`: When `True`, only objects defined exactly in the specified container (`folder`, `snippet`, or `device`) are returned. Inherited or propagated objects are filtered out.
- `exclude_folders (List[str])`: Provide a list of folder names that you do not want included in the results.
- `exclude_snippets (List[str])`: Provide a list of snippet values to exclude from the results.
- `exclude_devices (List[str])`: Provide a list of device values to exclude from the results.

**Examples:**

<div class="termy">

<!-- termynal -->

```python
# Only return addresses defined exactly in 'Texas'
exact_addresses = addresses.list(
folder='Texas',
exact_match=True
)

for addr in exact_addresses:
print(f"Exact match: {addr.name} in {addr.folder}")

# Exclude all addresses from the 'All' folder
no_all_addresses = addresses.list(
folder='Texas',
exclude_folders=['All']
)

for addr in no_all_addresses:
assert addr.folder != 'All'
print(f"Filtered out 'All': {addr.name}")

# Exclude addresses that come from 'default' snippet
no_default_snippet = addresses.list(
folder='Texas',
exclude_snippets=['default']
)

for addr in no_default_snippet:
assert addr.snippet != 'default'
print(f"Filtered out 'default' snippet: {addr.name}")

# Exclude addresses associated with 'DeviceA'
no_deviceA = addresses.list(
folder='Texas',
exclude_devices=['DeviceA']
)

for addr in no_deviceA:
assert addr.device != 'DeviceA'
print(f"Filtered out 'DeviceA': {addr.name}")

# Combine exact_match with multiple exclusions
combined_filters = addresses.list(
folder='Texas',
exact_match=True,
exclude_folders=['All'],
exclude_snippets=['default'],
exclude_devices=['DeviceA']
)

for addr in combined_filters:
print(f"Combined filters result: {addr.name} in {addr.folder}")
```

</div>

### Deleting Addresses

<div class="termy">
Expand Down
74 changes: 74 additions & 0 deletions docs/sdk/config/objects/address_group.md
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,80 @@ filtered_groups = address_groups.list(**list_params)

</div>


### Filtering Responses

The `list()` method supports additional parameters to refine your query results even further. Alongside basic filters
(like `types`, `values`, and `tags`), you can leverage the `exact_match`, `exclude_folders`, `exclude_snippets`, and
`exclude_devices` parameters to control which objects are included or excluded after the initial API response is fetched.

**Parameters:**
- `exact_match (bool)`: When `True`, only objects defined exactly in the specified container (`folder`, `snippet`, or `device`) are returned. Inherited or propagated objects are filtered out.
- `exclude_folders (List[str])`: Provide a list of folder names that you do not want included in the results.
- `exclude_snippets (List[str])`: Provide a list of snippet values to exclude from the results.
- `exclude_devices (List[str])`: Provide a list of device values to exclude from the results.

**Examples:**

<div class="termy">

<!-- termynal -->

```python
# Only return address groups defined exactly in 'Texas'
exact_address_groups = address_groups.list(
folder='Texas',
exact_match=True
)

for each in exact_address_groups:
print(f"Exact match: {each.name} in {each.folder}")

# Exclude all address groups from the 'All' folder
no_all_address_groups = address_groups.list(
folder='Texas',
exclude_folders=['All']
)

for each in no_all_address_groups:
assert each.folder != 'All'
print(f"Filtered out 'All': {each.name}")

# Exclude address groups that come from 'default' snippet
no_default_snippet = address_groups.list(
folder='Texas',
exclude_snippets=['default']
)

for addr in no_default_snippet:
assert addr.snippet != 'default'
print(f"Filtered out 'default' snippet: {addr.name}")

# Exclude address groups associated with 'DeviceA'
no_deviceA = address_groups.list(
folder='Texas',
exclude_devices=['DeviceA']
)

for each in no_deviceA:
assert each.device != 'DeviceA'
print(f"Filtered out 'DeviceA': {each.name}")

# Combine exact_match with multiple exclusions
combined_filters = address_groups.list(
folder='Texas',
exact_match=True,
exclude_folders=['All'],
exclude_snippets=['default'],
exclude_devices=['DeviceA']
)

for each in combined_filters:
print(f"Combined filters result: {each.name} in {each.folder}")
```

</div>

### Deleting Address Groups

<div class="termy">
Expand Down
60 changes: 60 additions & 0 deletions docs/sdk/config/objects/application.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
- [Retrieving Applications](#retrieving-applications)
- [Updating Applications](#updating-applications)
- [Listing Applications](#listing-applications)
- [Filtering Responses](#filtering-responses)
- [Deleting Applications](#deleting-applications)
7. [Managing Configuration Changes](#managing-configuration-changes)
- [Performing Commits](#performing-commits)
Expand Down Expand Up @@ -217,6 +218,65 @@ filtered_apps = applications.list(**list_params)

</div>

### Filtering Responses

The `list()` method supports additional parameters to refine your query results even further. Alongside basic filters
(like `types`, `values`, and `tags`), you can leverage the `exact_match`, `exclude_folders`, and `exclude_snippets`parameters to control which objects are included or excluded after the initial API response is fetched.

**Parameters:**
- `exact_match (bool)`: When `True`, only objects defined exactly in the specified container (`folder` or `snippet`) are returned. Inherited or propagated objects are filtered out.
- `exclude_folders (List[str])`: Provide a list of folder names that you do not want included in the results.
- `exclude_snippets (List[str])`: Provide a list of snippet values to exclude from the results.

**Examples:**

<div class="termy">

<!-- termynal -->

```python
# Only return applications defined exactly in 'Texas'
exact_applications = applications.list(
folder='Texas',
exact_match=True
)

for app in exact_applications:
print(f"Exact match: {app.name} in {app.folder}")

# Exclude all applications from the 'All' folder
no_all_applications = applications.list(
folder='Texas',
exclude_folders=['All']
)

for app in no_all_applications:
assert app.folder != 'All'
print(f"Filtered out 'All': {app.name}")

# Exclude applications that come from 'default' snippet
no_default_snippet = applications.list(
folder='Texas',
exclude_snippets=['default']
)

for app in no_default_snippet:
assert app.snippet != 'default'
print(f"Filtered out 'default' snippet: {app.name}")


# Combine exact_match with multiple exclusions
combined_filters = applications.list(
folder='Texas',
exact_match=True,
exclude_folders=['All'],
exclude_snippets=['default'],
)

for app in combined_filters:
print(f"Combined filters result: {app.name} in {app.folder}")
```

### Deleting Applications

<div class="termy">
Expand Down
75 changes: 75 additions & 0 deletions docs/sdk/config/objects/application_filters.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
- [Retrieving Application Filters](#retrieving-application-filters)
- [Updating Application Filters](#updating-application-filters)
- [Listing Application Filters](#listing-application-filters)
- [Filtering Responses](#filtering-responses)
- [Deleting Application Filters](#deleting-application-filters)
7. [Managing Configuration Changes](#managing-configuration-changes)
- [Performing Commits](#performing-commits)
Expand Down Expand Up @@ -211,6 +212,80 @@ filtered_results = app_filters.list(**list_params)

</div>

### Filtering Responses

The `list()` method supports additional parameters to refine your query results even further. Alongside basic filters
(like `category`, `subcategory`, `technology`, and `risk`), you can leverage the `exact_match`, `exclude_folders`, `exclude_snippets`, and
`exclude_devices` parameters to control which objects are included or excluded after the initial API response is fetched.

**Parameters:**
- `exact_match (bool)`: When `True`, only objects defined exactly in the specified container (`folder`, `snippet`, or `device`) are returned. Inherited or propagated objects are filtered out.
- `exclude_folders (List[str])`: Provide a list of folder names that you do not want included in the results.
- `exclude_snippets (List[str])`: Provide a list of snippet values to exclude from the results.
- `exclude_devices (List[str])`: Provide a list of device values to exclude from the results.

**Examples:**

<div class="termy">

<!-- termynal -->

```python
# Only return filters defined exactly in 'Texas'
exact_filters = app_filters.list(
folder='Texas',
exact_match=True
)

for f in exact_filters:
print(f"Exact match: {f.name} in {f.folder}")

# Exclude all filters from the 'All' folder
no_all_filters = app_filters.list(
folder='Texas',
exclude_folders=['All']
)

for f in no_all_filters:
assert f.folder != 'All'
print(f"Filtered out 'All': {f.name}")

# Exclude filters that come from 'default' snippet
no_default_snippet = app_filters.list(
folder='Texas',
exclude_snippets=['default']
)

for f in no_default_snippet:
assert f.snippet != 'default'
print(f"Filtered out 'default' snippet: {f.name}")

# Exclude filters associated with 'DeviceA'
no_deviceA = app_filters.list(
folder='Texas',
exclude_devices=['DeviceA']
)

for f in no_deviceA:
assert f.device != 'DeviceA'
print(f"Filtered out 'DeviceA': {f.name}")

# Combine exact_match with multiple exclusions
combined_filters = app_filters.list(
folder='Texas',
exact_match=True,
exclude_folders=['All'],
exclude_snippets=['default'],
exclude_devices=['DeviceA']
)

for f in combined_filters:
print(f"Combined filters result: {f.name} in {f.folder}")
```

</div>


### Deleting Application Filters

<div class="termy">
Expand Down
Loading
Loading