Skip to content

Commit

Permalink
Use non-lamba builder
Browse files Browse the repository at this point in the history
  • Loading branch information
Russsnizza committed Sep 27, 2024
1 parent fa27010 commit 2786562
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/main/java/gyro/aws/rds/DbClusterParameterGroupResource.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
import software.amazon.awssdk.services.rds.model.DescribeDbClusterParameterGroupsResponse;
import software.amazon.awssdk.services.rds.model.DescribeDbClusterParametersResponse;
import software.amazon.awssdk.services.rds.model.Parameter;
import software.amazon.awssdk.services.rds.model.DescribeDbClusterParameterGroupsRequest;
import software.amazon.awssdk.services.rds.model.DescribeDbClusterParametersRequest;

import java.util.ArrayList;
import java.util.List;
Expand Down Expand Up @@ -145,17 +147,22 @@ protected boolean doRefresh() {
}
try {
DescribeDbClusterParameterGroupsResponse response = client.describeDBClusterParameterGroups(
r -> r.dbClusterParameterGroupName(getName())
DescribeDbClusterParameterGroupsRequest.builder()
.dbClusterParameterGroupName(getName())
.build()
);
response.dbClusterParameterGroups().forEach(this::copyFrom);

Set<String> names = getParameter().stream().map(DbParameter::getName).collect(Collectors.toSet());
getParameter().clear();

String[] marker = {null};
String marker = null;
do {
DescribeDbClusterParametersResponse parametersResponse = client.describeDBClusterParameters(
r -> r.dbClusterParameterGroupName(getName()).marker(marker[0])
DescribeDbClusterParametersRequest.builder()
.dbClusterParameterGroupName(getName())
.marker(marker)
.build()
);

getParameter().addAll(parametersResponse.parameters().stream()
Expand All @@ -170,8 +177,8 @@ protected boolean doRefresh() {
.collect(Collectors.toList())
);

marker[0] = parametersResponse.marker();
} while (marker[0] != null);
marker = parametersResponse.marker();
} while (marker != null);
} catch (DbParameterGroupNotFoundException ex) {
return false;
}
Expand Down

0 comments on commit 2786562

Please sign in to comment.