Locator
sereto.models.locator
¶
BaseLocatorModel
¶
Bases: SeretoBaseModel
Common base model for all locator types.
You should typically use LocatorModel instead of this class directly.
Attributes:
| Name | Type | Description |
|---|---|---|
type |
str
|
The type of locator (discriminator field). |
description |
str | None
|
An optional description of the locator. |
Source code in sereto/models/locator.py
9 10 11 12 13 14 15 16 17 18 19 20 | |
DomainLocatorModel
¶
Bases: BaseLocatorModel
Model representing a domain locator.
Attributes:
| Name | Type | Description |
|---|---|---|
type |
Literal['domain']
|
The discriminator for the locator type, which is always "domain". |
value |
str
|
The domain of the locator. |
description |
str | None
|
Optional description of the domain locator. |
Source code in sereto/models/locator.py
53 54 55 56 57 58 59 60 61 62 63 | |
FileLocatorModel
¶
Bases: BaseLocatorModel
Model representing a file locator.
Attributes:
| Name | Type | Description |
|---|---|---|
type |
Literal['file']
|
The discriminator for the locator type, which is always "file". |
value |
str
|
The path to the file, may contain specific line. |
description |
str | None
|
Optional description of the file locator. |
Source code in sereto/models/locator.py
83 84 85 86 87 88 89 90 91 92 93 | |
HostnameLocatorModel
¶
Bases: BaseLocatorModel
Model representing a hostname locator.
Attributes:
| Name | Type | Description |
|---|---|---|
type |
Literal['hostname']
|
The discriminator for the locator type, which is always "hostname". |
value |
str
|
The hostname of the locator. |
description |
str | None
|
Optional description of the hostname locator. |
Source code in sereto/models/locator.py
40 41 42 43 44 45 46 47 48 49 50 | |
IpLocatorModel
¶
Bases: BaseLocatorModel
Model representing an IP locator.
Attributes:
| Name | Type | Description |
|---|---|---|
type |
Literal['ip']
|
The discriminator for the locator type, which is always "ip". |
value |
IPvAnyAddress | IPvAnyNetwork
|
The IP address or network of the locator. |
description |
str | None
|
Optional description of the IP locator. |
Source code in sereto/models/locator.py
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | |
PlatformLocatorModel
¶
Bases: BaseLocatorModel
Model representing a platform locator.
Attributes:
| Name | Type | Description |
|---|---|---|
type |
Literal['platform']
|
The discriminator for the locator type, which is always "platform". |
value |
str
|
The platform name. |
description |
str | None
|
Optional description of the platform locator. |
Source code in sereto/models/locator.py
96 97 98 99 100 101 102 103 104 105 106 | |
UrlLocatorModel
¶
Bases: BaseLocatorModel
Model representing a URL locator.
Attributes:
| Name | Type | Description |
|---|---|---|
type |
Literal['url']
|
The discriminator for the locator type, which is always "url". |
value |
AnyUrl
|
The URL of the locator. |
description |
str | None
|
Optional description of the URL locator. |
Source code in sereto/models/locator.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | |
dump_locators_to_toml(locators)
¶
Dump locators to a TOML string.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
locators
|
Iterable[LocatorModel]
|
An iterable of LocatorModel instances. |
required |
Returns:
| Type | Description |
|---|---|
str
|
A TOML formatted string representing the locators. |
Source code in sereto/models/locator.py
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 | |
get_locator_types()
¶
Get all locator types defined in LocatorModel.
Source code in sereto/models/locator.py
141 142 143 144 145 | |