Skip to content

Commit

Permalink
Ab2d/sonarqube fix (#116)
Browse files Browse the repository at this point in the history
  • Loading branch information
smirnovaae authored Nov 15, 2024
1 parent 7b107ea commit 987c17d
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import software.amazon.awssdk.regions.Region;

public class AttributionDataShareConstants {
public final class AttributionDataShareConstants {

public static final String ROLE_PARAM = "/ab2d/opt-out/bfd-bucket-role-arn";
public static final String DB_HOST_PARAM = "/ab2d/opt-out/db-host";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package gov.cms.ab2d.attributiondatashare;

import gov.cms.ab2d.lambdalibs.lib.SsmClientUtil;
import software.amazon.awssdk.services.ssm.SsmClient;
import software.amazon.awssdk.services.ssm.model.GetParameterRequest;

Expand All @@ -20,9 +21,7 @@ public AttributionParameterStore(String role, String dbHost, String dbUser, Stri
}

public static AttributionParameterStore getParameterStore() {
var ssmClient = SsmClient.builder()
.region(S3_REGION)
.build();
var ssmClient = SsmClientUtil.getClient();

var role = getValueFromParameterStore(ROLE_PARAM, ssmClient);
var dbHost = getValueFromParameterStore(DB_HOST_PARAM, ssmClient);
Expand Down
1 change: 1 addition & 0 deletions lambda-lib/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ dependencies {
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.9.1'
testImplementation 'org.junit.platform:junit-platform-commons:1.9.1'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.9.1'
implementation 'software.amazon.awssdk:ssm:2.25.7'

}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package gov.cms.ab2d.lambdalibs.lib;

import software.amazon.awssdk.regions.Region;
import software.amazon.awssdk.services.ssm.SsmClient;

public class SsmClientUtil {

public static SsmClient getClient(){
return SsmClient.builder()
.region(Region.US_EAST_1)
.build();
}
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
package gov.cms.ab2d.testutils;

import org.testcontainers.containers.PostgreSQLContainer;
import org.testcontainers.containers.localstack.LocalStackContainer;
import org.testcontainers.utility.DockerImageName;

import java.util.Collections;

public class AB2DLocalstackContainer extends LocalStackContainer {

private static final DockerImageName IMAGE_VERSION = DockerImageName.parse("localstack/localstack:1.4.0");
private static final DockerImageName IMAGE_VERSION = DockerImageName.parse("localstack/localstack:3.5.0");

public AB2DLocalstackContainer() {
super(IMAGE_VERSION);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package gov.cms.ab2d.optout;

import gov.cms.ab2d.lambdalibs.lib.SsmClientUtil;
import software.amazon.awssdk.services.ssm.SsmClient;
import software.amazon.awssdk.services.ssm.model.GetParameterRequest;

Expand All @@ -19,9 +20,7 @@ public OptOutParameterStore(String role, String dbHost, String dbUser, String d
}

public static OptOutParameterStore getParameterStore() {
var ssmClient = SsmClient.builder()
.region(S3_REGION)
.build();
var ssmClient = SsmClientUtil.getClient();

var role = getValueFromParameterStore(ROLE_PARAM, ssmClient);
var dbHost = getValueFromParameterStore(DB_HOST_PARAM, ssmClient);
Expand Down

0 comments on commit 987c17d

Please sign in to comment.