Skip to main content

GlobalProtect Forwarding Profile User Location Models

Overview

The Forwarding Profile User Location models provide a structured way to manage location matching criteria for GlobalProtect forwarding profiles in Palo Alto Networks' Strata Cloud Manager. A user location matches either by internal host detection or by a list of IP addresses. The models handle validation of inputs and outputs when interacting with the SCM API.

Models

The module provides the following Pydantic models:

  • ForwardingProfileUserLocationBaseModel: Base model with fields common to all operations
  • ForwardingProfileUserLocationCreateModel: Model for creating new user locations
  • ForwardingProfileUserLocationUpdateModel: Model for updating existing user locations (adds id)
  • ForwardingProfileUserLocationResponseModel: Response model for user location operations (adds id)
  • UserLocationChoice: Location matching criteria (exactly one option must be set)
  • UserLocationInternalHostDetection: Internal host detection settings (ip_address, fqdn)
  • UserLocationIpEntry: A single IP address entry (name)

Request models use extra="forbid" configuration, which rejects any fields not explicitly defined in the model. The response model uses extra="ignore" for forward compatibility.

Attributes

AttributeTypeRequiredDefaultDescription
namestrYesNoneName of the user location. Max length: 64 chars. Pattern: ^[0-9a-zA-Z._-]+$
choiceUserLocationChoiceYesNoneLocation matching criteria (exactly one option)
descriptionstrNoNoneDescription of the user location. Max length: 1023 chars
idUUIDYes*NoneUUID of the user location

* Present in UpdateModel and ResponseModel only

UserLocationChoice

AttributeTypeRequiredDescription
internal_host_detectionUserLocationInternalHostDetectionOne ofInternal host detection settings
ip_addressesList[UserLocationIpEntry]One ofList of IP address entries

Exactly one of internal_host_detection or ip_addresses must be provided.

UserLocationInternalHostDetection

AttributeTypeRequiredDescription
ip_addressstrNoIPv4 address with optional wildcards or CIDR suffix
fqdnstrNoFully qualified domain name. Max length: 255 chars

UserLocationIpEntry

AttributeTypeRequiredDescription
namestrYesIPv4 address with optional wildcards or CIDR suffix

Model Validators

Choice Validation

The UserLocationChoice model enforces that exactly one matching option is provided:

from scm.models.mobile_agent import UserLocationChoice

# This will raise a validation error — both options provided
UserLocationChoice(
internal_host_detection={"fqdn": "internal.example.com"},
ip_addresses=[{"name": "10.0.0.0/8"}],
)

Usage Example

from scm.client import Scm
from scm.models.mobile_agent import ForwardingProfileUserLocationCreateModel

client = Scm(
client_id="your_client_id",
client_secret="your_client_secret",
tsg_id="your_tsg_id"
)

# Create a user location using a model
user_location = ForwardingProfileUserLocationCreateModel(
name="branch-offices",
choice={
"ip_addresses": [
{"name": "10.1.0.0/16"},
{"name": "10.2.0.0/16"},
]
},
)

# Convert the model to a dictionary for the API call
payload = user_location.model_dump(exclude_unset=True)
result = client.forwarding_profile_user_location.create(payload)
print(f"Created user location: {result.id}")