2021-05-03 14:50:25 +00:00
|
|
|
from typing import Sequence
|
|
|
|
|
|
|
|
from jsonmodels import validators
|
2022-03-15 14:18:57 +00:00
|
|
|
from jsonmodels.fields import StringField, BoolField
|
2021-05-03 14:50:25 +00:00
|
|
|
from jsonmodels.models import Base
|
|
|
|
|
|
|
|
from apiserver.apimodels import ListField
|
|
|
|
|
|
|
|
|
|
|
|
class MetadataItem(Base):
|
|
|
|
key = StringField(required=True)
|
|
|
|
type = StringField(required=True)
|
|
|
|
value = StringField(required=True)
|
|
|
|
|
|
|
|
|
|
|
|
class DeleteMetadata(Base):
|
|
|
|
keys: Sequence[str] = ListField(str, validators=validators.Length(minimum_value=1))
|
|
|
|
|
|
|
|
|
|
|
|
class AddOrUpdateMetadata(Base):
|
|
|
|
metadata: Sequence[MetadataItem] = ListField(
|
|
|
|
[MetadataItem], validators=validators.Length(minimum_value=1)
|
|
|
|
)
|
2022-03-15 14:18:57 +00:00
|
|
|
replace_metadata = BoolField(default=False)
|