2021-03-09 13:30:12 -09:00
|
|
|
# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
|
|
|
# or more contributor license agreements. Licensed under the Elastic License
|
|
|
|
|
# 2.0; you may not use this file except in compliance with the Elastic License
|
|
|
|
|
# 2.0.
|
|
|
|
|
|
|
|
|
|
"""Definitions for packages destined for the registry."""
|
|
|
|
|
|
2023-11-01 12:47:40 -04:00
|
|
|
from dataclasses import dataclass, field
|
2021-03-09 13:30:12 -09:00
|
|
|
|
2025-07-01 15:20:55 +02:00
|
|
|
from detection_rules.mixins import MarshmallowDataclassMixin
|
|
|
|
|
from detection_rules.schemas.definitions import ConditionSemVer, SemVer
|
2021-03-09 13:30:12 -09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
@dataclass
|
2023-11-01 12:47:40 -04:00
|
|
|
class ConditionElastic:
|
|
|
|
|
subscription: str
|
2025-07-01 15:20:55 +02:00
|
|
|
capabilities: list[str] | None
|
2023-11-01 12:47:40 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
@dataclass
|
|
|
|
|
class Condition:
|
|
|
|
|
kibana_version: str = field(metadata={"data_key": "kibana.version"})
|
|
|
|
|
elastic: ConditionElastic
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@dataclass
|
|
|
|
|
class Icon:
|
|
|
|
|
size: str
|
|
|
|
|
src: str
|
|
|
|
|
type: str
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@dataclass
|
|
|
|
|
class RegistryPackageManifestBase(MarshmallowDataclassMixin):
|
2021-03-09 13:30:12 -09:00
|
|
|
"""Base class for registry packages."""
|
|
|
|
|
|
2025-07-01 15:20:55 +02:00
|
|
|
categories: list[str]
|
2021-06-15 07:54:50 -06:00
|
|
|
description: str
|
|
|
|
|
format_version: SemVer
|
2025-07-01 15:20:55 +02:00
|
|
|
icons: list[Icon]
|
2021-06-15 07:54:50 -06:00
|
|
|
name: str
|
2025-07-01 15:20:55 +02:00
|
|
|
owner: dict[str, str]
|
2021-06-15 07:54:50 -06:00
|
|
|
title: str
|
|
|
|
|
type: str
|
2021-03-09 13:30:12 -09:00
|
|
|
version: SemVer
|
|
|
|
|
|
2025-07-01 15:20:55 +02:00
|
|
|
internal: bool | None
|
|
|
|
|
policy_templates: list[str] | None
|
|
|
|
|
screenshots: list[str] | None
|
2023-11-01 12:47:40 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
@dataclass
|
|
|
|
|
class RegistryPackageManifestV1(RegistryPackageManifestBase):
|
|
|
|
|
"""Registry packages using elastic-package v1."""
|
|
|
|
|
|
2025-07-01 15:20:55 +02:00
|
|
|
conditions: dict[str, ConditionSemVer]
|
2023-11-01 12:47:40 -04:00
|
|
|
license: str
|
|
|
|
|
release: str
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@dataclass
|
|
|
|
|
class RegistryPackageManifestV3(RegistryPackageManifestBase):
|
|
|
|
|
"""Registry packages using elastic-package v3."""
|
|
|
|
|
|
|
|
|
|
conditions: Condition
|
2025-07-01 15:20:55 +02:00
|
|
|
source: dict[str, str]
|