Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/provision policy sample #6

Open
wants to merge 68 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
6824239
build(deps): bump agilepathway/label-checker from 1.6.13 to 1.6.16 (#…
dependabot[bot] Jan 22, 2024
548d733
build(deps): bump agilepathway/label-checker from 1.6.16 to 1.6.20 (#…
dependabot[bot] Jan 29, 2024
4770b44
build(deps): bump testcontainers from 1.19.3 to 1.19.4 (#196)
dependabot[bot] Jan 29, 2024
c24cc29
build(deps): bump org.assertj:assertj-core from 3.25.1 to 3.25.2 (#195)
dependabot[bot] Feb 1, 2024
de017e0
build(deps): bump org.assertj:assertj-core from 3.25.2 to 3.25.3 (#200)
dependabot[bot] Feb 5, 2024
82b4bc2
build(deps): bump jupiter from 5.10.1 to 5.10.2 (#199)
dependabot[bot] Feb 5, 2024
05d0864
build(deps): bump testcontainers from 1.19.4 to 1.19.5 (#202)
dependabot[bot] Feb 9, 2024
4eca68b
build(deps): bump agilepathway/label-checker from 1.6.20 to 1.6.21 (#…
dependabot[bot] Feb 12, 2024
57e22c7
build(deps): bump agilepathway/label-checker from 1.6.21 to 1.6.22 (#…
dependabot[bot] Feb 19, 2024
f83d098
build(deps): bump io.opentelemetry.javaagent:opentelemetry-javaagent …
dependabot[bot] Feb 19, 2024
a1bdd75
build(deps): bump testcontainers from 1.19.5 to 1.19.6 (#211)
dependabot[bot] Feb 22, 2024
3d77faa
build(deps): bump org.apache.kafka:kafka-clients from 3.6.1 to 3.7.0 …
dependabot[bot] Feb 27, 2024
cfe90e6
feat: add basic policy sample (#207)
juliapampus Feb 28, 2024
8f5eda4
build(deps): bump agilepathway/label-checker from 1.6.22 to 1.6.24 (#…
dependabot[bot] Mar 4, 2024
881b439
build: add triage opened issue workflow
ndr-brt Mar 5, 2024
227416d
build(deps): bump EDC to 0.5.1 (#217)
ndr-brt Mar 5, 2024
58af134
build(deps): bump testcontainers from 1.19.6 to 1.19.7 (#219)
dependabot[bot] Mar 6, 2024
5c8a4c8
build(deps): bump agilepathway/label-checker from 1.6.24 to 1.6.25 (#…
dependabot[bot] Mar 11, 2024
70302ab
build(deps): bump io.opentelemetry.javaagent:opentelemetry-javaagent …
dependabot[bot] Mar 15, 2024
7ac5f7b
build(deps): bump org.awaitility:awaitility from 4.2.0 to 4.2.1 (#226)
dependabot[bot] Mar 18, 2024
65f9404
build(deps): bump agilepathway/label-checker from 1.6.25 to 1.6.27 (#…
dependabot[bot] Mar 26, 2024
95c9164
docs: updated README.md for transfer-02-consumer-pull (#225)
man8pr Mar 26, 2024
37382c4
fix: update description about required Java version (#232)
iwasakims Mar 28, 2024
e9d9ef7
build(deps): bump edc from 0.5.1 to 0.6.0 (#230)
dependabot[bot] Mar 29, 2024
f1eba40
build(deps): bump tsickert/discord-webhook from 5.4.0 to 5.5.0 (#233)
dependabot[bot] Apr 2, 2024
f1e5f80
build(deps): bump agilepathway/label-checker from 1.6.27 to 1.6.29 (#…
dependabot[bot] Apr 2, 2024
64575ec
fix: build.gradle.kts imports fixed (#227)
alzcurda Apr 5, 2024
b1378bc
build(deps): bump tsickert/discord-webhook from 5.5.0 to 6.0.0 (#235)
dependabot[bot] Apr 9, 2024
db48e13
build(deps): bump io.opentelemetry.javaagent:opentelemetry-javaagent …
dependabot[bot] Apr 15, 2024
6cd717b
build(deps): bump com.squareup.okhttp3:mockwebserver from 5.0.0-alpha…
dependabot[bot] Apr 26, 2024
85fc9a4
fix: update transfer-05-file-transfer-cloud sample (#247)
bpetrovbg Apr 29, 2024
545311b
build(deps): bump jakarta.ws.rs:jakarta.ws.rs-api from 3.1.0 to 4.0.0…
dependabot[bot] May 3, 2024
1af902d
build(deps): bump testcontainers from 1.19.7 to 1.19.8 (#255)
dependabot[bot] May 9, 2024
c98f5eb
build(deps): bump agilepathway/label-checker from 1.6.29 to 1.6.32 (#…
dependabot[bot] May 13, 2024
90c18cb
build: bump EDC to 0.6.4 (#259)
ndr-brt May 14, 2024
3349945
build(deps): bump io.opentelemetry.javaagent:opentelemetry-javaagent …
dependabot[bot] May 20, 2024
b407b55
build(deps): bump org.assertj:assertj-core from 3.25.3 to 3.26.0 (#264)
dependabot[bot] May 27, 2024
5881d75
build(deps): bump agilepathway/label-checker from 1.6.32 to 1.6.37 (#…
dependabot[bot] Jun 3, 2024
3a08bae
build(deps): bump agilepathway/label-checker from 1.6.37 to 1.6.41 (#…
dependabot[bot] Jun 10, 2024
e2387fc
build(deps): Bump EDC to 0.7.0 (#268)
ndr-brt Jun 10, 2024
6cc90ad
build(deps): bump agilepathway/label-checker from 1.6.41 to 1.6.44 (#…
dependabot[bot] Jun 24, 2024
3d7ab72
build(deps): bump EDC to 0.7.1 (#275)
ndr-brt Jun 28, 2024
559c1f9
build(deps): bump jupiter from 5.10.2 to 5.10.3 (#277)
dependabot[bot] Jun 28, 2024
489b421
build(deps): bump org.apache.kafka:kafka-clients from 3.7.0 to 3.7.1 …
dependabot[bot] Jul 1, 2024
f1d9077
build(deps): bump io.opentelemetry.javaagent:opentelemetry-javaagent …
dependabot[bot] Jul 1, 2024
8e77077
feat: create local resource provision methods for provision policy sa…
farhin23 Mar 21, 2023
6c08e78
for: updated checkstyle - local resource provision methods for provis…
farhin23 Mar 21, 2023
d6d1003
feat: file transfer local for provision policy sample
farhin23 Mar 21, 2023
247834f
feat: create provider Policy functions for provision policy sample
farhin23 Mar 21, 2023
4ea4cb5
feat: create consumer Policy functions for provision policy sample
farhin23 Mar 21, 2023
6709662
feat: create consumer and provider connector for provision policy sample
farhin23 Mar 21, 2023
52e1de3
feat: create provision policy sample - request bodies and README.md
farhin23 Mar 21, 2023
6b07c26
feat: create provision policy sample - integration tests
farhin23 Apr 24, 2023
3b21f00
for: update correct checkstyle
farhin23 Apr 25, 2023
75ffb68
for: update contractoffer.json modification during contract negotiati…
farhin23 May 2, 2023
6aa3023
for: add commented out modules - update dependencies in libs.versions…
farhin23 May 3, 2023
6a900db
chore: update to latest main
ronjaquensel Sep 22, 2023
3a0837f
chore: update code for new version
ronjaquensel Sep 22, 2023
aaab4c7
refactor: merge consumer modules to :policy-02-provision:policy-provi…
juliapampus Sep 22, 2023
34ae2e2
refactor: merge provider modules to :policy-02-provision:policy-provi…
juliapampus Sep 22, 2023
78cc2cc
refactor: clean up consumer code
juliapampus Sep 22, 2023
83bc261
refactor: move policy02 e2e tests
juliapampus Sep 22, 2023
10cbb5c
refactor: clean up provider code
juliapampus Sep 22, 2023
b4aac0c
chore: update Policy 02 README, config.properties for provider and co…
majadlymhmd Mar 13, 2024
0276cfb
chore: update json files and Readme
majadlymhmd Apr 17, 2024
a7123cd
chore: update the provision policy
majadlymhmd Jun 11, 2024
4e18fd7
refactor: update the E2E test of the policy provision sample to newes…
majadlymhmd Jul 5, 2024
06f7ff1
chore: add missing dependency
ronjaquensel Jul 10, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/discord-webhook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: New Discussion
uses: tsickert/discord-webhook@v5.4.0
uses: tsickert/discord-webhook@v6.0.0
if: ${{ (github.event_name == 'discussion') }}
with:
webhook-url: ${{ secrets.DISCORD_WEBHOOK_GITHUB }}
Expand All @@ -25,7 +25,7 @@ jobs:
embed-description: A **discussion** has been created in ${{ github.repository }}.

- name: New Issue
uses: tsickert/discord-webhook@v5.4.0
uses: tsickert/discord-webhook@v6.0.0
if: ${{ (github.event_name == 'issues') }}
with:
webhook-url: ${{ secrets.DISCORD_WEBHOOK_GITHUB }}
Expand All @@ -38,7 +38,7 @@ jobs:
embed-description: An **issue** has been opened in ${{ github.repository }}.

- name: New Pull Request
uses: tsickert/discord-webhook@v5.4.0
uses: tsickert/discord-webhook@v6.0.0
if: ${{ (github.event_name == 'pull_request_target') }}
with:
webhook-url: ${{ secrets.DISCORD_WEBHOOK_GITHUB }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/scan-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
continue-on-error: false
steps:
- uses: actions/checkout@v4
- uses: agilepathway/label-checker@v1.6.13
- uses: agilepathway/label-checker@v1.6.44
with:
any_of: api,bug,build,dependencies,documentation,enhancement,refactoring
repo_token: ${{ secrets.GITHUB_TOKEN }}
20 changes: 20 additions & 0 deletions .github/workflows/triage-issue.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: triage opened issue

on:
issues:
types:
- reopened
- opened

jobs:
label-issue:
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- run: gh issue edit "$NUMBER" --add-label "$LABELS"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
NUMBER: ${{ github.event.issue.number }}
LABELS: triage
1 change: 1 addition & 0 deletions .github/workflows/verify.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: Test Code (Style, Tests)

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
paths-ignore:
Expand Down
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ strongly advise reading the [documentation](https://eclipse-edc.github.io/docs/#

Also, a working knowledge of **Git**, **Gradle**, **Java** and **HTTP** is presumed.

We'll assume that you've just checked out the samples code base and have **Java 11+** installed on your development
machine. If not, please download and install JDK 11+ for your OS.
We'll assume that you've just checked out the samples code base and have **Java 17+** installed on your development
machine. If not, please download and install JDK 17+ for your OS.

Command examples in this document will use the `bash` syntax and use Unix-style paths, but any other shell should be
fine as well. If you're using Windows you either need to adapt the paths or use WSL2.
Expand Down Expand Up @@ -49,6 +49,14 @@ Click the link above to learn about the transfer samples in more detail.

All transfer samples are located in the `advanced` directory.

### [Policy](./policy/README.md)

These samples deal with the topic of policies and their evaluation and enforcement. They will teach you what
configurations you need to make to enable the evaluation of specific policy rules and constraint and how to provide
custom code for their enforcement.

All policy samples are located in the `policy` directory.

## Contributing

See [how to contribute](https://github.com/eclipse-edc/docs/blob/main/CONTRIBUTING.md).
Expand Down
81 changes: 42 additions & 39 deletions advanced/advanced-01-open-telemetry/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,29 +25,17 @@ is configured to expose a Prometheus metrics endpoint.

To run the consumer, the provider, and Jaeger execute the following commands in the project root folder:

Build the connector
```bash
docker compose -f advanced/advanced-01-open-telemetry/docker-compose.yaml up --abort-on-container-exit
./gradlew :advanced:advanced-01-open-telemetry:open-telemetry-runtime:build
```

Open a new terminal.

Register data planes for provider and consumer:

Start the docker compose
```bash
curl -H 'Content-Type: application/json' \
-H "X-Api-Key: password" \
-d @transfer/transfer-00-prerequisites/resources/dataplane/register-data-plane-provider.json \
-X POST "http://localhost:19193/management/v2/dataplanes" \
-s | jq
docker compose -f advanced/advanced-01-open-telemetry/docker-compose.yaml up --abort-on-container-exit
```

```bash
curl -H 'Content-Type: application/json' \
-H "X-Api-Key: password" \
-d @transfer/transfer-00-prerequisites/resources/dataplane/register-data-plane-consumer.json \
-X POST "http://localhost:29193/management/v2/dataplanes" \
-s | jq
```
Open a new terminal.

Create an asset:

Expand All @@ -63,7 +51,7 @@ Create a Policy on the provider connector:
```bash
curl -H "X-Api-Key: password" \
-d @transfer/transfer-01-negotiation/resources/create-policy.json \
-H 'content-type: application/json' http://localhost:19193/management/v2/policydefinitions \
-H 'content-type: application/json' http://localhost:19193/management/v3/policydefinitions \
-s | jq
```

Expand All @@ -72,7 +60,7 @@ Follow up with the creation of a contract definition:
```bash
curl -H "X-Api-Key: password" \
-d @transfer/transfer-01-negotiation/resources/create-contract-definition.json \
-H 'content-type: application/json' http://localhost:19193/management/v2/contractdefinitions \
-H 'content-type: application/json' http://localhost:19193/management/v3/contractdefinitions \
-s | jq
```

Expand All @@ -84,7 +72,7 @@ directly with this call:
curl -H "X-Api-Key: password" \
-H "Content-Type: application/json" \
-d @advanced/advanced-01-open-telemetry/resources/get-dataset.json \
-X POST "http://localhost:29193/management/v2/catalog/dataset/request" \
-X POST "http://localhost:29193/management/v3/catalog/dataset/request" \
-s | jq
```

Expand All @@ -95,40 +83,55 @@ The output will be something like:
"@id": "assetId",
"@type": "dcat:Dataset",
"odrl:hasPolicy": {
"@id": "MQ==:YXNzZXRJZA==:YjI5ZDVkZDUtZWU0Mi00NWRiLWE2OTktYjNmMjlmMWNjODk3",
"@type": "odrl:Set",
"@id": "MQ==:YXNzZXRJZA==:NjdlNDFhM2EtYThjMS00YTBmLWFkNmYtMjk5NzkzNTE2OTE3",
"@type": "odrl:Offer",
"odrl:permission": [],
"odrl:prohibition": [],
"odrl:obligation": [],
"odrl:target": "assetId"
"odrl:obligation": []
},
"dcat:distribution": [
{
"@type": "dcat:Distribution",
"dct:format": {
"@id": "HttpProxy"
"@id": "HttpData-PULL"
},
"dcat:accessService": "06348bca-6bf0-47fe-8bb5-6741cff7a955"
"dcat:accessService": {
"@id": "cb701b36-48ee-4132-8436-dba7b83c606c",
"@type": "dcat:DataService",
"dcat:endpointDescription": "dspace:connector",
"dcat:endpointUrl": "http://provider:19194/protocol",
"dct:terms": "dspace:connector",
"dct:endpointUrl": "http://provider:19194/protocol"
}
},
{
"@type": "dcat:Distribution",
"dct:format": {
"@id": "HttpData"
"@id": "HttpData-PUSH"
},
"dcat:accessService": "06348bca-6bf0-47fe-8bb5-6741cff7a955"
"dcat:accessService": {
"@id": "cb701b36-48ee-4132-8436-dba7b83c606c",
"@type": "dcat:DataService",
"dcat:endpointDescription": "dspace:connector",
"dcat:endpointUrl": "http://provider:19194/protocol",
"dct:terms": "dspace:connector",
"dct:endpointUrl": "http://provider:19194/protocol"
}
}
],
"edc:name": "product description",
"edc:id": "assetId",
"edc:contenttype": "application/json",
"name": "product description",
"id": "assetId",
"contenttype": "application/json",
"@context": {
"dct": "https://purl.org/dc/terms/",
"@vocab": "https://w3id.org/edc/v0.0.1/ns/",
"edc": "https://w3id.org/edc/v0.0.1/ns/",
"dcat": "https://www.w3.org/ns/dcat/",
"dcat": "http://www.w3.org/ns/dcat#",
"dct": "http://purl.org/dc/terms/",
"odrl": "http://www.w3.org/ns/odrl/2/",
"dspace": "https://w3id.org/dspace/v0.8/"
}
}

```

With the `odrl:hasPolicy/@id` we can now replace it in the [negotiate-contract.json](resources/negotiate-contract.json) file
Expand All @@ -138,7 +141,7 @@ and request the contract negotiation:
curl -H "X-Api-Key: password" \
-H "Content-Type: application/json" \
-d @advanced/advanced-01-open-telemetry/resources/negotiate-contract.json \
-X POST "http://localhost:29193/management/v2/contractnegotiations" \
-X POST "http://localhost:29193/management/v3/contractnegotiations" \
-s | jq
```

Expand All @@ -147,7 +150,7 @@ state with this call, replacing `{{contract-negotiation-id}}` with the id return

```shell
curl -H 'X-Api-Key: password' \
-X GET "http://localhost:29193/management/v2/contractnegotiations/{{contract-negotiation-id}}" \
-X GET "http://localhost:29193/management/v3/contractnegotiations/{{contract-negotiation-id}}" \
-s | jq
```

Expand All @@ -157,7 +160,7 @@ Finally, update the contract agreement id in the [start-transfer.json](resources
curl -H "X-Api-Key: password" \
-H "Content-Type: application/json" \
-d @advanced/advanced-01-open-telemetry/resources/start-transfer.json \
-X POST "http://localhost:29193/management/v2/transferprocesses" \
-X POST "http://localhost:29193/management/v3/transferprocesses" \
-s | jq
```

Expand Down Expand Up @@ -232,11 +235,11 @@ In order to provide your own OpenTelemetry implementation, you have to "deploy a
- Add a file in the resource directory META-INF/services. The file should be called `io.opentelemetry.api.OpenTelemetry`.
- Add to the file the fully qualified name of your custom OpenTelemetry implementation class.

EDC uses a [ServiceLoader](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/ServiceLoader.html)
EDC uses a [ServiceLoader](https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/util/ServiceLoader.html)
to load an implementation of OpenTelemetry. If it finds an OpenTelemetry service provider on the class path it will use
it, otherwise it will use the registered global OpenTelemetry. You can look at the section
`Deploying service providers on the class path` of the
[ServiceLoader documentation](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/ServiceLoader.html)
[ServiceLoader documentation](https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/util/ServiceLoader.html)
to have more information about service providers.

---
---
21 changes: 11 additions & 10 deletions advanced/advanced-01-open-telemetry/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ services:

consumer:
build:
context: ../..
dockerfile: advanced/advanced-01-open-telemetry/open-telemetry-consumer/Dockerfile
context: open-telemetry-runtime
volumes:
- ./:/open-telemetry
- ../../transfer/transfer-00-prerequisites/:/prerequisites
Expand All @@ -15,8 +14,9 @@ services:
environment:
EDC_HOSTNAME: consumer
OTEL_SERVICE_NAME: consumer
OTEL_TRACES_EXPORTER: jaeger
OTEL_EXPORTER_JAEGER_ENDPOINT: http://jaeger:14250
OTEL_LOGS_EXPORTER: none
OTEL_JAVAAGENT_EXTENSIONS: /app/opentelemetry-exporter-otlp.jar
OTEL_EXPORTER_OTLP_ENDPOINT: http://jaeger:4318
OTEL_METRICS_EXPORTER: prometheus
WEB_HTTP_PORT: 29191
WEB_HTTP_PATH: /api
Expand All @@ -34,7 +34,6 @@ services:
EDC_API_AUTH_KEY: password
EDC_KEYSTORE: /prerequisites/resources/certs/cert.pfx
EDC_KEYSTORE_PASSWORD: 123456
EDC_VAULT: /prerequisites/resources/configuration/provider-vault.properties
EDC_FS_CONFIG: /prerequisites/resources/configuration/provider-configuration.properties
entrypoint: java
-javaagent:/app/opentelemetry-javaagent.jar
Expand All @@ -43,8 +42,7 @@ services:

provider:
build:
context: ../..
dockerfile: advanced/advanced-01-open-telemetry/open-telemetry-provider/Dockerfile
context: open-telemetry-runtime
volumes:
- ./:/open-telemetry
- ../../transfer/transfer-00-prerequisites/:/prerequisites
Expand All @@ -54,8 +52,9 @@ services:
environment:
EDC_HOSTNAME: provider
OTEL_SERVICE_NAME: provider
OTEL_TRACES_EXPORTER: jaeger
OTEL_EXPORTER_JAEGER_ENDPOINT: http://jaeger:14250
OTEL_LOGS_EXPORTER: none
OTEL_JAVAAGENT_EXTENSIONS: /app/opentelemetry-exporter-otlp.jar
OTEL_EXPORTER_OTLP_ENDPOINT: http://jaeger:4318
WEB_HTTP_PORT: 19191
WEB_HTTP_PATH: /api
WEB_HTTP_PUBLIC_PORT: 19291
Expand All @@ -72,7 +71,6 @@ services:
EDC_API_AUTH_KEY: password
EDC_KEYSTORE: /prerequisites/resources/certs/cert.pfx
EDC_KEYSTORE_PASSWORD: 123456
EDC_VAULT: /prerequisites/resources/configuration/consumer-vault.properties
EDC_FS_CONFIG: /prerequisites/resources/configuration/consumer-configuration.properties
EDC_SAMPLES_TRANSFER_01_ASSET_PATH: /open-telemetry/README.md
entrypoint: java
Expand All @@ -82,7 +80,10 @@ services:

jaeger:
image: jaegertracing/all-in-one
environment:
- COLLECTOR_OTLP_ENABLED=true
ports:
- "4317:4317"
- "16686:16686"

prometheus:
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM openjdk:17-slim

WORKDIR /app
COPY build/libs/opentelemetry-javaagent-2.5.0.jar /app/opentelemetry-javaagent.jar
COPY build/libs/opentelemetry-exporter-otlp-1.39.0.jar /app/opentelemetry-exporter-otlp.jar
COPY build/libs/connector.jar /app/connector.jar
Loading
Loading