app.models package

Submodules

app.models.asset module

Asset model definition.

This module defines the Asset data model used to represent assets managed by the EDC Studio Backend. An asset is any data resource (HTTP or file-based) that can be published, transferred, or managed through the Eclipse Data Connector (EDC).

The model is implemented using Pydantic for data validation and type hinting, ensuring consistency across the API and MongoDB storage.

class app.models.asset.Asset(**data)

Bases: BaseModel

Represents an asset managed by the EDC Studio Backend.

This model defines the structure and metadata of a registered asset, including its identifier, type, and connection parameters.

Example

>>> asset = Asset(
...     asset_id="asset-001",
...     name="Weather Dataset",
...     content_type="application/json",
...     data_address_name="weather-data",
...     data_address_type="HttpData",
...     data_address_proxy=False,
...     base_url="https://data.server.com/weather",
...     edc="edc-provider-01"
... )
>>> print(asset.name)
Weather Dataset

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

asset_id: str

Unique identifier of the asset within EDC.

name: str

Human-readable name of the asset.

content_type: str

MIME type of the asset (e.g., application/json).

data_address_name: str

Name of the data address configured in EDC.

_abc_impl = <_abc._abc_data object>
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

data_address_type: Literal['HttpData', 'File']

Type of data address (HttpData or File).

data_address_proxy: bool

Whether the data address uses proxying.

base_url: str

Base URL or path where the asset is located.

edc: str

Identifier of the EDC connector associated with the asset.

app.models.connector module

Connector model definition.

This module defines the data models related to EDC connectors. A connector represents an Eclipse Data Connector (EDC) instance that can act as a provider or consumer of data assets. Each connector includes network port configurations, endpoint URLs, authentication information, and operational state.

The models are implemented using Pydantic for data validation, type hinting, and JSON serialization, ensuring consistency across the EDC Studio Backend.

class app.models.connector.PortConfig(**data)

Bases: BaseModel

Defines the port configuration for an EDC connector instance.

Each connector uses multiple ports for communication across control, protocol, and management interfaces.

Example

>>> ports = PortConfig(
...     http=8181,
...     management=8182,
...     protocol=8183,
...     control=8184,
...     public=8185,
...     version=1
... )

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

http: int

Port used for the HTTP interface.

management: int

Port used for the management API.

protocol: int

Port used for the data transfer protocol.

control: int

Port used for control-plane communication.

public: int

Publicly accessible port of the connector.

version: int

Version number of the port configuration.

_abc_impl = <_abc._abc_data object>
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class app.models.connector.Endpoints(**data)

Bases: BaseModel

Defines the accessible endpoints of an EDC connector.

These endpoints represent the URLs exposed by the connector for management and data exchange operations.

Example

>>> endpoints = Endpoints(
...     management="http://localhost:8182/api/v1/management",
...     protocol="http://localhost:8183/api/v1/protocol"
... )

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

management: str

Management API endpoint URL.

protocol: Optional[str]

Protocol endpoint URL (optional).

_abc_impl = <_abc._abc_data object>
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class app.models.connector.Connector(**data)

Bases: BaseModel

Represents an Eclipse Data Connector (EDC) instance.

A connector can operate as a provider or consumer of data, depending on its assigned type. It may run locally (managed mode) or remotely (remote mode), and exposes endpoints for communication.

Example

>>> connector = Connector(
...     name="EDC Provider 01",
...     description="Primary provider connector",
...     type="provider",
...     state="running",
...     mode="managed",
...     ports=PortConfig(http=8181, management=8182, protocol=8183, control=8184, public=8185, version=1),
...     endpoints_url=Endpoints(
...         management="http://localhost:8182/api/v1/management",
...         protocol="http://localhost:8183/api/v1/protocol"
...     ),
...     domain="localhost"
... )
>>> print(connector.name)
EDC Provider 01

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

_abc_impl = <_abc._abc_data object>
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

