Skip to content

Commit 995ad07

Browse files
committed
fix examples
1 parent 2c7dc96 commit 995ad07

File tree

2 files changed

+44
-111
lines changed

2 files changed

+44
-111
lines changed

docs/build-your-software-catalog/customize-integrations/configure-data-model/setup-blueprint/properties/aggregation-property.md

Lines changed: 44 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -913,7 +913,7 @@ When a `pathFilter` is defined, Port will include only entities that can be reac
913913
| Field | Description |
914914
|---------------------------|----------------------------------------------------------------------------------------------------------------------|
915915
| `pathFilter.path` | An array containing the full path of relation identifiers to traverse. |
916-
| `pathFilter.fromBlueprint` | *(Optional)* The blueprint to start the path traversal from. If omitted, traversal starts from the source blueprint. |
916+
| `pathFilter.fromBlueprint` | *(Optional)* The blueprint to start the path traversal from. Can be the target blueprint or omitted. If omitted, traversal starts from the source blueprint. |
917917

918918

919919
<h4> For upstream paths </h4>
@@ -944,56 +944,32 @@ When a `pathFilter` is defined, Port will include only entities that can be reac
944944

945945
<h4> Examples </h4>
946946

947+
Suppose you have the following data model:
948+
949+
![Blueprints graph diagram](/img/software-catalog/blueprint/pathFilterDiagramExample.png)
950+
947951
<Tabs groupId="path-filter-examples" defaultValue="api" values={[
948952
{label: "API", value: "api"},
949953
{label: "Terraform", value: "tf"}
950954
]}>
951955

952956
<TabItem value="api">
953957

954-
<h4>Example 1: Direct Relationship Path</h4>
958+
<h4>Example 1: Standard Path Filter</h4>
955959

956-
Count Jira issues directly related to a Microservice:
960+
Count how many deployments are directly related to a cluster:
957961

958962
```json
959963
{
960-
"identifier": "microservice",
961-
"title": "Microservice",
962-
"aggregationProperties": {
963-
"directJiraIssuesCount": {
964-
"title": "Direct Jira Issues Count",
965-
"target": "jiraIssue",
966-
"pathFilter": [
967-
{
968-
"path": ["jira_issue_rel"]
969-
}
970-
],
971-
"calculationSpec": {
972-
"calculationBy": "entities",
973-
"func": "count"
974-
}
975-
}
976-
}
977-
}
978-
```
979-
980-
The `"path": ["jira_issue_rel"]` ensures that only Jira issues directly related to the microservice through the `jira_issue_rel` relation are counted.
981-
982-
<h4> Example 2: Multi-hop Relationship Path</h4>
983-
984-
Count deployments through Service → Microservice → Deployment
985-
986-
```json
987-
{
988-
"identifier": "service",
989-
"title": "Service",
964+
"identifier": "cluster",
965+
"title": "Cluster",
990966
"aggregationProperties": {
991967
"deploymentCount": {
992968
"title": "Deployment Count",
993969
"target": "deployment",
994970
"pathFilter": [
995971
{
996-
"path": ["microservice_rel", "deployment_rel"]
972+
"path": ["deployment_rel"]
997973
}
998974
],
999975
"calculationSpec": {
@@ -1005,23 +981,23 @@ Count deployments through Service → Microservice → Deployment
1005981
}
1006982
```
1007983

1008-
The `pathFilter` with `"path": ["microservice_rel", "deployment_rel"]` counts deployments that are connected through the `microservice_rel` relation first, then to the `deployment_rel` relation.
984+
The `pathFilter` with `"path": ["deployment_rel"]` counts deployments that are directly related to the cluster through the `deployment_rel` relation.
1009985

1010-
<h4>Example 3: Starting Path from Specific Blueprint</h4>
986+
<h4>Example 2: Using fromBlueprint</h4>
1011987

1012-
Count deployments by starting path traversal from the target blueprint:
988+
Count how many clusters are related to a deployment:
1013989

1014990
```json
1015991
{
1016-
"identifier": "service",
1017-
"title": "Service",
992+
"identifier": "deployment",
993+
"title": "Deployment",
1018994
"aggregationProperties": {
1019-
"deploymentCountFromService": {
1020-
"title": "Deployment Count from Service",
1021-
"target": "deployment",
995+
"clusterCount": {
996+
"title": "Cluster Count",
997+
"target": "cluster",
1022998
"pathFilter": [
1023999
{
1024-
"path": ["microservice_rel", "deployment_rel"],
1000+
"path": ["deployment_rel"],
10251001
"fromBlueprint": "deployment"
10261002
}
10271003
],
@@ -1034,67 +1010,29 @@ Count deployments by starting path traversal from the target blueprint:
10341010
}
10351011
```
10361012

1037-
The `fromBlueprint: "deployment"` specifies that the path traversal should start from the deployment blueprint (the target), then follow the path backwards through `microservice_rel` to service.
1013+
The `fromBlueprint: "deployment"` specifies that the path traversal should start from the deployment blueprint (the target), then follow the path backwards through `deployment_rel` to cluster.
10381014

10391015
</TabItem>
10401016

10411017
<TabItem value="tf">
10421018

