Skip to content

Commit

Permalink
wildfire-antivirus (#18)
Browse files Browse the repository at this point in the history
* Add support for WildFire Antivirus Profiles

Reorganized mkdocs navigation and introduced new models/methods
for managing WildFire Antivirus Profiles. Updated SDK documentation
and release notes accordingly. Fixed import path for AntiSpywareProfile
to match the file renaming.

* Update version to 0.1.9

Incremented the project version from 0.1.8 to 0.1.9 in the pyproject.toml file. This change likely includes new features, bug fixes, or improvements to the SDK.
  • Loading branch information
cdot65 authored Oct 17, 2024
1 parent 749dfdb commit 2ed957e
Show file tree
Hide file tree
Showing 16 changed files with 1,267 additions and 13 deletions.
2 changes: 1 addition & 1 deletion docs/about/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ automate these tasks, ensuring consistency and efficiency.

## Getting Help

- **Documentation**: Explore the [SDK Developer Documentation](../sdk/index.md) for detailed guidance.
- **Documentation**: Explore the [Developer Documentation](../sdk/index.md) for detailed guidance.
- **GitHub Repository**: Visit the [pan-scm-sdk GitHub repository](https://github.com/cdot65/pan-scm-sdk) for source
code and issue tracking.

Expand Down
10 changes: 10 additions & 0 deletions docs/about/release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@ enhancements, and fixes in each version of the tool.

---

## Version 0.1.9

**Release Date:** October 17, 2024

### Wildfire Antivirus Security Profiles

- **Wildfire Antivirus**: Add support for managing Wildfire Anti-Virus Security Profiles.

---

## Version 0.1.8

**Release Date:** October 16, 2024
Expand Down
165 changes: 165 additions & 0 deletions docs/sdk/config/security_services/wildfire_antivirus.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
# WildFire Antivirus Profile Configuration Object

The `WildfireAntivirusProfile` class is used to manage WildFire Antivirus Profile objects in the Strata Cloud Manager.
It provides methods to create, retrieve, update, delete, and list WildFire Antivirus Profile objects.

---

## Importing the WildfireAntivirusProfile Class

```python
from scm.config.security import WildfireAntivirusProfile
```

## Methods

### `create(data: Dict[str, Any]) -> WildfireAntivirusProfileResponseModel`

Creates a new WildFire Antivirus Profile object.

**Parameters:**

- `data` (Dict[str, Any]): A dictionary containing the WildFire Antivirus Profile object data.

**Example:**

```python
profile_data = {
"name": "test_profile",
"description": "Created via pan-scm-sdk",
"folder": "Prisma Access",
"rules": [
{
"name": "rule1",
"direction": "both",
"analysis": "public-cloud"
}
]
}

new_profile = wildfire_antivirus_profile.create(profile_data)
print(f"Created WildFire Antivirus Profile with ID: {new_profile.id}")
```

### `get(object_id: str) -> WildfireAntivirusProfileResponseModel`

Retrieves a WildFire Antivirus Profile object by its ID.

**Parameters:**

- `object_id` (str): The UUID of the WildFire Antivirus Profile object.

**Example:**

```python
profile_id = "123e4567-e89b-12d3-a456-426655440000"
profile_object = wildfire_antivirus_profile.get(profile_id)
print(f"Profile Name: {profile_object.name}")
```

### `update(object_id: str, data: Dict[str, Any]) -> WildfireAntivirusProfileResponseModel`

Updates an existing WildFire Antivirus Profile object.

**Parameters:**

- `object_id` (str): The UUID of the WildFire Antivirus Profile object.
- `data` (Dict[str, Any]): A dictionary containing the updated WildFire Antivirus Profile data.

**Example:**

```python
update_data = {
"description": "Updated description",
}

updated_profile = wildfire_antivirus_profile.update(profile_id, update_data)
print(f"Updated WildFire Antivirus Profile with ID: {updated_profile.id}")
```

### `delete(object_id: str) -> None`

Deletes a WildFire Antivirus Profile object by its ID.

**Parameters:**

- `object_id` (str): The UUID of the WildFire Antivirus Profile object.

**Example:**

```python
wildfire_antivirus_profile.delete(profile_id)
print(f"Deleted WildFire Antivirus Profile with ID: {profile_id}")
```

###
`list(folder: Optional[str] = None, snippet: Optional[str] = None, device: Optional[str] = None, offset: Optional[int] = None, limit: Optional[int] = None, name: Optional[str] = None, **filters) -> List[WildfireAntivirusProfileResponseModel]`

Lists WildFire Antivirus Profile objects, optionally filtered by folder, snippet, device, or other criteria.

**Parameters:**

- `folder` (Optional[str]): The folder to list profiles from.
- `snippet` (Optional[str]): The snippet to list profiles from.
- `device` (Optional[str]): The device to list profiles from.
- `offset` (Optional[int]): The pagination offset.
- `limit` (Optional[int]): The pagination limit.
- `name` (Optional[str]): Filter profiles by name.
- `**filters`: Additional filters.

**Example:**

```python
profiles = wildfire_antivirus_profile.list(folder='Prisma Access', limit=10)

for profile in profiles:
print(f"Profile Name: {profile.name}, ID: {profile.id}")
```

---

## Usage Example

```python
from scm.client import Scm
from scm.config.security import WildfireAntivirusProfile

# Initialize the SCM client
scm = Scm(
client_id="your_client_id",
client_secret="your_client_secret",
tsg_id="your_tsg_id",
)

# Create a WildfireAntivirusProfile instance
wildfire_antivirus_profile = WildfireAntivirusProfile(scm)

# Create a new WildFire Antivirus Profile
profile_data = {
"name": "test_profile",
"description": "Created via pan-scm-sdk",
"folder": "Prisma Access",
"rules": [
{
"name": "rule1",
"direction": "both",
"analysis": "public-cloud"
}
]
}

new_profile = wildfire_antivirus_profile.create(profile_data)
print(f"Created WildFire Antivirus Profile with ID: {new_profile.id}")

# List WildFire Antivirus Profiles
profiles = wildfire_antivirus_profile.list(folder='Prisma Access', limit=10)
for profile in profiles:
print(f"Profile Name: {profile.name}, ID: {profile.id}")
```

---

## Related Models

- [WildfireAntivirusProfileRequestModel](models/wildfire_antivirus_profile_models.md#wildfireantivirusprofilerequest)
- [WildfireAntivirusProfileResponseModel](models/wildfire_antivirus_profile_models.md#wildfireantivirusprofileresponse)
2 changes: 2 additions & 0 deletions docs/sdk/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ configuration objects and data models used to interact with Palo Alto Networks S
- [Service](config/objects/service.md)
- [Security Services](config/security_services/index)
- [Anti-Spyware](config/security_services/anti_spyware.md)
- [Wildfire Antivirus](config/security_services/wildfire_antivirus.md)
- Data Models
- [Objects](models/objects/index)
- [Address Models](models/objects/address_models.md)
Expand All @@ -23,6 +24,7 @@ configuration objects and data models used to interact with Palo Alto Networks S
- [Service Models](models/objects/service_models.md)
- [Security Services](models/security_services/index)
- [Anti-Spyware](models/security_services/anti_spyware_profile_models.md)
- [Wildfire Antivirus](models/security_services/wildfire_antivirus_profile_models.md)

---

Expand Down
1 change: 1 addition & 0 deletions docs/sdk/models/security_services/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ For each configuration object, there are corresponding request and response mode
## Models by Configuration Object

- [Anti Spyware Security Profile Models](anti_spyware_profile_models.md)
- [Wildfire Antivirus Security Profile Models](wildfire_antivirus_profile_models.md)
133 changes: 133 additions & 0 deletions docs/sdk/models/security_services/wildfire_antivirus_profile_models.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
# WildFire Antivirus Profile Models

This section covers the data models associated with the `WildfireAntivirusProfile` configuration object.

---

## WildfireAntivirusProfileRequestModel

Used when creating or updating a WildFire Antivirus Profile object.

### Attributes

- `name` (str): **Required.** The name of the WildFire Antivirus Profile object.
- `description` (Optional[str]): A description of the WildFire Antivirus Profile object.
- `packet_capture` (Optional[bool]): Whether packet capture is enabled.
- `mlav_exception` (Optional[List[MlavExceptionEntry]]): List of MLAV exceptions.
- `rules` (List[RuleBase]): **Required.** List of rules for the profile.
- `threat_exception` (Optional[List[ThreatExceptionEntry]]): List of threat exceptions.
- **Container Type Fields** (Exactly one must be provided):
- `folder` (Optional[str]): The folder where the profile is defined.
- `snippet` (Optional[str]): The snippet where the profile is defined.
- `device` (Optional[str]): The device where the profile is defined.

### Example

```python
profile_request = WildfireAntivirusProfileRequestModel(
name="test-profile",
description="Sample WildFire Antivirus Profile",
folder="Prisma Access",
rules=[
RuleRequest(
name="rule1",
direction="both",
analysis="public-cloud"
)
]
)
```

---

## WildfireAntivirusProfileResponseModel

Used when parsing WildFire Antivirus Profile objects retrieved from the API.

### Attributes

- `id` (str): The UUID of the WildFire Antivirus Profile object.
- `name` (str): The name of the WildFire Antivirus Profile object.
- `description` (Optional[str]): A description of the WildFire Antivirus Profile object.
- `packet_capture` (Optional[bool]): Whether packet capture is enabled.
- `mlav_exception` (Optional[List[MlavExceptionEntry]]): List of MLAV exceptions.
- `rules` (List[RuleBase]): List of rules for the profile.
- `threat_exception` (Optional[List[ThreatExceptionEntry]]): List of threat exceptions.
- **Container Type Fields**:
- `folder` (Optional[str]): The folder where the profile is defined.
- `snippet` (Optional[str]): The snippet where the profile is defined.
- `device` (Optional[str]): The device where the profile is defined.

### Example

```python
profile_response = WildfireAntivirusProfileResponseModel(
id="123e4567-e89b-12d3-a456-426655440000",
name="test-profile",
description="Sample WildFire Antivirus Profile",
folder="Prisma Access",
rules=[
RuleResponse(
name="rule1",
direction="both",
analysis="public-cloud"
)
]
)
```

---

## RuleBase

Base class for Rule objects used in WildFire Antivirus Profiles.

### Attributes

- `name` (str): **Required.** Rule name.
- `analysis` (Optional[Analysis]): Analysis type (public-cloud or private-cloud).
- `application` (List[str]): List of applications (default: ["any"]).
- `direction` (Direction): **Required.** Direction (download, upload, or both).
- `file_type` (List[str]): List of file types (default: ["any"]).

---

## MlavExceptionEntry

Represents an entry in the 'mlav_exception' list.

### Attributes

- `name` (str): **Required.** Exception name.
- `description` (Optional[str]): Description of the exception.
- `filename` (str): **Required.** Filename for the exception.

---

## ThreatExceptionEntry

Represents an entry in the 'threat_exception' list.

### Attributes

- `name` (str): **Required.** Threat exception name.
- `notes` (Optional[str]): Notes for the threat exception.

---

## Enums

### Analysis

Enumeration of analysis types:

- `public_cloud`
- `private_cloud`

### Direction

Enumeration of directions:

- `download`
- `upload`
- `both`
16 changes: 9 additions & 7 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,15 @@ plugins:
show_source: true
nav:
- Home: index.md
- Introduction: about/introduction.md
- Installation: about/installation.md
- Getting Started: about/getting-started.md
- SDK Developer Documentation:
- About:
- Introduction: about/introduction.md
- Installation: about/installation.md
- Getting Started: about/getting-started.md
- Troubleshooting: about/troubleshooting.md
- Contributing: about/contributing.md
- Release Notes: about/release-notes.md
- License: about/license.md
- Developer Documentation:
- Overview: sdk/index.md
- Configuration:
- Objects:
Expand All @@ -50,9 +55,6 @@ nav:
- Anti Spyware Security Profile: sdk/models/security_services/anti_spyware.md
- Authentication Module: sdk/auth.md
- SCM Client: sdk/client.md
- Troubleshooting: about/troubleshooting.md
- Contributing: about/contributing.md
- License: about/license.md
extra_css:
- css/termynal.css
- css/custom.css
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "pan-scm-sdk"
version = "0.1.8"
version = "0.1.9"
description = "Python SDK for Palo Alto Networks Strata Cloud Manager."
authors = ["Calvin Remsburg <[email protected]>"]
license = "Apache 2.0"
Expand Down
3 changes: 2 additions & 1 deletion scm/config/security/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# scm/config/security/__init__.py

from .anti_spyware_profiles import AntiSpywareProfile
from .anti_spyware_profile import AntiSpywareProfile
from .wildfire_antivirus_profile import WildfireAntivirusProfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# scm/config/security/anti_spyware_profiles.py
# scm/config/security/anti_spyware_profile.py

from typing import List, Dict, Any, Optional
from scm.config import BaseObject
Expand Down
Loading

0 comments on commit 2ed957e

Please sign in to comment.