cdot65 / pan-scm-sdk

Python SDK for Palo Alto Networks Strata Cloud Manager.
https://cdot65.github.io/pan-scm-sdk/
Apache License 2.0
1 stars 1 forks source link

32-error-logging-missing-details #36

Closed cdot65 closed 18 minutes ago

cdot65 commented 1 week ago

Checklist for This Pull Request

🚨Please adhere to the guidelines for contributing to this repository.

Pull Request Description

Improve logging mechanism for both client and server exceptions.

What does this pull request accomplish?

Are there any breaking changes included?

Is there anything the reviewers should know?

Thank you for your contributions!

codecov[bot] commented 1 week ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

:white_check_mark: All tests successful. No failed tests found.

Files with missing lines Coverage Δ
scm/auth.py 100.00% <100.00%> (ø)
scm/client.py 100.00% <100.00%> (ø)
scm/config/objects/__init__.py 100.00% <100.00%> (ø)
scm/config/objects/address.py 100.00% <100.00%> (ø)
scm/config/objects/address_group.py 100.00% <100.00%> (ø)
scm/config/objects/application.py 100.00% <100.00%> (ø)
scm/config/objects/application_group.py 100.00% <100.00%> (ø)
scm/config/objects/service.py 100.00% <100.00%> (ø)
scm/config/objects/tag.py 100.00% <100.00%> (ø)
scm/config/security/anti_spyware_profile.py 100.00% <100.00%> (ø)
... and 22 more
cdot65 commented 19 minutes ago

Key Updates to the SDK:

  1. Error Handling & Logging Improvements:

    • Implemented comprehensive logging across all SDK components with configurable log levels
    • Standardized error handling by replacing custom exceptions with APIError
    • Added detailed error handling for OAuth2 authentication and token refresh
    • Enhanced HTTP and JSON parsing error handling
    • Added logging for API responses and error conditions
  2. Model & Architecture Changes:

    • Renamed and standardized security-related models (AntiSpyware, Vulnerability Protection, Wildfire Antivirus)
    • Added UUID support as optional ID field in various update models
    • Restructured response handling to provide strongly typed response objects
    • Removed redundant code and simplified API response mapping
  3. Testing Infrastructure:

    • Added comprehensive factory patterns for test data generation
    • Implemented extensive unit tests for all Pydantic models
    • Added tests for various error scenarios and edge cases
    • Created specialized factories for Address, AddressGroup, Application, and Service models
    • Added validation tests for all security profile types
  4. Security Profiles Enhancement:

    • Refactored security rule enums and related fields
    • Improved validation logic in decryption profiles
    • Standardized naming conventions across security-related components
    • Enhanced tag handling and validation
  5. Documentation & Code Quality:

    • Added docstrings and improved code formatting
    • Added release notes for version 0.2.2
    • Reorganized import structures
    • Improved code readability and organization