From 4f2be07d862ea3ccee70d0a7c86d3146e6dee823 Mon Sep 17 00:00:00 2001 From: Thomas Poepping Date: Fri, 29 Oct 2021 14:43:41 -0700 Subject: [PATCH] Change import checkstyle configuration and fix all import violations (#136) * change import checkstyle * update import order rules and fix all ImportOrder checkstyle violations * add a comment about checkstyle to CONTRIBUTING.md * Change hyperlink to checkstyle.xml for clarity * reduce allowed checkstyle violations to the current violations Co-authored-by: Thomas Poepping --- CONTRIBUTING.md | 2 +- functions/alb-update/pom.xml | 2 +- functions/ecs-deploy/pom.xml | 2 +- functions/ecs-service-update/pom.xml | 2 +- functions/ecs-shutdown-services/pom.xml | 2 +- functions/ecs-startup-services/pom.xml | 2 +- functions/onboarding-notification/pom.xml | 2 +- functions/system-rest-api-client/pom.xml | 2 +- installer/pom.xml | 2 +- layers/apigw-helper/pom.xml | 2 +- layers/utils/pom.xml | 2 +- metering-billing/lambdas/pom.xml | 2 +- .../aggregation/BillingEventAggregation.java | 33 ++++++---------- .../aggregation/StripeBillingPublish.java | 39 +++++++------------ .../metering/billing/ProcessBillingEvent.java | 17 ++++---- .../metering/common/Constants.java | 9 +---- .../metering/common/TenantConfiguration.java | 13 +++---- metrics-analytics/metrics-java-sdk/pom.xml | 2 +- .../com/amazonaws/saas/metrics/Metric.java | 1 + .../saas/metrics/MetricEventBuilder.java | 3 +- .../saas/metrics/MetricEventLogger.java | 7 ++-- .../com/amazonaws/saas/metrics/Tenant.java | 1 + resources/checkstyle/checkstyle.xml | 2 +- .../custom-resources/cidr-dynamodb/pom.xml | 2 +- .../custom-resources/clear-s3-bucket/pom.xml | 2 +- .../disable-instance-protection/pom.xml | 2 +- .../custom-resources/fsx-dns-name/pom.xml | 2 +- .../custom-resources/rds-bootstrap/pom.xml | 2 +- .../custom-resources/rds-options/pom.xml | 2 +- .../custom-resources/redshift-table/pom.xml | 2 +- .../saasfactory/saasboost/RedshiftTable.java | 6 +-- services/metric-service/pom.xml | 2 +- .../saasfactory/saasboost/MetricHelper.java | 33 +++++++--------- .../saasfactory/saasboost/MetricService.java | 2 +- services/onboarding-service/pom.xml | 2 +- services/quotas-service/pom.xml | 2 +- services/settings-service/pom.xml | 2 +- services/tenant-service/pom.xml | 2 +- services/user-service/pom.xml | 2 +- 39 files changed, 95 insertions(+), 123 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 488a3b39..1e185d98 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -31,7 +31,7 @@ To send us a pull request, please: 1. Fork the repository. 2. Modify the source; please focus on the specific change you are contributing. If you also reformat all the code, it will be hard for us to focus on your change. -3. Ensure local tests pass. +3. Ensure local checks pass, including test, checkstyle, and spotbugs. Our checkstyle rules are closely patterned after the IntelliJ IDE's defaults and can be found in [resources/checkstyle/checkstyle.xml](resources/checkstyle/checkstyle.xml). 4. Commit to your fork using clear commit messages. 5. Send us a pull request, answering any default questions in the pull request interface. 6. Pay attention to any automated CI failures reported in the pull request, and stay involved in the conversation. diff --git a/functions/alb-update/pom.xml b/functions/alb-update/pom.xml index 80c8873e..a937a5a8 100644 --- a/functions/alb-update/pom.xml +++ b/functions/alb-update/pom.xml @@ -34,7 +34,7 @@ limitations under the License. - 30 + 25 diff --git a/functions/ecs-deploy/pom.xml b/functions/ecs-deploy/pom.xml index b9c16e9d..56be5826 100644 --- a/functions/ecs-deploy/pom.xml +++ b/functions/ecs-deploy/pom.xml @@ -34,7 +34,7 @@ limitations under the License. - 24 + 17 diff --git a/functions/ecs-service-update/pom.xml b/functions/ecs-service-update/pom.xml index 822f5b17..1d633ce1 100644 --- a/functions/ecs-service-update/pom.xml +++ b/functions/ecs-service-update/pom.xml @@ -34,7 +34,7 @@ limitations under the License. - 8 + 5 diff --git a/functions/ecs-shutdown-services/pom.xml b/functions/ecs-shutdown-services/pom.xml index f545792e..d8c7c823 100644 --- a/functions/ecs-shutdown-services/pom.xml +++ b/functions/ecs-shutdown-services/pom.xml @@ -34,7 +34,7 @@ limitations under the License. - 11 + 8 diff --git a/functions/ecs-startup-services/pom.xml b/functions/ecs-startup-services/pom.xml index edfa9792..8f708463 100644 --- a/functions/ecs-startup-services/pom.xml +++ b/functions/ecs-startup-services/pom.xml @@ -34,7 +34,7 @@ limitations under the License. - 15 + 12 diff --git a/functions/onboarding-notification/pom.xml b/functions/onboarding-notification/pom.xml index 8d855bba..c5ac3c87 100644 --- a/functions/onboarding-notification/pom.xml +++ b/functions/onboarding-notification/pom.xml @@ -34,7 +34,7 @@ limitations under the License. - 23 + 16 diff --git a/functions/system-rest-api-client/pom.xml b/functions/system-rest-api-client/pom.xml index 46f74295..5b32a243 100644 --- a/functions/system-rest-api-client/pom.xml +++ b/functions/system-rest-api-client/pom.xml @@ -34,7 +34,7 @@ limitations under the License. - 16 + 9 diff --git a/installer/pom.xml b/installer/pom.xml index 48b522e8..1e59de41 100644 --- a/installer/pom.xml +++ b/installer/pom.xml @@ -35,7 +35,7 @@ limitations under the License. - 138 + 104 diff --git a/layers/apigw-helper/pom.xml b/layers/apigw-helper/pom.xml index e71c33a7..da44a9e4 100644 --- a/layers/apigw-helper/pom.xml +++ b/layers/apigw-helper/pom.xml @@ -34,7 +34,7 @@ limitations under the License. - 24 + 9 diff --git a/layers/utils/pom.xml b/layers/utils/pom.xml index 633088bb..4e114ffd 100644 --- a/layers/utils/pom.xml +++ b/layers/utils/pom.xml @@ -34,7 +34,7 @@ limitations under the License. - 342 + 334 diff --git a/metering-billing/lambdas/pom.xml b/metering-billing/lambdas/pom.xml index 9dd67807..712e8bc3 100644 --- a/metering-billing/lambdas/pom.xml +++ b/metering-billing/lambdas/pom.xml @@ -35,7 +35,7 @@ limitations under the License. - 208 + 136 diff --git a/metering-billing/lambdas/src/main/java/com/amazon/aws/partners/saasfactory/metering/aggregation/BillingEventAggregation.java b/metering-billing/lambdas/src/main/java/com/amazon/aws/partners/saasfactory/metering/aggregation/BillingEventAggregation.java index 3a3852fe..be9819ae 100644 --- a/metering-billing/lambdas/src/main/java/com/amazon/aws/partners/saasfactory/metering/aggregation/BillingEventAggregation.java +++ b/metering-billing/lambdas/src/main/java/com/amazon/aws/partners/saasfactory/metering/aggregation/BillingEventAggregation.java @@ -15,26 +15,13 @@ */ package com.amazon.aws.partners.saasfactory.metering.aggregation; -import java.io.InputStream; -import java.io.OutputStream; -import java.time.Instant; -import java.time.ZoneId; -import java.time.ZonedDateTime; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; -import java.util.stream.Collectors; - +import com.amazon.aws.partners.saasfactory.metering.common.BillingEvent; +import com.amazon.aws.partners.saasfactory.metering.common.TenantConfiguration; import com.amazon.aws.partners.saasfactory.saasboost.Utils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import com.amazonaws.services.lambda.runtime.Context; import com.amazonaws.services.lambda.runtime.RequestStreamHandler; - +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import software.amazon.awssdk.services.dynamodb.DynamoDbClient; import software.amazon.awssdk.services.dynamodb.model.AttributeValue; import software.amazon.awssdk.services.dynamodb.model.ConditionalCheckFailedException; @@ -44,17 +31,21 @@ import software.amazon.awssdk.services.dynamodb.model.QueryRequest; import software.amazon.awssdk.services.dynamodb.model.QueryResponse; import software.amazon.awssdk.services.dynamodb.model.ResourceNotFoundException; -import software.amazon.awssdk.services.dynamodb.model.TransactionCanceledException; import software.amazon.awssdk.services.dynamodb.model.TransactWriteItem; import software.amazon.awssdk.services.dynamodb.model.TransactWriteItemsRequest; +import software.amazon.awssdk.services.dynamodb.model.TransactionCanceledException; import software.amazon.awssdk.services.dynamodb.model.Update; -import com.amazon.aws.partners.saasfactory.metering.common.TenantConfiguration; -import com.amazon.aws.partners.saasfactory.metering.common.BillingEvent; +import java.io.InputStream; +import java.io.OutputStream; +import java.time.Instant; +import java.time.ZoneId; +import java.time.ZonedDateTime; +import java.util.*; +import java.util.stream.Collectors; import static com.amazon.aws.partners.saasfactory.metering.common.Constants.*; - public class BillingEventAggregation implements RequestStreamHandler { private final DynamoDbClient ddb; diff --git a/metering-billing/lambdas/src/main/java/com/amazon/aws/partners/saasfactory/metering/aggregation/StripeBillingPublish.java b/metering-billing/lambdas/src/main/java/com/amazon/aws/partners/saasfactory/metering/aggregation/StripeBillingPublish.java index a8d51a24..677bfe6f 100644 --- a/metering-billing/lambdas/src/main/java/com/amazon/aws/partners/saasfactory/metering/aggregation/StripeBillingPublish.java +++ b/metering-billing/lambdas/src/main/java/com/amazon/aws/partners/saasfactory/metering/aggregation/StripeBillingPublish.java @@ -15,42 +15,33 @@ */ package com.amazon.aws.partners.saasfactory.metering.aggregation; -import java.io.InputStream; -import java.io.OutputStream; -import java.time.Instant; -import java.time.temporal.ChronoUnit; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import com.amazon.aws.partners.saasfactory.metering.common.AggregationEntry; +import com.amazon.aws.partners.saasfactory.metering.common.TenantConfiguration; import com.amazon.aws.partners.saasfactory.saasboost.ApiGatewayHelper; import com.amazon.aws.partners.saasfactory.saasboost.ApiRequest; import com.amazon.aws.partners.saasfactory.saasboost.Utils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import com.amazonaws.services.lambda.runtime.Context; import com.amazonaws.services.lambda.runtime.RequestStreamHandler; - -import software.amazon.awssdk.http.SdkHttpFullRequest; -import software.amazon.awssdk.services.dynamodb.DynamoDbClient; -import software.amazon.awssdk.services.dynamodb.model.AttributeValue; -import software.amazon.awssdk.services.dynamodb.model.InternalServerErrorException; -import software.amazon.awssdk.services.dynamodb.model.QueryRequest; -import software.amazon.awssdk.services.dynamodb.model.QueryResponse; -import software.amazon.awssdk.services.dynamodb.model.ResourceNotFoundException; -import software.amazon.awssdk.services.dynamodb.model.TransactionCanceledException; -import software.amazon.awssdk.services.dynamodb.model.UpdateItemRequest; - import com.stripe.Stripe; import com.stripe.exception.StripeException; import com.stripe.model.UsageRecord; import com.stripe.net.RequestOptions; import com.stripe.param.UsageRecordCreateOnSubscriptionItemParams; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import software.amazon.awssdk.http.SdkHttpFullRequest; +import software.amazon.awssdk.services.dynamodb.DynamoDbClient; +import software.amazon.awssdk.services.dynamodb.model.*; -import com.amazon.aws.partners.saasfactory.metering.common.AggregationEntry; -import com.amazon.aws.partners.saasfactory.metering.common.TenantConfiguration; +import java.io.InputStream; +import java.io.OutputStream; +import java.time.Instant; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import static com.amazon.aws.partners.saasfactory.metering.common.Constants.*; diff --git a/metering-billing/lambdas/src/main/java/com/amazon/aws/partners/saasfactory/metering/billing/ProcessBillingEvent.java b/metering-billing/lambdas/src/main/java/com/amazon/aws/partners/saasfactory/metering/billing/ProcessBillingEvent.java index aaeec41b..89e14b4c 100644 --- a/metering-billing/lambdas/src/main/java/com/amazon/aws/partners/saasfactory/metering/billing/ProcessBillingEvent.java +++ b/metering-billing/lambdas/src/main/java/com/amazon/aws/partners/saasfactory/metering/billing/ProcessBillingEvent.java @@ -15,27 +15,24 @@ */ package com.amazon.aws.partners.saasfactory.metering.billing; -import java.time.Instant; -import java.util.HashMap; -import java.util.Map; - +import com.amazon.aws.partners.saasfactory.metering.common.BillingEvent; +import com.amazon.aws.partners.saasfactory.metering.common.ProcessBillingEventException; +import com.amazon.aws.partners.saasfactory.metering.common.TenantConfiguration; import com.amazon.aws.partners.saasfactory.metering.onboarding.OnboardTenantProduct; import com.amazon.aws.partners.saasfactory.saasboost.Utils; +import com.amazonaws.services.lambda.runtime.Context; import com.amazonaws.services.lambda.runtime.RequestHandler; import org.slf4j.Logger; import org.slf4j.LoggerFactory; - -import com.amazonaws.services.lambda.runtime.Context; - import software.amazon.awssdk.services.dynamodb.DynamoDbClient; import software.amazon.awssdk.services.dynamodb.model.AttributeValue; import software.amazon.awssdk.services.dynamodb.model.InternalServerErrorException; import software.amazon.awssdk.services.dynamodb.model.PutItemRequest; import software.amazon.awssdk.services.dynamodb.model.ResourceNotFoundException; -import com.amazon.aws.partners.saasfactory.metering.common.BillingEvent; -import com.amazon.aws.partners.saasfactory.metering.common.TenantConfiguration; -import com.amazon.aws.partners.saasfactory.metering.common.ProcessBillingEventException; +import java.time.Instant; +import java.util.HashMap; +import java.util.Map; import static com.amazon.aws.partners.saasfactory.metering.common.Constants.*; diff --git a/metering-billing/lambdas/src/main/java/com/amazon/aws/partners/saasfactory/metering/common/Constants.java b/metering-billing/lambdas/src/main/java/com/amazon/aws/partners/saasfactory/metering/common/Constants.java index 1fe260c0..d19a2f41 100644 --- a/metering-billing/lambdas/src/main/java/com/amazon/aws/partners/saasfactory/metering/common/Constants.java +++ b/metering-billing/lambdas/src/main/java/com/amazon/aws/partners/saasfactory/metering/common/Constants.java @@ -16,19 +16,12 @@ package com.amazon.aws.partners.saasfactory.metering.common; import org.slf4j.Logger; - -import software.amazon.awssdk.auth.credentials.EnvironmentVariableCredentialsProvider; import software.amazon.awssdk.core.SdkSystemSetting; -import software.amazon.awssdk.core.client.config.ClientOverrideConfiguration; -import software.amazon.awssdk.http.urlconnection.UrlConnectionHttpClient; import software.amazon.awssdk.regions.Region; -import software.amazon.awssdk.services.dynamodb.DynamoDbClient; -import java.net.URI; -import java.net.URISyntaxException; +import java.time.Instant; import java.time.temporal.ChronoUnit; import java.util.UUID; -import java.time.Instant; public final class Constants { diff --git a/metering-billing/lambdas/src/main/java/com/amazon/aws/partners/saasfactory/metering/common/TenantConfiguration.java b/metering-billing/lambdas/src/main/java/com/amazon/aws/partners/saasfactory/metering/common/TenantConfiguration.java index fd94ffcc..4022c3fd 100644 --- a/metering-billing/lambdas/src/main/java/com/amazon/aws/partners/saasfactory/metering/common/TenantConfiguration.java +++ b/metering-billing/lambdas/src/main/java/com/amazon/aws/partners/saasfactory/metering/common/TenantConfiguration.java @@ -15,13 +15,7 @@ */ package com.amazon.aws.partners.saasfactory.metering.common; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - import org.slf4j.Logger; - import software.amazon.awssdk.services.dynamodb.DynamoDbClient; import software.amazon.awssdk.services.dynamodb.model.AttributeValue; import software.amazon.awssdk.services.dynamodb.model.GetItemRequest; @@ -30,6 +24,11 @@ import software.amazon.awssdk.services.dynamodb.model.QueryResponse; import software.amazon.awssdk.services.dynamodb.model.ResourceNotFoundException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + import static com.amazon.aws.partners.saasfactory.metering.common.Constants.CONFIG_EXPRESSION_NAME; import static com.amazon.aws.partners.saasfactory.metering.common.Constants.CONFIG_EXPRESSION_VALUE; import static com.amazon.aws.partners.saasfactory.metering.common.Constants.CONFIG_INDEX_NAME_ENV_VARIABLE; @@ -37,8 +36,8 @@ import static com.amazon.aws.partners.saasfactory.metering.common.Constants.PRIMARY_KEY_NAME; import static com.amazon.aws.partners.saasfactory.metering.common.Constants.SORT_KEY_NAME; import static com.amazon.aws.partners.saasfactory.metering.common.Constants.SUBSCRIPTION_MAPPING_ATTRIBUTE_NAME; -import static com.amazon.aws.partners.saasfactory.metering.common.Constants.getEnvVariable; import static com.amazon.aws.partners.saasfactory.metering.common.Constants.formatTenantEntry; +import static com.amazon.aws.partners.saasfactory.metering.common.Constants.getEnvVariable; public class TenantConfiguration { diff --git a/metrics-analytics/metrics-java-sdk/pom.xml b/metrics-analytics/metrics-java-sdk/pom.xml index 906b57dc..63fdc2d5 100644 --- a/metrics-analytics/metrics-java-sdk/pom.xml +++ b/metrics-analytics/metrics-java-sdk/pom.xml @@ -30,7 +30,7 @@ limitations under the License. 1.8 - 26 + 25 diff --git a/metrics-analytics/metrics-java-sdk/src/main/java/com/amazonaws/saas/metrics/Metric.java b/metrics-analytics/metrics-java-sdk/src/main/java/com/amazonaws/saas/metrics/Metric.java index cb005700..9ea9eab8 100644 --- a/metrics-analytics/metrics-java-sdk/src/main/java/com/amazonaws/saas/metrics/Metric.java +++ b/metrics-analytics/metrics-java-sdk/src/main/java/com/amazonaws/saas/metrics/Metric.java @@ -17,6 +17,7 @@ import com.fasterxml.jackson.annotation.JsonGetter; import com.fasterxml.jackson.annotation.JsonIgnore; + import java.util.Objects; public class Metric { diff --git a/metrics-analytics/metrics-java-sdk/src/main/java/com/amazonaws/saas/metrics/MetricEventBuilder.java b/metrics-analytics/metrics-java-sdk/src/main/java/com/amazonaws/saas/metrics/MetricEventBuilder.java index 5cb0bf17..a05f8bff 100644 --- a/metrics-analytics/metrics-java-sdk/src/main/java/com/amazonaws/saas/metrics/MetricEventBuilder.java +++ b/metrics-analytics/metrics-java-sdk/src/main/java/com/amazonaws/saas/metrics/MetricEventBuilder.java @@ -16,10 +16,11 @@ package com.amazonaws.saas.metrics; import com.amazonaws.saas.metrics.MetricEvent.Type; -import java.util.Map; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.util.Map; + public class MetricEventBuilder { private static final Logger logger = LoggerFactory.getLogger(MetricEventBuilder.class); private MetricEvent metricEvent; diff --git a/metrics-analytics/metrics-java-sdk/src/main/java/com/amazonaws/saas/metrics/MetricEventLogger.java b/metrics-analytics/metrics-java-sdk/src/main/java/com/amazonaws/saas/metrics/MetricEventLogger.java index fd513cfd..22202757 100644 --- a/metrics-analytics/metrics-java-sdk/src/main/java/com/amazonaws/saas/metrics/MetricEventLogger.java +++ b/metrics-analytics/metrics-java-sdk/src/main/java/com/amazonaws/saas/metrics/MetricEventLogger.java @@ -17,9 +17,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import io.netty.util.CharsetUtil; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import software.amazon.awssdk.core.SdkBytes; @@ -28,6 +25,10 @@ import software.amazon.awssdk.services.firehose.model.PutRecordBatchRequest; import software.amazon.awssdk.services.firehose.model.Record; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + public class MetricEventLogger { private static final Logger logger = LoggerFactory.getLogger(MetricEventLogger.class); public static final int DEFAULT_FLUSH_TIME_IN_SECS = 60; diff --git a/metrics-analytics/metrics-java-sdk/src/main/java/com/amazonaws/saas/metrics/Tenant.java b/metrics-analytics/metrics-java-sdk/src/main/java/com/amazonaws/saas/metrics/Tenant.java index 527d57b6..789c8d17 100644 --- a/metrics-analytics/metrics-java-sdk/src/main/java/com/amazonaws/saas/metrics/Tenant.java +++ b/metrics-analytics/metrics-java-sdk/src/main/java/com/amazonaws/saas/metrics/Tenant.java @@ -17,6 +17,7 @@ import com.fasterxml.jackson.annotation.JsonGetter; import com.fasterxml.jackson.annotation.JsonIgnore; + import java.util.Objects; public class Tenant { diff --git a/resources/checkstyle/checkstyle.xml b/resources/checkstyle/checkstyle.xml index 106ef15c..587308e7 100644 --- a/resources/checkstyle/checkstyle.xml +++ b/resources/checkstyle/checkstyle.xml @@ -233,7 +233,7 @@ - + diff --git a/resources/custom-resources/cidr-dynamodb/pom.xml b/resources/custom-resources/cidr-dynamodb/pom.xml index 25f86983..806eeed4 100644 --- a/resources/custom-resources/cidr-dynamodb/pom.xml +++ b/resources/custom-resources/cidr-dynamodb/pom.xml @@ -33,7 +33,7 @@ limitations under the License. - 16 + 7 diff --git a/resources/custom-resources/clear-s3-bucket/pom.xml b/resources/custom-resources/clear-s3-bucket/pom.xml index 38821bc0..ab3a0b20 100644 --- a/resources/custom-resources/clear-s3-bucket/pom.xml +++ b/resources/custom-resources/clear-s3-bucket/pom.xml @@ -33,7 +33,7 @@ limitations under the License. - 16 + 6 diff --git a/resources/custom-resources/disable-instance-protection/pom.xml b/resources/custom-resources/disable-instance-protection/pom.xml index 48dccc5a..4f9297b0 100644 --- a/resources/custom-resources/disable-instance-protection/pom.xml +++ b/resources/custom-resources/disable-instance-protection/pom.xml @@ -33,7 +33,7 @@ limitations under the License. - 13 + 6 diff --git a/resources/custom-resources/fsx-dns-name/pom.xml b/resources/custom-resources/fsx-dns-name/pom.xml index 98e31c76..6e924c31 100644 --- a/resources/custom-resources/fsx-dns-name/pom.xml +++ b/resources/custom-resources/fsx-dns-name/pom.xml @@ -33,7 +33,7 @@ limitations under the License. - 12 + 5 diff --git a/resources/custom-resources/rds-bootstrap/pom.xml b/resources/custom-resources/rds-bootstrap/pom.xml index a7b62ea5..dd7629c7 100644 --- a/resources/custom-resources/rds-bootstrap/pom.xml +++ b/resources/custom-resources/rds-bootstrap/pom.xml @@ -33,7 +33,7 @@ limitations under the License. - 24 + 15 diff --git a/resources/custom-resources/rds-options/pom.xml b/resources/custom-resources/rds-options/pom.xml index 524965a7..f325acca 100644 --- a/resources/custom-resources/rds-options/pom.xml +++ b/resources/custom-resources/rds-options/pom.xml @@ -33,7 +33,7 @@ limitations under the License. - 45 + 37 diff --git a/resources/custom-resources/redshift-table/pom.xml b/resources/custom-resources/redshift-table/pom.xml index b3d2f556..676fec09 100644 --- a/resources/custom-resources/redshift-table/pom.xml +++ b/resources/custom-resources/redshift-table/pom.xml @@ -33,7 +33,7 @@ limitations under the License. - 46 + 35 diff --git a/resources/custom-resources/redshift-table/src/main/java/com/amazon/aws/partners/saasfactory/saasboost/RedshiftTable.java b/resources/custom-resources/redshift-table/src/main/java/com/amazon/aws/partners/saasfactory/saasboost/RedshiftTable.java index f831747c..a8a45791 100644 --- a/resources/custom-resources/redshift-table/src/main/java/com/amazon/aws/partners/saasfactory/saasboost/RedshiftTable.java +++ b/resources/custom-resources/redshift-table/src/main/java/com/amazon/aws/partners/saasfactory/saasboost/RedshiftTable.java @@ -15,12 +15,15 @@ */ package com.amazon.aws.partners.saasfactory.saasboost; +// import com.amazon.redshift.jdbc42.Driver; //keep this just make sure jar is present import com.amazonaws.services.lambda.runtime.Context; import com.amazonaws.services.lambda.runtime.RequestHandler; import com.fasterxml.jackson.databind.node.JsonNodeFactory; import com.fasterxml.jackson.databind.node.ObjectNode; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import software.amazon.awssdk.core.exception.SdkServiceException; +import software.amazon.awssdk.services.ssm.SsmClient; import java.io.*; import java.net.HttpURLConnection; @@ -31,9 +34,6 @@ import java.sql.Statement; import java.util.*; import java.util.concurrent.*; -import com.amazon.redshift.jdbc42.Driver; //keep this just make sure jar is present -import software.amazon.awssdk.core.exception.SdkServiceException; -import software.amazon.awssdk.services.ssm.SsmClient; public class RedshiftTable implements RequestHandler, Object> { diff --git a/services/metric-service/pom.xml b/services/metric-service/pom.xml index 8c8309bc..95e2715a 100644 --- a/services/metric-service/pom.xml +++ b/services/metric-service/pom.xml @@ -34,7 +34,7 @@ limitations under the License. - 214 + 165 diff --git a/services/metric-service/src/main/java/com/amazon/aws/partners/saasfactory/saasboost/MetricHelper.java b/services/metric-service/src/main/java/com/amazon/aws/partners/saasfactory/saasboost/MetricHelper.java index 1ebe5a01..b3b9d6ac 100644 --- a/services/metric-service/src/main/java/com/amazon/aws/partners/saasfactory/saasboost/MetricHelper.java +++ b/services/metric-service/src/main/java/com/amazon/aws/partners/saasfactory/saasboost/MetricHelper.java @@ -15,6 +15,21 @@ */ package com.amazon.aws.partners.saasfactory.saasboost; +import software.amazon.awssdk.services.athena.AthenaClient; +import software.amazon.awssdk.services.athena.model.AthenaException; +import software.amazon.awssdk.services.athena.model.ColumnInfo; +import software.amazon.awssdk.services.athena.model.Datum; +import software.amazon.awssdk.services.athena.model.GetQueryExecutionRequest; +import software.amazon.awssdk.services.athena.model.GetQueryExecutionResponse; +import software.amazon.awssdk.services.athena.model.GetQueryResultsRequest; +import software.amazon.awssdk.services.athena.model.GetQueryResultsResponse; +import software.amazon.awssdk.services.athena.model.QueryExecutionContext; +import software.amazon.awssdk.services.athena.model.QueryExecutionState; +import software.amazon.awssdk.services.athena.model.ResultConfiguration; +import software.amazon.awssdk.services.athena.model.Row; +import software.amazon.awssdk.services.athena.model.StartQueryExecutionRequest; +import software.amazon.awssdk.services.athena.model.StartQueryExecutionResponse; +import software.amazon.awssdk.services.athena.paginators.GetQueryResultsIterable; import software.amazon.awssdk.utils.StringUtils; import java.math.BigDecimal; @@ -26,26 +41,8 @@ import java.time.ZoneId; import java.time.temporal.ChronoUnit; import java.time.temporal.TemporalAdjusters; -import java.time.temporal.TemporalUnit; import java.util.*; -import software.amazon.awssdk.services.athena.AthenaClient; -import software.amazon.awssdk.services.athena.model.QueryExecutionContext; -import software.amazon.awssdk.services.athena.model.ResultConfiguration; -import software.amazon.awssdk.services.athena.model.StartQueryExecutionRequest; -import software.amazon.awssdk.services.athena.model.StartQueryExecutionResponse; -import software.amazon.awssdk.services.athena.model.AthenaException; -import software.amazon.awssdk.services.athena.model.GetQueryExecutionRequest; -import software.amazon.awssdk.services.athena.model.GetQueryExecutionResponse; -import software.amazon.awssdk.services.athena.model.QueryExecutionState; -import software.amazon.awssdk.services.athena.model.GetQueryResultsRequest; -import software.amazon.awssdk.services.athena.model.GetQueryResultsResponse; -import software.amazon.awssdk.services.athena.model.ColumnInfo; -import software.amazon.awssdk.services.athena.model.Row; -import software.amazon.awssdk.services.athena.model.Datum; -import software.amazon.awssdk.services.athena.paginators.GetQueryResultsIterable; -import java.util.List; - public class MetricHelper { public static final long SLEEP_AMOUNT_IN_MS = 500; diff --git a/services/metric-service/src/main/java/com/amazon/aws/partners/saasfactory/saasboost/MetricService.java b/services/metric-service/src/main/java/com/amazon/aws/partners/saasfactory/saasboost/MetricService.java index 66b79bbc..c903aa59 100644 --- a/services/metric-service/src/main/java/com/amazon/aws/partners/saasfactory/saasboost/MetricService.java +++ b/services/metric-service/src/main/java/com/amazon/aws/partners/saasfactory/saasboost/MetricService.java @@ -18,9 +18,9 @@ import com.amazonaws.services.lambda.runtime.Context; import com.amazonaws.services.lambda.runtime.RequestHandler; import com.amazonaws.services.lambda.runtime.events.APIGatewayProxyResponseEvent; - import org.slf4j.Logger; import org.slf4j.LoggerFactory; + import java.io.InputStream; import java.io.OutputStream; import java.net.URL; diff --git a/services/onboarding-service/pom.xml b/services/onboarding-service/pom.xml index 806316bb..e0cb4b67 100644 --- a/services/onboarding-service/pom.xml +++ b/services/onboarding-service/pom.xml @@ -34,7 +34,7 @@ limitations under the License. - 193 + 175 diff --git a/services/quotas-service/pom.xml b/services/quotas-service/pom.xml index 8f750458..4a576290 100644 --- a/services/quotas-service/pom.xml +++ b/services/quotas-service/pom.xml @@ -34,7 +34,7 @@ limitations under the License. - 33 + 25 diff --git a/services/settings-service/pom.xml b/services/settings-service/pom.xml index e3e89560..b13ff88d 100644 --- a/services/settings-service/pom.xml +++ b/services/settings-service/pom.xml @@ -34,7 +34,7 @@ limitations under the License. - 175 + 155 diff --git a/services/tenant-service/pom.xml b/services/tenant-service/pom.xml index ec804903..81e175df 100644 --- a/services/tenant-service/pom.xml +++ b/services/tenant-service/pom.xml @@ -34,7 +34,7 @@ limitations under the License. - 44 + 32 diff --git a/services/user-service/pom.xml b/services/user-service/pom.xml index b1821c18..7323fd0f 100644 --- a/services/user-service/pom.xml +++ b/services/user-service/pom.xml @@ -34,7 +34,7 @@ limitations under the License. - 39 + 26