<commit_before>from django.db import models
from django.contrib import admin


class Cluster(models.Model):

    name = models.CharField(max_length=64, primary_key=True, blank=False)
    master_node = models.CharField(max_length=128, null=True, blank=True)
    rest_username = models.CharField(max_length=32, blank=False)
    rest_password = models.CharField(max_length=64, blank=False)
    description = models.CharField(max_length=1024, null=True, blank=True)

    def __str__(self):
        return self.name

    class Admin:
        pass


class Server(models.Model):

    class Meta:
        unique_together = ["address", "cluster"]

    cluster = models.ForeignKey('Cluster')
    address = models.CharField(max_length=80, blank=False)
    ssh_username = models.CharField(max_length=32, blank=True)
    ssh_password = models.CharField(max_length=64, blank=True)
    ssh_key = models.CharField(max_length=4096, blank=True)
    description = models.CharField(max_length=1024, blank=True)

    def __str__(self):
        return self.address

    class Admin:
        pass


class BucketType(models.Model):

    type = models.CharField(max_length=9, primary_key=True)

    def __str__(self):
        return self.type

    class Admin:
        pass


class Bucket(models.Model):

    class Meta:
        unique_together = ["name", "cluster"]

    name = models.CharField(max_length=32, default="default")
    cluster = models.ForeignKey("Cluster")
    type = models.ForeignKey("BucketType", blank=True, null=True)
    port = models.IntegerField(default=11211, null=True, blank=True)
    password = models.CharField(max_length=64, blank=True)

    def __str__(self):
        return self.name

    class Admin:
        pass


class ObservableType(models.Model):

    type = models.CharField(max_length=6, primary_key=True)

    def __str__(self):
        return self.type

    class Admin:
        pass


class Observable(models.Model):

    class Meta:
        unique_together = ["name", "cluster", "server", "bucket"]

    name = models.CharField(max_length=128)
    type = models.ForeignKey(ObservableType)
    unit = models.CharField(max_length=16, null=True, blank=True)
    description = models.CharField(max_length=1024, null=True, blank=True)
    cluster = models.ForeignKey("Cluster")
    server = models.ForeignKey("Server", null=True, blank=True)
    bucket = models.ForeignKey("Bucket", null=True, blank=True)
    collector = models.CharField(max_length=32)

    def __str__(self):
        return self.name

    class Admin:
        pass


class Snapshot(models.Model):

    name = models.CharField(max_length=256, primary_key=True, blank=False)
    ts_from = models.DateTimeField()
    ts_to = models.DateTimeField()
    description = models.CharField(max_length=1024, null=True, blank=True)
    cluster = models.ForeignKey("Cluster")

    def __str__(self):
        return self.name

    class Admin:
        pass


class ReportType(models.Model):

    name = models.CharField(max_length=64, primary_key=True)

    def __str__(self):
        return self.name

    class Admin:
        pass


admin.site.register(Cluster)
admin.site.register(Server)
admin.site.register(Bucket)
admin.site.register(Observable)<commit_msg>allow to manage snapshot and report types<commit_after>from django.db import models
from django.contrib import admin


class Cluster(models.Model):

    name = models.CharField(max_length=64, primary_key=True, blank=False)
    master_node = models.CharField(max_length=128, null=True, blank=True)
    rest_username = models.CharField(max_length=32, blank=False)
    rest_password = models.CharField(max_length=64, blank=False)
    description = models.CharField(max_length=1024, null=True, blank=True)

    def __str__(self):
        return self.name

    class Admin:
        pass


class Server(models.Model):

    class Meta:
        unique_together = ["address", "cluster"]

    cluster = models.ForeignKey('Cluster')
    address = models.CharField(max_length=80, blank=False)
    ssh_username = models.CharField(max_length=32, blank=True)
    ssh_password = models.CharField(max_length=64, blank=True)
    ssh_key = models.CharField(max_length=4096, blank=True)
    description = models.CharField(max_length=1024, blank=True)

    def __str__(self):
        return self.address

    class Admin:
        pass


class BucketType(models.Model):

    type = models.CharField(max_length=9, primary_key=True)

    def __str__(self):
        return self.type

    class Admin:
        pass


class Bucket(models.Model):

    class Meta:
        unique_together = ["name", "cluster"]

    name = models.CharField(max_length=32, default="default")
    cluster = models.ForeignKey("Cluster")
    type = models.ForeignKey("BucketType", blank=True, null=True)
    port = models.IntegerField(default=11211, null=True, blank=True)
    password = models.CharField(max_length=64, blank=True)

    def __str__(self):
        return self.name

    class Admin:
        pass


class ObservableType(models.Model):

    type = models.CharField(max_length=6, primary_key=True)

    def __str__(self):
        return self.type

    class Admin:
        pass


class Observable(models.Model):

    class Meta:
        unique_together = ["name", "cluster", "server", "bucket"]

    name = models.CharField(max_length=128)
    type = models.ForeignKey(ObservableType)
    unit = models.CharField(max_length=16, null=True, blank=True)
    description = models.CharField(max_length=1024, null=True, blank=True)
    cluster = models.ForeignKey("Cluster")
    server = models.ForeignKey("Server", null=True, blank=True)
    bucket = models.ForeignKey("Bucket", null=True, blank=True)
    collector = models.CharField(max_length=32)

    def __str__(self):
        return self.name

    class Admin:
        pass


class Snapshot(models.Model):

    name = models.CharField(max_length=256, primary_key=True, blank=False)
    ts_from = models.DateTimeField()
    ts_to = models.DateTimeField()
    description = models.CharField(max_length=1024, null=True, blank=True)
    cluster = models.ForeignKey("Cluster")

    def __str__(self):
        return self.name

    class Admin:
        pass


class ReportType(models.Model):

    name = models.CharField(max_length=64, primary_key=True)

    def __str__(self):
        return self.name

    class Admin:
        pass


admin.site.register(Cluster)
admin.site.register(Server)
admin.site.register(Bucket)
admin.site.register(Observable)
admin.site.register(Snapshot)
admin.site.register(ReportType)
{'fraction_non_alphanumeric': 0.11107720476045163, 'fraction_numerical': 0.017699115044247787, 'mean_word_length': 3.692197566213314, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2237296', 'n_tokens_mistral': 2124, 'n_tokens_neox': 1968, 'n_words': 405}