name: str

Human-readable name of the connector.

description: Optional[str]

Optional text description of the connector.

type: Literal['provider', 'consumer']

Connector role within the EDC ecosystem (provider or consumer).

ports: Optional[PortConfig]

Port configuration for this connector (optional).

api_key: Optional[str]

Authentication key used to secure management API access.

state: Literal['running', 'stopped']

Operational state of the connector (running or stopped).

mode: Literal['managed', 'remote']

Execution mode of the connector (managed = local, remote = external).

endpoints_url: Optional[Endpoints]

URLs for management and protocol endpoints (optional).

domain: Optional[str]

Network domain or hostname where the connector is accessible.

app.models.contract module

Contract model definition.

This module defines the Contract data model, which represents a contract definition within the Eclipse Data Connector (EDC) framework. Contracts specify the policies that govern data access and usage between connectors, linking assets with associated policy definitions.

The model follows the EDC specification and uses Pydantic for type validation and serialization.

class app.models.contract.Contract(**data)

Bases: BaseModel

Represents a contract definition in the EDC ecosystem.

A contract links assets with access and contract policies, defining the rules under which data can be exchanged between provider and consumer connectors. Each contract is identified by a unique contract_id and associated with a specific EDC connector.

Example

>>> contract = Contract(
...     edc="edc-provider-01",
...     contract_id="contract-1234",
...     accessPolicyId="policy-access-001",
...     contractPolicyId="policy-contract-001",
...     assetsSelector=["asset-001", "asset-002"]
... )
>>> print(contract.contract_id)
contract-1234

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

edc: str

Identifier of the EDC connector associated with this contract.

contract_id: str

Unique identifier of the contract definition.

accessPolicyId: str

Identifier of the access policy that regulates data access.

_abc_impl = <_abc._abc_data object>
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

contractPolicyId: str

Identifier of the contract policy that defines usage conditions.

assetsSelector: List[str]

List of asset identifiers included in this contract.

context: Dict[str, str]

JSON-LD context used for EDC vocabulary resolution.

app.models.policy module

Policy model definition.

This module defines the data models that represent access and usage policies in the Eclipse Data Connector (EDC) ecosystem. Policies are based on the ODRL (Open Digital Rights Language) specification and describe permissions, prohibitions, and obligations that regulate how data can be used and shared between connectors.

The models follow a hierarchical structure: - Operator: defines the comparison operator in a constraint. - Constraint: specifies a condition (e.g., leftOperand, operator, rightOperand). - Rule: represents a single permission, prohibition, or obligation. - PolicyDefinition: groups rules into a complete ODRL policy. - Policy: top-level model that associates a policy definition with a specific EDC.

class app.models.policy.Operator(**data)

Bases: BaseModel

Represents a logical or comparison operator used in constraints.

Example

>>> operator = Operator(id="EQ")

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

id: str

Identifier of the operator (e.g., ‘EQ’, ‘NEQ’, ‘GT’, ‘LT’).

_abc_impl = <_abc._abc_data object>
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class app.models.policy.Constraint(**data)

Bases: BaseModel

Defines a constraint that applies to a policy rule.

A constraint expresses a conditional restriction or requirement on the application of a rule (e.g., “purpose EQ research”).

Example

>>> constraint = Constraint(
...     leftOperand="purpose",
...     operator=Operator(id="EQ"),
...     rightOperand="research"
... )

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

leftOperand: str

Left operand of the constraint (e.g., ‘purpose’, ‘spatial’).

operator: Operator

Operator defining the relationship between operands.

rightOperand: str

Right operand or value of the constraint.

_abc_impl = <_abc._abc_data object>
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class app.models.policy.Rule(**data)

Bases: BaseModel

Defines a single rule in a policy (permission, prohibition, or obligation).

Example

>>> rule = Rule(
...     action="USE",
...     constraint=[
...         Constraint(
...             leftOperand="purpose",
...             operator=Operator(id="EQ"),
...             rightOperand="research"
...         )
...     ]
... )

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

