Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DBCluster] Support add support for StorageThroughput #513

Merged
merged 2 commits into from
Feb 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
aws-rds-handlers.iml
rpdk.log
/build/
# python helper scripts
bin/
lib/
env/
# for IntelliJ IDEA
.idea/
# Gradle
.gradle
/gradle/
/wrapper/
6 changes: 3 additions & 3 deletions aws-rds-cfn-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>utils</artifactId>
<version>2.21.17</version>
<version>2.24.13</version>
</dependency>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>rds</artifactId>
<version>2.21.17</version>
<version>2.24.13</version>
</dependency>
<dependency>
<groupId>software.amazon.cloudformation</groupId>
Expand Down Expand Up @@ -190,7 +190,7 @@
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.4</version>
<version>0.8.8</version>
<configuration>
<excludes>
</excludes>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import software.amazon.rds.common.error.ErrorRuleSet;
import software.amazon.rds.common.error.ErrorStatus;
import software.amazon.rds.common.error.UnexpectedErrorStatus;
import software.amazon.rds.common.handler.Tagging.TagSet;
import software.amazon.rds.common.logging.LoggingProxyClient;
import software.amazon.rds.common.logging.RequestLogger;
import software.amazon.rds.common.printer.FilteredJsonPrinter;
Expand Down Expand Up @@ -83,6 +84,26 @@ public void setup() {
proxyRdsClient = new LoggingProxyClient<>(new RequestLogger(null, request, new FilteredJsonPrinter()), MOCK_PROXY(proxy, rds));
}

@Test
void tagset_emptySystemTags_notEmpty() {
final Set<Tag> systemTags = Collections.emptySet();
final Set<Tag> stackTags = STACK_TAGS;
final Set<Tag> resourceTags = RESOURCE_TAGS;

final TagSet tagset = new TagSet(systemTags, stackTags, resourceTags);
assertThat(tagset.isEmpty()).isFalse();
}

@Test
void tagset_emptyResourceTags_notEmpty() {
final Set<Tag> systemTags = SYSTEM_TAGS;
final Set<Tag> stackTags = STACK_TAGS;
final Set<Tag> resourceTags = Collections.emptySet();

final TagSet tagset = new TagSet(systemTags, stackTags, resourceTags);
assertThat(tagset.isEmpty()).isFalse();
}

@Test
void simple_success() {
final ProgressEvent<Void, Void> event = new ProgressEvent<>();
Expand Down Expand Up @@ -186,6 +207,14 @@ void test_translateTagsToSdk() {
assertThat(allTags.containsAll(RESOURCE_TAGS)).isTrue();
}

@Test
void test_translateTagsToSdk_from_collection() {
final Collection<Tag> tagSet = Collections.emptyList();
final Collection<Tag> allTags = Tagging.translateTagsToSdk(tagSet);

assertThat(allTags.isEmpty());
}

@Test
void test_translateTagsToSdk_duplicate_tags() {
String duplicateTagKey = "duplicate-tag-key";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,19 @@ void test_pass_if_logger_null() {
}
}

@Test
void test_log_with_exception() {
try{
ResourceHandlerRequest<Void> request = new ResourceHandlerRequest<>();
request.setStackId(STACK_ID);
RequestLogger requestLogger = new RequestLogger(logger, request, null);
requestLogger.log(SIMPLE_LOG, request);
} catch (Throwable throwable) {
verify(logger, atLeast(1)).log(captor.capture());
assertThat(captor.getValue().contains(STACK_ID)).isTrue();
}
}

@Test
void test_log_and_throw() {
Throwable throwable = new Throwable("This is Exception");
Expand Down
2 changes: 1 addition & 1 deletion aws-rds-cfn-test-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.4</version>
<version>0.8.8</version>
<configuration>
<excludes>
</excludes>
Expand Down
4 changes: 2 additions & 2 deletions aws-rds-customdbengineversion/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>rds</artifactId>
<version>2.21.17</version>
<version>2.24.13</version>
</dependency>
<dependency>
<groupId>software.amazon.rds.common</groupId>
Expand Down Expand Up @@ -159,7 +159,7 @@
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.4</version>
<version>0.8.8</version>
<configuration>
<excludes>
<exclude>**/BaseConfiguration*</exclude>
Expand Down
7 changes: 6 additions & 1 deletion aws-rds-dbcluster/aws-rds-dbcluster.json
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,10 @@
"description": "Indicates whether the DB instance is encrypted.\nIf you specify the DBClusterIdentifier, SnapshotIdentifier, or SourceDBInstanceIdentifier property, don't specify this property. The value is inherited from the cluster, snapshot, or source DB instance.",
"type": "boolean"
},
"StorageThroughput": {
"description": "Specifies the storage throughput value for the DB cluster. This setting applies only to the gp3 storage type.",
"type": "integer"
},
"StorageType": {
"description": "Specifies the storage type to be associated with the DB cluster.",
"type": "string"
Expand Down Expand Up @@ -422,7 +426,8 @@
"/properties/Endpoint/Port",
"/properties/ReadEndpoint/Port",
"/properties/ReadEndpoint/Address",
"/properties/MasterUserSecret/SecretArn"
"/properties/MasterUserSecret/SecretArn",
"/properties/StorageThroughput"
],
"createOnlyProperties": [
"/properties/AvailabilityZones",
Expand Down
4 changes: 2 additions & 2 deletions aws-rds-dbcluster/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>rds</artifactId>
<version>2.22.12</version>
<version>2.24.13</version>
</dependency>
<dependency>
<groupId>software.amazon.awssdk</groupId>
Expand Down Expand Up @@ -178,7 +178,7 @@
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.4</version>
<version>0.8.8</version>
<configuration>
<excludes>
<exclude>**/BaseConfiguration*</exclude>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
import software.amazon.awssdk.services.rds.model.Event;
import software.amazon.awssdk.services.rds.model.GlobalCluster;
import software.amazon.awssdk.services.rds.model.GlobalClusterNotFoundException;
import software.amazon.awssdk.services.rds.model.InsufficientDbInstanceCapacityException;
import software.amazon.awssdk.services.rds.model.InsufficientStorageClusterCapacityException;
import software.amazon.awssdk.services.rds.model.InvalidDbClusterSnapshotStateException;
import software.amazon.awssdk.services.rds.model.InvalidDbClusterStateException;
Expand Down Expand Up @@ -136,6 +137,7 @@ public abstract class BaseHandlerStd extends BaseHandler<CallbackContext> {
.withErrorClasses(ErrorStatus.failWith(HandlerErrorCode.ServiceLimitExceeded),
DbClusterQuotaExceededException.class,
InsufficientStorageClusterCapacityException.class,
InsufficientDbInstanceCapacityException.class,
StorageQuotaExceededException.class,
SnapshotQuotaExceededException.class)
.withErrorClasses(ErrorStatus.failWith(HandlerErrorCode.ResourceConflict),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,7 @@ public static ResourceModel translateDbClusterFromSdk(
.serverlessV2ScalingConfiguration(translateServerlessV2ScalingConfigurationFromSdk(dbCluster.serverlessV2ScalingConfiguration()))
.scalingConfiguration(translateScalingConfigurationFromSdk(dbCluster.scalingConfigurationInfo()))
.storageEncrypted(dbCluster.storageEncrypted())
.storageThroughput(dbCluster.storageThroughput())
.storageType(Optional.ofNullable(dbCluster.storageType()).orElse(STORAGE_TYPE_AURORA))
.tags(translateTagsFromSdk(dbCluster.tagList()))
.vpcSecurityGroupIds(
Expand Down
Loading
Loading