1043-
<h4> Example 1: Direct Relationship Path</h4>
1044-
1045-
Count Jira issues directly related to a Microservice:
1046-
1047-
```hcl
1048-
resource "port_blueprint" "microservice_blueprint" {
1049-
identifier = "microservice"
1050-
title = "Microservice"
1051-
}
1052-
1053-
resource "port_aggregation_properties" "microservice_aggregation_properties" {
1054-
blueprint_identifier = port_blueprint.microservice_blueprint.identifier
1055-
properties = {
1056-
direct_jira_issues_count = {
1057-
target_blueprint_identifier = port_blueprint.jira_issue_blueprint.identifier
1058-
title = "Direct Jira Issues Count"
1059-
icon = "Terraform"
1060-
description = "Direct Jira Issues Count"
1061-
path_filter = [
1062-
{
1063-
path = ["jira_issue_rel"]
1064-
}
1065-
]
1066-
method = {
1067-
count_entities = true
1068-
}
1069-
}
1070-
}
1071-
}
1072-
```
1073-
1074-
The `path = ["jira_issue_rel"]` ensures that only Jira issues directly related to the microservice through the `jira_issue_rel` relation are counted.
1019+
<h4>Example 1: Standard Path Filter</h4>
10751020

1076-
<h4>Example 2: Multi-hop Relationship Path</h4>
1077-
1078-
Count deployments through Service → Microservice → Deployment:
1021+
Count how many deployments are directly related to a cluster:
10791022

10801023
```hcl
1081-
resource "port_blueprint" "service_blueprint" {
1082-
identifier = "service"
1083-
title = "Service"
1084-
}
1085-
1086-
resource "port_blueprint" "microservice_blueprint" {
1087-
identifier = "microservice"
1088-
title = "Microservice"
1024+
resource "port_blueprint" "cluster_blueprint" {
1025+
identifier = "cluster"
1026+
title = "Cluster"
10891027
}
10901028
10911029
resource "port_blueprint" "deployment_blueprint" {
10921030
identifier = "deployment"
10931031
title = "Deployment"
10941032
}
10951033
1096-
resource "port_aggregation_properties" "service_aggregation_properties" {
1097-
blueprint_identifier = port_blueprint.service_blueprint.identifier
1034+
resource "port_aggregation_properties" "cluster_aggregation_properties" {
1035+
blueprint_identifier = port_blueprint.cluster_blueprint.identifier
10981036
properties = {
10991037
deployment_count = {
11001038
target_blueprint_identifier = port_blueprint.deployment_blueprint.identifier
@@ -1103,7 +1041,7 @@ resource "port_aggregation_properties" "service_aggregation_properties" {
11031041
description = "Deployment Count"
11041042
path_filter = [
11051043
{
1106-
path = ["microservice_rel", "deployment_rel"]
1044+
path = ["deployment_rel"]
11071045
}
11081046
]
11091047
method = {
@@ -1114,39 +1052,34 @@ resource "port_aggregation_properties" "service_aggregation_properties" {
11141052
}
11151053
```
11161054

1117-
The `path = ["microservice_rel", "deployment_rel"]` counts deployments that are connected through the `microservice_rel` relation first, then to the `deployment_rel` relation.
1055+
The `path = ["deployment_rel"]` counts deployments that are directly related to the cluster through the `deployment_rel` relation.
11181056

1119-
<h4>Example 3: Starting Path from Specific Blueprint</h4>
1057+
<h4>Example 2: Using fromBlueprint</h4>
11201058

1121-
Count deployments by starting path traversal from the target blueprint:
1059+
Count how many clusters are related to a deployment:
11221060

11231061
```hcl
1124-
resource "port_blueprint" "service_blueprint" {
1125-
identifier = "service"
1126-
title = "Service"
1127-
}
1128-
1129-
resource "port_blueprint" "microservice_blueprint" {
1130-
identifier = "microservice"
1131-
title = "Microservice"
1132-
}
1133-
11341062
resource "port_blueprint" "deployment_blueprint" {
11351063
identifier = "deployment"
11361064
title = "Deployment"
11371065
}
11381066
1139-
resource "port_aggregation_properties" "service_aggregation_properties" {
1140-
blueprint_identifier = port_blueprint.service_blueprint.identifier
1067+
resource "port_blueprint" "cluster_blueprint" {
1068+
identifier = "cluster"
1069+
title = "Cluster"
1070+
}
1071+
1072+
resource "port_aggregation_properties" "deployment_aggregation_properties" {
1073+
blueprint_identifier = port_blueprint.deployment_blueprint.identifier
11411074
properties = {
1142-
deployment_count_from_service = {
1143-
target_blueprint_identifier = port_blueprint.deployment_blueprint.identifier
1144-
title = "Deployment Count from Service"
1075+
cluster_count = {
1076+
target_blueprint_identifier = port_blueprint.cluster_blueprint.identifier
1077+
title = "Cluster Count"
11451078
icon = "Terraform"
1146-
description = "Deployment Count from Service"
1079+
description = "Cluster Count"
11471080
path_filter = [
11481081
{
1149-
path = ["microservice_rel", "deployment_rel"]
1082+
path = ["deployment_rel"]
11501083
from_blueprint = "deployment"
11511084
}
11521085
]
@@ -1158,7 +1091,7 @@ resource "port_aggregation_properties" "service_aggregation_properties" {
11581091
}
11591092
```
11601093

1161-
The `from_blueprint = "deployment"` specifies that the path traversal should start from the deployment blueprint (the target), then follow the path backwards through `microservice_rel` to service.
1094+
The `from_blueprint = "deployment"` specifies that the path traversal should start from the deployment blueprint (the target), then follow the path backwards through `deployment_rel` to cluster.
11621095

11631096
</TabItem>
11641097

36.2 KB
Loading

0 commit comments

Comments
 (0)