diff --git a/aws-rds-dbshardgroup/aws-rds-dbshardgroup.json b/aws-rds-dbshardgroup/aws-rds-dbshardgroup.json index e5e8f8c9..85c2a887 100644 --- a/aws-rds-dbshardgroup/aws-rds-dbshardgroup.json +++ b/aws-rds-dbshardgroup/aws-rds-dbshardgroup.json @@ -9,7 +9,7 @@ "rds:RemoveTagsFromResource" ], "taggable": true, - "tagOnCreate": true, + "tagOnCreate": false, "tagUpdatable": true, "tagProperty": "/properties/Tags" }, diff --git a/aws-rds-dbshardgroup/src/main/java/software/amazon/rds/dbshardgroup/CreateHandler.java b/aws-rds-dbshardgroup/src/main/java/software/amazon/rds/dbshardgroup/CreateHandler.java index 6405dab5..489566c9 100644 --- a/aws-rds-dbshardgroup/src/main/java/software/amazon/rds/dbshardgroup/CreateHandler.java +++ b/aws-rds-dbshardgroup/src/main/java/software/amazon/rds/dbshardgroup/CreateHandler.java @@ -59,26 +59,18 @@ protected ProgressEvent handleRequest( } return ProgressEvent.progress(request.getDesiredResourceState(), callbackContext) - .then(progress -> Tagging.createWithTaggingFallback(proxy, proxyClient, this::createDbShardGroup, progress, allTags) - .then(p -> Commons.execOnce(p, () -> { - final Tagging.TagSet extraTags = Tagging.TagSet.builder() - .stackTags(allTags.getStackTags()) - .resourceTags(allTags.getResourceTags()) - .build(); - return addTags(proxyClient, request, p, extraTags); - }, CallbackContext::isAddTagsComplete, CallbackContext::setAddTagsComplete)) - ) + .then(progress -> createDbShardGroup(proxy, proxyClient, progress)) + .then(progress -> Commons.execOnce(progress, () -> addTags(proxyClient, request, progress, allTags), CallbackContext::isAddTagsComplete, CallbackContext::setAddTagsComplete)) .then(progress -> new ReadHandler().handleRequest(proxy, proxyClient, request, callbackContext)); } private ProgressEvent createDbShardGroup( final AmazonWebServicesClientProxy proxy, final ProxyClient proxyClient, - final ProgressEvent progress, - final Tagging.TagSet tags + final ProgressEvent progress ) { return proxy.initiate("rds::create-db-shard-group", proxyClient, progress.getResourceModel(), progress.getCallbackContext()) - .translateToServiceRequest((resourceModel) -> Translator.createDbShardGroupRequest(resourceModel, tags)) + .translateToServiceRequest((resourceModel) -> Translator.createDbShardGroupRequest(resourceModel)) .backoffDelay(config.getBackoff()) .makeServiceCall((createDbShardGroupRequest, proxyInvocation) -> proxyInvocation.injectCredentialsAndInvokeV2(createDbShardGroupRequest, proxyInvocation.client()::createDBShardGroup)) .stabilize((createRequest, createResponse, proxyInvocation, model, context) -> isDBShardGroupStabilizedAfterMutate(model, proxyInvocation)) diff --git a/aws-rds-dbshardgroup/src/main/java/software/amazon/rds/dbshardgroup/Translator.java b/aws-rds-dbshardgroup/src/main/java/software/amazon/rds/dbshardgroup/Translator.java index 924bff10..844d588b 100644 --- a/aws-rds-dbshardgroup/src/main/java/software/amazon/rds/dbshardgroup/Translator.java +++ b/aws-rds-dbshardgroup/src/main/java/software/amazon/rds/dbshardgroup/Translator.java @@ -17,6 +17,17 @@ public class Translator { + static CreateDbShardGroupRequest createDbShardGroupRequest(final ResourceModel model) { + return CreateDbShardGroupRequest.builder() + .computeRedundancy(model.getComputeRedundancy()) + .dbClusterIdentifier(model.getDBClusterIdentifier()) + .dbShardGroupIdentifier(model.getDBShardGroupIdentifier()) + .maxACU(model.getMaxACU()) + .minACU(model.getMinACU()) + .publiclyAccessible(model.getPubliclyAccessible()) + .build(); + } + static CreateDbShardGroupRequest createDbShardGroupRequest(final ResourceModel model, final Tagging.TagSet tags) { return CreateDbShardGroupRequest.builder() .computeRedundancy(model.getComputeRedundancy()) diff --git a/aws-rds-dbshardgroup/src/test/java/software/amazon/rds/dbshardgroup/CreateHandlerTest.java b/aws-rds-dbshardgroup/src/test/java/software/amazon/rds/dbshardgroup/CreateHandlerTest.java index 6fc3cd19..972b409e 100644 --- a/aws-rds-dbshardgroup/src/test/java/software/amazon/rds/dbshardgroup/CreateHandlerTest.java +++ b/aws-rds-dbshardgroup/src/test/java/software/amazon/rds/dbshardgroup/CreateHandlerTest.java @@ -115,7 +115,7 @@ public void handleRequest_SimpleSuccess() { Objects.equals(DB_SHARD_GROUP_CREATING.dbShardGroupIdentifier(), req.dbShardGroupIdentifier()) ) ); - verify(proxyClient.client(), times(2)).describeDBShardGroups( + verify(proxyClient.client(), times(3)).describeDBShardGroups( ArgumentMatchers.argThat(req -> Objects.equals(DB_SHARD_GROUP_CREATING.dbShardGroupIdentifier(), req.dbShardGroupIdentifier()) ) @@ -180,7 +180,7 @@ public void handleRequest_NoDbShardGroupIdentifier() { Objects.equals(dbShardGroupIdentifier, req.dbShardGroupIdentifier()) ) ); - verify(proxyClient.client(), times(2)).describeDBShardGroups( + verify(proxyClient.client(), times(3)).describeDBShardGroups( ArgumentMatchers.argThat(req -> Objects.equals(dbShardGroupIdentifier, req.dbShardGroupIdentifier()) ) @@ -255,7 +255,7 @@ public void handleRequest_Stabilize() { Objects.equals(DB_SHARD_GROUP_CREATING.dbShardGroupIdentifier(), req.dbShardGroupIdentifier()) ) ); - verify(proxyClient.client(), times(3)).describeDBShardGroups( + verify(proxyClient.client(), times(4)).describeDBShardGroups( ArgumentMatchers.argThat(req -> Objects.equals(DB_SHARD_GROUP_CREATING.dbShardGroupIdentifier(), req.dbShardGroupIdentifier()) )