Skip to content

Commit d33ef9c

Browse files
feat: add tier and organizationId fields to dynamic policy types (#76)
* feat: add tier and organizationId fields to dynamic policy types Add PolicyTier and organizationId support to DynamicPolicy and CreateDynamicPolicyRequest to enable tiered policy scoping (system, organization, tenant) for multi-tenant policy management. * docs: add 3.2.0 changelog and bump version for tier field on dynamic policy requests * fix: address code review issues for dynamic policy tier field - Add tier and organizationId to UpdateDynamicPolicyRequest - Add tier and organizationId filters to ListDynamicPoliciesOptions - Update listDynamicPolicies to pass tier/org_id query params - Add Javadoc to CreateDynamicPolicyRequest builder methods * chore: align changelog format with cross-SDK conventions
1 parent 3561aaf commit d33ef9c

5 files changed

Lines changed: 105 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,15 @@ All notable changes to the AxonFlow Java SDK will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [3.2.0] - 2026-02-05
9+
10+
### Added
11+
12+
- **Dynamic policy tier support**: `tier` (`PolicyTier`) and `organizationId` fields on `CreateDynamicPolicyRequest`, `UpdateDynamicPolicyRequest`, and `DynamicPolicy` response. Defaults to `PolicyTier.TENANT` when not specified. Builder: `.tier(PolicyTier.ORGANIZATION).organizationId("org-123")`.
13+
- **`ListDynamicPoliciesOptions` filters**: Filter dynamic policies by `tier` and `organizationId`, matching `ListStaticPoliciesOptions` parity.
14+
15+
---
16+
817
## [3.1.0] - 2026-02-04
918

1019
### Changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,14 @@ If you're new to AxonFlow, this short video shows how the control plane and SDKs
4545
<dependency>
4646
<groupId>com.getaxonflow</groupId>
4747
<artifactId>axonflow-sdk</artifactId>
48-
<version>3.1.0</version>
48+
<version>3.2.0</version>
4949
</dependency>
5050
```
5151

5252
### Gradle
5353

5454
```groovy
55-
implementation 'com.getaxonflow:axonflow-sdk:3.1.0'
55+
implementation 'com.getaxonflow:axonflow-sdk:3.2.0'
5656
```
5757

5858
## Quick Start

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>com.getaxonflow</groupId>
88
<artifactId>axonflow-sdk</artifactId>
9-
<version>3.1.0</version>
9+
<version>3.2.0</version>
1010
<packaging>jar</packaging>
1111

1212
<name>AxonFlow Java SDK</name>

src/main/java/com/getaxonflow/sdk/AxonFlow.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1877,6 +1877,12 @@ private String buildDynamicPolicyQueryString(String basePath, ListDynamicPolicie
18771877
if (options.getType() != null) {
18781878
appendQueryParam(query, "type", options.getType());
18791879
}
1880+
if (options.getTier() != null) {
1881+
appendQueryParam(query, "tier", options.getTier().getValue());
1882+
}
1883+
if (options.getOrganizationId() != null) {
1884+
appendQueryParam(query, "organization_id", options.getOrganizationId());
1885+
}
18801886
if (options.getEnabled() != null) {
18811887
appendQueryParam(query, "enabled", options.getEnabled().toString());
18821888
}

src/main/java/com/getaxonflow/sdk/types/policies/PolicyTypes.java

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -631,6 +631,9 @@ public static class DynamicPolicy {
631631
private String description;
632632
private String type; // "risk", "content", "user", "cost"
633633
private String category; // "dynamic-risk", "dynamic-compliance", etc.
634+
private PolicyTier tier;
635+
@JsonProperty("organization_id")
636+
private String organizationId;
634637
private List<DynamicPolicyCondition> conditions;
635638
private List<DynamicPolicyAction> actions;
636639
private int priority;
@@ -651,6 +654,10 @@ public static class DynamicPolicy {
651654
public void setType(String type) { this.type = type; }
652655
public String getCategory() { return category; }
653656
public void setCategory(String category) { this.category = category; }
657+
public PolicyTier getTier() { return tier; }
658+
public void setTier(PolicyTier tier) { this.tier = tier; }
659+
public String getOrganizationId() { return organizationId; }
660+
public void setOrganizationId(String organizationId) { this.organizationId = organizationId; }
654661
public List<DynamicPolicyCondition> getConditions() { return conditions; }
655662
public void setConditions(List<DynamicPolicyCondition> conditions) { this.conditions = conditions; }
656663
public List<DynamicPolicyAction> getActions() { return actions; }
@@ -670,6 +677,8 @@ public static class DynamicPolicy {
670677
*/
671678
public static class ListDynamicPoliciesOptions {
672679
private String type; // Filter by policy type: "risk", "content", "user", "cost"
680+
private PolicyTier tier;
681+
private String organizationId;
673682
private Boolean enabled;
674683
private Integer limit;
675684
private Integer offset;
@@ -682,6 +691,8 @@ public static Builder builder() {
682691
}
683692

684693
public String getType() { return type; }
694+
public PolicyTier getTier() { return tier; }
695+
public String getOrganizationId() { return organizationId; }
685696
public Boolean getEnabled() { return enabled; }
686697
public Integer getLimit() { return limit; }
687698
public Integer getOffset() { return offset; }
@@ -703,6 +714,28 @@ public Builder type(String type) {
703714
return this;
704715
}
705716

717+
/**
718+
* Filters policies by tier.
719+
*
720+
* @param tier the policy tier
721+
* @return this builder
722+
*/
723+
public Builder tier(PolicyTier tier) {
724+
options.tier = tier;
725+
return this;
726+
}
727+
728+
/**
729+
* Filters policies by organization ID (Enterprise).
730+
*
731+
* @param organizationId the organization ID
732+
* @return this builder
733+
*/
734+
public Builder organizationId(String organizationId) {
735+
options.organizationId = organizationId;
736+
return this;
737+
}
738+
706739
public Builder enabled(Boolean enabled) {
707740
options.enabled = enabled;
708741
return this;
@@ -754,6 +787,9 @@ public static class CreateDynamicPolicyRequest {
754787
private String description;
755788
private String type; // "risk", "content", "user", "cost"
756789
private String category; // "dynamic-risk", "dynamic-compliance", etc.
790+
private PolicyTier tier = PolicyTier.TENANT;
791+
@JsonProperty("organization_id")
792+
private String organizationId;
757793
private List<DynamicPolicyCondition> conditions;
758794
private List<DynamicPolicyAction> actions;
759795
private int priority;
@@ -767,6 +803,8 @@ public static Builder builder() {
767803
public String getDescription() { return description; }
768804
public String getType() { return type; }
769805
public String getCategory() { return category; }
806+
public PolicyTier getTier() { return tier; }
807+
public String getOrganizationId() { return organizationId; }
770808
public List<DynamicPolicyCondition> getConditions() { return conditions; }
771809
public List<DynamicPolicyAction> getActions() { return actions; }
772810
public int getPriority() { return priority; }
@@ -808,6 +846,28 @@ public Builder category(String category) {
808846
return this;
809847
}
810848

849+
/**
850+
* Sets the policy tier. Defaults to {@link PolicyTier#TENANT}.
851+
*
852+
* @param tier the policy tier
853+
* @return this builder
854+
*/
855+
public Builder tier(PolicyTier tier) {
856+
request.tier = tier;
857+
return this;
858+
}
859+
860+
/**
861+
* Sets the organization ID for organization-tier policies (Enterprise).
862+
*
863+
* @param organizationId the organization ID
864+
* @return this builder
865+
*/
866+
public Builder organizationId(String organizationId) {
867+
request.organizationId = organizationId;
868+
return this;
869+
}
870+
811871
public Builder conditions(List<DynamicPolicyCondition> conditions) {
812872
request.conditions = conditions;
813873
return this;
@@ -849,6 +909,9 @@ public static class UpdateDynamicPolicyRequest {
849909
private String description;
850910
private String type;
851911
private String category;
912+
private PolicyTier tier;
913+
@JsonProperty("organization_id")
914+
private String organizationId;
852915
private List<DynamicPolicyCondition> conditions;
853916
private List<DynamicPolicyAction> actions;
854917
private Integer priority;
@@ -862,6 +925,8 @@ public static Builder builder() {
862925
public String getDescription() { return description; }
863926
public String getType() { return type; }
864927
public String getCategory() { return category; }
928+
public PolicyTier getTier() { return tier; }
929+
public String getOrganizationId() { return organizationId; }
865930
public List<DynamicPolicyCondition> getConditions() { return conditions; }
866931
public List<DynamicPolicyAction> getActions() { return actions; }
867932
public Integer getPriority() { return priority; }
@@ -896,6 +961,28 @@ public Builder category(String category) {
896961
return this;
897962
}
898963

964+
/**
965+
* Sets the policy tier.
966+
*
967+
* @param tier the policy tier
968+
* @return this builder
969+
*/
970+
public Builder tier(PolicyTier tier) {
971+
request.tier = tier;
972+
return this;
973+
}
974+
975+
/**
976+
* Sets the organization ID for organization-tier policies (Enterprise).
977+
*
978+
* @param organizationId the organization ID
979+
* @return this builder
980+
*/
981+
public Builder organizationId(String organizationId) {
982+
request.organizationId = organizationId;
983+
return this;
984+
}
985+
899986
public Builder conditions(List<DynamicPolicyCondition> conditions) {
900987
request.conditions = conditions;
901988
return this;

0 commit comments

Comments
 (0)