class ReservedVirtualNetworkAttributes(Schema): bandwidth = fields.Number(required=True, description='Minimum network bitrate (in Mbps).') networkType = fields.Str( required=True, description='The type of network that maps to the virtualised network ' 'that has been reserved. Examples are: "local", "vlan", ' '"vxlan", "gre", etc.') segmentType = fields.Str( required=True, description='The isolated segment for the virtualised network that ' 'has been reserved. For instance, for a "vlan" ' 'networkType, it corresponds to the vlan identifier; and ' 'for a "gre" networkType, this corresponds to a gre key.') isShared = fields.Bool( required=True, description='It defines whether the virtualised network that has been ' 'reserved is shared among consumers.') metadata = fields.Nested( KeyValuePair, many=True, description='List of metadata key-value pairs used by the consumer to ' 'associate meaningful metadata to the related virtualised ' 'resource.')
class GrapheSchema(Schema): """ A graphe is composed of nodes and edges """ end_points = fields.List(fields.Str(), required=True, description="End points of the graphe") hotpoints = fields.List(fields.Str(), required=True, description="The hotpoint of the graphe") nodes = fields.Nested(NodeSchema, many=True, required=True) edges = fields.Nested(EdgeSchema, many=True, required=True) @post_load def make_graphe(self, data): graphe = Graphe("GrapheFromApiRest") graphe.endpoints = data["end_points"] graphe.hotpoints = data["hotpoints"] graphe.nodes = {d.name: d for d in data["nodes"]} graphe.edges = { Edge._compute_name(d.source, d.dest): d for d in data["edges"] } for node_name, node in graphe.nodes.items(): for name, edge in graphe.edges.items(): if node_name == edge.source or node_name == edge.dest: node.edges.append(edge) return graphe @pre_dump def graphe_helper(self, data): return DummyGraphe([d for d in data.nodes.values()], [e for e in data.edges.values()], data.end_points, data.hotpoints)
class VirtualMemoryResourceInformation(Schema): virtualMemSize = fields.Number( required=True, description='Amount of virtual memory (e.g. in MB). Cardinality "1" ' 'covers the case where a specific configuration for the ' 'consumable resource is advertised.') virtualMemOversubscriptionPolicy = fields.Str( required=True, description='The memory core oversubscription policy in terms of ' 'virtual memory to physical memory on the platform. The ' 'cardinality can be 0 if no concrete policy is defined.') numaSupported = fields.Bool( required=True, description='It specifies if the memory allocation can be cognisant ' 'of the relevant process/core allocation.')
class VirtualStorage(Schema): """VirtualStorage. The VirtualStorage information element encapsulates information of an instantiated virtualised storage resource. """ storageId = fields.Str( required=True, description='Identifier of the virtualised storage resource.') storageName = fields.Str( required=True, description='Name of the virtualised storage resource.') flavourId = fields.Str( required=True, description='Identifier of the storage flavour used to instantiate ' 'this virtual storage.') typeOfStorage = fields.Str( required=True, description='Type of virtualised storage resource (e.g. volume, ' 'object).') sizeOfStorage = fields.Number( required=True, description='Size of virtualised storage resource (e.g. size of ' 'volume, in GB).') # rdmaEnabled = fields.Bool(description='Indicates if the storage ' # 'supports RDMA.') ownerId = fields.Str( required=True, description='Identifier of the virtualised resource that owns and ' 'uses such a virtualised storage resource. The value can ' 'be NULL if the virtualised storage is not attached yet ' 'to any other resource (e.g. a virtual machine).') zoneId = fields.Str( required=True, description='If present, it identifies the Resource Zone where the ' 'virtual storage resources have been allocated.') hostId = fields.Str( required=True, description='Identifier of the host where the virtualised storage ' 'resource is allocated. A cardinality of 0 refers to ' 'distributed storage solutions.') operationalState = fields.Str( required=True, description='Operational state of the resource.')
class HandoverSpec(Schema): handover_token = fields.UUID(metadata={'description': 'Handover Token UID', 'example': '3729-jhshs-12929-1mssn'}, required=True) src_uri = fields.Str(metadata={'description': 'Mysql Source URI', 'example': 'mysql://*****:*****@host:3366/dbname'}, required=True) database = fields.Str(metadata={'description': 'Database to handover', 'example': 'malus_domestica_golden_variation_52_105_1'}, required=True) contact = fields.Str(metadata={'description': 'user email id', 'example': '*****@*****.**'}, required=True) comment = fields.Str(metadata={'description': 'user comment', 'example': 'Handover homosapiens for release 105'}, required=True) source = fields.Str(metadata={'description': 'source ', 'example': 'Handover source'}, default='Handover') tgt_uri = fields.Str(metadata={'description': 'Target source db ', 'example': 'mysql://*****:*****@mysql-ens-sta-3-b:port/malus_domestica_golden_variation_52_105_1'}) staging_uri = fields.Str(metadata={'description': 'stating URI ', 'example': 'mysql://*****:*****@mysql-ens-sta-3-b:port/'}) db_division = fields.Str(metadata={'description': 'Division of handover database', 'example': 'plants'}, required=True) db_type = fields.Str(metadata={'description': 'Database type ', 'example': 'core'}, required=True) ENS_VERSION = fields.Int(metadata={'description': 'Ensembl release number', 'example': '105'}, required=True) EG_VERSION = fields.Int(metadata={'description': 'Ensembl Genomes release number', 'example': '52'}, required=True) RR_VERSION = fields.Int(metadata={'description': 'Rapid Release number', 'example': '24'}, required=True)
class NodeSchema(Schema): """ A node """ id = fields.Str(required=True, default="140-42", description="The id of the node") x = fields.Float(required=True, default=48.399626, description="latitude in meter") y = fields.Float(required=True, default=-4.472394, description="longitude in meter") z = fields.Float(required=True, default=1.2, description="altitude in meter") data = fields.Dict(description="Some information about the node") @post_load def make_node(self, data): return Node(data["id"], point=Point(data["x"], data["y"], data["z"]), data=data["data"]) @pre_dump def node_helper2(self, data): class ALACON: def __init__(self, id, x, y, z, data): self.id = id self.x = x self.y = y self.z = z self.data = data return ALACON(data.name, data.x, data.y, data.z, data.data) @post_dump def node_helper(self, data): if "data" not in data: data["data"] = {} return data
class ReservedComputePool(Schema): numCpuCores = fields.Int( required=True, description='Number of CPU cores that have been reserved.') numVcInstances = fields.Int( required=True, description='Number of virtual container instances that have been ' 'reserved.') virtualMemSize = fields.Number( required=True, description='Size of virtual memory that has been reserved.') computeAttributes = fields.Nested( ReservedVirtualComputeAttributes, required=True, description='Information specifying additional attributes of the ' 'virtual compute resource that have been reserved.') zoneId = fields.Str( required=True, description='References the resource zone where the virtual compute ' 'resources have been reserved. Cardinality can be 0 to ' 'cover the case where reserved compute resources are not ' 'bound to a specific resource zone.')
class NetworkSubnet(Schema): resourceId = fields.Str( required=True, description='Identifier of the virtualised sub-network.') networkId = fields.Str( required=True, description='The identifier of the virtualised network that the ' 'virtualised sub-network is attached to. The cardinality ' 'can be 0 to cover the case where this type is used to ' 'describe the L3 attributes of a network rather than a ' 'subnetwork.') ipVersion = fields.Str( required=True, description='The IP version of the network/subnetwork.') gatewayIp = fields.Str( IPAddress, required=True, description='The IP address of the network/subnetwork gateway.') cidr = fields.Str( required=True, description='The CIDR of the network/subnetwork, i.e. network address ' 'and subnet mask.') isDhcpEnabled = fields.Bool( required=True, description='True when DHCP is enabled for this network/subnetwork, ' 'or false otherwise.') addressPool = fields.Str( required=True, description='Address pools for the network/subnetwork. The ' 'cardinality can be 0 when VIM is allowed to allocate all ' 'addresses in the CIDR except for the address of the ' 'network/subnetwork gateway.') operationalState = fields.Str( required=True, description='The operational state of the virtualised sub-network.') metadata = fields.Nested( KeyValuePair, required=False, many=True, description='List of metadata key-value pairs used by the consumer ' 'to associate meaningful metadata to the related ' 'virtualised resource.')
class VirtualNetworkQuota(Schema): resourceGroupId = fields.Str( required=True, description='Unique identifier of the "infrastructure resource ' 'group", logical grouping of virtual resources assigned ' 'to a tenant within an Infrastructure Domain.') numPublicIps = fields.Int( required=True, description='Number of public IP addresses that have been restricted ' 'by the quota. The cardinality can be 0 if no specific ' 'number of public IP addresses has been requested to be ' 'restricted by the quota.') numPorts = fields.Int( required=True, description='Number of ports that have been restricted by the quota. ' 'The cardinality can be 0 if no specific number of ports ' 'has been requested to be restricted by the quota.') numSubnets = fields.Int( required=True, description='Number of subnets that have been restricted by the ' 'quota. The cardinality can be 0 if no specific number of ' 'subnets has been requested to be restricted by the ' 'quota.')
class VirtualComputeQuota(Schema): resourceGroupId = fields.Str( required=True, description='Unique identifier of the "infrastructure resource ' 'group", logical grouping of virtual resources assigned ' 'to a tenant within an Infrastructure Domain.') numVCPUs = fields.Int( required=True, description='Number of CPU cores that have been restricted by the ' 'quota. The cardinality can be 0 if no specific number of ' 'CPU cores has been requested to be restricted by the ' 'quota.') numVcInstances = fields.Int( required=True, description='Number of virtualisation container instances that have ' 'been restricted by the quota. The cardinality can be 0 ' 'if no specific number of CPU cores has been requested to ' 'be restricted by the quota.') virtualMemSize = fields.Number( required=True, description='Size of virtual memory that has been restricted by the ' 'quota. The cardinality can be 0 if no specific number of ' 'CPU cores has been requested to be restricted by the ' 'quota.')
class VirtualNetworkPort(Schema): resourceId = fields.Str( required=True, description='Identifier of the virtual network port.') networkId = fields.Str( required=True, description='Identifier of the network that the port belongs to. When ' 'creating a port, such port needs to be part of a ' 'network.') attachedResourceId = fields.Str( required=True, description='Identifier of the attached resource to the network port ' '(e.g. a virtualised compute resource, or identifier of ' 'the virtual network interface). The cardinality can be ' '"0" if there is no specific resource connected to the ' 'network port.') portType = fields.Str( required=True, description='Type of network port. Examples of types are access ports ' '(layer 2 or 3), or trunk ports (layer 1) that become ' 'transport for multiple layer 2 or layer 3 networks.') segmentId = fields.Str( required=True, description='The isolated segment the network port belongs to. For ' 'instance, for a "vlan", it corresponds to the vlan ' 'identifier; and for a "gre", this corresponds to a gre ' 'key. The cardinality can be "0" for flat networks ' 'without any specific segmentation.') bandwidth = fields.Number( required=True, description='The bandwidth of the virtual network port (in Mbps). ' 'Cardinality can be "0" for virtual network ports without ' 'any specific allocated bandwidth.') operationalState = fields.Str( required=True, description='The operational state of the virtual network port.') metadata = fields.Nested( KeyValuePair, required=False, many=True, description='List of metadata key-value pairs used by the consumer ' 'to associate meaningful metadata to the related ' 'virtualised resource.')
class CallbackPayload(Schema): url = fields.Str()
class Task(Schema): state = fields.Str() queue = fields.Str() key = fields.Str() task_data = TaskData
class HubVersion(Schema): version = fields.Str()
class DataFact(Schema): dag_json = fields.Str() data_json = fields.Str()
class Status(Schema): status = fields.Str()
class PetSchema(Schema): category = fields.Nested(CategorySchema, many=True) name = fields.Str()
class CategorySchema(Schema): id = fields.Int() name = fields.Str(required=True)
class TokenSchema(ma.Schema): access_token = fields.Str() token_type = fields.Str() expires_in = fields.Integer()
class Palette(Schema): pallete_name = fields.Str() colors = fields.Nested(Color, many=True)
class User(Schema): username = fields.Str(required=True) age = fields.Int(required=True, min=18) tags = fields.List(fields.Str())
class Color(Schema): name = fields.Str()
class QueueList(Schema): queues = fields.Nested(fields.Str(), many=True)
class LogEntry(Schema): message = fields.Str()
class KeyValuePair(Schema): key = fields.Str(required=True) value = fields.Str(required=True)
class NetworkQoS(Schema): qosName = fields.Str(required=True, description='Name given to the QoS parameter.') qosValue = fields.Str(required=True, description='Value of the QoS parameter.')
class QueueLogEntry(Schema): state = fields.Str() task_key = fields.Str()
class User(Schema): username = fields.Str(required=True, default="Sirius Black") # wrong default "180" to force validation error age = fields.Int(required=True, min=18, default="180") tags = fields.List(fields.Str(), default=["wizard", "hogwarts", "dead"])
class AllocateNetworkRequest(Schema): networkResourceName = fields.Str( required=True, description='Name provided by the consumer for the virtualised ' 'network resource to allocate. It can be used for ' 'identifying resources from consumer side.') reservationId = fields.Str( required=True, description='Identifier of the resource reservation applicable to ' 'this virtualised resource management operation.') networkResourceType = fields.Str( required=True, description='Type of virtualised network resource. Possible values ' 'are: "network", "subnet" or network-port.') typeNetworkData = fields.Nested( VirtualNetworkData, required=True, description='The network data provides information about the ' 'particular virtual network resource to create. ' 'Cardinality can be "0" depending on the value of ' 'networkResourceType.', ) typeNetworkPortData = fields.Nested( VirtualNetworkPortData, required=True, description='The network port data provides information about the ' 'particular network port to create. Cardinality can be "0" depending ' 'on the value of networkResourceType.', ) typeSubnetData = fields.Nested( NetworkSubnetData, required=True, description='The subnet data provides information about the particular ' 'sub-network resource to create. Cardinality can be "0" depending on the ' 'value of networkResourceType.', ) affinityOrAntiAffinityConstraints = fields.Nested( AffinityOrAntiAffinityConstraint, many=True, required=True, description= 'A list of element with affinity or anti affinity information ' 'of the virtualised network resource to allocate. All the listed constraints ' ' shall be fulfilled for a successful operation.', ) metadata = fields.Nested( KeyValuePair, required=False, many=True, description='List of metadata key-value pairs used by the consumer ' 'to associate meaningful metadata to the related ' 'network ressource.') resourceGroupId = fields.Str( required=True, description='Unique identifier of the "infrastructure resource ' 'group", logical grouping of virtual resources assigned ' 'to a tenant within an Infrastructure Domain.') locationConstraints = fields.Str( required=True, description='Controls the visibility of the image. In case of ' '"private" value the image is available only for the ' 'tenant assigned to the provided resourceGroupId and the ' 'administrator tenants of the VIM while in case of ' '"public" value, all tenants of the VIM can use the ' 'image.')
class LuggageItemSchema(Schema): luggage_type = fields.Str() weight_in_lbs = fields.Number()