Python SDK for Cisco Security Cloud Control Platform Management APIs
Project description
Cisco Security Cloud Control Python SDK
A Python SDK for interacting with the Cisco Security Cloud Control Platform Management APIs.
Installation
pip3 install cisco-scc-sdk
Or install from source:
pip3 install .
Quick Start
from scc_sdk import Client
# Initialize the client with your access token
client = Client(access_token="your_bearer_token_here")
# Work with organizations
organizations = client.organizations.list()
org = client.organizations.get(org_id="550e8400-e29b-41d4-a716-446655440000")
new_org = client.organizations.create(name="New Org", region_code="NAM")
# Work with subscriptions
subscriptions = client.subscriptions.list(org_id="org-uuid")
subscription = client.subscriptions.get(org_id="org-uuid", subscription_id="sub-uuid")
# Work with groups
groups = client.groups.list(org_id="org-uuid")
group = client.groups.get(org_id="org-uuid", group_id="group-uuid")
Features
- Simple Authentication: Just pass your bearer token
- Resource-based API: Organized into logical resource classes
- Type Hints: Full type hint support for better IDE integration
- Context Manager Support: Use with
withstatement for automatic cleanup - Comprehensive Error Handling: Custom exceptions for different error types
Configuration
The SDK uses a configurable base URL. By default, it points to https://api.security.cisco.com/v1.
To use a different URL:
client = Client(
access_token="your_token",
base_url="https://api.security.cisco.com",
base_path="v1"
)
Usage Examples
Using Context Manager
with Client(access_token="your_token") as client:
orgs = client.organizations.list()
# Session is automatically closed when exiting the context
Organizations
# List organizations with filtering and pagination
orgs = client.organizations.list(
name="Acme",
type="STANDALONE",
region_code="NAM",
max=50,
sort_by="name",
order="ASC"
)
# Get a specific organization
org = client.organizations.get(org_id="550e8400-e29b-41d4-a716-446655440000")
# Create a new organization
new_org = client.organizations.create(
name="New Organization",
region_code="NAM",
type="STANDALONE"
)
# Update an organization
updated_org = client.organizations.update(
org_id="550e8400-e29b-41d4-a716-446655440000",
name="Updated Name"
)
Subscriptions
org_id = "550e8400-e29b-41d4-a716-446655440000"
# List subscriptions
subscriptions = client.subscriptions.list(org_id=org_id)
# Get a specific subscription
subscription = client.subscriptions.get(
org_id=org_id,
subscription_id="3742d652-6740-489c-b628-143f00690fea"
)
# Create a subscription with claim code
new_subscription = client.subscriptions.create(
org_id=org_id,
claim_code="PHJZ-DWMF-ZBYH-FYMB",
type="STANDALONE"
)
# Read claim code details before creating
claim_info = client.subscriptions.read_claim_code(
org_id=org_id,
claim_code="PHJZ-DWMF-ZBYH-FYMB"
)
# Update subscription (activate/deactivate product)
updated_sub = client.subscriptions.update(
org_id=org_id,
subscription_id="sub-uuid",
product_id="product-uuid",
status=True,
region_code="NAM",
initial_admin="admin@example.com"
)
# Patch subscription (update SKU quantities for managed orgs)
patched_sub = client.subscriptions.patch(
org_id=org_id,
subscription_id="sub-uuid",
skus=[
{"name": "E3S-AIDEF-ADV", "quantity": 10},
{"name": "CPT-SEC-ADV", "quantity": 50}
]
)
Groups
org_id = "550e8400-e29b-41d4-a716-446655440000"
# List groups
groups = client.groups.list(org_id=org_id)
# Get a specific group
group = client.groups.get(
org_id=org_id,
group_id="e980e881-b61f-11f0-a9b4-06fbd2118f4e"
)
# Create a new group
new_group = client.groups.create(
org_id=org_id,
name="Engineering Team",
description="Engineering department group",
applies_to="SOME_MANAGED"
)
# Update a group
updated_group = client.groups.update(
org_id=org_id,
group_id="group-uuid",
name="Updated Team Name",
description="Updated description"
)
# Delete a group
client.groups.delete(org_id=org_id, group_id="group-uuid")
# Remove shared group from managed organization
client.groups.remove_shared_group(org_id=org_id, group_id="group-uuid")
Token Refresh
# Refresh access token using refresh token
new_tokens = client.tokens.refresh(
org_id="org-uuid",
api_key_id="key-uuid",
refresh_token="your_refresh_token"
)
access_token = new_tokens["access_token"]
refresh_token = new_tokens["refresh_token"]
expires_in = new_tokens["expires_in"]
Error Handling
The SDK provides custom exceptions for different error scenarios:
from scc_sdk import (
Client,
SCCError,
AuthenticationError,
NotFoundError,
ValidationError,
ForbiddenError,
ServerError
)
try:
client = Client(access_token="your_token")
org = client.organizations.get(org_id="invalid-uuid")
except AuthenticationError:
print("Invalid access token")
except NotFoundError:
print("Organization not found")
except ValidationError:
print("Invalid request data")
except ForbiddenError:
print("Access forbidden")
except ServerError:
print("Server error occurred")
except SCCError as e:
print(f"API error occurred: {e}")
API Resources
Organizations Resource
list()- List organizations with filteringget(org_id)- Get organization by IDcreate(name, region_code, type)- Create new organizationupdate(org_id, name)- Update organization name
Subscriptions Resource
list(org_id, name)- List subscriptionsget(org_id, subscription_id)- Get subscription by IDcreate(org_id, claim_code, type, products)- Create subscriptionupdate(org_id, subscription_id, ...)- Update subscriptionpatch(org_id, subscription_id, skus, ...)- Patch subscription SKUsread_claim_code(org_id, claim_code)- Validate claim code
Groups Resource
list(org_id)- List groupsget(org_id, group_id)- Get group by IDcreate(org_id, name, description, applies_to)- Create groupupdate(org_id, group_id, name, description)- Update groupdelete(org_id, group_id)- Delete groupremove_shared_group(org_id, group_id)- Remove shared group
Tokens Resource
refresh(org_id, api_key_id, refresh_token)- Refresh access token
Development
Running Tests
pip3 install -e ".[dev]"
pytest
Code Formatting
black scc_sdk/
flake8 scc_sdk/
mypy scc_sdk/
API Documentation
For full API documentation, refer to the Cisco Security Cloud Control API Documentation.
Contributing
Thanks for your interest in contributing! There are many ways to contribute to this project. Get started here.
Support
For questions, issues, or feedback regarding this SDK, please contact the Cisco SCC SDK Team:
📧 Email: cisco-scc-sdk-team@cisco.com
License
This library is distributed under the Apache 2.0 license found in the LICENSE file.
Project details
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cisco_scc_sdk-1.0.1.tar.gz.
File metadata
- Download URL: cisco_scc_sdk-1.0.1.tar.gz
- Upload date:
- Size: 14.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
498000f99fb10a120c76cb8c6c45396f77d3bea60ce090f18a94fb171e1fdced
|
|
| MD5 |
16e6e3c9381a2cf0f6ac77c2390b6dbb
|
|
| BLAKE2b-256 |
94853537391f17c24ed2a8be9d6d7f188299932749bd58816e960d2f365ff0b2
|
Provenance
The following attestation bundles were made for cisco_scc_sdk-1.0.1.tar.gz:
Publisher:
publish.yml on cisco-sbg/scc-python-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cisco_scc_sdk-1.0.1.tar.gz -
Subject digest:
498000f99fb10a120c76cb8c6c45396f77d3bea60ce090f18a94fb171e1fdced - Sigstore transparency entry: 815013352
- Sigstore integration time:
-
Permalink:
cisco-sbg/scc-python-sdk@bbb56e9fba4cea5421bdcce71110019535f302d1 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/cisco-sbg
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@bbb56e9fba4cea5421bdcce71110019535f302d1 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file cisco_scc_sdk-1.0.1-py3-none-any.whl.
File metadata
- Download URL: cisco_scc_sdk-1.0.1-py3-none-any.whl
- Upload date:
- Size: 18.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8a299dbdd35abec32515d375c55f55b7df9722c20fdbe392b7b481196755fd44
|
|
| MD5 |
a613a521ac78d55a9ae1c9232966dd28
|
|
| BLAKE2b-256 |
d578e255d6f39fb051959f21d3cd140d5f793b9a0cf3835da6de6bd932164fd5
|
Provenance
The following attestation bundles were made for cisco_scc_sdk-1.0.1-py3-none-any.whl:
Publisher:
publish.yml on cisco-sbg/scc-python-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cisco_scc_sdk-1.0.1-py3-none-any.whl -
Subject digest:
8a299dbdd35abec32515d375c55f55b7df9722c20fdbe392b7b481196755fd44 - Sigstore transparency entry: 815013357
- Sigstore integration time:
-
Permalink:
cisco-sbg/scc-python-sdk@bbb56e9fba4cea5421bdcce71110019535f302d1 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/cisco-sbg
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@bbb56e9fba4cea5421bdcce71110019535f302d1 -
Trigger Event:
workflow_dispatch
-
Statement type: