Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified crowdsec_service_api/__pycache__/base_model.cpython-311.pyc
Binary file not shown.
Binary file modified crowdsec_service_api/__pycache__/http_client.cpython-311.pyc
Binary file not shown.
138 changes: 61 additions & 77 deletions crowdsec_service_api/models.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
# generated by datamodel-codegen:
# filename: <stdin>
# timestamp: 2025-05-02T13:09:22+00:00
# timestamp: 2025-11-13T14:32:21+00:00

from __future__ import annotations

from datetime import datetime
from enum import Enum
from typing import Annotated, Dict, List, Optional, Union

from pydantic import AnyUrl, ConfigDict, Field, RootModel
from pydantic import AnyUrl, AwareDatetime, ConfigDict, Field, RootModel

from .base_model import BaseModelSdk

Expand Down Expand Up @@ -50,11 +49,11 @@ class AllowlistCreateResponse(BaseModelSdk):
Field(description='Description of the allowlist', title='Description'),
] = None
created_at: Annotated[
datetime,
AwareDatetime,
Field(description='Time the allowlist was created', title='Created At'),
]
updated_at: Annotated[
Optional[datetime],
Optional[AwareDatetime],
Field(description='Time the allowlist was updated', title='Updated At'),
] = None
from_cti_query: Annotated[
Expand Down Expand Up @@ -85,7 +84,7 @@ class AllowlistItemUpdateRequest(BaseModelSdk):
Field(description='Description of the allowlist entry', title='Description'),
] = None
expiration: Annotated[
Optional[datetime],
Optional[AwareDatetime],
Field(description='Time the allowlist entry will expire', title='Expiration'),
] = None

Expand All @@ -103,7 +102,7 @@ class AllowlistItemsCreateRequest(BaseModelSdk):
Field(description='Description of the allowlist entry', title='Description'),
]
expiration: Annotated[
Optional[datetime],
Optional[AwareDatetime],
Field(description='Time the allowlist entry will expire', title='Expiration'),
] = None

Expand Down Expand Up @@ -180,7 +179,7 @@ class BlocklistAddIPsRequest(BaseModelSdk):
)
ips: Annotated[List[str], Field(description='List of IPs or networks', title='Ips')]
expiration: Annotated[
Optional[datetime],
Optional[AwareDatetime],
Field(
description='Expiration date',
examples=['2030-01-01T00:00:00.000Z'],
Expand Down Expand Up @@ -327,7 +326,7 @@ class BlocklistUsageStats(BaseModelSdk):
total_subscribed_organizations: Annotated[
Optional[int], Field(title='Total Subscribed Organizations')
] = 0
updated_at: Annotated[Optional[datetime], Field(title='Updated At')] = None
updated_at: Annotated[Optional[AwareDatetime], Field(title='Updated At')] = None


class BodyUploadBlocklistContent(BaseModelSdk):
Expand Down Expand Up @@ -448,6 +447,7 @@ class MetricUnits(Enum):
REQUEST = 'request'
IP = 'ip'
LINE = 'line'
EVENT = 'event'


class OutputFormat(Enum):
Expand All @@ -465,22 +465,6 @@ class OutputFormat(Enum):
SOPHOS = 'sophos'


class Total(RootModel[int]):
root: Annotated[int, Field(ge=0, title='Total')]


class Page(RootModel[int]):
root: Annotated[int, Field(ge=1, title='Page')]


class Size(RootModel[int]):
root: Annotated[int, Field(ge=1, title='Size')]


class Pages(RootModel[int]):
root: Annotated[int, Field(ge=0, title='Pages')]


class Permission(Enum):
READ = 'read'
WRITE = 'write'
Expand All @@ -497,7 +481,7 @@ class RemediationMetricsData(BaseModelSdk):
Union[int, float], Field(description='Value of the metric', title='Value')
]
timestamp: Annotated[
datetime, Field(description='Timestamp of the metric', title='Timestamp')
AwareDatetime, Field(description='Timestamp of the metric', title='Timestamp')
]


Expand Down Expand Up @@ -726,10 +710,10 @@ class BlocklistsDeleteBlocklistPathParameters(BaseModelSdk):

class BlocklistsUploadBlocklistContentQueryParameters(BaseModelSdk):
expiration: Annotated[
Optional[datetime],
Optional[AwareDatetime],
Field(
description='Blocklist expiration',
examples='2025-05-02T13:08:57.499429+00:00',
examples='2025-11-13T14:32:12.968716+00:00',
title='Expiration',
),
] = None
Expand Down Expand Up @@ -911,14 +895,14 @@ class IntegrationsGetIntegrationContentStreamPathParameters(BaseModelSdk):

class MetricsGetMetricsRemediationQueryParameters(BaseModelSdk):
start_date: Annotated[
Optional[datetime],
Optional[AwareDatetime],
Field(
description='Start date of the metrics, default to last day',
title='Start Date',
),
] = None
end_date: Annotated[
Optional[datetime],
Optional[AwareDatetime],
Field(description='End date of the metrics', title='End Date'),
] = None
engine_ids: Annotated[
Expand Down Expand Up @@ -1006,11 +990,11 @@ class AllowlistUpdateResponse(BaseModelSdk):
Field(description='Description of the allowlist', title='Description'),
] = None
created_at: Annotated[
datetime,
AwareDatetime,
Field(description='Time the allowlist was created', title='Created At'),
]
updated_at: Annotated[
Optional[datetime],
Optional[AwareDatetime],
Field(description='Time the allowlist was updated', title='Updated At'),
] = None
from_cti_query: Annotated[
Expand Down Expand Up @@ -1090,7 +1074,7 @@ class BlocklistContentStats(BaseModelSdk):
Optional[List[CtiCountry]], Field(title='Top Attacking Countries')
] = []
top_ips: Annotated[Optional[List[CtiIp]], Field(title='Top Ips')] = []
updated_at: Annotated[Optional[datetime], Field(title='Updated At')] = None
updated_at: Annotated[Optional[AwareDatetime], Field(title='Updated At')] = None


class BlocklistOrigin(BaseModelSdk):
Expand Down Expand Up @@ -1196,7 +1180,7 @@ class BlocklistStats(BaseModelSdk):
Optional[float], Field(title='Change Month Percentage')
] = 0.0
count: Annotated[Optional[int], Field(title='Count')] = 0
updated_at: Annotated[Optional[datetime], Field(title='Updated At')] = None
updated_at: Annotated[Optional[AwareDatetime], Field(title='Updated At')] = None


