diff --git a/docs/sdk/address.md b/docs/sdk/config/objects/address.md similarity index 95% rename from docs/sdk/address.md rename to docs/sdk/config/objects/address.md index cff82138..8e37a9e9 100644 --- a/docs/sdk/address.md +++ b/docs/sdk/config/objects/address.md @@ -147,5 +147,5 @@ for addr in addresses: ## Related Models -- [AddressRequestModel](models/address_models.md#addressrequestmodel) -- [AddressResponseModel](models/address_models.md#addressresponsemodel) +- [AddressRequestModel](../../models/objects/address_models.md#addressrequestmodel) +- [AddressResponseModel](../../models/objects/address_models.md#addressresponsemodel) diff --git a/docs/sdk/address_group.md b/docs/sdk/config/objects/address_group.md similarity index 95% rename from docs/sdk/address_group.md rename to docs/sdk/config/objects/address_group.md index 7624d272..a10b1b94 100644 --- a/docs/sdk/address_group.md +++ b/docs/sdk/config/objects/address_group.md @@ -163,5 +163,5 @@ for group in groups: ## Related Models -- [AddressGroupRequestModel](models/address_group_models.md#addressgrouprequestmodel) -- [AddressGroupResponseModel](models/address_group_models.md#addressgroupresponsemodel) +- [AddressGroupRequestModel](../../models/objects/address_group_models.md#addressgrouprequestmodel) +- [AddressGroupResponseModel](../../models/objects/address_group_models.md#addressgroupresponsemodel) diff --git a/docs/sdk/application.md b/docs/sdk/config/objects/application.md similarity index 95% rename from docs/sdk/application.md rename to docs/sdk/config/objects/application.md index 39971e2e..600b89aa 100644 --- a/docs/sdk/application.md +++ b/docs/sdk/config/objects/application.md @@ -173,5 +173,5 @@ for app in applications: ## Related Models -- [ApplicationRequestModel](models/application_models.md#applicationrequestmodel) -- [ApplicationResponseModel](models/application_models.md#applicationresponsemodel) +- [ApplicationRequestModel](../../models/objects/application_models.md#applicationrequestmodel) +- [ApplicationResponseModel](../../models/objects/application_models.md#applicationresponsemodel) diff --git a/docs/sdk/application_group.md b/docs/sdk/config/objects/application_group.md similarity index 94% rename from docs/sdk/application_group.md rename to docs/sdk/config/objects/application_group.md index 3d0fcc88..f6eae9b2 100644 --- a/docs/sdk/application_group.md +++ b/docs/sdk/config/objects/application_group.md @@ -155,5 +155,5 @@ print(f"Created application group with ID: {new_group.id}") ## Related Models -- [ApplicationGroupRequestModel](models/application_group_models.md#ApplicationGrouprequestmodel) -- [ApplicationGroupResponseModel](models/application_group_models.md#ApplicationGroupresponsemodel) +- [ApplicationGroupRequestModel](../../models/objects/application_group_models.md#ApplicationGrouprequestmodel) +- [ApplicationGroupResponseModel](../../models/objects/application_group_models.md#ApplicationGroupresponsemodel) diff --git a/docs/sdk/configuration_objects.md b/docs/sdk/config/objects/index.md similarity index 97% rename from docs/sdk/configuration_objects.md rename to docs/sdk/config/objects/index.md index 28e3b71d..e2e6ba3a 100644 --- a/docs/sdk/configuration_objects.md +++ b/docs/sdk/config/objects/index.md @@ -1,4 +1,4 @@ -# Configuration Objects +# Objects This section covers the configuration objects provided by the `pan-scm-sdk`: diff --git a/docs/sdk/service.md b/docs/sdk/config/objects/service.md similarity index 95% rename from docs/sdk/service.md rename to docs/sdk/config/objects/service.md index 391742c0..c3b587a9 100644 --- a/docs/sdk/service.md +++ b/docs/sdk/config/objects/service.md @@ -168,7 +168,7 @@ for svc in services: ## Related Models -- [ServiceRequestModel](models/service_models.md#servicerequestmodel) -- [ServiceResponseModel](models/service_models.md#serviceresponsemodel) +- [ServiceRequestModel](../../models/objects/service_models.md#servicerequestmodel) +- [ServiceResponseModel](../../models/objects/service_models.md#serviceresponsemodel) --- diff --git a/docs/sdk/config/security_services/anti_spyware.md b/docs/sdk/config/security_services/anti_spyware.md new file mode 100644 index 00000000..d6ca6f56 --- /dev/null +++ b/docs/sdk/config/security_services/anti_spyware.md @@ -0,0 +1,169 @@ +# Anti-Spyware Profile Configuration Object + +The `AntiSpywareProfile` class is used to manage anti-spyware profile objects in the Strata Cloud Manager. It provides +methods to create, retrieve, update, delete, and list anti-spyware profile objects. + +--- + +## Importing the AntiSpywareProfile Class + +```python +from scm.config.security import AntiSpywareProfile +``` + +## Methods + +### `create(data: Dict[str, Any]) -> AntiSpywareProfileResponseModel` + +Creates a new anti-spyware profile object. + +**Parameters:** + +- `data` (Dict[str, Any]): A dictionary containing the anti-spyware profile object data. + +**Example:** + +```python +profile_data = { + "name": "test_profile", + "description": "Test anti-spyware profile", + "folder": "Prisma Access", + "rules": [ + { + "name": "rule1", + "severity": ["critical", "high"], + "category": "spyware", + "action": {"alert": {}} + } + ] +} + +new_profile = anti_spyware_profile.create(profile_data) +print(f"Created anti-spyware profile with ID: {new_profile.id}") +``` + +### `get(object_id: str) -> AntiSpywareProfileResponseModel` + +Retrieves an anti-spyware profile object by its ID. + +**Parameters:** + +- `object_id` (str): The UUID of the anti-spyware profile object. + +**Example:** + +```python +profile_id = "123e4567-e89b-12d3-a456-426655440000" +profile_object = anti_spyware_profile.get(profile_id) +print(f"Anti-Spyware Profile Name: {profile_object.name}") +``` + +### `update(object_id: str, data: Dict[str, Any]) -> AntiSpywareProfileResponseModel` + +Updates an existing anti-spyware profile object. + +**Parameters:** + +- `object_id` (str): The UUID of the anti-spyware profile object. +- `data` (Dict[str, Any]): A dictionary containing the updated anti-spyware profile data. + +**Example:** + +```python +update_data = { + "description": "Updated anti-spyware profile description", +} + +updated_profile = anti_spyware_profile.update(profile_id, update_data) +print(f"Updated anti-spyware profile with ID: {updated_profile.id}") +``` + +### `delete(object_id: str) -> None` + +Deletes an anti-spyware profile object by its ID. + +**Parameters:** + +- `object_id` (str): The UUID of the anti-spyware profile object. + +**Example:** + +```python +anti_spyware_profile.delete(profile_id) +print(f"Deleted anti-spyware 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[AntiSpywareProfileResponseModel]` + +Lists anti-spyware profile objects, optionally filtered by folder, snippet, device, or other criteria. + +**Parameters:** + +- `folder` (Optional[str]): The folder to list anti-spyware profiles from. +- `snippet` (Optional[str]): The snippet to list anti-spyware profiles from. +- `device` (Optional[str]): The device to list anti-spyware profiles from. +- `offset` (Optional[int]): The offset for pagination. +- `limit` (Optional[int]): The limit for pagination. +- `name` (Optional[str]): Filter profiles by name. +- `**filters`: Additional filters. + +**Example:** + +```python +profiles = anti_spyware_profile.list(folder='Prisma Access', limit=10) + +for profile in profiles: + print(f"Anti-Spyware Profile Name: {profile.name}, ID: {profile.id}") +``` + +--- + +## Usage Example + +```python +from scm.client import Scm +from scm.config.security import AntiSpywareProfile + +# Initialize the SCM client +scm = Scm( + client_id="your_client_id", + client_secret="your_client_secret", + tsg_id="your_tsg_id", +) + +# Create an AntiSpywareProfile instance +anti_spyware_profile = AntiSpywareProfile(scm) + +# Create a new anti-spyware profile +profile_data = { + "name": "test_profile", + "description": "Test anti-spyware profile", + "folder": "Prisma Access", + "rules": [ + { + "name": "rule1", + "severity": ["critical", "high"], + "category": "spyware", + "action": {"alert": {}} + } + ] +} + +new_profile = anti_spyware_profile.create(profile_data) +print(f"Created anti-spyware profile with ID: {new_profile.id}") + +# List anti-spyware profiles +profiles = anti_spyware_profile.list(folder='Prisma Access', limit=10) +for profile in profiles: + print(f"Anti-Spyware Profile Name: {profile.name}, ID: {profile.id}") +``` + +--- + +## Related Models + +- [AntiSpywareProfileRequestModel](../../models/security_services/anti_spyware_profile_models.md#AntiSpywareProfileRequestModel) +- [AntiSpywareProfileResponseModel](../../models/security_services/anti_spyware_profile_models.md#AntiSpywareProfileResponseModel) + diff --git a/docs/sdk/config/security_services/index.md b/docs/sdk/config/security_services/index.md new file mode 100644 index 00000000..d5a6b2be --- /dev/null +++ b/docs/sdk/config/security_services/index.md @@ -0,0 +1,20 @@ +# Security Services + +This section covers the configuration security services provided by the `pan-scm-sdk`: + +- [Anti Spyware Profile](anti_spyware.md) + +Each configuration object corresponds to a resource in the Strata Cloud Manager and provides methods for CRUD (Create, +Read, Update, Delete) operations. + +--- + +## Available Objects + +### [AntiSpywareProfile](anti_spyware.md) + +Manage individual Anti-Spyware Security Profiles. + +--- + +Select an object above to view detailed documentation, including methods, parameters, and examples. diff --git a/docs/sdk/index.md b/docs/sdk/index.md index 4da31533..06ad3a27 100644 --- a/docs/sdk/index.md +++ b/docs/sdk/index.md @@ -5,18 +5,24 @@ configuration objects and data models used to interact with Palo Alto Networks S ## Contents -- [Configuration Objects](configuration_objects.md) - - [Address](address.md) - - [Address Group](address_group.md) - - [Application](application.md) - - [Application Group](application_group.md) - - [Service](service.md) -- [Data Models](models.md) - - [Address Models](models/address_models.md) - - [Address Group Models](models/address_group_models.md) - - [Application Models](models/application_models.md) - - [Application Group Models](models/application_group_models.md) - - [Service Models](models/service_models.md) +- Configuration + - [Objects](config/objects/index) + - [Address](config/objects/address.md) + - [Address Group](config/objects/address_group.md) + - [Application](config/objects/application.md) + - [Application Group](config/objects/application_group.md) + - [Service](config/objects/service.md) + - [Security Services](config/security_services/index) + - [Anti-Spyware](config/security_services/anti_spyware.md) +- Data Models + - [Objects](models/objects/index) + - [Address Models](models/objects/address_models.md) + - [Address Group Models](models/objects/address_group_models.md) + - [Application Models](models/objects/application_models.md) + - [Application Group Models](models/objects/application_group_models.md) + - [Service Models](models/objects/service_models.md) + - [Security Services](models/security_services/index) + - [Anti-Spyware](models/security_services/anti_spyware_profile_models.md) --- @@ -25,5 +31,6 @@ configuration objects and data models used to interact with Palo Alto Networks S The `pan-scm-sdk` provides a set of classes and models to simplify interaction with the Strata Cloud Manager API. By utilizing this SDK, developers can programmatically manage configurations, ensuring consistency and efficiency. -Proceed to the [Configuration Objects](configuration_objects.md) section to learn more about the objects you can manage +Proceed to the [Configuration Objects](config/objects/index) section to learn more about the objects you can +manage using the SDK. diff --git a/docs/sdk/models/address_group_models.md b/docs/sdk/models/objects/address_group_models.md similarity index 100% rename from docs/sdk/models/address_group_models.md rename to docs/sdk/models/objects/address_group_models.md diff --git a/docs/sdk/models/address_models.md b/docs/sdk/models/objects/address_models.md similarity index 100% rename from docs/sdk/models/address_models.md rename to docs/sdk/models/objects/address_models.md diff --git a/docs/sdk/models/application_group_models.md b/docs/sdk/models/objects/application_group_models.md similarity index 100% rename from docs/sdk/models/application_group_models.md rename to docs/sdk/models/objects/application_group_models.md diff --git a/docs/sdk/models/application_models.md b/docs/sdk/models/objects/application_models.md similarity index 100% rename from docs/sdk/models/application_models.md rename to docs/sdk/models/objects/application_models.md diff --git a/docs/sdk/models.md b/docs/sdk/models/objects/index.md similarity index 66% rename from docs/sdk/models.md rename to docs/sdk/models/objects/index.md index 8018df2b..0c484a93 100644 --- a/docs/sdk/models.md +++ b/docs/sdk/models/objects/index.md @@ -16,8 +16,8 @@ For each configuration object, there are corresponding request and response mode ## Models by Configuration Object -- [Address Models](models/address_models.md) -- [Address Group Models](models/address_group_models.md) -- [Application Models](models/application_models.md) -- [Application Group Models](models/application_group_models.md) -- [Service Models](models/service_models.md) +- [Address Models](address_models.md) +- [Address Group Models](address_group_models.md) +- [Application Models](application_models.md) +- [Application Group Models](application_group_models.md) +- [Service Models](service_models.md) diff --git a/docs/sdk/models/service_models.md b/docs/sdk/models/objects/service_models.md similarity index 100% rename from docs/sdk/models/service_models.md rename to docs/sdk/models/objects/service_models.md diff --git a/docs/sdk/models/security_services/anti_spyware_profile_models.md b/docs/sdk/models/security_services/anti_spyware_profile_models.md new file mode 100644 index 00000000..42ded69e --- /dev/null +++ b/docs/sdk/models/security_services/anti_spyware_profile_models.md @@ -0,0 +1,138 @@ +# Anti-Spyware Profile Models + +This section covers the data models associated with the `AntiSpywareProfile` configuration object. + +--- + +## AntiSpywareProfileRequestModel + +Used when creating or updating an anti-spyware profile object. + +### Attributes + +- `name` (str): **Required.** The name of the anti-spyware profile. +- `description` (Optional[str]): A description of the anti-spyware profile. +- `cloud_inline_analysis` (Optional[bool]): Enable or disable cloud inline analysis. Defaults to False. +- `inline_exception_edl_url` (Optional[List[str]]): List of inline exception EDL URLs. +- `inline_exception_ip_address` (Optional[List[str]]): List of inline exception IP addresses. +- `mica_engine_spyware_enabled` (Optional[List[MicaEngineSpywareEnabledEntry]]): List of MICA engine spyware enabled + entries. +- **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. +- `rules` (List[RuleRequest]): **Required.** List of rules for the profile. +- `threat_exception` (Optional[List[ThreatExceptionRequest]]): List of threat exceptions for the profile. + +### Example + +```python +anti_spyware_profile_request = AntiSpywareProfileRequestModel( + name="test_profile", + description="Test anti-spyware profile", + folder="Prisma Access", + rules=[ + RuleRequest( + name="rule1", + severity=["critical", "high"], + category="spyware", + action=ActionRequest(root={"alert": {}}) + ) + ] +) +``` + +--- + +## AntiSpywareProfileResponseModel + +Used when parsing anti-spyware profile objects retrieved from the API. + +### Attributes + +- `id` (str): The UUID of the anti-spyware profile object. +- `name` (str): The name of the anti-spyware profile. +- `description` (Optional[str]): A description of the anti-spyware profile. +- `cloud_inline_analysis` (Optional[bool]): Cloud inline analysis setting. +- `inline_exception_edl_url` (Optional[List[str]]): List of inline exception EDL URLs. +- `inline_exception_ip_address` (Optional[List[str]]): List of inline exception IP addresses. +- `mica_engine_spyware_enabled` (Optional[List[MicaEngineSpywareEnabledEntry]]): List of MICA engine spyware enabled + entries. +- **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. +- `rules` (List[RuleResponse]): List of rules for the profile. +- `threat_exception` (Optional[List[ThreatExceptionResponse]]): List of threat exceptions for the profile. + +### Example + +```python +anti_spyware_profile_response = AntiSpywareProfileResponseModel( + id="123e4567-e89b-12d3-a456-426655440000", + name="test_profile", + description="Test anti-spyware profile", + folder="Prisma Access", + rules=[ + RuleResponse( + name="rule1", + severity=["critical", "high"], + category="spyware", + action=ActionResponse(root={"alert": {}}) + ) + ] +) +``` + +--- + +## Additional Models + +### MicaEngineSpywareEnabledEntry + +Represents an entry in the 'mica_engine_spyware_enabled' list. + +#### Attributes + +- `name` (str): Name of the MICA engine spyware detector. +- `inline_policy_action` (InlinePolicyAction): Action to be taken by the inline policy. + +### RuleRequest and RuleResponse + +Represents a rule in the anti-spyware profile. + +#### Attributes + +- `name` (str): Rule name. +- `severity` (List[Severity]): List of severities. +- `category` (Category): Category of the rule. +- `threat_name` (Optional[str]): Threat name. +- `packet_capture` (Optional[PacketCapture]): Packet capture setting. +- `action` (ActionRequest or ActionResponse): Action to be taken. + +### ThreatExceptionRequest and ThreatExceptionResponse + +Represents a threat exception in the anti-spyware profile. + +#### Attributes + +- `name` (str): Threat exception name. +- `packet_capture` (PacketCapture): Packet capture setting. +- `exempt_ip` (Optional[List[ExemptIpEntry]]): Exempt IP list. +- `notes` (Optional[str]): Notes. +- `action` (ActionRequest or ActionResponse): Action to be taken. + +### ActionRequest and ActionResponse + +Represents the 'action' field in rules and threat exceptions. + +#### Methods + +- `get_action_name() -> str`: Returns the name of the action. + +### Enums + +- `InlinePolicyAction`: Enumeration of allowed inline policy actions. +- `PacketCapture`: Enumeration of packet capture options. +- `Severity`: Enumeration of severity levels. +- `Category`: Enumeration of threat categories. diff --git a/docs/sdk/models/security_services/index.md b/docs/sdk/models/security_services/index.md new file mode 100644 index 00000000..7225810e --- /dev/null +++ b/docs/sdk/models/security_services/index.md @@ -0,0 +1,19 @@ +# Data Models + +The `pan-scm-sdk` utilizes Pydantic models for data validation and serialization. This ensures that the data being sent +to and received from the Strata Cloud Manager API adheres to the expected structure and constraints. + +--- + +## Overview + +For each configuration object, there are corresponding request and response models: + +- **Request Models**: Used when creating or updating resources. +- **Response Models**: Used when parsing data retrieved from the API. + +--- + +## Models by Configuration Object + +- [Anti Spyware Security Profile Models](anti_spyware_profile_models.md) diff --git a/mkdocs.yml b/mkdocs.yml index a270cdb2..7ec0b1c7 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -26,19 +26,28 @@ nav: - Getting Started: about/getting-started.md - SDK Developer Documentation: - Overview: sdk/index.md - - Configuration Objects: - - Address: sdk/address.md - - Address Group: sdk/address_group.md - - Application: sdk/application.md - - Application Group: sdk/application_group.md - - Service: sdk/service.md + - Configuration: + - Objects: + - Overview: sdk/config/objects/index.md + - Address: sdk/config/objects/address.md + - Address Group: sdk/config/objects/address_group.md + - Application: sdk/config/objects/application.md + - Application Group: sdk/config/objects/application_group.md + - Service: sdk/config/objects/service.md + - Security Services: + - Overview: sdk/config/security_services/index.md + - Address: sdk/config/security_services/anti_spyware.md - Data Models: - - Overview: sdk/models.md - - Address Models: sdk/models/address_models.md - - Address Group Models: sdk/models/address_group_models.md - - Application Models: sdk/models/application_models.md - - Application Group Models: sdk/models/application_group_models.md - - Service Models: sdk/models/service_models.md + - Objects: + - Overview: sdk/models/objects/index.md + - Address Models: sdk/models/objects/address_models.md + - Address Group Models: sdk/models/objects/address_group_models.md + - Application Models: sdk/models/objects/application_models.md + - Application Group Models: sdk/models/objects/application_group_models.md + - Service Models: sdk/models/objects/service_models.md + - Security Services: + - Overview: sdk/models/security_services/index.md + - Address: sdk/models/security_services/anti_spyware.md - Authentication Module: sdk/auth.md - SCM Client: sdk/client.md - Troubleshooting: about/troubleshooting.md