Models¶
Resource models returned by the managers. These are pydantic models — you read fields off them and pass identifiers or model objects back into manager methods.
models
¶
Pydantic models for API resources.
Delegation
module-attribute
¶
Delegation: TypeAlias = (
ForwardZoneDelegation | ReverseZoneDelegation
)
A DNS delegation: always a concrete forward or reverse zone delegation.
Zone
module-attribute
¶
Zone: TypeAlias = ForwardZone | ReverseZone
A DNS zone: always a concrete forward or reverse zone.
Atom
pydantic-model
¶
Bases: HostPolicy
Model for an atom.
Show JSON schema:
{
"description": "Model for an atom.",
"properties": {
"create_date": {
"format": "date-time",
"title": "Create Date",
"type": "string"
},
"updated_at": {
"format": "date-time",
"title": "Updated At",
"type": "string"
},
"name": {
"title": "Name",
"type": "string"
},
"description": {
"title": "Description",
"type": "string"
},
"id": {
"title": "Id",
"type": "integer"
},
"roles": {
"items": {
"type": "string"
},
"title": "Roles",
"type": "array"
}
},
"required": [
"create_date",
"updated_at",
"name",
"description",
"id",
"roles"
],
"title": "Atom",
"type": "object"
}
Fields:
-
created_at_tz_naive(datetime) -
updated_at(datetime) -
name(str) -
description(str) -
id(int) -
roles(NameList)
Validators:
created_at_tz_naive
pydantic-field
¶
created_at_tz_naive: datetime
Constructed datetime field from create_date in the API.
WARNING¶
DO NOT USE THIS FIELD FOR TIMEZONE-AWARE COMPARISONS!
Always use created_at instead when comparing with timezone-aware
fields such as update_time.
__setattr__
¶
Raise an exception when trying to set an attribute.
validate_created_at
pydantic-validator
¶
CNAME
pydantic-model
¶
Bases: MregModelWithTimestamps
Represents a CNAME record.
Show JSON schema:
{
"description": "Represents a CNAME record.",
"properties": {
"created_at": {
"format": "date-time",
"title": "Created At",
"type": "string"
},
"updated_at": {
"format": "date-time",
"title": "Updated At",
"type": "string"
},
"id": {
"title": "Id",
"type": "integer"
},
"name": {
"title": "Name",
"type": "string"
},
"host": {
"title": "Host",
"type": "integer"
},
"ttl": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"title": "Ttl"
},
"zone": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"title": "Zone"
}
},
"required": [
"created_at",
"updated_at",
"id",
"name",
"host"
],
"title": "CNAME",
"type": "object"
}
Fields:
Community
pydantic-model
¶
Bases: MregModelWithTimestamps
Network community.
Show JSON schema:
{
"description": "Network community.",
"properties": {
"created_at": {
"format": "date-time",
"title": "Created At",
"type": "string"
},
"updated_at": {
"format": "date-time",
"title": "Updated At",
"type": "string"
},
"id": {
"title": "Id",
"type": "integer"
},
"name": {
"title": "Name",
"type": "string"
},
"description": {
"title": "Description",
"type": "string"
},
"network": {
"title": "Network",
"type": "integer"
},
"hosts": {
"default": [],
"items": {
"type": "string"
},
"title": "Hosts",
"type": "array"
},
"global_name": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Global Name"
}
},
"required": [
"created_at",
"updated_at",
"id",
"name",
"description",
"network"
],
"title": "Community",
"type": "object"
}
Fields:
ContactEmail
pydantic-model
¶
Bases: MregModelWithTimestamps
Model for a host's contact email.
Show JSON schema:
{
"description": "Model for a host's contact email.",
"properties": {
"created_at": {
"format": "date-time",
"title": "Created At",
"type": "string"
},
"updated_at": {
"format": "date-time",
"title": "Updated At",
"type": "string"
},
"id": {
"title": "Id",
"type": "integer"
},
"email": {
"title": "Email",
"type": "string"
}
},
"required": [
"created_at",
"updated_at",
"id",
"email"
],
"title": "ContactEmail",
"type": "object"
}
Fields:
DhcpHost
pydantic-model
¶
Base model for all DHCP hosts.
Show JSON schema:
{
"description": "Base model for all DHCP hosts.",
"properties": {
"name": {
"title": "Name",
"type": "string"
},
"ipaddress": {
"anyOf": [
{
"format": "ipv4",
"type": "string"
},
{
"format": "ipv6",
"type": "string"
}
],
"title": "Ipaddress"
},
"macaddress": {
"title": "Macaddress",
"type": "string"
},
"zone": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Zone"
}
},
"required": [
"name",
"ipaddress",
"macaddress"
],
"title": "DhcpHost",
"type": "object"
}
Fields:
-
name(str) -
ipaddress(IP_AddressT) -
macaddress(MacAddress) -
zone(str | None)
DhcpHostIPv4
pydantic-model
¶
Bases: DhcpHost
Model for a DHCP host with an IPv4 address.
Show JSON schema:
{
"description": "Model for a DHCP host with an IPv4 address.",
"properties": {
"name": {
"title": "Name",
"type": "string"
},
"ipaddress": {
"anyOf": [
{
"format": "ipv4",
"type": "string"
},
{
"format": "ipv6",
"type": "string"
}
],
"title": "Ipaddress"
},
"macaddress": {
"title": "Macaddress",
"type": "string"
},
"zone": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Zone"
}
},
"required": [
"name",
"ipaddress",
"macaddress"
],
"title": "DhcpHostIPv4",
"type": "object"
}
Fields:
-
name(str) -
ipaddress(IP_AddressT) -
macaddress(MacAddress) -
zone(str | None)
DhcpHostIPv6
pydantic-model
¶
Bases: DhcpHost
Model for a DHCP host with an IPv6 address.
Show JSON schema:
{
"description": "Model for a DHCP host with an IPv6 address.",
"properties": {
"name": {
"title": "Name",
"type": "string"
},
"ipaddress": {
"anyOf": [
{
"format": "ipv4",
"type": "string"
},
{
"format": "ipv6",
"type": "string"
}
],
"title": "Ipaddress"
},
"macaddress": {
"title": "Macaddress",
"type": "string"
},
"zone": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Zone"
}
},
"required": [
"name",
"ipaddress",
"macaddress"
],
"title": "DhcpHostIPv6",
"type": "object"
}
Fields:
-
name(str) -
ipaddress(IP_AddressT) -
macaddress(MacAddress) -
zone(str | None)
DhcpHostIPv6ByIPv4
pydantic-model
¶
Bases: DhcpHost
Model for a DHCP hosts with an IPv6 address via IPv4 address.
Show JSON schema:
{
"description": "Model for a DHCP hosts with an IPv6 address via IPv4 address.",
"properties": {
"name": {
"title": "Name",
"type": "string"
},
"ipaddress": {
"anyOf": [
{
"format": "ipv4",
"type": "string"
},
{
"format": "ipv6",
"type": "string"
}
],
"title": "Ipaddress"
},
"macaddress": {
"title": "Macaddress",
"type": "string"
},
"zone": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Zone"
}
},
"required": [
"name",
"ipaddress",
"macaddress"
],
"title": "DhcpHostIPv6ByIPv4",
"type": "object"
}
Fields:
-
name(str) -
ipaddress(IP_AddressT) -
macaddress(MacAddress) -
zone(str | None)
ExcludedRange
pydantic-model
¶
Bases: MregModelWithTimestamps
Model for an excluded IP range for a network.
Show JSON schema:
{
"description": "Model for an excluded IP range for a network.",
"properties": {
"created_at": {
"format": "date-time",
"title": "Created At",
"type": "string"
},
"updated_at": {
"format": "date-time",
"title": "Updated At",
"type": "string"
},
"id": {
"title": "Id",
"type": "integer"
},
"network": {
"title": "Network",
"type": "integer"
},
"start_ip": {
"anyOf": [
{
"format": "ipv4",
"type": "string"
},
{
"format": "ipv6",
"type": "string"
}
],
"title": "Start Ip"
},
"end_ip": {
"anyOf": [
{
"format": "ipv4",
"type": "string"
},
{
"format": "ipv6",
"type": "string"
}
],
"title": "End Ip"
}
},
"required": [
"created_at",
"updated_at",
"id",
"network",
"start_ip",
"end_ip"
],
"title": "ExcludedRange",
"type": "object"
}
Fields:
ForwardZone
pydantic-model
¶
Bases: _Zone
A forward zone.
Show JSON schema:
{
"$defs": {
"NameServer": {
"description": "Model for representing a nameserver within a DNS zone.",
"properties": {
"created_at": {
"format": "date-time",
"title": "Created At",
"type": "string"
},
"updated_at": {
"format": "date-time",
"title": "Updated At",
"type": "string"
},
"id": {
"title": "Id",
"type": "integer"
},
"name": {
"title": "Name",
"type": "string"
},
"ttl": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"title": "Ttl"
}
},
"required": [
"created_at",
"updated_at",
"id",
"name",
"ttl"
],
"title": "NameServer",
"type": "object"
}
},
"description": "A forward zone.",
"properties": {
"created_at": {
"format": "date-time",
"title": "Created At",
"type": "string"
},
"updated_at": {
"format": "date-time",
"title": "Updated At",
"type": "string"
},
"id": {
"title": "Id",
"type": "integer"
},
"nameservers": {
"items": {
"$ref": "#/$defs/NameServer"
},
"title": "Nameservers",
"type": "array"
},
"updated": {
"title": "Updated",
"type": "boolean"
},
"primary_ns": {
"title": "Primary Ns",
"type": "string"
},
"email": {
"title": "Email",
"type": "string"
},
"serialno": {
"title": "Serialno",
"type": "integer"
},
"serialno_updated_at": {
"format": "date-time",
"title": "Serialno Updated At",
"type": "string"
},
"refresh": {
"title": "Refresh",
"type": "integer"
},
"retry": {
"title": "Retry",
"type": "integer"
},
"expire": {
"title": "Expire",
"type": "integer"
},
"soa_ttl": {
"title": "Soa Ttl",
"type": "integer"
},
"default_ttl": {
"title": "Default Ttl",
"type": "integer"
},
"name": {
"title": "Name",
"type": "string"
}
},
"required": [
"created_at",
"updated_at",
"id",
"nameservers",
"updated",
"primary_ns",
"email",
"serialno",
"serialno_updated_at",
"refresh",
"retry",
"expire",
"soa_ttl",
"default_ttl",
"name"
],
"title": "ForwardZone",
"type": "object"
}
Fields:
-
created_at(datetime) -
updated_at(datetime) -
id(int) -
nameservers(list[NameServer]) -
updated(bool) -
primary_ns(str) -
email(str) -
serialno(int) -
serialno_updated_at(datetime) -
refresh(int) -
retry(int) -
expire(int) -
soa_ttl(int) -
default_ttl(int) -
name(str)
__setattr__
¶
Raise an exception when trying to set an attribute.
ForwardZoneDelegation
pydantic-model
¶
Bases: _Delegation
A forward zone delegation.
Show JSON schema:
{
"$defs": {
"NameServer": {
"description": "Model for representing a nameserver within a DNS zone.",
"properties": {
"created_at": {
"format": "date-time",
"title": "Created At",
"type": "string"
},
"updated_at": {
"format": "date-time",
"title": "Updated At",
"type": "string"
},
"id": {
"title": "Id",
"type": "integer"
},
"name": {
"title": "Name",
"type": "string"
},
"ttl": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"title": "Ttl"
}
},
"required": [
"created_at",
"updated_at",
"id",
"name",
"ttl"
],
"title": "NameServer",
"type": "object"
}
},
"description": "A forward zone delegation.",
"properties": {
"created_at": {
"format": "date-time",
"title": "Created At",
"type": "string"
},
"updated_at": {
"format": "date-time",
"title": "Updated At",
"type": "string"
},
"id": {
"title": "Id",
"type": "integer"
},
"nameservers": {
"items": {
"$ref": "#/$defs/NameServer"
},
"title": "Nameservers",
"type": "array"
},
"name": {
"title": "Name",
"type": "string"
},
"comment": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Comment"
},
"zone": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"title": "Zone"
}
},
"required": [
"created_at",
"updated_at",
"id",
"nameservers",
"name"
],
"title": "ForwardZoneDelegation",
"type": "object"
}
Fields:
-
created_at(datetime) -
updated_at(datetime) -
id(int) -
nameservers(list[NameServer]) -
name(str) -
comment(str | None) -
zone(int | None)
__setattr__
¶
Raise an exception when trying to set an attribute.
HInfo
pydantic-model
¶
Bases: MregModelWithTimestamps
Represents a HINFO record.
Show JSON schema:
{
"description": "Represents a HINFO record.",
"properties": {
"created_at": {
"format": "date-time",
"title": "Created At",
"type": "string"
},
"updated_at": {
"format": "date-time",
"title": "Updated At",
"type": "string"
},
"cpu": {
"title": "Cpu",
"type": "string"
},
"os": {
"title": "Os",
"type": "string"
},
"host": {
"title": "Host",
"type": "integer"
}
},
"required": [
"created_at",
"updated_at",
"cpu",
"os",
"host"
],
"title": "HInfo",
"type": "object"
}
Fields:
HealthInfo
pydantic-model
¶
Bases: BaseModel
Combined information from all health endpoints.
Show JSON schema:
{
"$defs": {
"HeartbeatHealth": {
"description": "Model for heartbeat health endpoint.",
"properties": {
"uptime": {
"title": "Uptime",
"type": "integer"
},
"start_time": {
"title": "Start Time",
"type": "integer"
}
},
"required": [
"uptime",
"start_time"
],
"title": "HeartbeatHealth",
"type": "object"
},
"LDAPHealth": {
"description": "Model for LDAP health endpoint.",
"properties": {
"status": {
"enum": [
"OK",
"Down",
"Unknown"
],
"title": "Status",
"type": "string"
}
},
"required": [
"status"
],
"title": "LDAPHealth",
"type": "object"
}
},
"description": "Combined information from all health endpoints.",
"properties": {
"heartbeat": {
"$ref": "#/$defs/HeartbeatHealth"
},
"ldap": {
"$ref": "#/$defs/LDAPHealth"
}
},
"required": [
"heartbeat",
"ldap"
],
"title": "HealthInfo",
"type": "object"
}
Fields:
-
heartbeat(HeartbeatHealth) -
ldap(LDAPHealth)
HeartbeatHealth
pydantic-model
¶
Host
pydantic-model
¶
Bases: MregModelWithTimestamps
Model for an individual host.
Show JSON schema:
{
"$defs": {
"CNAME": {
"description": "Represents a CNAME record.",
"properties": {
"created_at": {
"format": "date-time",
"title": "Created At",
"type": "string"
},
"updated_at": {
"format": "date-time",
"title": "Updated At",
"type": "string"
},
"id": {
"title": "Id",
"type": "integer"
},
"name": {
"title": "Name",
"type": "string"
},
"host": {
"title": "Host",
"type": "integer"
},
"ttl": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"title": "Ttl"
},
"zone": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"title": "Zone"
}
},
"required": [
"created_at",
"updated_at",
"id",
"name",
"host"
],
"title": "CNAME",
"type": "object"
},
"Community": {
"description": "Network community.",
"properties": {
"created_at": {
"format": "date-time",
"title": "Created At",
"type": "string"
},
"updated_at": {
"format": "date-time",
"title": "Updated At",
"type": "string"
},
"id": {
"title": "Id",
"type": "integer"
},
"name": {
"title": "Name",
"type": "string"
},
"description": {
"title": "Description",
"type": "string"
},
"network": {
"title": "Network",
"type": "integer"
},
"hosts": {
"default": [],
"items": {
"type": "string"
},
"title": "Hosts",
"type": "array"
},
"global_name": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Global Name"
}
},
"required": [
"created_at",
"updated_at",
"id",
"name",
"description",
"network"
],
"title": "Community",
"type": "object"
},
"ContactEmail": {
"description": "Model for a host's contact email.",
"properties": {
"created_at": {
"format": "date-time",
"title": "Created At",
"type": "string"
},
"updated_at": {
"format": "date-time",
"title": "Updated At",
"type": "string"
},
"id": {
"title": "Id",
"type": "integer"
},
"email": {
"title": "Email",
"type": "string"
}
},
"required": [
"created_at",
"updated_at",
"id",
"email"
],
"title": "ContactEmail",
"type": "object"
},
"HInfo": {
"description": "Represents a HINFO record.",
"properties": {
"created_at": {
"format": "date-time",
"title": "Created At",
"type": "string"
},
"updated_at": {
"format": "date-time",
"title": "Updated At",
"type": "string"
},
"cpu": {
"title": "Cpu",
"type": "string"
},
"os": {
"title": "Os",
"type": "string"
},
"host": {
"title": "Host",
"type": "integer"
}
},
"required": [
"created_at",
"updated_at",
"cpu",
"os",
"host"
],
"title": "HInfo",
"type": "object"
},
"HostCommunity": {
"description": "Model for a host's community.\n\nCommunities are associated with hosts via IP addresses.",
"properties": {
"ipaddress": {
"title": "Ipaddress",
"type": "integer"
},
"community": {
"$ref": "#/$defs/Community"
}
},
"required": [
"ipaddress",
"community"
],
"title": "HostCommunity",
"type": "object"
},
"IPAddress": {
"description": "Represents an IP address with associated details.",
"properties": {
"created_at": {
"format": "date-time",
"title": "Created At",
"type": "string"
},
"updated_at": {
"format": "date-time",
"title": "Updated At",
"type": "string"
},
"id": {
"title": "Id",
"type": "integer"
},
"macaddress": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Macaddress"
},
"ipaddress": {
"anyOf": [
{
"format": "ipv4",
"type": "string"
},
{
"format": "ipv6",
"type": "string"
}
],
"title": "Ipaddress"
},
"host": {
"title": "Host",
"type": "integer"
}
},
"required": [
"created_at",
"updated_at",
"id",
"ipaddress",
"host"
],
"title": "IPAddress",
"type": "object"
},
"Location": {
"description": "Represents a LOC record.",
"properties": {
"created_at": {
"format": "date-time",
"title": "Created At",
"type": "string"
},
"updated_at": {
"format": "date-time",
"title": "Updated At",
"type": "string"
},
"loc": {
"title": "Loc",
"type": "string"
},
"host": {
"title": "Host",
"type": "integer"
}
},
"required": [
"created_at",
"updated_at",
"loc",
"host"
],
"title": "Location",
"type": "object"
},
"MX": {
"description": "Represents a MX record.",
"properties": {
"created_at": {
"format": "date-time",
"title": "Created At",
"type": "string"
},
"updated_at": {
"format": "date-time",
"title": "Updated At",
"type": "string"
},
"id": {
"title": "Id",
"type": "integer"
},
"mx": {
"title": "Mx",
"type": "string"
},
"priority": {
"title": "Priority",
"type": "integer"
},
"host": {
"title": "Host",
"type": "integer"
}
},
"required": [
"created_at",
"updated_at",
"id",
"mx",
"priority",
"host"
],
"title": "MX",
"type": "object"
},
"NAPTR": {
"description": "Represents a NAPTR record.",
"properties": {
"created_at": {
"format": "date-time",
"title": "Created At",
"type": "string"
},
"updated_at": {
"format": "date-time",
"title": "Updated At",
"type": "string"
},
"id": {
"title": "Id",
"type": "integer"
},
"preference": {
"title": "Preference",
"type": "integer"
},
"order": {
"title": "Order",
"type": "integer"
},
"flag": {
"default": "",
"title": "Flag",
"type": "string"
},
"service": {
"default": "",
"title": "Service",
"type": "string"
},
"regex": {
"default": "",
"title": "Regex",
"type": "string"
},
"replacement": {
"title": "Replacement",
"type": "string"
},
"host": {
"title": "Host",
"type": "integer"
}
},
"required": [
"created_at",
"updated_at",
"id",
"preference",
"order",
"replacement",
"host"
],
"title": "NAPTR",
"type": "object"
},
"PTR_override": {
"description": "Represents a PTR override record.",
"properties": {
"created_at": {
"format": "date-time",
"title": "Created At",
"type": "string"
},
"updated_at": {
"format": "date-time",
"title": "Updated At",
"type": "string"
},
"id": {
"title": "Id",
"type": "integer"
},
"ipaddress": {
"anyOf": [
{
"format": "ipv4",
"type": "string"
},
{
"format": "ipv6",
"type": "string"
}
],
"title": "Ipaddress"
},
"host": {
"title": "Host",
"type": "integer"
}
},
"required": [
"created_at",
"updated_at",
"id",
"ipaddress",
"host"
],
"title": "PTR_override",
"type": "object"
},
"SSHFP": {
"description": "Represents a SSHFP record.",
"properties": {
"created_at": {
"format": "date-time",
"title": "Created At",
"type": "string"
},
"updated_at": {
"format": "date-time",
"title": "Updated At",
"type": "string"
},
"id": {
"title": "Id",
"type": "integer"
},
"algorithm": {
"title": "Algorithm",
"type": "integer"
},
"hash_type": {
"title": "Hash Type",
"type": "integer"
},
"fingerprint": {
"title": "Fingerprint",
"type": "string"
},
"host": {
"title": "Host",
"type": "integer"
},
"ttl": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"title": "Ttl"
}
},
"required": [
"created_at",
"updated_at",
"id",
"algorithm",
"hash_type",
"fingerprint",
"host"
],
"title": "SSHFP",
"type": "object"
},
"Srv": {
"description": "Represents a SRV record.",
"properties": {
"created_at": {
"format": "date-time",
"title": "Created At",
"type": "string"
},
"updated_at": {
"format": "date-time",
"title": "Updated At",
"type": "string"
},
"id": {
"title": "Id",
"type": "integer"
},
"name": {
"title": "Name",
"type": "string"
},
"priority": {
"title": "Priority",
"type": "integer"
},
"weight": {
"title": "Weight",
"type": "integer"
},
"port": {
"title": "Port",
"type": "integer"
},
"host": {
"title": "Host",
"type": "integer"
},
"ttl": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"title": "Ttl"
},
"zone": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"title": "Zone"
}
},
"required": [
"created_at",
"updated_at",
"id",
"name",
"priority",
"weight",
"port",
"host"
],
"title": "Srv",
"type": "object"
},
"TXT": {
"description": "Represents a TXT record.",
"properties": {
"created_at": {
"format": "date-time",
"title": "Created At",
"type": "string"
},
"updated_at": {
"format": "date-time",
"title": "Updated At",
"type": "string"
},
"id": {
"title": "Id",
"type": "integer"
},
"txt": {
"title": "Txt",
"type": "string"
},
"host": {
"title": "Host",
"type": "integer"
}
},
"required": [
"created_at",
"updated_at",
"id",
"txt",
"host"
],
"title": "TXT",
"type": "object"
}
},
"description": "Model for an individual host.",
"properties": {
"created_at": {
"format": "date-time",
"title": "Created At",
"type": "string"
},
"updated_at": {
"format": "date-time",
"title": "Updated At",
"type": "string"
},
"id": {
"title": "Id",
"type": "integer"
},
"name": {
"title": "Name",
"type": "string"
},
"ipaddresses": {
"items": {
"$ref": "#/$defs/IPAddress"
},
"title": "Ipaddresses",
"type": "array"
},
"cnames": {
"default": [],
"items": {
"$ref": "#/$defs/CNAME"
},
"title": "Cnames",
"type": "array"
},
"mxs": {
"default": [],
"items": {
"$ref": "#/$defs/MX"
},
"title": "Mxs",
"type": "array"
},
"txts": {
"default": [],
"items": {
"$ref": "#/$defs/TXT"
},
"title": "Txts",
"type": "array"
},
"ptr_overrides": {
"default": [],
"items": {
"$ref": "#/$defs/PTR_override"
},
"title": "Ptr Overrides",
"type": "array"
},
"hinfo": {
"anyOf": [
{
"$ref": "#/$defs/HInfo"
},
{
"type": "null"
}
],
"default": null
},
"loc": {
"anyOf": [
{
"$ref": "#/$defs/Location"
},
{
"type": "null"
}
],
"default": null
},
"bacnetid": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"title": "Bacnetid"
},
"ttl": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"title": "Ttl"
},
"srvs": {
"default": [],
"items": {
"$ref": "#/$defs/Srv"
},
"title": "Srvs",
"type": "array"
},
"naptrs": {
"default": [],
"items": {
"$ref": "#/$defs/NAPTR"
},
"title": "Naptrs",
"type": "array"
},
"sshfps": {
"default": [],
"items": {
"$ref": "#/$defs/SSHFP"
},
"title": "Sshfps",
"type": "array"
},
"roles": {
"default": [],
"items": {
"type": "string"
},
"title": "Roles",
"type": "array"
},
"hostgroups": {
"default": [],
"items": {
"type": "string"
},
"title": "Hostgroups",
"type": "array"
},
"comment": {
"title": "Comment",
"type": "string"
},
"contacts": {
"default": [],
"items": {
"$ref": "#/$defs/ContactEmail"
},
"title": "Contacts",
"type": "array"
},
"contact": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"deprecated": true,
"title": "Contact"
},
"zone": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"title": "Zone"
},
"communities": {
"default": [],
"items": {
"$ref": "#/$defs/HostCommunity"
},
"title": "Communities",
"type": "array"
}
},
"required": [
"created_at",
"updated_at",
"id",
"name",
"ipaddresses",
"comment"
],
"title": "Host",
"type": "object"
}
Fields:
-
created_at(datetime) -
updated_at(datetime) -
id(int) -
name(HostNameField) -
ipaddresses(list[IPAddress]) -
cnames(list[CNAME]) -
mxs(list[MX]) -
txts(list[TXT]) -
ptr_overrides(list[PTR_override]) -
hinfo(HInfo | None) -
loc(Location | None) -
bacnetid(int | None) -
ttl(int | None) -
srvs(list[Srv]) -
naptrs(list[NAPTR]) -
sshfps(list[SSHFP]) -
roles(list[str]) -
hostgroups(list[str]) -
comment(str) -
contacts(list[ContactEmail]) -
contact(str | None) -
zone(int | None) -
communities(list[HostCommunity])
Validators:
-
_set_deprecated_contact_field -
_validate_none_communities_as_empty_list→communities -
convert_bacnetid→bacnetid
__setattr__
¶
Raise an exception when trying to set an attribute.
convert_bacnetid
pydantic-validator
¶
Use nested ID value in bacnetid value.
get_community
¶
Get a community by name, optionally filtered by IP address.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name of the community to search for. |
required |
ip
|
IPAddress | None
|
If given, only match communities associated with this IP. |
None
|
Returns:
| Type | Description |
|---|---|
Community | None
|
The community if found, None otherwise. |
get_community_associations
¶
Get all IPAddress->Community associations for a given community name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name of the community to search for. |
required |
Returns:
| Type | Description |
|---|---|
list[tuple[Community, IPAddress]]
|
A list of tuples of (Community, IPAddress) for all associations with the given name |
get_ip
¶
get_ip(arg_ip: IP_AddressT) -> IPAddress | None
Get the IP address object for the given IP address.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
arg_ip
|
IP_AddressT
|
IP address to search for |
required |
Returns:
| Type | Description |
|---|---|
IPAddress | None
|
IPAddress | None: IP address object if found, None otherwise |
get_ip_by_id
¶
Get the IP address object for the given ID.
get_ip_by_mac
¶
get_ip_by_mac(arg_mac: MacAddress) -> IPAddress | None
Return the IPAddress with the given MAC, or None if not found.
get_ptr_override
¶
get_ptr_override(ip: IP_AddressT) -> PTR_override | None
Get the PTR override for the given IP address.
has_ip_with_mac
¶
has_ip_with_mac(arg_mac: MacAddress) -> IPAddress | None
Return the IPAddress with the given MAC, or None if not found.
has_mx_with_priority
¶
Return the MX record matching mx and priority, or None.
has_ptr_override
¶
has_ptr_override(arg_ip: IP_AddressT) -> bool
Return True if the host has a PTR override for the given IP.
ips_with_macaddresses
¶
Return all IP addresses that have a MAC address set.
HostCommunity
pydantic-model
¶
Bases: MregModel
Model for a host's community.
Communities are associated with hosts via IP addresses.
Show JSON schema:
{
"$defs": {
"Community": {
"description": "Network community.",
"properties": {
"created_at": {
"format": "date-time",
"title": "Created At",
"type": "string"
},
"updated_at": {
"format": "date-time",
"title": "Updated At",
"type": "string"
},
"id": {
"title": "Id",
"type": "integer"
},
"name": {
"title": "Name",
"type": "string"
},
"description": {
"title": "Description",
"type": "string"
},
"network": {
"title": "Network",
"type": "integer"
},
"hosts": {
"default": [],
"items": {
"type": "string"
},
"title": "Hosts",
"type": "array"
},
"global_name": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Global Name"
}
},
"required": [
"created_at",
"updated_at",
"id",
"name",
"description",
"network"
],
"title": "Community",
"type": "object"
}
},
"description": "Model for a host's community.\n\nCommunities are associated with hosts via IP addresses.",
"properties": {
"ipaddress": {
"title": "Ipaddress",
"type": "integer"
},
"community": {
"$ref": "#/$defs/Community"
}
},
"required": [
"ipaddress",
"community"
],
"title": "HostCommunity",
"type": "object"
}
Fields:
HostContactModification
pydantic-model
¶
Bases: MregModel
Model for host contact email modifications.
Show JSON schema:
{
"description": "Model for host contact email modifications.",
"properties": {
"added": {
"items": {
"type": "string"
},
"title": "Added",
"type": "array"
},
"already_exists": {
"items": {
"type": "string"
},
"title": "Already Exists",
"type": "array"
},
"removed": {
"items": {
"type": "string"
},
"title": "Removed",
"type": "array"
},
"not_found": {
"items": {
"type": "string"
},
"title": "Not Found",
"type": "array"
}
},
"title": "HostContactModification",
"type": "object"
}
Fields:
HostGroup
pydantic-model
¶
Bases: MregModelWithTimestamps
Model for a hostgroup.
Show JSON schema:
{
"description": "Model for a hostgroup.",
"properties": {
"created_at": {
"format": "date-time",
"title": "Created At",
"type": "string"
},
"updated_at": {
"format": "date-time",
"title": "Updated At",
"type": "string"
},
"id": {
"title": "Id",
"type": "integer"
},
"name": {
"title": "Name",
"type": "string"
},
"description": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Description"
},
"parent": {
"items": {
"type": "string"
},
"title": "Parent",
"type": "array"
},
"groups": {
"items": {
"type": "string"
},
"title": "Groups",
"type": "array"
},
"hosts": {
"items": {
"type": "string"
},
"title": "Hosts",
"type": "array"
},
"owners": {
"items": {
"type": "string"
},
"title": "Owners",
"type": "array"
}
},
"required": [
"created_at",
"updated_at",
"id",
"name",
"parent",
"groups",
"hosts",
"owners"
],
"title": "HostGroup",
"type": "object"
}
Fields:
HostList
pydantic-model
¶
Bases: MregModel
Model for a list of hosts.
Show JSON schema:
{
"$defs": {
"CNAME": {
"description": "Represents a CNAME record.",
"properties": {
"created_at": {
"format": "date-time",
"title": "Created At",
"type": "string"
},
"updated_at": {
"format": "date-time",
"title": "Updated At",
"type": "string"
},
"id": {
"title": "Id",
"type": "integer"
},
"name": {
"title": "Name",
"type": "string"
},
"host": {
"title": "Host",
"type": "integer"
},
"ttl": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"title": "Ttl"
},
"zone": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"title": "Zone"
}
},
"required": [
"created_at",
"updated_at",
"id",
"name",
"host"
],
"title": "CNAME",
"type": "object"
},
"Community": {
"description": "Network community.",
"properties": {
"created_at": {
"format": "date-time",
"title": "Created At",
"type": "string"
},
"updated_at": {
"format": "date-time",
"title": "Updated At",
"type": "string"
},
"id": {
"title": "Id",
"type": "integer"
},
"name": {
"title": "Name",
"type": "string"
},
"description": {
"title": "Description",
"type": "string"
},
"network": {
"title": "Network",
"type": "integer"
},
"hosts": {
"default": [],
"items": {
"type": "string"
},
"title": "Hosts",
"type": "array"
},
"global_name": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Global Name"
}
},
"required": [
"created_at",
"updated_at",
"id",
"name",
"description",
"network"
],
"title": "Community",
"type": "object"
},
"ContactEmail": {
"description": "Model for a host's contact email.",
"properties": {
"created_at": {
"format": "date-time",
"title": "Created At",
"type": "string"
},
"updated_at": {
"format": "date-time",
"title": "Updated At",
"type": "string"
},
"id": {
"title": "Id",
"type": "integer"
},
"email": {
"title": "Email",
"type": "string"
}
},
"required": [
"created_at",
"updated_at",
"id",
"email"
],
"title": "ContactEmail",
"type": "object"
},
"HInfo": {
"description": "Represents a HINFO record.",
"properties": {
"created_at": {
"format": "date-time",
"title": "Created At",
"type": "string"
},
"updated_at": {
"format": "date-time",
"title": "Updated At",
"type": "string"
},
"cpu": {
"title": "Cpu",
"type": "string"
},
"os": {
"title": "Os",
"type": "string"
},
"host": {
"title": "Host",
"type": "integer"
}
},
"required": [
"created_at",
"updated_at",
"cpu",
"os",
"host"
],
"title": "HInfo",
"type": "object"
},
"Host": {
"description": "Model for an individual host.",
"properties": {
"created_at": {
"format": "date-time",
"title": "Created At",
"type": "string"
},
"updated_at": {
"format": "date-time",
"title": "Updated At",
"type": "string"
},
"id": {
"title": "Id",
"type": "integer"
},
"name": {
"title": "Name",
"type": "string"
},
"ipaddresses": {
"items": {
"$ref": "#/$defs/IPAddress"
},
"title": "Ipaddresses",
"type": "array"
},
"cnames": {
"default": [],
"items": {
"$ref": "#/$defs/CNAME"
},
"title": "Cnames",
"type": "array"
},
"mxs": {
"default": [],
"items": {
"$ref": "#/$defs/MX"
},
"title": "Mxs",
"type": "array"
},
"txts": {
"default": [],
"items": {
"$ref": "#/$defs/TXT"
},
"title": "Txts",
"type": "array"
},
"ptr_overrides": {
"default": [],
"items": {
"$ref": "#/$defs/PTR_override"
},
"title": "Ptr Overrides",
"type": "array"
},
"hinfo": {
"anyOf": [
{
"$ref": "#/$defs/HInfo"
},
{
"type": "null"
}
],
"default": null
},
"loc": {
"anyOf": [
{
"$ref": "#/$defs/Location"
},
{
"type": "null"
}
],
"default": null
},
"bacnetid": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"title": "Bacnetid"
},
"ttl": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"title": "Ttl"
},
"srvs": {
"default": [],
"items": {
"$ref": "#/$defs/Srv"
},
"title": "Srvs",
"type": "array"
},
"naptrs": {
"default": [],
"items": {
"$ref": "#/$defs/NAPTR"
},
"title": "Naptrs",
"type": "array"
},
"sshfps": {
"default": [],
"items": {
"$ref": "#/$defs/SSHFP"
},
"title": "Sshfps",
"type": "array"
},
"roles": {
"default": [],
"items": {
"type": "string"
},
"title": "Roles",
"type": "array"
},
"hostgroups": {
"default": [],
"items": {
"type": "string"
},
"title": "Hostgroups",
"type": "array"
},
"comment": {
"title": "Comment",
"type": "string"
},
"contacts": {
"default": [],
"items": {
"$ref": "#/$defs/ContactEmail"
},
"title": "Contacts",
"type": "array"
},
"contact": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"deprecated": true,
"title": "Contact"
},
"zone": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"title": "Zone"
},
"communities": {
"default": [],
"items": {
"$ref": "#/$defs/HostCommunity"
},
"title": "Communities",
"type": "array"
}
},
"required": [
"created_at",
"updated_at",
"id",
"name",
"ipaddresses",
"comment"
],
"title": "Host",
"type": "object"
},
"HostCommunity": {
"description": "Model for a host's community.\n\nCommunities are associated with hosts via IP addresses.",
"properties": {
"ipaddress": {
"title": "Ipaddress",
"type": "integer"
},
"community": {
"$ref": "#/$defs/Community"
}
},
"required": [
"ipaddress",
"community"
],
"title": "HostCommunity",
"type": "object"
},
"IPAddress": {
"description": "Represents an IP address with associated details.",
"properties": {
"created_at": {
"format": "date-time",
"title": "Created At",
"type": "string"
},
"updated_at": {
"format": "date-time",
"title": "Updated At",
"type": "string"
},
"id": {
"title": "Id",
"type": "integer"
},
"macaddress": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Macaddress"
},
"ipaddress": {
"anyOf": [
{
"format": "ipv4",
"type": "string"
},
{
"format": "ipv6",
"type": "string"
}
],
"title": "Ipaddress"
},
"host": {
"title": "Host",
"type": "integer"
}
},
"required": [
"created_at",
"updated_at",
"id",
"ipaddress",
"host"
],
"title": "IPAddress",
"type": "object"
},
"Location": {
"description": "Represents a LOC record.",
"properties": {
"created_at": {
"format": "date-time",
"title": "Created At",
"type": "string"
},
"updated_at": {
"format": "date-time",
"title": "Updated At",
"type": "string"
},
"loc": {
"title": "Loc",
"type": "string"
},
"host": {
"title": "Host",
"type": "integer"
}
},
"required": [
"created_at",
"updated_at",
"loc",
"host"
],
"title": "Location",
"type": "object"
},
"MX": {
"description": "Represents a MX record.",
"properties": {
"created_at": {
"format": "date-time",
"title": "Created At",
"type": "string"
},
"updated_at": {
"format": "date-time",
"title": "Updated At",
"type": "string"
},
"id": {
"title": "Id",
"type": "integer"
},
"mx": {
"title": "Mx",
"type": "string"
},
"priority": {
"title": "Priority",
"type": "integer"
},
"host": {
"title": "Host",
"type": "integer"
}
},
"required": [
"created_at",
"updated_at",
"id",
"mx",
"priority",
"host"
],
"title": "MX",
"type": "object"
},
"NAPTR": {
"description": "Represents a NAPTR record.",
"properties": {
"created_at": {
"format": "date-time",
"title": "Created At",
"type": "string"
},
"updated_at": {
"format": "date-time",
"title": "Updated At",
"type": "string"
},
"id": {
"title": "Id",
"type": "integer"
},
"preference": {
"title": "Preference",
"type": "integer"
},
"order": {
"title": "Order",
"type": "integer"
},
"flag": {
"default": "",
"title": "Flag",
"type": "string"
},
"service": {
"default": "",
"title": "Service",
"type": "string"
},
"regex": {
"default": "",
"title": "Regex",
"type": "string"
},
"replacement": {
"title": "Replacement",
"type": "string"
},
"host": {
"title": "Host",
"type": "integer"
}
},
"required": [
"created_at",
"updated_at",
"id",
"preference",
"order",
"replacement",
"host"
],
"title": "NAPTR",
"type": "object"
},
"PTR_override": {
"description": "Represents a PTR override record.",
"properties": {
"created_at": {
"format": "date-time",
"title": "Created At",
"type": "string"
},
"updated_at": {
"format": "date-time",
"title": "Updated At",
"type": "string"
},
"id": {
"title": "Id",
"type": "integer"
},
"ipaddress": {
"anyOf": [
{
"format": "ipv4",
"type": "string"
},
{
"format": "ipv6",
"type": "string"
}
],
"title": "Ipaddress"
},
"host": {
"title": "Host",
"type": "integer"
}
},
"required": [
"created_at",
"updated_at",
"id",
"ipaddress",
"host"
],
"title": "PTR_override",
"type": "object"
},
"SSHFP": {
"description": "Represents a SSHFP record.",
"properties": {
"created_at": {
"format": "date-time",
"title": "Created At",
"type": "string"
},
"updated_at": {
"format": "date-time",
"title": "Updated At",
"type": "string"
},
"id": {
"title": "Id",
"type": "integer"
},
"algorithm": {
"title": "Algorithm",
"type": "integer"
},
"hash_type": {
"title": "Hash Type",
"type": "integer"
},
"fingerprint": {
"title": "Fingerprint",
"type": "string"
},
"host": {
"title": "Host",
"type": "integer"
},
"ttl": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"title": "Ttl"
}
},
"required": [
"created_at",
"updated_at",
"id",
"algorithm",
"hash_type",
"fingerprint",
"host"
],
"title": "SSHFP",
"type": "object"
},
"Srv": {
"description": "Represents a SRV record.",
"properties": {
"created_at": {
"format": "date-time",
"title": "Created At",
"type": "string"
},
"updated_at": {
"format": "date-time",
"title": "Updated At",
"type": "string"
},
"id": {
"title": "Id",
"type": "integer"
},
"name": {
"title": "Name",
"type": "string"
},
"priority": {
"title": "Priority",
"type": "integer"
},
"weight": {
"title": "Weight",
"type": "integer"
},
"port": {
"title": "Port",
"type": "integer"
},
"host": {
"title": "Host",
"type": "integer"
},
"ttl": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"title": "Ttl"
},
"zone": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"title": "Zone"
}
},
"required": [
"created_at",
"updated_at",
"id",
"name",
"priority",
"weight",
"port",
"host"
],
"title": "Srv",
"type": "object"
},
"TXT": {
"description": "Represents a TXT record.",
"properties": {
"created_at": {
"format": "date-time",
"title": "Created At",
"type": "string"
},
"updated_at": {
"format": "date-time",
"title": "Updated At",
"type": "string"
},
"id": {
"title": "Id",
"type": "integer"
},
"txt": {
"title": "Txt",
"type": "string"
},
"host": {
"title": "Host",
"type": "integer"
}
},
"required": [
"created_at",
"updated_at",
"id",
"txt",
"host"
],
"title": "TXT",
"type": "object"
}
},
"description": "Model for a list of hosts.",
"properties": {
"results": {
"items": {
"$ref": "#/$defs/Host"
},
"title": "Results",
"type": "array"
}
},
"required": [
"results"
],
"title": "HostList",
"type": "object"
}
Fields:
__setattr__
¶
Raise an exception when trying to set an attribute.
HostPolicy
pydantic-model
¶
Base model for Host Policy objects.
Note
Host policy models in MREG have a different created_at field than
other models. It is called create_date and is a date - not a datetime.
This model has a custom validator to validate and convert the create_date
field to a datetime object with the expected created_at name.
Show JSON schema:
{
"description": "Base model for Host Policy objects.\n\nNote:\n Host policy models in MREG have a different `created_at` field than\n other models. It is called `create_date` and is a date - not a datetime.\n\n This model has a custom validator to validate and convert the `create_date`\n field to a datetime object with the expected `created_at` name.",
"properties": {
"create_date": {
"format": "date-time",
"title": "Create Date",
"type": "string"
},
"updated_at": {
"format": "date-time",
"title": "Updated At",
"type": "string"
},
"name": {
"title": "Name",
"type": "string"
},
"description": {
"title": "Description",
"type": "string"
}
},
"required": [
"create_date",
"updated_at",
"name",
"description"
],
"title": "HostPolicy",
"type": "object"
}
Fields:
-
created_at_tz_naive(datetime) -
updated_at(datetime) -
name(str) -
description(str)
Validators:
created_at_tz_naive
pydantic-field
¶
created_at_tz_naive: datetime
Constructed datetime field from create_date in the API.
WARNING¶
DO NOT USE THIS FIELD FOR TIMEZONE-AWARE COMPARISONS!
Always use created_at instead when comparing with timezone-aware
fields such as update_time.
__setattr__
¶
Raise an exception when trying to set an attribute.
validate_created_at
pydantic-validator
¶
IPAddress
pydantic-model
¶
Bases: MregModelWithTimestamps
Represents an IP address with associated details.
Show JSON schema:
{
"description": "Represents an IP address with associated details.",
"properties": {
"created_at": {
"format": "date-time",
"title": "Created At",
"type": "string"
},
"updated_at": {
"format": "date-time",
"title": "Updated At",
"type": "string"
},
"id": {
"title": "Id",
"type": "integer"
},
"macaddress": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Macaddress"
},
"ipaddress": {
"anyOf": [
{
"format": "ipv4",
"type": "string"
},
{
"format": "ipv6",
"type": "string"
}
],
"title": "Ipaddress"
},
"host": {
"title": "Host",
"type": "integer"
}
},
"required": [
"created_at",
"updated_at",
"id",
"ipaddress",
"host"
],
"title": "IPAddress",
"type": "object"
}
Fields:
-
created_at(datetime) -
updated_at(datetime) -
id(int) -
macaddress(MacAddress | None) -
ipaddress(IP_AddressT) -
host(int)
Validators:
-
create_valid_macadress_or_none→macaddress
__setattr__
¶
Raise an exception when trying to set an attribute.
create_valid_macadress_or_none
pydantic-validator
¶
create_valid_macadress_or_none(v: Any) -> MacAddress | None
Create macaddress or convert empty strings to None.
The API can return an empty string for this field, which fails to validate as a MAC address. Therefore, treat empty strings as None.
LDAPHealth
pydantic-model
¶
Label
pydantic-model
¶
Bases: MregModelWithTimestamps
Model for a label.
Show JSON schema:
{
"description": "Model for a label.",
"properties": {
"created_at": {
"format": "date-time",
"title": "Created At",
"type": "string"
},
"updated_at": {
"format": "date-time",
"title": "Updated At",
"type": "string"
},
"id": {
"title": "Id",
"type": "integer"
},
"name": {
"title": "Name",
"type": "string"
},
"description": {
"title": "Description",
"type": "string"
}
},
"required": [
"created_at",
"updated_at",
"id",
"name",
"description"
],
"title": "Label",
"type": "object"
}
Fields:
Location
pydantic-model
¶
Bases: MregModelWithTimestamps
Represents a LOC record.
Show JSON schema:
{
"description": "Represents a LOC record.",
"properties": {
"created_at": {
"format": "date-time",
"title": "Created At",
"type": "string"
},
"updated_at": {
"format": "date-time",
"title": "Updated At",
"type": "string"
},
"loc": {
"title": "Loc",
"type": "string"
},
"host": {
"title": "Host",
"type": "integer"
}
},
"required": [
"created_at",
"updated_at",
"loc",
"host"
],
"title": "Location",
"type": "object"
}
Fields:
MX
pydantic-model
¶
Bases: MregModelWithTimestamps
Represents a MX record.
Show JSON schema:
{
"description": "Represents a MX record.",
"properties": {
"created_at": {
"format": "date-time",
"title": "Created At",
"type": "string"
},
"updated_at": {
"format": "date-time",
"title": "Updated At",
"type": "string"
},
"id": {
"title": "Id",
"type": "integer"
},
"mx": {
"title": "Mx",
"type": "string"
},
"priority": {
"title": "Priority",
"type": "integer"
},
"host": {
"title": "Host",
"type": "integer"
}
},
"required": [
"created_at",
"updated_at",
"id",
"mx",
"priority",
"host"
],
"title": "MX",
"type": "object"
}
Fields:
NAPTR
pydantic-model
¶
Bases: MregModelWithTimestamps
Represents a NAPTR record.
Show JSON schema:
{
"description": "Represents a NAPTR record.",
"properties": {
"created_at": {
"format": "date-time",
"title": "Created At",
"type": "string"
},
"updated_at": {
"format": "date-time",
"title": "Updated At",
"type": "string"
},
"id": {
"title": "Id",
"type": "integer"
},
"preference": {
"title": "Preference",
"type": "integer"
},
"order": {
"title": "Order",
"type": "integer"
},
"flag": {
"default": "",
"title": "Flag",
"type": "string"
},
"service": {
"default": "",
"title": "Service",
"type": "string"
},
"regex": {
"default": "",
"title": "Regex",
"type": "string"
},
"replacement": {
"title": "Replacement",
"type": "string"
},
"host": {
"title": "Host",
"type": "integer"
}
},
"required": [
"created_at",
"updated_at",
"id",
"preference",
"order",
"replacement",
"host"
],
"title": "NAPTR",
"type": "object"
}
Fields:
NameServer
pydantic-model
¶
Bases: MregModelWithTimestamps
Model for representing a nameserver within a DNS zone.
Show JSON schema:
{
"description": "Model for representing a nameserver within a DNS zone.",
"properties": {
"created_at": {
"format": "date-time",
"title": "Created At",
"type": "string"
},
"updated_at": {
"format": "date-time",
"title": "Updated At",
"type": "string"
},
"id": {
"title": "Id",
"type": "integer"
},
"name": {
"title": "Name",
"type": "string"
},
"ttl": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"title": "Ttl"
}
},
"required": [
"created_at",
"updated_at",
"id",
"name",
"ttl"
],
"title": "NameServer",
"type": "object"
}
Config:
frozen:True
Fields:
Network
pydantic-model
¶
Bases: MregModelWithTimestamps
Model for a network.
Show JSON schema:
{
"$defs": {
"Community": {
"description": "Network community.",
"properties": {
"created_at": {
"format": "date-time",
"title": "Created At",
"type": "string"
},
"updated_at": {
"format": "date-time",
"title": "Updated At",
"type": "string"
},
"id": {
"title": "Id",
"type": "integer"
},
"name": {
"title": "Name",
"type": "string"
},
"description": {
"title": "Description",
"type": "string"
},
"network": {
"title": "Network",
"type": "integer"
},
"hosts": {
"default": [],
"items": {
"type": "string"
},
"title": "Hosts",
"type": "array"
},
"global_name": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Global Name"
}
},
"required": [
"created_at",
"updated_at",
"id",
"name",
"description",
"network"
],
"title": "Community",
"type": "object"
},
"ExcludedRange": {
"description": "Model for an excluded IP range for a network.",
"properties": {
"created_at": {
"format": "date-time",
"title": "Created At",
"type": "string"
},
"updated_at": {
"format": "date-time",
"title": "Updated At",
"type": "string"
},
"id": {
"title": "Id",
"type": "integer"
},
"network": {
"title": "Network",
"type": "integer"
},
"start_ip": {
"anyOf": [
{
"format": "ipv4",
"type": "string"
},
{
"format": "ipv6",
"type": "string"
}
],
"title": "Start Ip"
},
"end_ip": {
"anyOf": [
{
"format": "ipv4",
"type": "string"
},
{
"format": "ipv6",
"type": "string"
}
],
"title": "End Ip"
}
},
"required": [
"created_at",
"updated_at",
"id",
"network",
"start_ip",
"end_ip"
],
"title": "ExcludedRange",
"type": "object"
},
"NetworkPolicy": {
"description": "Network policy used in a community.",
"properties": {
"created_at": {
"format": "date-time",
"title": "Created At",
"type": "string"
},
"updated_at": {
"format": "date-time",
"title": "Updated At",
"type": "string"
},
"id": {
"title": "Id",
"type": "integer"
},
"name": {
"title": "Name",
"type": "string"
},
"description": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Description"
},
"attributes": {
"default": [],
"items": {
"$ref": "#/$defs/NetworkPolicyAttributeValue"
},
"title": "Attributes",
"type": "array"
},
"community_template_pattern": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Community Template Pattern"
}
},
"required": [
"created_at",
"updated_at",
"id",
"name"
],
"title": "NetworkPolicy",
"type": "object"
},
"NetworkPolicyAttributeValue": {
"description": "Name and value of a network policy's attribute.",
"properties": {
"name": {
"title": "Name",
"type": "string"
},
"value": {
"title": "Value",
"type": "boolean"
}
},
"required": [
"name",
"value"
],
"title": "NetworkPolicyAttributeValue",
"type": "object"
}
},
"description": "Model for a network.",
"properties": {
"created_at": {
"format": "date-time",
"title": "Created At",
"type": "string"
},
"updated_at": {
"format": "date-time",
"title": "Updated At",
"type": "string"
},
"id": {
"title": "Id",
"type": "integer"
},
"excluded_ranges": {
"items": {
"$ref": "#/$defs/ExcludedRange"
},
"title": "Excluded Ranges",
"type": "array"
},
"network": {
"title": "Network",
"type": "string"
},
"description": {
"title": "Description",
"type": "string"
},
"vlan": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"title": "Vlan"
},
"dns_delegated": {
"title": "Dns Delegated",
"type": "boolean"
},
"category": {
"title": "Category",
"type": "string"
},
"location": {
"title": "Location",
"type": "string"
},
"frozen": {
"title": "Frozen",
"type": "boolean"
},
"reserved": {
"title": "Reserved",
"type": "integer"
},
"policy": {
"anyOf": [
{
"$ref": "#/$defs/NetworkPolicy"
},
{
"type": "null"
}
],
"default": null
},
"communities": {
"default": [],
"items": {
"$ref": "#/$defs/Community"
},
"title": "Communities",
"type": "array"
},
"max_communities": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"title": "Max Communities"
}
},
"required": [
"created_at",
"updated_at",
"id",
"excluded_ranges",
"network",
"description",
"dns_delegated",
"category",
"location",
"frozen",
"reserved"
],
"title": "Network",
"type": "object"
}
Fields:
-
created_at(datetime) -
updated_at(datetime) -
id(int) -
excluded_ranges(list[ExcludedRange]) -
network(str) -
description(str) -
vlan(int | None) -
dns_delegated(bool) -
category(str) -
location(str) -
frozen(bool) -
reserved(int) -
policy(NetworkPolicy | None) -
communities(list[Community]) -
max_communities(int | None)
__setattr__
¶
Raise an exception when trying to set an attribute.
dummy_network_from_ip
classmethod
¶
Create a Network object for an unknown network given an IP.
NOTE: Does not perform any API calls. This is purely to work around the fact that MREG supports creating IP addresses for networks that are not registered in MREG.
get_communities
¶
get_community
¶
NetworkOrIP
pydantic-model
¶
Bases: BaseModel
A model for either a network or an IP address.
Show JSON schema:
{
"description": "A model for either a network or an IP address.",
"properties": {
"ip_or_network": {
"anyOf": [
{
"format": "ipv4",
"type": "string"
},
{
"format": "ipv6",
"type": "string"
},
{
"format": "ipv4network",
"type": "string"
},
{
"format": "ipv6network",
"type": "string"
}
],
"title": "Ip Or Network"
}
},
"required": [
"ip_or_network"
],
"title": "NetworkOrIP",
"type": "object"
}
Fields:
-
ip_or_network(IP_AddressT | IP_NetworkT)
Validators:
-
validate_ip_or_network→ip_or_network
parse
classmethod
¶
parse(
value: Any, mode: None = None
) -> IP_AddressT | IP_NetworkT | None
parse(
value: Any, mode: Literal["ipv4"]
) -> IPv4Address | None
parse(
value: Any, mode: Literal["ipv6"]
) -> IPv6Address | None
parse(
value: Any, mode: Literal["networkv4"]
) -> IPv4Network | None
parse(
value: Any, mode: Literal["networkv6"]
) -> IPv6Network | None
parse(
value: Any, mode: IPNetMode | None = None
) -> IP_AddressT | IP_NetworkT | None
Parse a value as an IP address or network, or None if parsing fails.
Optionally specify the mode to validate the input as.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
Any
|
The value to parse. |
required |
mode
|
IPNetMode | None
|
The mode to validate the input as. |
None
|
Returns:
| Type | Description |
|---|---|
IP_AddressT | IP_NetworkT | None
|
The parsed value as an IP address or network, or None. |
parse_or_raise
classmethod
¶
parse_or_raise(
value: Any, mode: None = None
) -> IP_AddressT | IP_NetworkT
parse_or_raise(
value: Any, mode: Literal["ipv4"]
) -> IPv4Address
parse_or_raise(
value: Any, mode: Literal["ipv6"]
) -> IPv6Address
parse_or_raise(
value: Any, mode: Literal["networkv4"]
) -> IPv4Network
parse_or_raise(
value: Any, mode: Literal["networkv6"]
) -> IPv6Network
parse_or_raise(
value: Any, mode: IPNetMode | None = None
) -> IP_AddressT | IP_NetworkT
Parse a value as an IP address or network.
Optionally specify the mode to validate the input as.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
Any
|
The value to parse. |
required |
mode
|
IPNetMode | None
|
The mode to validate the input as. |
None
|
Returns:
| Type | Description |
|---|---|
IP_AddressT | IP_NetworkT
|
The parsed value as an IP address or network. |
Raises:
| Type | Description |
|---|---|
IPNetworkError
|
If the value is not an IP address or network. |
validate
classmethod
¶
Create a NetworkOrIP model instance from a value.
This constructor validates and wraps the IP/network in the model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
str | IP_AddressT | IP_NetworkT | Self
|
The value to convert (string or IP object) |
required |
Returns:
| Type | Description |
|---|---|
Self
|
A NetworkOrIP model instance |
Raises:
| Type | Description |
|---|---|
InputFailure
|
If validation fails |
NetworkPolicy
pydantic-model
¶
Bases: MregModelWithTimestamps
Network policy used in a community.
Show JSON schema:
{
"$defs": {
"NetworkPolicyAttributeValue": {
"description": "Name and value of a network policy's attribute.",
"properties": {
"name": {
"title": "Name",
"type": "string"
},
"value": {
"title": "Value",
"type": "boolean"
}
},
"required": [
"name",
"value"
],
"title": "NetworkPolicyAttributeValue",
"type": "object"
}
},
"description": "Network policy used in a community.",
"properties": {
"created_at": {
"format": "date-time",
"title": "Created At",
"type": "string"
},
"updated_at": {
"format": "date-time",
"title": "Updated At",
"type": "string"
},
"id": {
"title": "Id",
"type": "integer"
},
"name": {
"title": "Name",
"type": "string"
},
"description": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Description"
},
"attributes": {
"default": [],
"items": {
"$ref": "#/$defs/NetworkPolicyAttributeValue"
},
"title": "Attributes",
"type": "array"
},
"community_template_pattern": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Community Template Pattern"
}
},
"required": [
"created_at",
"updated_at",
"id",
"name"
],
"title": "NetworkPolicy",
"type": "object"
}
Fields:
-
created_at(datetime) -
updated_at(datetime) -
id(int) -
name(str) -
description(str | None) -
attributes(list[NetworkPolicyAttributeValue]) -
community_template_pattern(str | None)
__setattr__
¶
Raise an exception when trying to set an attribute.
get_attribute
¶
get_attribute(
name: str,
) -> NetworkPolicyAttributeValue | None
Get a attribute by name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name of the attribute to search for. |
required |
Returns:
| Type | Description |
|---|---|
NetworkPolicyAttributeValue | None
|
The attribute if found, None otherwise. |
get_attribute_or_raise
¶
get_attribute_or_raise(
name: str,
) -> NetworkPolicyAttributeValue
Get a network attribute value by name, and raise if not found.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name of the attribute to search for. |
required |
Returns:
| Type | Description |
|---|---|
NetworkPolicyAttributeValue
|
The attribute if found. |
Raises:
| Type | Description |
|---|---|
EntityNotFound
|
If the attribute is not found. |
NetworkPolicyAttribute
pydantic-model
¶
Bases: MregModelWithTimestamps
The definition of a network policy attribute.
See NetworkPolicyAttr for the representation of attributes in Policies.
Show JSON schema:
{
"description": "The definition of a network policy attribute.\n\nSee NetworkPolicyAttr for the representation of attributes in Policies.",
"properties": {
"created_at": {
"format": "date-time",
"title": "Created At",
"type": "string"
},
"updated_at": {
"format": "date-time",
"title": "Updated At",
"type": "string"
},
"id": {
"title": "Id",
"type": "integer"
},
"name": {
"title": "Name",
"type": "string"
},
"description": {
"title": "Description",
"type": "string"
}
},
"required": [
"created_at",
"updated_at",
"id",
"name",
"description"
],
"title": "NetworkPolicyAttribute",
"type": "object"
}
Fields:
NetworkPolicyAttributeValue
pydantic-model
¶
PTR_override
pydantic-model
¶
Bases: MregModelWithTimestamps
Represents a PTR override record.
Show JSON schema:
{
"description": "Represents a PTR override record.",
"properties": {
"created_at": {
"format": "date-time",
"title": "Created At",
"type": "string"
},
"updated_at": {
"format": "date-time",
"title": "Updated At",
"type": "string"
},
"id": {
"title": "Id",
"type": "integer"
},
"ipaddress": {
"anyOf": [
{
"format": "ipv4",
"type": "string"
},
{
"format": "ipv6",
"type": "string"
}
],
"title": "Ipaddress"
},
"host": {
"title": "Host",
"type": "integer"
}
},
"required": [
"created_at",
"updated_at",
"id",
"ipaddress",
"host"
],
"title": "PTR_override",
"type": "object"
}
Fields:
Permission
pydantic-model
¶
Bases: MregModelWithTimestamps
Model for a permission object.
Show JSON schema:
{
"description": "Model for a permission object.",
"properties": {
"created_at": {
"format": "date-time",
"title": "Created At",
"type": "string"
},
"updated_at": {
"format": "date-time",
"title": "Updated At",
"type": "string"
},
"id": {
"title": "Id",
"type": "integer"
},
"group": {
"title": "Group",
"type": "string"
},
"range": {
"anyOf": [
{
"format": "ipv4network",
"type": "string"
},
{
"format": "ipv6network",
"type": "string"
}
],
"title": "Range"
},
"regex": {
"title": "Regex",
"type": "string"
},
"labels": {
"items": {
"type": "integer"
},
"title": "Labels",
"type": "array"
}
},
"required": [
"created_at",
"updated_at",
"id",
"group",
"range",
"regex",
"labels"
],
"title": "Permission",
"type": "object"
}
Fields:
-
created_at(datetime) -
updated_at(datetime) -
id(int) -
group(str) -
range(IP_NetworkT) -
regex(str) -
labels(list[int])
Validators:
-
validate_ip_or_network→range
__setattr__
¶
Raise an exception when trying to set an attribute.
ReverseZone
pydantic-model
¶
Bases: _Zone
A reverse zone.
Show JSON schema:
{
"$defs": {
"NameServer": {
"description": "Model for representing a nameserver within a DNS zone.",
"properties": {
"created_at": {
"format": "date-time",
"title": "Created At",
"type": "string"
},
"updated_at": {
"format": "date-time",
"title": "Updated At",
"type": "string"
},
"id": {
"title": "Id",
"type": "integer"
},
"name": {
"title": "Name",
"type": "string"
},
"ttl": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"title": "Ttl"
}
},
"required": [
"created_at",
"updated_at",
"id",
"name",
"ttl"
],
"title": "NameServer",
"type": "object"
}
},
"description": "A reverse zone.",
"properties": {
"created_at": {
"format": "date-time",
"title": "Created At",
"type": "string"
},
"updated_at": {
"format": "date-time",
"title": "Updated At",
"type": "string"
},
"id": {
"title": "Id",
"type": "integer"
},
"nameservers": {
"items": {
"$ref": "#/$defs/NameServer"
},
"title": "Nameservers",
"type": "array"
},
"updated": {
"title": "Updated",
"type": "boolean"
},
"primary_ns": {
"title": "Primary Ns",
"type": "string"
},
"email": {
"title": "Email",
"type": "string"
},
"serialno": {
"title": "Serialno",
"type": "integer"
},
"serialno_updated_at": {
"format": "date-time",
"title": "Serialno Updated At",
"type": "string"
},
"refresh": {
"title": "Refresh",
"type": "integer"
},
"retry": {
"title": "Retry",
"type": "integer"
},
"expire": {
"title": "Expire",
"type": "integer"
},
"soa_ttl": {
"title": "Soa Ttl",
"type": "integer"
},
"default_ttl": {
"title": "Default Ttl",
"type": "integer"
},
"name": {
"title": "Name",
"type": "string"
}
},
"required": [
"created_at",
"updated_at",
"id",
"nameservers",
"updated",
"primary_ns",
"email",
"serialno",
"serialno_updated_at",
"refresh",
"retry",
"expire",
"soa_ttl",
"default_ttl",
"name"
],
"title": "ReverseZone",
"type": "object"
}
Fields:
-
created_at(datetime) -
updated_at(datetime) -
id(int) -
nameservers(list[NameServer]) -
updated(bool) -
primary_ns(str) -
email(str) -
serialno(int) -
serialno_updated_at(datetime) -
refresh(int) -
retry(int) -
expire(int) -
soa_ttl(int) -
default_ttl(int) -
name(str)
__setattr__
¶
Raise an exception when trying to set an attribute.
ReverseZoneDelegation
pydantic-model
¶
Bases: _Delegation
A reverse zone delegation.
Show JSON schema:
{
"$defs": {
"NameServer": {
"description": "Model for representing a nameserver within a DNS zone.",
"properties": {
"created_at": {
"format": "date-time",
"title": "Created At",
"type": "string"
},
"updated_at": {
"format": "date-time",
"title": "Updated At",
"type": "string"
},
"id": {
"title": "Id",
"type": "integer"
},
"name": {
"title": "Name",
"type": "string"
},
"ttl": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"title": "Ttl"
}
},
"required": [
"created_at",
"updated_at",
"id",
"name",
"ttl"
],
"title": "NameServer",
"type": "object"
}
},
"description": "A reverse zone delegation.",
"properties": {
"created_at": {
"format": "date-time",
"title": "Created At",
"type": "string"
},
"updated_at": {
"format": "date-time",
"title": "Updated At",
"type": "string"
},
"id": {
"title": "Id",
"type": "integer"
},
"nameservers": {
"items": {
"$ref": "#/$defs/NameServer"
},
"title": "Nameservers",
"type": "array"
},
"name": {
"title": "Name",
"type": "string"
},
"comment": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Comment"
},
"zone": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"title": "Zone"
}
},
"required": [
"created_at",
"updated_at",
"id",
"nameservers",
"name"
],
"title": "ReverseZoneDelegation",
"type": "object"
}
Fields:
-
created_at(datetime) -
updated_at(datetime) -
id(int) -
nameservers(list[NameServer]) -
name(str) -
comment(str | None) -
zone(int | None)
__setattr__
¶
Raise an exception when trying to set an attribute.
Role
pydantic-model
¶
Bases: HostPolicy
Model for a role.
Show JSON schema:
{
"description": "Model for a role.",
"properties": {
"create_date": {
"format": "date-time",
"title": "Create Date",
"type": "string"
},
"updated_at": {
"format": "date-time",
"title": "Updated At",
"type": "string"
},
"name": {
"title": "Name",
"type": "string"
},
"description": {
"title": "Description",
"type": "string"
},
"id": {
"title": "Id",
"type": "integer"
},
"hosts": {
"items": {
"type": "string"
},
"title": "Hosts",
"type": "array"
},
"atoms": {
"items": {
"type": "string"
},
"title": "Atoms",
"type": "array"
},
"labels": {
"items": {
"type": "integer"
},
"title": "Labels",
"type": "array"
}
},
"required": [
"create_date",
"updated_at",
"name",
"description",
"id",
"hosts",
"atoms",
"labels"
],
"title": "Role",
"type": "object"
}
Fields:
-
created_at_tz_naive(datetime) -
updated_at(datetime) -
name(str) -
description(str) -
id(int) -
hosts(NameList) -
atoms(NameList) -
labels(list[int])
Validators:
created_at_tz_naive
pydantic-field
¶
created_at_tz_naive: datetime
Constructed datetime field from create_date in the API.
WARNING¶
DO NOT USE THIS FIELD FOR TIMEZONE-AWARE COMPARISONS!
Always use created_at instead when comparing with timezone-aware
fields such as update_time.
__setattr__
¶
Raise an exception when trying to set an attribute.
validate_created_at
pydantic-validator
¶
SSHFP
pydantic-model
¶
Bases: MregModelWithTimestamps
Represents a SSHFP record.
Show JSON schema:
{
"description": "Represents a SSHFP record.",
"properties": {
"created_at": {
"format": "date-time",
"title": "Created At",
"type": "string"
},
"updated_at": {
"format": "date-time",
"title": "Updated At",
"type": "string"
},
"id": {
"title": "Id",
"type": "integer"
},
"algorithm": {
"title": "Algorithm",
"type": "integer"
},
"hash_type": {
"title": "Hash Type",
"type": "integer"
},
"fingerprint": {
"title": "Fingerprint",
"type": "string"
},
"host": {
"title": "Host",
"type": "integer"
},
"ttl": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"title": "Ttl"
}
},
"required": [
"created_at",
"updated_at",
"id",
"algorithm",
"hash_type",
"fingerprint",
"host"
],
"title": "SSHFP",
"type": "object"
}
Fields:
ServerLibraries
pydantic-model
¶
Bases: BaseModel
Model for server libraries metadata.
Show JSON schema:
{
"$defs": {
"Library": {
"description": "Model for library metadata.",
"properties": {
"name": {
"title": "Name",
"type": "string"
},
"version": {
"title": "Version",
"type": "string"
}
},
"required": [
"name",
"version"
],
"title": "Library",
"type": "object"
}
},
"description": "Model for server libraries metadata.",
"properties": {
"libraries": {
"items": {
"$ref": "#/$defs/Library"
},
"title": "Libraries",
"type": "array"
}
},
"required": [
"libraries"
],
"title": "ServerLibraries",
"type": "object"
}
Fields:
ServerVersion
pydantic-model
¶
Srv
pydantic-model
¶
Bases: MregModelWithTimestamps
Represents a SRV record.
Show JSON schema:
{
"description": "Represents a SRV record.",
"properties": {
"created_at": {
"format": "date-time",
"title": "Created At",
"type": "string"
},
"updated_at": {
"format": "date-time",
"title": "Updated At",
"type": "string"
},
"id": {
"title": "Id",
"type": "integer"
},
"name": {
"title": "Name",
"type": "string"
},
"priority": {
"title": "Priority",
"type": "integer"
},
"weight": {
"title": "Weight",
"type": "integer"
},
"port": {
"title": "Port",
"type": "integer"
},
"host": {
"title": "Host",
"type": "integer"
},
"ttl": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"title": "Ttl"
},
"zone": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"title": "Zone"
}
},
"required": [
"created_at",
"updated_at",
"id",
"name",
"priority",
"weight",
"port",
"host"
],
"title": "Srv",
"type": "object"
}
Fields:
TXT
pydantic-model
¶
Bases: MregModelWithTimestamps
Represents a TXT record.
Show JSON schema:
{
"description": "Represents a TXT record.",
"properties": {
"created_at": {
"format": "date-time",
"title": "Created At",
"type": "string"
},
"updated_at": {
"format": "date-time",
"title": "Updated At",
"type": "string"
},
"id": {
"title": "Id",
"type": "integer"
},
"txt": {
"title": "Txt",
"type": "string"
},
"host": {
"title": "Host",
"type": "integer"
}
},
"required": [
"created_at",
"updated_at",
"id",
"txt",
"host"
],
"title": "TXT",
"type": "object"
}
Fields:
TokenAuth
pydantic-model
¶
TokenInfo
pydantic-model
¶
Bases: BaseModel
Model for token information.
Show JSON schema:
{
"description": "Model for token information.",
"properties": {
"is_valid": {
"title": "Is Valid",
"type": "boolean"
},
"created": {
"title": "Created",
"type": "string"
},
"expire": {
"title": "Expire",
"type": "string"
},
"last_used": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Last Used"
},
"lifespan": {
"title": "Lifespan",
"type": "string"
}
},
"required": [
"is_valid",
"created",
"expire",
"lifespan"
],
"title": "TokenInfo",
"type": "object"
}
Fields:
UserDjangoStatus
pydantic-model
¶
Bases: BaseModel
Model for Django status in the user response.
Show JSON schema:
{
"description": "Model for Django status in the user response.",
"properties": {
"superuser": {
"default": false,
"title": "Superuser",
"type": "boolean"
},
"staff": {
"default": false,
"title": "Staff",
"type": "boolean"
},
"active": {
"default": false,
"title": "Active",
"type": "boolean"
}
},
"title": "UserDjangoStatus",
"type": "object"
}
Fields:
UserInfo
pydantic-model
¶
Bases: BaseModel
Model for the user information.
Show JSON schema:
{
"$defs": {
"TokenInfo": {
"description": "Model for token information.",
"properties": {
"is_valid": {
"title": "Is Valid",
"type": "boolean"
},
"created": {
"title": "Created",
"type": "string"
},
"expire": {
"title": "Expire",
"type": "string"
},
"last_used": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Last Used"
},
"lifespan": {
"title": "Lifespan",
"type": "string"
}
},
"required": [
"is_valid",
"created",
"expire",
"lifespan"
],
"title": "TokenInfo",
"type": "object"
},
"UserDjangoStatus": {
"description": "Model for Django status in the user response.",
"properties": {
"superuser": {
"default": false,
"title": "Superuser",
"type": "boolean"
},
"staff": {
"default": false,
"title": "Staff",
"type": "boolean"
},
"active": {
"default": false,
"title": "Active",
"type": "boolean"
}
},
"title": "UserDjangoStatus",
"type": "object"
},
"UserMregStatus": {
"description": "Model for Mreg status in the user response.",
"properties": {
"superuser": {
"default": false,
"title": "Superuser",
"type": "boolean"
},
"admin": {
"default": false,
"title": "Admin",
"type": "boolean"
},
"group_admin": {
"default": false,
"title": "Group Admin",
"type": "boolean"
},
"network_admin": {
"default": false,
"title": "Network Admin",
"type": "boolean"
},
"hostpolicy_admin": {
"default": false,
"title": "Hostpolicy Admin",
"type": "boolean"
},
"dns_wildcard_admin": {
"default": false,
"title": "Dns Wildcard Admin",
"type": "boolean"
},
"underscore_admin": {
"default": false,
"title": "Underscore Admin",
"type": "boolean"
}
},
"title": "UserMregStatus",
"type": "object"
},
"UserPermission": {
"description": "Model for permissions in the user response.",
"properties": {
"group": {
"title": "Group",
"type": "string"
},
"range": {
"title": "Range",
"type": "string"
},
"regex": {
"title": "Regex",
"type": "string"
},
"labels": {
"items": {
"type": "string"
},
"title": "Labels",
"type": "array"
}
},
"required": [
"group",
"range",
"regex",
"labels"
],
"title": "UserPermission",
"type": "object"
}
},
"description": "Model for the user information.",
"properties": {
"username": {
"title": "Username",
"type": "string"
},
"last_login": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Last Login"
},
"token": {
"anyOf": [
{
"$ref": "#/$defs/TokenInfo"
},
{
"type": "null"
}
],
"default": null
},
"django_status": {
"$ref": "#/$defs/UserDjangoStatus"
},
"mreg_status": {
"$ref": "#/$defs/UserMregStatus"
},
"groups": {
"items": {
"type": "string"
},
"title": "Groups",
"type": "array"
},
"permissions": {
"items": {
"$ref": "#/$defs/UserPermission"
},
"title": "Permissions",
"type": "array"
}
},
"required": [
"username"
],
"title": "UserInfo",
"type": "object"
}
Fields:
-
username(str) -
last_login(str | None) -
token(TokenInfo | None) -
django_status(UserDjangoStatus) -
mreg_status(UserMregStatus) -
groups(list[str]) -
permissions(list[UserPermission])
UserMregStatus
pydantic-model
¶
Bases: BaseModel
Model for Mreg status in the user response.
Show JSON schema:
{
"description": "Model for Mreg status in the user response.",
"properties": {
"superuser": {
"default": false,
"title": "Superuser",
"type": "boolean"
},
"admin": {
"default": false,
"title": "Admin",
"type": "boolean"
},
"group_admin": {
"default": false,
"title": "Group Admin",
"type": "boolean"
},
"network_admin": {
"default": false,
"title": "Network Admin",
"type": "boolean"
},
"hostpolicy_admin": {
"default": false,
"title": "Hostpolicy Admin",
"type": "boolean"
},
"dns_wildcard_admin": {
"default": false,
"title": "Dns Wildcard Admin",
"type": "boolean"
},
"underscore_admin": {
"default": false,
"title": "Underscore Admin",
"type": "boolean"
}
},
"title": "UserMregStatus",
"type": "object"
}
Fields:
-
superuser(bool) -
admin(bool) -
group_admin(bool) -
network_admin(bool) -
hostpolicy_admin(bool) -
dns_wildcard_admin(bool) -
underscore_admin(bool)
UserPermission
pydantic-model
¶
Bases: BaseModel
Model for permissions in the user response.
Show JSON schema:
{
"description": "Model for permissions in the user response.",
"properties": {
"group": {
"title": "Group",
"type": "string"
},
"range": {
"title": "Range",
"type": "string"
},
"regex": {
"title": "Regex",
"type": "string"
},
"labels": {
"items": {
"type": "string"
},
"title": "Labels",
"type": "array"
}
},
"required": [
"group",
"range",
"regex",
"labels"
],
"title": "UserPermission",
"type": "object"
}
Fields:
ZoneFile
¶
history
¶
History abstractions for mreg-cli.
HistoryItem
pydantic-model
¶
Bases: BaseModel
Represents a history item.
Show JSON schema:
{
"$defs": {
"HistoryResource": {
"description": "History resources for the API.\n\nNames represent resource names.\nValues represent resource relations.\n\nAccess resource names and relation with the `resource()` and `relation()` methods.",
"enum": [
"hosts",
"groups",
"roles",
"atoms"
],
"title": "HistoryResource",
"type": "string"
},
"JsonValue": {}
},
"description": "Represents a history item.",
"properties": {
"id": {
"title": "Id",
"type": "integer"
},
"timestamp": {
"format": "date-time",
"title": "Timestamp",
"type": "string"
},
"user": {
"title": "User",
"type": "string"
},
"resource": {
"$ref": "#/$defs/HistoryResource"
},
"name": {
"title": "Name",
"type": "string"
},
"model_id": {
"title": "Model Id",
"type": "integer"
},
"model": {
"title": "Model",
"type": "string"
},
"action": {
"title": "Action",
"type": "string"
},
"data": {
"additionalProperties": {
"$ref": "#/$defs/JsonValue"
},
"title": "Data",
"type": "object"
}
},
"required": [
"id",
"timestamp",
"user",
"resource",
"name",
"model_id",
"model",
"action",
"data"
],
"title": "HistoryItem",
"type": "object"
}
Fields:
-
id(int) -
timestamp(datetime) -
user(str) -
resource(HistoryResource) -
name(str) -
mid(int) -
model(str) -
action(str) -
data(JsonMapping)
Validators:
-
parse_json_data→data
HistoryRelation
pydantic-model
¶
Bases: BaseModel
Data for history of addition/removal of relations.
Show JSON schema:
{
"description": "Data for history of addition/removal of relations.",
"properties": {
"relation": {
"title": "Relation",
"type": "string"
},
"id": {
"anyOf": [
{
"type": "integer"
},
{
"type": "string"
}
],
"title": "Id"
},
"name": {
"title": "Name",
"type": "string"
}
},
"required": [
"relation",
"id",
"name"
],
"title": "HistoryRelation",
"type": "object"
}
Fields:
HistoryResource
¶
History resources for the API.
Names represent resource names. Values represent resource relations.
Access resource names and relation with the resource() and relation() methods.
HistoryUpdate
pydantic-model
¶
Bases: BaseModel
Data for history of updates to an object.
Show JSON schema:
{
"$defs": {
"JsonValue": {}
},
"description": "Data for history of updates to an object.",
"properties": {
"current_data": {
"additionalProperties": {
"$ref": "#/$defs/JsonValue"
},
"title": "Current Data",
"type": "object"
},
"update": {
"additionalProperties": {
"$ref": "#/$defs/JsonValue"
},
"title": "Update",
"type": "object"
}
},
"required": [
"current_data",
"update"
],
"title": "HistoryUpdate",
"type": "object"
}
Fields:
-
current_data(JsonMapping) -
update(JsonMapping)
fields
¶
Custom field types for Pydantic models.
The types resolve to basic types like str, int, etc., but with additional validation added to them. The types are used in Pydantic models for consistent validation of common fields such as hostnames, MAC addresses, etc.
Warning: Values constructed from these types should NOT be checked at runtime with isinstance()! Pydantic will always coerce these types to their schema types (str, int, etc.).
HostNameField
module-attribute
¶
HostNameField = Annotated[
HostName, AfterValidator(parse_hostname)
]
Pydantic-compatible hostname field type.
Use as a model field type where the server returns hostnames that should be normalised (lowercase, trailing dot stripped) on deserialisation.
No expansion occurs, since the server should always return fully qualified hostnames. Furthermore, we have no way to know what domain to expand to, so we don't attempt it.
TODO: Consider if we should remove validation of incoming hostnames from the server. It is not really the client's responsibility to validate server data to this level of granularity.
NameList
module-attribute
¶
NameList = Annotated[
list[Annotated[str, BeforeValidator(_extract_name)]],
AfterValidator(_remove_falsy_list_items),
]
List of names extracted from a list of dicts.
VerifiedNS
module-attribute
¶
A nameserver that is a (best-effort) FQDN and has been verified to exist in mreg and have an A-record/glue.
Acts like a string on runtime.
MacAddress
¶
Bases: MacAddress
MAC address string type used in Pydantic models.
parse
classmethod
¶
parse(obj: Any) -> MacAddress | None
Parse a MAC address from a string. Returns None if the MAC address is invalid.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
obj
|
Any
|
The object to parse. |
required |
Returns:
| Type | Description |
|---|---|
MacAddress | None
|
The MAC address as a string or None if it is invalid. |
parse_or_raise
classmethod
¶
parse_or_raise(obj: Any) -> MacAddress
Parse a MAC address from a string. Returns the MAC address as a string.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
obj
|
Any
|
The object to parse. |
required |
Returns:
| Type | Description |
|---|---|
MacAddress
|
The MAC address as a string. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the object is not a valid MAC address. |
parse_hostname
¶
Normalise and optionally expand a hostname.
Normalisation: lowercase, strip trailing dot, validate shape.
Expansion: if no dot remains after normalisation and domain is non-empty,
append the domain.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
str
|
Raw hostname string. |
required |
domain
|
str | None
|
Domain to append when the name has no dot after normalisation.
Pass |
None
|
Returns:
| Type | Description |
|---|---|
HostName
|
Normalised (and optionally expanded) :data: |
Raises:
| Type | Description |
|---|---|
InputFailure
|
If the value is not a valid hostname shape. |
abstracts
¶
Abstract models for the API.
MregModelWithTimestamps
pydantic-model
¶
Bases: MregModel
Model with created_at and updated_at fields.
Show JSON schema:
{
"description": "Model with created_at and updated_at fields.",
"properties": {
"created_at": {
"format": "date-time",
"title": "Created At",
"type": "string"
},
"updated_at": {
"format": "date-time",
"title": "Updated At",
"type": "string"
}
},
"required": [
"created_at",
"updated_at"
],
"title": "MregModelWithTimestamps",
"type": "object"
}
Fields: