Python SDK for Palo Alto Networks Strata Cloud Manager.
Project description
Strata Cloud Manager SDK
Python SDK for Palo Alto Networks Strata Cloud Manager.
Table of Contents
Features
- OAuth2 Authentication: Securely authenticate with the Strata Cloud Manager API using OAuth2 client credentials flow.
- Resource Management: Create, read, update, and delete configuration objects such as addresses.
- Data Validation: Utilize Pydantic models for data validation and serialization.
- Exception Handling: Comprehensive error handling with custom exceptions for API errors.
- Extensibility: Designed for easy extension to support additional resources and endpoints.
Installation
Requirements:
- Python 3.10 or higher
Install the package via pip:
pip install pan-scm-sdk
Usage
Authentication
Before interacting with the SDK, you need to authenticate using your Strata Cloud Manager credentials.
from pan_scm_sdk.client import APIClient
# Initialize the API client with your credentials
api_client = APIClient(
client_id="your_client_id",
client_secret="your_client_secret",
tsg_id="your_tsg_id",
)
# The api_client is now ready to use
Creating Address Objects
from pan_scm_sdk.resources.address import AddressClient
from pan_scm_sdk.models.address import Address
# Create an AddressClient instance
address_client = AddressClient(api_client)
# Define a new address object
address = Address(
name="MyAddress",
ip_netmask="192.168.1.1/32",
folder="Shared",
)
# Create the address in Strata Cloud Manager
created_address = address_client.create_address(address)
print(f"Created address with ID: {created_address.id}")
Listing Addresses
# List addresses with optional filtering
addresses = address_client.list_addresses(limit=10)
for addr in addresses:
print(f"Address ID: {addr.id}, Name: {addr.name}, IP: {addr.ip_netmask}")
Updating an Address
# Retrieve an existing address
address_id = "123e4567-e89b-12d3-a456-426655440000"
address = address_client.get_address(address_id)
# Update the address properties
address.description = "Updated description"
# Send the update to Strata Cloud Manager
updated_address = address_client.update_address(address_id, address)
print(f"Updated address with ID: {updated_address.id}")
Deleting an Address
# Delete an address by ID
address_id = "123e4567-e89b-12d3-a456-426655440000"
address_client.delete_address(address_id)
print(f"Deleted address with ID: {address_id}")
Contributing
We welcome contributions! To contribute:
- Fork the repository.
- Create a new feature branch (
git checkout -b feature/your-feature
). - Commit your changes (
git commit -m 'Add new feature'
). - Push to your branch (
git push origin feature/your-feature
). - Open a Pull Request.
Ensure your code adheres to the project's coding standards and includes tests where appropriate.
License
This project is licensed under the Apache 2.0 License. See the LICENSE file for details.
Support
For support and questions, please refer to the SUPPORT.md file in this repository.
Detailed documentation is available on our GitHub Pages site.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pan_scm_sdk-0.1.1.tar.gz
.
File metadata
- Download URL: pan_scm_sdk-0.1.1.tar.gz
- Upload date:
- Size: 14.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.5 Darwin/23.5.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f9e05cd77758e4790593bc6c1798f75c43aeaa7d8b2feb5ab362f7eea41b287e |
|
MD5 | 5919539797e253e7eaaad282eb3d634d |
|
BLAKE2b-256 | eb9db4fad196ace3953ae74ae9fec624fe14457e20c65ba3bf74389162b83e87 |
File details
Details for the file pan_scm_sdk-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: pan_scm_sdk-0.1.1-py3-none-any.whl
- Upload date:
- Size: 18.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.5 Darwin/23.5.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | da2844cf4e918b9bb7eeb374c9b20a7f7739770d3c80ead3f1c4e106cf34d2ee |
|
MD5 | d5747fec748048148f5fe2fe53da0bc1 |
|
BLAKE2b-256 | efb9ca29621e04c079727d13bbba0eb2a8a3b3ee3a3a6b6c965ce8cc5661e477 |