| 1 | # Data Plane API |
| 2 | |
| 3 | This extension provides the interfaces and implementations for the Data Plane API, which are respectively: |
| 4 | |
| 5 | - the Control API which is used by the Control Plane to delegate the data transfer to its Data Plane, |
| 6 | - the Public API which is essentially a data proxy enabling a consumer to actively query data out from the provider data source. |
| 7 | |
| 8 | ### Scope |
| 9 | |
| 10 | These APIs have been designed to support the different data transfer types that the Data Plane must support, which are: |
| 11 | |
| 12 | - Consumer Data Pull: the consumer backend applications use the Data Plane to proxy data request until the provided data source. |
| 13 | This data transfer type is exclusively built around the Public API of the Data Plane. |
| 14 | - Provider Push and Streaming: once contract is agreed by both participants, the Control Plane of the provider delegates |
| 15 | the data transfer to its Data Plane through the Control API. |
| 16 | |
| 17 | ### Use Cases |
| 18 | |
| 19 | #### Use Case #1 |
| 20 | |
| 21 | Provider wants to expose a Rest API taking as input some query parameters that restrict the amount of data returned for each query. |
| 22 | Here it is not feasible for the data consumer to negotiate a contract for each query that will hit the provider data source API. |
| 23 | Here the approach for the consumer would then be to |
| 24 | [negotiate with the provider the possibility to access the data source through a proxy](../../control-plane/data-plane-transfer/data-plane-transfer-sync/). |
| 25 | If the negotiation ends successfully, the consumer will be provided an access token that its backend applications can then use when querying the Data Plane public API. |
| 26 | |
| 27 | This approach enables the consumer backend application to pass directly the query parameters, path parameters and body |
| 28 | in the request to Data Plane public API. If the provider data source allows it, these parameters will then be conveyed until the data source. |
| 29 | |
| 30 | ### Use Case #2 |
| 31 | |
| 32 | Provider exposes some data located in a Cloud storage, such as AWS S3 or Azure storage. Consumer wants to copy these data |
| 33 | into its own storage system (which can be of a different type than the one of the provider). Here the consumer will negotiate a |
| 34 | _simple_ data transfer, by notifying to which location the data should be copied. Once contract is agreed between both parties, |
| 35 | the provider will automatically trigger the data transfer by delegating the data copy to is Data Plane system, through its Control API. |
| 36 | |
| 37 | ## Technical Details |
| 38 | |
| 39 | ### Interfaces |
| 40 | |
| 41 | OpenApi documentation can be found [here](../../../resources/openapi/yaml/data-plane-api.yaml). |
| 42 | |
| 43 | ### Dependencies |
| 44 | |
| 45 | _Provide some information about dependencies, e.g., used extensions._ |
| 46 | |
| 47 | | Name | Description | |
| 48 | |:--------|:---------------------------------------------| |
| 49 | | web-spi | Essentially for the Controllers registration | |
| 50 | |
| 51 | ## Design Principles |
| 52 | |
| 53 | Both public and control APIs rely on the `DataPlaneManager` for executing the actual data transfer, see [Data Plane Framework](../../../core/data-plane/data-plane-framework/README.md) for more details. |
| 54 | |
| 55 | The Data Plane public API takes an access token in input from the `Authorization` header, which is validated and decode by calling the |
| 56 | validation server. If the validation is successful, then the Data Plane is executed in order to query the data from the data address returned by the validation server. |
| 57 | As mentioned earlier, the Data Plane public API is essentially a data proxy, which by definition will convey the information from the request (query parameters, path information, request body) |
| 58 | into the `DataPlaneManager` through the `DataFlowRequest` properties. If the data source allows it, then the request information will |
| 59 | be used in the request to the actual data source. |
| 60 | |
| 61 | ### Security |
| 62 | |
| 63 | Data Plane public API is, by nature, opened to external incoming http calls. Because it accepts any set of query params, path parameters and request body, |
| 64 | it could be used by malicious attackers to attempt an attack e.g. DDoS. |
| 65 | |
| 66 | By default, Jetty, which is the embedded HTTP server in the EDC, provides some security against this: |
| 67 | |
| 68 | - max request header size of 8 KB: every call whose request header size is larger is discarded, |
| 69 | - max form content size of 200 KB: every form request call whose body is larger than this is discarded, |
| 70 | - max form content keys of 1000: every form request call which contains more keys is discarded. |
| 71 | |
| 72 | No other limits are implemented as of now, so we strongly recommend putting a reverse proxy in front of the Data Plane public API, such as Nginx, configured to block malicious calls. |