Skip to content

Commit

Permalink
restapi: adapt for pydantic >= 2
Browse files Browse the repository at this point in the history
  • Loading branch information
joergsteffens committed Sep 28, 2023
1 parent b376f3d commit caf1141
Showing 1 changed file with 8 additions and 23 deletions.
31 changes: 8 additions & 23 deletions restapi/bareos_restapi/models.py
@@ -1,6 +1,6 @@
# BAREOS - Backup Archiving REcovery Open Sourced
#
# Copyright (C) 2020-2021 Bareos GmbH & Co. KG
# Copyright (C) 2020-2023 Bareos GmbH & Co. KG
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of version three of the GNU Affero General Public
Expand All @@ -21,6 +21,7 @@
from enum import Enum
import pathlib
from typing import Optional, List
from typing_extensions import Annotated
from fastapi import Depends, FastAPI, HTTPException, status, Response, Path, Body, Query


Expand Down Expand Up @@ -68,12 +69,6 @@ def __bool__(self):
return self.name == "yes"


class bareosTime(str):
# TODO: define this, stuff like "20 days" or "1 months"
def __str__(self):
return self.name


class bareosReplaceOption(str, Enum):
"""
Replace option used by restore command
Expand All @@ -88,22 +83,12 @@ def __str__(self):
return self.name


class bareosSpeed(str):
# TODO: define this
def __str__(self):
return self.name


class bareosSize(str):
# TODO: define this. Samples: 300, 10G
def __str__(self):
return self.name


class bareosACL(str):
# TODO: define this.
def __str__(self):
return self.name
# TODO: define this. Samples: "20 days" or "1 months"
bareosTime = Annotated[str, Field()]
bareosSpeed = Annotated[str, Field()]
# TODO: define this. Samples: 300, 10G
bareosSize = Annotated[str, Field()]
bareosACL = Annotated[str, Field()]


class jobStatus(str, Enum):
Expand Down

0 comments on commit caf1141

Please sign in to comment.