"""
Account models for NetBird API.
"""
from typing import Any, Dict, List, Optional
from pydantic import Field
from .common import BaseModel, ResourceId
[docs]
class AccountSettings(BaseModel):
"""Account settings configuration.
Attributes:
peer_login_expiration: Peer login expiration settings
peer_login_expiration_enabled: Whether peer login expiration is enabled
peer_inactivity_expiration_enabled: Whether peer inactivity expiration
is enabled
user_view_restrictions: User view restriction settings
group_propagation_enabled: Whether group propagation is enabled
jwt_groups_enabled: Whether JWT groups are enabled
jwt_groups_claim_name: JWT groups claim name
dns_resolution_enabled: Whether DNS resolution is enabled
network_traffic_logging_enabled: Whether network traffic logging is enabled
lazy_connection_enabled: Whether lazy connection is enabled
"""
peer_login_expiration: Optional[int] = Field(
None, description="Peer login expiration in seconds"
)
peer_login_expiration_enabled: bool = Field(
False, description="Enable peer login expiration"
)
peer_inactivity_expiration_enabled: bool = Field(
False, description="Enable peer inactivity expiration"
)
user_view_restrictions: Optional[Dict[str, bool]] = Field(
None, description="User view restrictions"
)
group_propagation_enabled: bool = Field(
True, description="Enable group propagation"
)
jwt_groups_enabled: bool = Field(False, description="Enable JWT groups")
jwt_groups_claim_name: Optional[str] = Field(
None, description="JWT groups claim name"
)
dns_resolution_enabled: bool = Field(True, description="Enable DNS resolution")
network_traffic_logging_enabled: bool = Field(
False, description="Enable network traffic logging"
)
lazy_connection_enabled: bool = Field(False, description="Enable lazy connection")
peer_inactivity_expiration: Optional[int] = Field(
None, description="Peer inactivity expiration in seconds"
)
routing_peer_dns_resolution_enabled: Optional[bool] = Field(
None, description="Enable routing peer DNS resolution"
)
network_range: Optional[str] = Field(None, description="Network range")
network_range_v6: Optional[str] = Field(None, description="IPv6 network range")
dns_domain: Optional[str] = Field(None, description="Custom DNS domain")
regular_users_view_blocked: Optional[bool] = Field(
None, description="Block regular users from viewing restricted resources"
)
groups_propagation_enabled: Optional[bool] = Field(
None, description="Propagate user auto-groups"
)
jwt_allow_groups: Optional[List[str]] = Field(
None, description="Groups allowed from JWT claims"
)
peer_expose_enabled: Optional[bool] = Field(None, description="Enable peer expose")
peer_expose_groups: Optional[List[str]] = Field(
None, description="Peer expose groups"
)
auto_update_version: Optional[str] = Field(None, description="Auto update version")
auto_update_always: Optional[bool] = Field(
None, description="Install updates automatically"
)
metrics_push_enabled: Optional[bool] = Field(
None, description="Push client metrics"
)
agent_network_only: Optional[bool] = Field(
None, description="Limit account to Agent Network"
)
dashboard_features: Optional[Dict[str, Any]] = Field(
None, description="Dashboard feature flags"
)
local_mfa_enabled: Optional[bool] = Field(None, description="Enable local MFA")
ipv6_enabled_groups: Optional[List[str]] = Field(
None, description="Groups receiving IPv6"
)
embedded_idp_enabled: Optional[bool] = Field(
None, description="Enable embedded IDP"
)
local_auth_disabled: Optional[bool] = Field(None, description="Disable local auth")
extra_settings: Optional[Dict[str, Any]] = Field(
None,
alias="extra",
description="Extra settings (peer_approval, traffic_logs, etc.)",
)
[docs]
class Account(BaseModel):
"""NetBird account model.
Attributes:
id: Unique account identifier
domain: Account domain
domain_category: Domain category
created_at: Account creation timestamp
created_by: User who created the account
settings: Account settings
"""
id: ResourceId = Field(..., description="Unique account identifier")
domain: str = Field(..., description="Account domain")
domain_category: Optional[str] = Field(None, description="Domain category")
created_at: Optional[str] = Field(None, description="Account creation timestamp")
created_by: Optional[str] = Field(None, description="User who created the account")
settings: Optional[Dict[str, Any]] = Field(None, description="Account settings")
onboarding: Optional[Dict[str, Any]] = Field(None, description="Onboarding status")