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

38-add-commit-method #54

Merged
merged 16 commits into from
Nov 30, 2024
Merged

38-add-commit-method #54

merged 16 commits into from
Nov 30, 2024

Conversation

cdot65
Copy link
Owner

@cdot65 cdot65 commented Nov 30, 2024

Checklist for This Pull Request

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

  • Ensure you are submitting your pull request to a branch dedicated to a specific topic/feature/bugfix. Avoid using the master branch for pull requests.
  • Target your pull request to the main development branch in this repository.
  • Ensure your commit messages follow the project's preferred format.
  • Check that your code additions do not fail any linting checks or unit tests.

Pull Request Description

Adding support for commits and the ability to pull in job status

What does this pull request accomplish?

  • Feature addition
  • Documentation update

Are there any breaking changes included?

  • Yes
  • No

Is there anything the reviewers should know?

Thank you for your contributions!

The detailed workflow examples in `address.md` and `address_group.md` have been removed to make the documentation more concise. Reference links to specific example scripts on GitHub have been added to guide users to the full examples, ensuring the documentation remains clear and focused.
Reorder try-except blocks to better manage exceptions and ensure proper cleanup even if errors occur. Moved address object initialization inside the main try block to handle potential authentication failures first. Updated tags in the create_data and ensured consistent function calls for address handling.
This commit introduces a new example script for creating, fetching, updating, and deleting address groups using the SCM client. It includes detailed logging and error handling for common exceptions such as authentication errors and name conflicts. The script demonstrates the process of setting up network objects and managing them efficiently.
This update enhances the BaseObject by introducing methods to check job status and commit configuration changes. The `get_job_status` method allows retrieval of job status using a job ID, while the `commit` method enables committing configuration changes with optional synchronization and timeout parameters. These additions improve interaction with the SCM service by providing more functionality and flexibility.
Introduce models for handling candidate push requests and responses, supporting commit operations in Palo Alto Networks' Strata Cloud Manager. Include job status details and responses to streamline job management and track commit operations effectively.
Implemented methods `get_job_status`, `wait_for_job`, and `commit` to enhance the SCM client with job status checking and configuration commit capabilities. The `commit` method now supports synchronous waiting for job completion with a specified timeout. These additions improve the client's ability to manage and monitor configuration changes more effectively.
This change adds noqa comments to the lines mounting HTTP adapters to suppress linting warnings. It ensures cleaner code by acknowledging the specific case where linting might otherwise flag these lines.
Introduce a `list_jobs` method to support fetching jobs with pagination and optional parent ID filtering. This enhances the module's ability to manage and retrieve job data efficiently. Updated imports to include `JobListResponse` for proper type annotation.
Include JobListItem and JobListResponse in the __init__.py to ensure these classes are available for import from the operations module. This change enhances module accessibility and organization by exposing additional components.
Introduce the JobListItem and JobListResponse models to handle job listing responses, which include pagination details. The JobListItem model includes fields for job details and a validator for timestamp fields, ensuring empty strings are converted to None for better consistency.
The list_jobs method provides functionality for listing jobs with pagination and optional parent ID filtering. It makes an API call to fetch job data and utilizes Pydantic models for response parsing. This enhancement allows users to effectively manage and retrieve job information from SCM.
Replaced json_encoders with field_serializer for datetime conversion to ISO format in JobDetails. This change ensures consistency and better code readability. Also, adjusted the model_config setup for datetime serialization and validation in JobStatusResponse.
Introducing comprehensive unit tests for CandidatePushRequestModel and Job-related models to ensure robustness and correctness. These tests cover validation mechanisms for input data, serialization of datetime objects, and API operations like job listing, status retrieval, and commit procedures. By adding these tests, we're enhancing the quality assurance of the codebase and monitoring critical functionalities.
Added detailed documentation for candidate push and job operations models in the SCM SDK. This includes new files explaining model attributes, exceptions, and usage examples. Updated the client and index documentation to reflect these changes, ensuring automatic token handling and improved error management.
The header comment in the candidate_push.py file was updated to correctly reflect its file path. This change ensures better alignment and reduces confusion for developers navigating the codebase.
This update introduces the ability to perform commits and to pull in job status, enhancing the functionality of the SDK. The release notes and pyproject.toml have been updated to reflect this version change.
@cdot65 cdot65 linked an issue Nov 30, 2024 that may be closed by this pull request
@cdot65 cdot65 merged commit 564bfe7 into main Nov 30, 2024
1 check passed
Copy link

codecov bot commented Nov 30, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Files with missing lines Coverage Δ
scm/auth.py 100.00% <100.00%> (ø)
scm/client.py 100.00% <100.00%> (ø)
scm/config/__init__.py 100.00% <100.00%> (ø)
scm/models/operations/__init__.py 100.00% <100.00%> (ø)
scm/models/operations/candidate_push.py 100.00% <100.00%> (ø)
scm/models/operations/jobs.py 100.00% <100.00%> (ø)

@cdot65 cdot65 deleted the 38-add-commit-method branch November 30, 2024 13:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add commit method
1 participant