Skip to content

Commit 54868d4

Browse files
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
1 parent 198c021 commit 54868d4

3 files changed

Lines changed: 74 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1212
- **`tier` field on `CreateDynamicPolicyRequest`**: Allows setting the policy tier (`SYSTEM`, `ORGANIZATION`, `TENANT`) when creating dynamic policies via `.tier(PolicyTier.ORGANIZATION)` builder method. Defaults to `PolicyTier.TENANT` for backward compatibility.
1313
- **`organizationId` field on `CreateDynamicPolicyRequest`**: Allows specifying the organization ID for organization-tier policies via `.organizationId(String)` builder method. Serialized as `organization_id` in JSON.
1414
- **`tier` and `organizationId` fields on `DynamicPolicy`**: Response class now includes `getTier()` and `getOrganizationId()` for policy tier metadata.
15+
- **`tier` and `organizationId` fields on `UpdateDynamicPolicyRequest`**: Allows updating the policy tier and organization ID on existing dynamic policies via `.tier(PolicyTier)` and `.organizationId(String)` builder methods.
16+
- **`tier` and `organizationId` filters on `ListDynamicPoliciesOptions`**: Allows filtering dynamic policies by tier and organization ID via `.tier(PolicyTier)` and `.organizationId(String)` builder methods, matching `ListStaticPoliciesOptions` parity.
17+
- **`listDynamicPolicies` query parameters**: `tier` and `organization_id` query parameters are now passed to the API when filtering dynamic policies.
1518

1619
## [3.1.0] - 2026-02-04
1720

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: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -677,6 +677,8 @@ public static class DynamicPolicy {
677677
*/
678678
public static class ListDynamicPoliciesOptions {
679679
private String type; // Filter by policy type: "risk", "content", "user", "cost"
680+
private PolicyTier tier;
681+
private String organizationId;
680682
private Boolean enabled;
681683
private Integer limit;
682684
private Integer offset;
@@ -689,6 +691,8 @@ public static Builder builder() {
689691
}
690692

691693
public String getType() { return type; }
694+
public PolicyTier getTier() { return tier; }
695+
public String getOrganizationId() { return organizationId; }
692696
public Boolean getEnabled() { return enabled; }
693697
public Integer getLimit() { return limit; }
694698
public Integer getOffset() { return offset; }
@@ -710,6 +714,28 @@ public Builder type(String type) {
710714
return this;
711715
}
712716

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+
713739
public Builder enabled(Boolean enabled) {
714740
options.enabled = enabled;
715741
return this;
@@ -820,11 +846,23 @@ public Builder category(String category) {
820846
return this;
821847
}
822848

849+
/**
850+
* Sets the policy tier. Defaults to {@link PolicyTier#TENANT}.
851+
*
852+
* @param tier the policy tier
853+
* @return this builder
854+
*/
823855
public Builder tier(PolicyTier tier) {
824856
request.tier = tier;
825857
return this;
826858
}
827859

860+
/**
861+
* Sets the organization ID for organization-tier policies (Enterprise).
862+
*
863+
* @param organizationId the organization ID
864+
* @return this builder
865+
*/
828866
public Builder organizationId(String organizationId) {
829867
request.organizationId = organizationId;
830868
return this;
@@ -871,6 +909,9 @@ public static class UpdateDynamicPolicyRequest {
871909
private String description;
872910
private String type;
873911
private String category;
912+
private PolicyTier tier;
913+
@JsonProperty("organization_id")
914+
private String organizationId;
874915
private List<DynamicPolicyCondition> conditions;
875916
private List<DynamicPolicyAction> actions;
876917
private Integer priority;
@@ -884,6 +925,8 @@ public static Builder builder() {
884925
public String getDescription() { return description; }
885926
public String getType() { return type; }
886927
public String getCategory() { return category; }
928+
public PolicyTier getTier() { return tier; }
929+
public String getOrganizationId() { return organizationId; }
887930
public List<DynamicPolicyCondition> getConditions() { return conditions; }
888931
public List<DynamicPolicyAction> getActions() { return actions; }
889932
public Integer getPriority() { return priority; }
@@ -918,6 +961,28 @@ public Builder category(String category) {
918961
return this;
919962
}
920963

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+
921986
public Builder conditions(List<DynamicPolicyCondition> conditions) {
922987
request.conditions = conditions;
923988
return this;

0 commit comments

Comments
 (0)