class BlocklistSubscriberEntity(BaseModelSdk):
Expand Down Expand Up @@ -1270,11 +1254,11 @@ class IntegrationCreateResponse(BaseModelSdk):
Field(description='Description of the integration', title='Description'),
] = None
created_at: Annotated[
datetime,
AwareDatetime,
Field(description='Time the integration was created', title='Created At'),
]
updated_at: Annotated[
datetime,
AwareDatetime,
Field(description='Last time the integration was updated', title='Updated At'),
]
entity_type: Annotated[
Expand All @@ -1284,7 +1268,7 @@ class IntegrationCreateResponse(BaseModelSdk):
OutputFormat, Field(description='Output format of the integration')
]
last_pull: Annotated[
Optional[datetime],
Optional[AwareDatetime],
Field(
description='Last time the integration pulled blocklists', title='Last Pull'
),
Expand Down Expand Up @@ -1336,11 +1320,11 @@ class IntegrationGetResponse(BaseModelSdk):
Field(description='Description of the integration', title='Description'),
] = None
created_at: Annotated[
datetime,
AwareDatetime,
Field(description='Time the integration was created', title='Created At'),
]
updated_at: Annotated[
datetime,
AwareDatetime,
Field(description='Last time the integration was updated', title='Updated At'),
]
entity_type: Annotated[
Expand All @@ -1350,7 +1334,7 @@ class IntegrationGetResponse(BaseModelSdk):
OutputFormat, Field(description='Output format of the integration')
]
last_pull: Annotated[
Optional[datetime],
Optional[AwareDatetime],
Field(
description='Last time the integration pulled blocklists', title='Last Pull'
),
Expand Down Expand Up @@ -1418,11 +1402,11 @@ class IntegrationUpdateResponse(BaseModelSdk):
Field(description='Description of the integration', title='Description'),
] = None
created_at: Annotated[
datetime,
AwareDatetime,
Field(description='Time the integration was created', title='Created At'),
]
updated_at: Annotated[
datetime,
AwareDatetime,
Field(description='Last time the integration was updated', title='Updated At'),
]
entity_type: Annotated[
Expand All @@ -1432,7 +1416,7 @@ class IntegrationUpdateResponse(BaseModelSdk):
OutputFormat, Field(description='Output format of the integration')
]
last_pull: Annotated[
Optional[datetime],
Optional[AwareDatetime],
Field(
description='Last time the integration pulled blocklists', title='Last Pull'
),
Expand Down Expand Up @@ -1476,38 +1460,38 @@ class OriginMetrics(BaseModelSdk):

class PageTAnyCustomizedAllowlistSubscriberEntity(BaseModelSdk):
items: Annotated[List[AllowlistSubscriberEntity], Field(title='Items')]
total: Annotated[Optional[Total], Field(title='Total')] = None
page: Annotated[Optional[Page], Field(title='Page')] = None
size: Annotated[Optional[Size], Field(title='Size')] = None
pages: Annotated[Optional[Pages], Field(title='Pages')] = None
total: Annotated[int, Field(ge=0, title='Total')]
page: Annotated[int, Field(ge=1, title='Page')]
size: Annotated[int, Field(ge=1, title='Size')]
pages: Annotated[int, Field(ge=0, title='Pages')]
links: Links


class PageTAnyCustomizedBlocklistSubscriberEntity(BaseModelSdk):
items: Annotated[List[BlocklistSubscriberEntity], Field(title='Items')]
total: Annotated[Optional[Total], Field(title='Total')] = None
page: Annotated[Optional[Page], Field(title='Page')] = None
size: Annotated[Optional[Size], Field(title='Size')] = None
pages: Annotated[Optional[Pages], Field(title='Pages')] = None
total: Annotated[int, Field(ge=0, title='Total')]
page: Annotated[int, Field(ge=1, title='Page')]
size: Annotated[int, Field(ge=1, title='Size')]
pages: Annotated[int, Field(ge=0, title='Pages')]
links: Links


class PageTAnyCustomizedIntegrationGetResponse(BaseModelSdk):
items: Annotated[List[IntegrationGetResponse], Field(title='Items')]
total: Annotated[Optional[Total], Field(title='Total')] = None
page: Annotated[Optional[Page], Field(title='Page')] = None
size: Annotated[Optional[Size], Field(title='Size')] = None
pages: Annotated[Optional[Pages], Field(title='Pages')] = None
total: Annotated[int, Field(ge=0, title='Total')]
page: Annotated[int, Field(ge=1, title='Page')]
size: Annotated[int, Field(ge=1, title='Size')]
pages: Annotated[int, Field(ge=0, title='Pages')]
links: Links


class PublicBlocklistResponse(BaseModelSdk):
id: Annotated[str, Field(description='Blocklist id', title='Id')]
created_at: Annotated[
datetime, Field(description='Blocklist creation date', title='Created At')
AwareDatetime, Field(description='Blocklist creation date', title='Created At')
]
updated_at: Annotated[
datetime, Field(description='Blocklist update date', title='Updated At')
AwareDatetime, Field(description='Blocklist update date', title='Updated At')
]
name: Annotated[
str,
Expand Down Expand Up @@ -2241,11 +2225,11 @@ class AllowlistGetItemsResponse(BaseModelSdk):
str, Field(description='Value of the allowlist entry', title='Value')
]
created_at: Annotated[
datetime,
AwareDatetime,
Field(description='Time the allowlist entry was created', title='Created At'),
]
updated_at: Annotated[
Optional[datetime],
Optional[AwareDatetime],
Field(description='Time the allowlist entry was updated', title='Updated At'),
] = None
created_by: Annotated[
Expand All @@ -2256,7 +2240,7 @@ class AllowlistGetItemsResponse(BaseModelSdk):
Field(description='The source user who updated the allowlist entry'),
] = None
expiration: Annotated[
Optional[datetime],
Optional[AwareDatetime],
Field(description='Time the allowlist entry will expire', title='Expiration'),
] = None

Expand All @@ -2279,11 +2263,11 @@ class AllowlistGetResponse(BaseModelSdk):
Field(description='Description of the allowlist', title='Description'),
] = None
created_at: Annotated[
datetime,
AwareDatetime,
Field(description='Time the allowlist was created', title='Created At'),
]
updated_at: Annotated[
Optional[datetime],
Optional[AwareDatetime],
Field(description='Time the allowlist was updated', title='Updated At'),
] = None
from_cti_query: Annotated[
Expand Down Expand Up @@ -2341,11 +2325,11 @@ class AllowlistItemUpdateResponse(BaseModelSdk):
str, Field(description='Value of the allowlist entry', title='Value')
]
created_at: Annotated[
datetime,
AwareDatetime,
Field(description='Time the allowlist entry was created', title='Created At'),
]
updated_at: Annotated[
datetime,
AwareDatetime,
Field(description='Time the allowlist entry was updated', title='Updated At'),
]
created_by: Annotated[
Expand All @@ -2355,7 +2339,7 @@ class AllowlistItemUpdateResponse(BaseModelSdk):
SourceInfo, Field(description='The source user who updated the allowlist entry')
]
expiration: Annotated[
Optional[datetime],
Optional[AwareDatetime],
Field(description='Time the allowlist entry will expire', title='Expiration'),
] = None

