from uuid import UUID
from model_security_client.api import ModelSecurityAPIClient
from model_security_client.generated.data.models.LabelsCreateRequestSchema import LabelsCreateRequestSchema
from model_security_client.generated.data.models.LabelSchema import LabelSchema
client = ModelSecurityAPIClient(
base_url="https://api.sase.paloaltonetworks.com/aims"
)
scan_uuid = UUID("550e8400-e29b-41d4-a716-446655440000")
# Replace all existing labels
client.set_scan_labels(
scan_uuid=scan_uuid,
data=LabelsCreateRequestSchema(
labels=[
LabelSchema(key="env", value="staging"),
LabelSchema(key="version", value="v2-0"),
LabelSchema(key="deployed", value="false"),
]
)
)
print(f"Labels set for scan {scan_uuid} (all previous labels removed)")