action: Literal['USE', 'READ', 'WRITE', 'MODIFY', 'DELETE', 'LOG', 'NOTIFY', 'ANONYMIZE']

Type of action that the rule allows, forbids, or obliges.

constraint: Optional[List[Constraint]]

Optional list of constraints associated with this rule.

_abc_impl = <_abc._abc_data object>
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class app.models.policy.PolicyDefinition(**data)

Bases: BaseModel

Defines the complete structure of an ODRL policy.

Each policy definition may include permissions, prohibitions, and obligations, along with metadata such as context and type.

Example

>>> policy_def = PolicyDefinition(
...     permission=[
...         Rule(action="USE")
...     ],
...     context="http://www.w3.org/ns/odrl.jsonld",
...     type="Set"
... )

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

permission: Optional[List[Rule]]

List of allowed actions under this policy.

prohibition: Optional[List[Rule]]

List of forbidden actions under this policy.

_abc_impl = <_abc._abc_data object>
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

obligation: Optional[List[Rule]]

List of required actions under this policy.

context: str

JSON-LD context for ODRL policy definitions.

type: str

Type of policy according to ODRL (‘Set’ by default).

class app.models.policy.Policy(**data)

Bases: BaseModel

Represents a top-level EDC policy entity.

A policy associates an EDC connector with a policy definition, establishing the rules and constraints for data access and usage.

Example

>>> policy = Policy(
...     edc="edc-provider-01",
...     policy_id="policy-001",
...     policy=PolicyDefinition(permission=[Rule(action="USE")])
... )
>>> print(policy.policy_id)
policy-001

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

_abc_impl = <_abc._abc_data object>
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

edc: str

Identifier of the EDC connector associated with this policy.

policy_id: str

Unique identifier of the policy.

policy: PolicyDefinition

Full policy definition containing permissions, prohibitions, and obligations.

context: dict

JSON-LD context used for EDC policy vocabulary resolution.

app.models.transfer module

Transfer model definition.

This module defines the Transfer data model used to represent data transfer processes between EDC connectors. Each transfer links a provider and consumer connector, an asset, and the associated contractual and policy information required to perform the exchange.

Transfers may occur in push or pull mode, depending on which connector initiates the data movement.

class app.models.transfer.Transfer(**data)

Bases: BaseModel

Represents a data transfer process between EDC connectors.

A transfer defines the relationship between the provider and consumer connectors, the asset being transferred, and the contractual context that authorizes the exchange.

Example

>>> transfer = Transfer(
...     consumer="edc-consumer-01",
...     provider="edc-provider-01",
...     asset="asset-001",
...     has_policy_id="policy-001",
...     negotiate_contract_id="contract-req-001",
...     contract_agreement_id="agreement-001",
...     transfer_process_id="transfer-123",
...     transfer_flow="push",
...     authorization="Bearer <token>",
...     endpoint="http://localhost:8282/api/v1/data"
... )
>>> print(transfer.transfer_flow)
push

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

consumer: str

Identifier of the consumer EDC connector involved in the transfer.

provider: str

Identifier of the provider EDC connector supplying the asset.

asset: str

Identifier of the asset being transferred.

has_policy_id: str

Identifier of the policy that governs this transfer.

negotiate_contract_id: str

Identifier of the negotiation process that led to this transfer.

_abc_impl = <_abc._abc_data object>
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

contract_agreement_id: str

Identifier of the finalized contract agreement for the transfer.

transfer_process_id: str

Unique identifier of the transfer process in EDC.

transfer_flow: Literal['push', 'pull']

Direction of the data flow: - push: the provider sends the data. - pull: the consumer retrieves the data.

authorization: Optional[str]

Optional authorization token used for secure data access.

endpoint: Optional[str]

Optional endpoint URL used for data delivery or retrieval.

Module contents