Esempio n. 1
0
class BaseNormalization(Document):
    """Base class for a normalization configuration."""

    domain_name = None

    class TimestampInfo(Document):
        field = StringField(required=True)
        format = StringField(required=True)

    class Fields(Document):
        scope = StringField()
        mapping = DictField()

    name = StringField(required=True)
    filter_query = BooleanField(default=False)
    os_types = ArrayField(StringField(), required=False)
    domain = StringField(required=True)
    strict = BooleanField(required=True)
    timestamp = DocumentField(TimestampInfo(), required=True)
    fields = DocumentField(Fields(), required=True)

    events = DictField(additional_properties=DictField(
        {
            'enum':
            DictField(additional_properties=DictField(
                additional_properties=StringField())),
            'mapping':
            DictField(),
            'filter':
            StringField(required=True)
        },
        required=True))
Esempio n. 2
0
class InputsPage(DocumentWithoutAddProp):
    title = StringField(required=True, max_length=60)
    description = StringField(max_length=200)
    table = DocumentField(InputsTable, as_ref=True, required=True)
    services = ArrayField(DictField(
        properties={
            "name": StringField(required=True, pattern="^[0-9a-zA-Z][0-9a-zA-Z_-]*$", max_length=50),
            "title": StringField(required=True, max_length=100),
            "entity": ArrayField(DocumentField(InputsEntity, as_ref=True), required=True),
            "options": DocumentField(Hooks, as_ref=True),
            "groups": ArrayField(DictField(
                properties={
                    "options": DictField(
                        properties={
                            "isExpandable": BooleanField(),
                            "expand": BooleanField()
                        }
                    ),
                    "label": StringField(required=True, max_length=100),
                    "field": ArrayField(StringField(required=True, pattern="^\w+$"))
                }
            ), required=False),
            "style": StringField(required=False, enum=["page", "dialog"]),
            "hook": DictField(required=False),
            "conf": StringField(required=False, max_length=100),
            "restHandlerName": StringField(required=False, max_length=100)
        }
    ), required=True)
    menu = DictField(required=False)
Esempio n. 3
0
class ValueLabelPair(DocumentWithoutAddProp):
    value = OneOfField([
        NumberField(),
        StringField(max_length=250),
        BooleanField()
    ])
    label = StringField(required=True, max_length=100)
Esempio n. 4
0
class Alerts(DocumentWithoutAddProp):
    name = StringField(required=True,
                       pattern="^[a-zA-Z0-9_]+$",
                       max_length=100)
    label = StringField(required=True, max_length=100)
    description = StringField(required=True)
    activeResponse = DictField(properties={
        "task":
        ArrayField(StringField(required=True), required=True, min_items=1),
        "supportsAdhoc":
        BooleanField(required=True),
        "subject":
        ArrayField(StringField(required=True), required=True, min_items=1),
        "category":
        ArrayField(StringField(required=True), required=True, min_items=1),
        "technology":
        ArrayField(DocumentField(Technology, as_ref=True),
                   required=True,
                   min_items=1),
        "drilldownUri":
        StringField(required=False),
        "sourcetype":
        StringField(required=False, pattern="^[a-zA-Z0-9:-_]+$", max_length=50)
    },
                               required=False)
    entity = ArrayField(DocumentField(AlertEntity, as_ref=True))
Esempio n. 5
0
class AlertEntity(DocumentWithoutAddProp):
    field = StringField(required=True, pattern="^\w+$")
    label = StringField(required=True, max_length=30)
    type = StringField(required=True,
                       enum=["text", "singleSelect", "checkbox", "radio", "singleSelectSplunkSearch"])
    help = StringField(max_length=200)
    defaultValue = OneOfField([
        NumberField(),
        StringField(max_length=250),
        BooleanField()
    ])
    required = BooleanField()
    search = StringField(max_length=200)
    valueField = StringField(max_length=200)
    labelField = StringField(max_length=200)
    options = DictField(
        properties={
            "items": ArrayField(DocumentField(ValueLabelPair, as_ref=True))
        }
    )
Esempio n. 6
0
class Response(Document):

    data = DictField(
        {
            'name': StringField(min_length=2, required=True),
            'url': UriField(),
            'main': BooleanField(default=False),
        },
        required=True)
    data_id = IntField()
    system = StringField(default='dev')
Esempio n. 7
0
class Request(Document):

    project_id = IntField(minimum=0, required=True)
    archived = BooleanField()
    include_stories = BooleanField()
Esempio n. 8
0
    class Parent(IntChild, StringChild):
        class Options(object):
            inheritance_mode = ONE_OF

        foo = BooleanField()
        bar = BooleanField()
Esempio n. 9
0
class OAuthFields(DocumentWithoutAddProp):
    oauth_field = StringField(max_length=100)
    label = StringField(max_length=100)
    field = StringField(max_length=100)
    help = StringField(max_length=200)
    encrypted = BooleanField()
Esempio n. 10
0
class Entity(DocumentWithoutAddProp):
    field = StringField(required=True, pattern="^\w+$")
    label = StringField(required=True, max_length=30)
    type = StringField(required=True,
                       enum=["custom", "text", "singleSelect", "checkbox", "multipleSelect", "radio", "placeholder", "oauth", "helpLink"])
    help = StringField(max_length=200)
    tooltip = StringField(max_length=250)
    defaultValue = OneOfField([
        NumberField(),
        StringField(max_length=250),
        BooleanField()
    ])
    options = DictField(
        properties={
            "disableSearch": BooleanField(),
            "autoCompleteFields": OneOfField([
                ArrayField(DictField(
                    properties={
                        "label": StringField(required=True, max_length=150),
                        "children": ArrayField(DocumentField(ValueLabelPair, as_ref=True), required=True)
                    }
                )),
                ArrayField(DocumentField(ValueLabelPair, as_ref=True))
            ]),
            "endpointUrl": StringField(max_length=350),
            "denyList": StringField(max_length=350),
            "allowList": StringField(max_length=350),
            "delimiter": StringField(max_length=1),
            "items": ArrayField(DocumentField(ValueLabelPair, as_ref=True)),
            "referenceName": StringField(max_length=250),
            "enable": BooleanField(),
            "placeholder": StringField(max_length=250),
            "display": BooleanField(),
            "labelField": StringField(max_length=250),
            "src": StringField(max_length=250),
            "defaultValue": StringField(max_length=250),
            "disableonEdit": BooleanField(),
            "basic": ArrayField(DocumentField(OAuthFields, as_ref=True)),
            "oauth": ArrayField(DocumentField(OAuthFields, as_ref=True)),
            "auth_type": ArrayField(StringField(max_length=100)),
            "auth_label": StringField(max_length=250),
            "oauth_popup_width": NumberField(),
            "oauth_popup_height": NumberField(),
            "oauth_timeout": NumberField(),
            "auth_code_endpoint": StringField(max_length=350),
            "access_token_endpoint": StringField(max_length=350),
            "text": StringField(max_length=50),
            "link": StringField()
        }
    )
    required = BooleanField()
    encrypted = BooleanField()
    # List of inbuilt field validator
    validators = ArrayField(AnyOfField([
        DocumentField(StringValidator, as_ref=True),
        DocumentField(NumberValidator, as_ref=True),
        DocumentField(RegexValidator, as_ref=True),
        DocumentField(EmailValidator, as_ref=True),
        DocumentField(Ipv4Validator, as_ref=True),
        DocumentField(UrlValidator, as_ref=True),
        DocumentField(DateValidator, as_ref=True)
    ]))