class VlanPortSchema(ma.ModelSchema): class Meta: model = models.VlanPort fields = ('id', 'vlan_num', 'name', 'description', 'shutdown', 'mtu', 'access_group_in', 'access_group_out', 'ip_redirect', 'ip_proxy_arp', 'unicast_reverse_path_forwarding', 'load_interval', 'mpls_ip', 'access_on_port', 'trunk_on_port', 'trunk_native_on_port', 'box', '_links') class PortSchema(ma.ModelSchema): class Meta: model = models.Port fields = ('_links', ) _links = ma.Hyperlinks({ 'self': ma.URLFor('show_port', box_id='<box_id>', id='<id>'), 'collection': ma.URLFor('show_ports', box_id='<box_id>') }) class BoxSchema(ma.ModelSchema): class Meta: model = models.Box fields = ('_links', ) _links = ma.Hyperlinks({ 'self': ma.URLFor('show_box', id='<id>'), 'collection': ma.URLFor('show_boxen') }) _links = ma.Hyperlinks({ 'self': ma.URLFor('show_vlan_port', box_id='<box_id>', port_id='<port_id>', role='<role>', id='<id>'), 'collection': ma.URLFor('show_vlan_ports', box_id='<box_id>', port_id='<port_id>', role='<role>') }) access_on_port = ma.Nested(PortSchema) trunk_on_port = ma.Nested(PortSchema) trunk_native_on_port = ma.Nested(PortSchema) box = ma.Nested(BoxSchema)
class VlanPortsSchema(ma.ModelSchema): class Meta: fields = ('members', 'count', '_links') class VlanPortSchema(ma.ModelSchema): class Meta: model = models.VlanPort fields = ('_links', ) _links = ma.Hyperlinks({ 'self': ma.URLFor('show_vlan_port', box_id='<box_id>', port_id='<port_id>', role='<role>', id='<id>') }) members = ma.Nested(VlanPortSchema, many=True) _links = ma.Hyperlinks({ 'self': ma.URLFor('show_vlan_ports', box_id='<box_id>', port_id='<port_id>', role='<role>') })
class BoxenSchema(ma.ModelSchema): class Meta: fields = ('members', 'count', '_links') class BoxSchema(ma.ModelSchema): class Meta: model = models.Box fields = ('vendor', 'model', 'version', 'uuid', '_links') _links = ma.Hyperlinks({'self': ma.URLFor('show_box', id='<id>')}) members = ma.Nested(BoxSchema, many=True) _links = ma.Hyperlinks({'self': ma.URLFor('show_boxen')})
class RoutesSchema(ma.ModelSchema): class Meta: fields = ('members', 'count', '_links') class RouteSchema(ma.ModelSchema): class Meta: model = models.Route fields = ('_links', ) _links = ma.Hyperlinks( {'self': ma.URLFor('show_route', box_id='<box_id>', id='<id>')}) members = ma.Nested(RouteSchema, many=True) _links = ma.Hyperlinks( {'self': ma.URLFor('show_routes', box_id='<box_id>')})
class CredentialsSchema(ma.ModelSchema): class Meta: fields = ('members', 'count', '_links') class CredentialSchema(ma.ModelSchema): class Meta: model = models.Credential fields = ('_links', ) _links = ma.Hyperlinks({ 'self': ma.URLFor('show_credential', box_id='<box_id>', id='<id>') }) members = ma.Nested(CredentialSchema, many=True) _links = ma.Hyperlinks( {'self': ma.URLFor('show_credentials', box_id='<box_id>')})