Expand All @@ -2377,28 +2361,28 @@ class ComputedSavedMetrics(BaseModelSdk):

class PageTAnyCustomizedAllowlistGetItemsResponse(BaseModelSdk):
items: Annotated[List[AllowlistGetItemsResponse], Field(title='Items')]
total: Annotated[Optional[Total], Field(title='Total')] = None
page: Annotated[Optional[Page], Field(title='Page')] = None
size: Annotated[Optional[Size], Field(title='Size')] = None
pages: Annotated[Optional[Pages], Field(title='Pages')] = None
total: Annotated[int, Field(ge=0, title='Total')]
page: Annotated[int, Field(ge=1, title='Page')]
size: Annotated[int, Field(ge=1, title='Size')]
pages: Annotated[int, Field(ge=0, title='Pages')]
links: Links


class PageTAnyCustomizedAllowlistGetResponse(BaseModelSdk):
items: Annotated[List[AllowlistGetResponse], Field(title='Items')]
total: Annotated[Optional[Total], Field(title='Total')] = None
page: Annotated[Optional[Page], Field(title='Page')] = None
size: Annotated[Optional[Size], Field(title='Size')] = None
pages: Annotated[Optional[Pages], Field(title='Pages')] = None
total: Annotated[int, Field(ge=0, title='Total')]
page: Annotated[int, Field(ge=1, title='Page')]
size: Annotated[int, Field(ge=1, title='Size')]
pages: Annotated[int, Field(ge=0, title='Pages')]
links: Links


class PageTAnyCustomizedPublicBlocklistResponse(BaseModelSdk):
items: Annotated[List[PublicBlocklistResponse], Field(title='Items')]
total: Annotated[Optional[Total], Field(title='Total')] = None
page: Annotated[Optional[Page], Field(title='Page')] = None
size: Annotated[Optional[Size], Field(title='Size')] = None
pages: Annotated[Optional[Pages], Field(title='Pages')] = None
total: Annotated[int, Field(ge=0, title='Total')]
page: Annotated[int, Field(ge=1, title='Page')]
size: Annotated[int, Field(ge=1, title='Size')]
pages: Annotated[int, Field(ge=0, title='Pages')]
links: Links


Expand Down
Binary file not shown.
Loading