50 lines
915 B
Python
50 lines
915 B
Python
#!/usr/bin/env python3
|
|
from marshm import ma
|
|
from marshmallow import fields
|
|
|
|
|
|
"""
|
|
Schemas of api objects
|
|
"""
|
|
|
|
|
|
__author__ = "@tormakris"
|
|
__copyright__ = "Copyright 2021, KMLabz Team"
|
|
__module_name__ = "schemas"
|
|
__version__text__ = "1"
|
|
|
|
|
|
class ServiceSchema(ma.Schema):
|
|
"""
|
|
Parameters:
|
|
- location (ipv4)
|
|
- zone (string)
|
|
"""
|
|
|
|
location = fields.String(required=True)
|
|
zone = fields.String(required=True)
|
|
|
|
|
|
class ServiceDirectorySchema(ma.Schema):
|
|
"""
|
|
Parameters:
|
|
- name (string)
|
|
- id (uuid)
|
|
"""
|
|
|
|
name = fields.String(required=True)
|
|
id = fields.String(required=True)
|
|
|
|
|
|
class ServiceLocatorSchema(ma.Schema):
|
|
"""
|
|
Parameters:
|
|
- name (string)
|
|
- id (uuid)
|
|
- servicearray (object)
|
|
"""
|
|
|
|
name = fields.String(required=True)
|
|
id = fields.String(required=True)
|
|
servicearray = fields.Nested(ServiceSchema, many=True, required=True)
|