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.2.tar.gz
.
File metadata
- Download URL: pan_scm_sdk-0.1.2.tar.gz
- Upload date:
- Size: 14.6 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 | fc7fe2e2cf451964e5287601cdd8d85c754712ab98f810ac642c87ebe34721c9 |
|
MD5 | 6ef85c6dd692e98fafa122b437a44239 |
|
BLAKE2b-256 | 686b34b14701732f2900d52f160fe9cd67aeadcbda9c2a6d49277be2ab1f2f11 |
File details
Details for the file pan_scm_sdk-0.1.2-py3-none-any.whl
.
File metadata
- Download URL: pan_scm_sdk-0.1.2-py3-none-any.whl
- Upload date:
- Size: 16.8 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 | 40ab6336b7e3b447aa99166230c8718e1ed8ef4a66ca082f9e0e7a587d7390c2 |
|
MD5 | 716d049d218a48cd1dd853b5d8077dc0 |
|
BLAKE2b-256 | d3a6bbab22926dbc3bb62dc1e7809541b007e845476fde808717fc40dfdc8a7d |