Skip to content

Objects Data Models

Table of Contents

  1. Overview
  2. Model Types
  3. Common Model Patterns
  4. Usage Examples
  5. Models by Category
  6. Address Objects
  7. Service Objects
  8. Application Objects
  9. Group Objects
  10. Profile Objects
  11. Tag Objects
  12. Best Practices
  13. Related Documentation

Overview

The Strata Cloud Manager SDK uses Pydantic models for data validation and serialization. These models ensure that the data being sent to and received from the Strata Cloud Manager API adheres to the expected structure and constraints. This section documents the models for object configuration resources.

Model Types

For each configuration object, there are corresponding model types:

  • Create Models: Used when creating new resources ({Object}CreateModel)
  • Update Models: Used when updating existing resources ({Object}UpdateModel)
  • Response Models: Used when parsing data retrieved from the API ({Object}ResponseModel)
  • Base Models: Common shared attributes for related models ({Object}BaseModel)

Common Model Patterns

Object models share common patterns:

  • Container validation (exactly one of folder/snippet/device)
  • UUID validation for identifiers
  • String length and pattern validation
  • Data type validation and conversion
  • Tag normalization and validation
  • Required field enforcement

Usage Examples

from scm.client import ScmClient
from scm.models.objects import AddressCreateModel, AddressUpdateModel
# Initialize clientclient = ScmClient(
client_id="your_client_id",
client_secret="your_client_secret",
tsg_id="your_tsg_id"
)
# Create a new object using a modeladdress = AddressCreateModel(
name="web-server",
description="Primary web server",
ip_netmask="10.0.1.100/32",
folder="Shared"
)
# Convert the model to a dictionary for the API calladdress_dict = address.model_dump(exclude_unset=True)
result = client.address.create(address_dict)
# Update an existing object using a modelupdate_address = AddressUpdateModel(
id=result.id,
name="web-server-updated",
description="Updated web server",
ip_netmask="10.0.1.101/32",
folder="Shared"
)

update_dict = update_address.model_dump(exclude_unset=True)
updated_result = client.address.update(update_dict)

Models by Category

Address Objects

Service Objects

Application Objects

Group Objects

Profile Objects

Tag Objects

  • Tag Models - Object categorization and organization tags

Best Practices

  1. Model Validation
  2. Always validate input data with models before sending to the API
  3. Handle validation errors appropriately
  4. Use model_dump(exclude_unset=True) to avoid sending default values

  5. Container Consistency

  6. Maintain consistent container usage (folder/snippet/device)
  7. Remember that exactly one container type must be specified
  8. Use the same container type for related objects

  9. Model Conversion

  10. Convert API responses to response models for type safety
  11. Use model_dump() for serialization to JSON or dictionaries
  12. Leverage model validators for complex validation logic

  13. Error Handling

  14. Catch and handle ValueError exceptions from model validation
  15. Implement proper error messages for validation failures
  16. Validate model data before executing API calls