mirror of
https://github.com/floci-io/floci.git
synced 2026-11-27 07:39:24 -05:00
feat(cloudformation): provision Application Auto Scaling targets and policies (#5407)
* feat(cloudformation): provision Application Auto Scaling targets and policies AWS::ApplicationAutoScaling::ScalableTarget and ::ScalingPolicy had no provisioner, so a template that scales an ECS service failed on those two resources although the Application Auto Scaling service behind them, including the ECS capacity adjuster, was already there. This wires the two together. A scalable target has no name of its own: it is keyed by the triple of service namespace, resource id and scalable dimension, and CloudFormation's Ref is those three joined by a pipe. That composite is the physical id, which is also what a policy's ScalingTargetId carries when a template points one at the other with Ref, so the provisioner splits it back into the triple. A policy's Ref is its ARN rather than its name, so deleting one resolves the ARN through findPolicyByArn to recover the name and triple the service deletes by. Because the target's id is derived from the triple, changing any part of it replaces the target rather than updating it, so both types go through ReplacementCleanup to deregister what they displaced. Deletes tolerate only ObjectNotFoundException through CfnDeletes.safeDelete: a target takes its own policies with it, so a stack teardown reaches an already-deleted policy by ordinary ordering, while any other failure still surfaces as DELETE_FAILED. The properties each schema marks required are enforced rather than defaulted. MinCapacity and MaxCapacity on a target, and PolicyName and PolicyType on a policy, would otherwise register a target that never scales or accept a template CloudFormation itself rejects. The two scaling configuration blocks are parsed by the same code the PutScalingPolicy API path uses, extracted to ScalingConfigurationParser, since CloudFormation spells their members exactly as the API does. One parser means a template and an API call cannot disagree about what a policy means. ScheduledActions on a target is logged rather than dropped silently: Floci does not run scheduled scaling, and a template that scales on a clock should not look fully provisioned when nothing is scheduled. * fix(cloudformation): resolve intrinsics inside the scaling configuration blocks Review on #5407: the two scaling configuration blocks and SuspendedState reached the parser as raw template JSON, so an intrinsic inside one was never resolved. That is worse than it sounds, because an intrinsic is still a non-null node: hasNonNull passes and the value is read with asDouble, asText or asBoolean, which answer 0, "" and false. A policy written as TargetValue: !Ref TargetCpu registered as a policy targeting 0 percent rather than failing, a ResourceLabel built with Fn::Join arrived empty, and a flag behind Fn::If read false. Each block now goes through ctx.engine().resolveNode first, which is what AutoScalingScalingPolicyCfnProvisioner already does with its own block. Only nested objects were affected: the top-level properties were already read through ctx.resolveOptional, which resolves. A target's Tags were dropped as well, passed to the service as an empty map rather than read with ctx.resolveTags. ScheduledActions now carries a note in the generated resource-type table rather than only a warning in the log, so the gap is visible before someone wonders why their clock-based scaling never fires. * test(cloudformation): make the SuspendedState intrinsic test fail without its fix Review on #5407: anIntrinsicInsideSuspendedStateIsResolvedToo passed against the previous commit too. REFS had no Suspend entry, so the flag resolved to an empty string and read false either way, and assertNotNull held regardless because the raw block was already an object. The test pinned nothing. REFS now maps Suspend to true and the assertion is on isDynamicScalingInSuspended(), so it fails with expected: <true> but was: <false> when SuspendedState is read without resolveNode. The redundant copy of the properties node is gone.
This commit is contained in:
1 parent
3ad1a76507
commit
bfa9c2fbcc
10 files changed
+853
-60
No files matched your search
+2
-57
@@ -331,66 +331,11 @@ public class ApplicationAutoScalingJsonHandler {
|
||||
}
|
||||
|
||||
private TargetTrackingConfiguration parseTargetTracking(JsonNode node) {
|
||||
if (node == null || node.isMissingNode() || node.isNull()) {
|
||||
return null;
|
||||
}
|
||||
TargetTrackingConfiguration config = new TargetTrackingConfiguration();
|
||||
if (node.hasNonNull("TargetValue")) {
|
||||
config.setTargetValue(node.get("TargetValue").asDouble());
|
||||
}
|
||||
JsonNode predefined = node.path("PredefinedMetricSpecification");
|
||||
if (predefined.isObject()) {
|
||||
PredefinedMetricSpecification spec = new PredefinedMetricSpecification();
|
||||
spec.setPredefinedMetricType(text(predefined, "PredefinedMetricType"));
|
||||
spec.setResourceLabel(text(predefined, "ResourceLabel"));
|
||||
config.setPredefinedMetricSpecification(spec);
|
||||
}
|
||||
JsonNode customized = node.path("CustomizedMetricSpecification");
|
||||
if (customized.isObject()) {
|
||||
config.setCustomizedMetricSpecification(
|
||||
objectMapper.convertValue(customized, new com.fasterxml.jackson.core.type.TypeReference<>() {}));
|
||||
}
|
||||
if (node.hasNonNull("DisableScaleIn")) {
|
||||
config.setDisableScaleIn(node.get("DisableScaleIn").asBoolean());
|
||||
}
|
||||
if (node.hasNonNull("ScaleInCooldown")) {
|
||||
config.setScaleInCooldown(node.get("ScaleInCooldown").asInt());
|
||||
}
|
||||
if (node.hasNonNull("ScaleOutCooldown")) {
|
||||
config.setScaleOutCooldown(node.get("ScaleOutCooldown").asInt());
|
||||
}
|
||||
return config;
|
||||
return ScalingConfigurationParser.parseTargetTracking(node, objectMapper);
|
||||
}
|
||||
|
||||
private StepScalingConfiguration parseStepScaling(JsonNode node) {
|
||||
if (node == null || node.isMissingNode() || node.isNull()) {
|
||||
return null;
|
||||
}
|
||||
StepScalingConfiguration config = new StepScalingConfiguration();
|
||||
config.setAdjustmentType(text(node, "AdjustmentType"));
|
||||
config.setMetricAggregationType(text(node, "MetricAggregationType"));
|
||||
if (node.hasNonNull("Cooldown")) {
|
||||
config.setCooldown(node.get("Cooldown").asInt());
|
||||
}
|
||||
if (node.hasNonNull("MinAdjustmentMagnitude")) {
|
||||
config.setMinAdjustmentMagnitude(node.get("MinAdjustmentMagnitude").asInt());
|
||||
}
|
||||
List<StepAdjustment> steps = new ArrayList<>();
|
||||
for (JsonNode stepNode : node.path("StepAdjustments")) {
|
||||
StepAdjustment step = new StepAdjustment();
|
||||
if (stepNode.hasNonNull("MetricIntervalLowerBound")) {
|
||||
step.setMetricIntervalLowerBound(stepNode.get("MetricIntervalLowerBound").asDouble());
|
||||
}
|
||||
if (stepNode.hasNonNull("MetricIntervalUpperBound")) {
|
||||
step.setMetricIntervalUpperBound(stepNode.get("MetricIntervalUpperBound").asDouble());
|
||||
}
|
||||
if (stepNode.hasNonNull("ScalingAdjustment")) {
|
||||
step.setScalingAdjustment(stepNode.get("ScalingAdjustment").asInt());
|
||||
}
|
||||
steps.add(step);
|
||||
}
|
||||
config.setStepAdjustments(steps);
|
||||
return config;
|
||||
return ScalingConfigurationParser.parseStepScaling(node);
|
||||
}
|
||||
|
||||
private Map<String, String> parseTags(JsonNode node) {
|
||||
|
||||
+6
-3
@@ -528,9 +528,12 @@ public class ApplicationAutoScalingService {
|
||||
return targets.get(targetKey(region, serviceNamespace, resourceId, scalableDimension));
|
||||
}
|
||||
|
||||
/** Looked up by {@link ScalingPolicyAlarmActionHandler} when an alarm's AlarmActions
|
||||
* references a scaling-policy ARN. */
|
||||
Optional<ScalingPolicy> findPolicyByArn(String policyArn, String region) {
|
||||
/**
|
||||
* Looked up by {@link ScalingPolicyAlarmActionHandler} when an alarm's AlarmActions references
|
||||
* a scaling-policy ARN, and by the CloudFormation provisioner, whose physical id for a policy
|
||||
* is that ARN while deleting one takes the triple plus the policy name.
|
||||
*/
|
||||
public Optional<ScalingPolicy> findPolicyByArn(String policyArn, String region) {
|
||||
String prefix = region + "::";
|
||||
return policies.scan(k -> k.startsWith(prefix)).stream()
|
||||
.filter(p -> policyArn.equals(p.getPolicyArn()))
|
||||
|
||||
+93
@@ -0,0 +1,93 @@
|
||||
package io.github.hectorvent.floci.services.applicationautoscaling;
|
||||
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import io.github.hectorvent.floci.services.applicationautoscaling.model.PredefinedMetricSpecification;
|
||||
import io.github.hectorvent.floci.services.applicationautoscaling.model.StepAdjustment;
|
||||
import io.github.hectorvent.floci.services.applicationautoscaling.model.StepScalingConfiguration;
|
||||
import io.github.hectorvent.floci.services.applicationautoscaling.model.TargetTrackingConfiguration;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Reads the two scaling-policy configuration blocks out of JSON.
|
||||
*
|
||||
* <p>Shared by {@link ApplicationAutoScalingJsonHandler} and the CloudFormation provisioner,
|
||||
* because {@code AWS::ApplicationAutoScaling::ScalingPolicy} spells
|
||||
* {@code TargetTrackingScalingPolicyConfiguration} and {@code StepScalingPolicyConfiguration}
|
||||
* with the same member names {@code PutScalingPolicy} does. One parser means a template and an
|
||||
* API call cannot disagree about what a policy means.
|
||||
*/
|
||||
public final class ScalingConfigurationParser {
|
||||
|
||||
private ScalingConfigurationParser() {
|
||||
}
|
||||
|
||||
public static TargetTrackingConfiguration parseTargetTracking(JsonNode node, ObjectMapper mapper) {
|
||||
if (node == null || node.isMissingNode() || node.isNull()) {
|
||||
return null;
|
||||
}
|
||||
TargetTrackingConfiguration config = new TargetTrackingConfiguration();
|
||||
if (node.hasNonNull("TargetValue")) {
|
||||
config.setTargetValue(node.get("TargetValue").asDouble());
|
||||
}
|
||||
JsonNode predefined = node.path("PredefinedMetricSpecification");
|
||||
if (predefined.isObject()) {
|
||||
PredefinedMetricSpecification spec = new PredefinedMetricSpecification();
|
||||
spec.setPredefinedMetricType(text(predefined, "PredefinedMetricType"));
|
||||
spec.setResourceLabel(text(predefined, "ResourceLabel"));
|
||||
config.setPredefinedMetricSpecification(spec);
|
||||
}
|
||||
JsonNode customized = node.path("CustomizedMetricSpecification");
|
||||
if (customized.isObject()) {
|
||||
config.setCustomizedMetricSpecification(mapper.convertValue(customized, new TypeReference<>() {}));
|
||||
}
|
||||
if (node.hasNonNull("DisableScaleIn")) {
|
||||
config.setDisableScaleIn(node.get("DisableScaleIn").asBoolean());
|
||||
}
|
||||
if (node.hasNonNull("ScaleInCooldown")) {
|
||||
config.setScaleInCooldown(node.get("ScaleInCooldown").asInt());
|
||||
}
|
||||
if (node.hasNonNull("ScaleOutCooldown")) {
|
||||
config.setScaleOutCooldown(node.get("ScaleOutCooldown").asInt());
|
||||
}
|
||||
return config;
|
||||
}
|
||||
|
||||
public static StepScalingConfiguration parseStepScaling(JsonNode node) {
|
||||
if (node == null || node.isMissingNode() || node.isNull()) {
|
||||
return null;
|
||||
}
|
||||
StepScalingConfiguration config = new StepScalingConfiguration();
|
||||
config.setAdjustmentType(text(node, "AdjustmentType"));
|
||||
config.setMetricAggregationType(text(node, "MetricAggregationType"));
|
||||
if (node.hasNonNull("Cooldown")) {
|
||||
config.setCooldown(node.get("Cooldown").asInt());
|
||||
}
|
||||
if (node.hasNonNull("MinAdjustmentMagnitude")) {
|
||||
config.setMinAdjustmentMagnitude(node.get("MinAdjustmentMagnitude").asInt());
|
||||
}
|
||||
List<StepAdjustment> steps = new ArrayList<>();
|
||||
for (JsonNode stepNode : node.path("StepAdjustments")) {
|
||||
StepAdjustment step = new StepAdjustment();
|
||||
if (stepNode.hasNonNull("MetricIntervalLowerBound")) {
|
||||
step.setMetricIntervalLowerBound(stepNode.get("MetricIntervalLowerBound").asDouble());
|
||||
}
|
||||
if (stepNode.hasNonNull("MetricIntervalUpperBound")) {
|
||||
step.setMetricIntervalUpperBound(stepNode.get("MetricIntervalUpperBound").asDouble());
|
||||
}
|
||||
if (stepNode.hasNonNull("ScalingAdjustment")) {
|
||||
step.setScalingAdjustment(stepNode.get("ScalingAdjustment").asInt());
|
||||
}
|
||||
steps.add(step);
|
||||
}
|
||||
config.setStepAdjustments(steps);
|
||||
return config;
|
||||
}
|
||||
|
||||
private static String text(JsonNode node, String field) {
|
||||
return node.hasNonNull(field) ? node.get(field).asText() : null;
|
||||
}
|
||||
}
|
||||
+224
@@ -0,0 +1,224 @@
|
||||
package io.github.hectorvent.floci.services.cloudformation.provisioners;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import io.github.hectorvent.floci.core.common.AwsException;
|
||||
import io.github.hectorvent.floci.services.applicationautoscaling.ApplicationAutoScalingService;
|
||||
import io.github.hectorvent.floci.services.applicationautoscaling.ScalingConfigurationParser;
|
||||
import io.github.hectorvent.floci.services.applicationautoscaling.model.ScalingPolicy;
|
||||
import io.github.hectorvent.floci.services.applicationautoscaling.model.SuspendedState;
|
||||
import io.github.hectorvent.floci.services.cloudformation.model.StackResource;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Provisions {@code AWS::ApplicationAutoScaling::ScalableTarget} and
|
||||
* {@code AWS::ApplicationAutoScaling::ScalingPolicy}.
|
||||
*
|
||||
* <p>A target is identified by the triple (service namespace, resource id, scalable dimension)
|
||||
* rather than by a name of its own, and CloudFormation's {@code Ref} is those three joined by
|
||||
* {@code |}. That composite is this provisioner's physical id, which is also what a policy's
|
||||
* {@code ScalingTargetId} carries when a template points one at the other with {@code Ref}.
|
||||
*/
|
||||
@ApplicationScoped
|
||||
public class ApplicationAutoScalingCfnProvisioner implements CfnResourceProvisioner {
|
||||
|
||||
static final String SCALABLE_TARGET = "AWS::ApplicationAutoScaling::ScalableTarget";
|
||||
static final String SCALING_POLICY = "AWS::ApplicationAutoScaling::ScalingPolicy";
|
||||
|
||||
private static final Logger LOG = Logger.getLogger(ApplicationAutoScalingCfnProvisioner.class);
|
||||
|
||||
private final ApplicationAutoScalingService service;
|
||||
private final ObjectMapper objectMapper;
|
||||
|
||||
public ApplicationAutoScalingCfnProvisioner(ApplicationAutoScalingService service, ObjectMapper objectMapper) {
|
||||
this.service = service;
|
||||
this.objectMapper = objectMapper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> resourceTypes() {
|
||||
return Set.of(SCALABLE_TARGET, SCALING_POLICY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void provision(StackResource r, JsonNode props, ProvisionContext ctx) {
|
||||
if (SCALABLE_TARGET.equals(r.getResourceType())) {
|
||||
provisionTarget(r, props, ctx);
|
||||
} else {
|
||||
provisionPolicy(r, props, ctx);
|
||||
}
|
||||
}
|
||||
|
||||
private void provisionTarget(StackResource r, JsonNode props, ProvisionContext ctx) {
|
||||
Map<String, String> attributesBefore = r.getAttributes() == null
|
||||
? new HashMap<>() : new HashMap<>(r.getAttributes());
|
||||
Triple triple = Triple.fromProperties(props, ctx);
|
||||
// Required by the resource schema, so a template missing either is refused here rather
|
||||
// than registering a target with no bounds that silently never scales.
|
||||
Integer min = requiredInteger(props, "MinCapacity", ctx);
|
||||
Integer max = requiredInteger(props, "MaxCapacity", ctx);
|
||||
String roleArn = ctx.resolveOptional(props, "RoleARN");
|
||||
if (props.hasNonNull("ScheduledActions")) {
|
||||
// Floci's Application Auto Scaling has no scheduled actions, and silently dropping them
|
||||
// would let a template that scales on a clock look provisioned while nothing is scheduled.
|
||||
LOG.warnv("ScalableTarget {0} declares ScheduledActions, which Floci does not run; "
|
||||
+ "the target itself is registered", r.getLogicalId());
|
||||
}
|
||||
service.registerScalableTarget(triple.serviceNamespace(), triple.resourceId(), triple.scalableDimension(),
|
||||
min, max, roleArn, suspendedState(props, ctx), ctx.resolveTags(props, "Tags"), ctx.region());
|
||||
r.setPhysicalId(triple.composite());
|
||||
r.getAttributes().put("Id", triple.composite());
|
||||
// The id is the triple, so changing any part of it replaces the target rather than
|
||||
// updating it, and the one it displaced has to be deregistered once the update commits.
|
||||
ReplacementCleanup.record(r, ctx, attributesBefore);
|
||||
}
|
||||
|
||||
private void provisionPolicy(StackResource r, JsonNode props, ProvisionContext ctx) {
|
||||
Map<String, String> attributesBefore = r.getAttributes() == null
|
||||
? new HashMap<>() : new HashMap<>(r.getAttributes());
|
||||
// PolicyName and PolicyType are both required by the resource schema: a generated name
|
||||
// or a defaulted type would accept a template that CloudFormation itself rejects.
|
||||
String policyName = Triple.required(ctx.resolveOptional(props, "PolicyName"), "PolicyName");
|
||||
String policyType = Triple.required(ctx.resolveOptional(props, "PolicyType"), "PolicyType");
|
||||
Triple triple = Triple.forPolicy(props, ctx);
|
||||
ScalingPolicy policy = service.putScalingPolicy(policyName, policyType,
|
||||
triple.serviceNamespace(), triple.resourceId(), triple.scalableDimension(),
|
||||
// Through the engine first: these blocks are nested objects, so an intrinsic inside
|
||||
// one is still a non-null node and would read as 0, "" or false rather than failing.
|
||||
ScalingConfigurationParser.parseTargetTracking(
|
||||
ctx.engine().resolveNode(props.path("TargetTrackingScalingPolicyConfiguration")), objectMapper),
|
||||
ScalingConfigurationParser.parseStepScaling(
|
||||
ctx.engine().resolveNode(props.path("StepScalingPolicyConfiguration"))),
|
||||
ctx.region());
|
||||
// Ref on a scaling policy is its ARN, so the ARN is the physical id rather than the name.
|
||||
r.setPhysicalId(policy.getPolicyArn());
|
||||
r.getAttributes().put("Arn", policy.getPolicyArn());
|
||||
ReplacementCleanup.record(r, ctx, attributesBefore);
|
||||
}
|
||||
|
||||
private SuspendedState suspendedState(JsonNode props, ProvisionContext ctx) {
|
||||
JsonNode node = ctx.engine().resolveNode(props.path("SuspendedState"));
|
||||
if (node == null || !node.isObject()) {
|
||||
return null;
|
||||
}
|
||||
SuspendedState state = new SuspendedState();
|
||||
if (node.hasNonNull("DynamicScalingInSuspended")) {
|
||||
state.setDynamicScalingInSuspended(node.get("DynamicScalingInSuspended").asBoolean());
|
||||
}
|
||||
if (node.hasNonNull("DynamicScalingOutSuspended")) {
|
||||
state.setDynamicScalingOutSuspended(node.get("DynamicScalingOutSuspended").asBoolean());
|
||||
}
|
||||
if (node.hasNonNull("ScheduledScalingSuspended")) {
|
||||
state.setScheduledScalingSuspended(node.get("ScheduledScalingSuspended").asBoolean());
|
||||
}
|
||||
return state;
|
||||
}
|
||||
|
||||
private Integer requiredInteger(JsonNode props, String name, ProvisionContext ctx) {
|
||||
String value = Triple.required(ctx.resolveOptional(props, name), name);
|
||||
try {
|
||||
return Integer.valueOf(value.trim());
|
||||
} catch (NumberFormatException e) {
|
||||
throw new AwsException("ValidationException", name + " must be an integer, got: " + value, 400);
|
||||
}
|
||||
}
|
||||
|
||||
/** The (namespace, resource id, dimension) a target is keyed by, and CloudFormation's {@code |} form of it. */
|
||||
private record Triple(String serviceNamespace, String resourceId, String scalableDimension) {
|
||||
|
||||
static Triple fromProperties(JsonNode props, ProvisionContext ctx) {
|
||||
return new Triple(required(ctx.resolveOptional(props, "ServiceNamespace"), "ServiceNamespace"),
|
||||
required(ctx.resolveOptional(props, "ResourceId"), "ResourceId"),
|
||||
required(ctx.resolveOptional(props, "ScalableDimension"), "ScalableDimension"));
|
||||
}
|
||||
|
||||
/**
|
||||
* A policy names its target either by the three properties or by {@code ScalingTargetId},
|
||||
* which is a {@code Ref} to the target and therefore already the composite.
|
||||
*/
|
||||
static Triple forPolicy(JsonNode props, ProvisionContext ctx) {
|
||||
String targetId = ctx.resolveOptional(props, "ScalingTargetId");
|
||||
if (targetId == null || targetId.isBlank()) {
|
||||
return fromProperties(props, ctx);
|
||||
}
|
||||
String[] parts = targetId.split("\\|", -1);
|
||||
if (parts.length != 3) {
|
||||
throw new AwsException("ValidationException",
|
||||
"ScalingTargetId must be resourceId|scalableDimension|serviceNamespace, got: " + targetId, 400);
|
||||
}
|
||||
return new Triple(parts[2], parts[0], parts[1]);
|
||||
}
|
||||
|
||||
String composite() {
|
||||
return resourceId + "|" + scalableDimension + "|" + serviceNamespace;
|
||||
}
|
||||
|
||||
static String required(String value, String name) {
|
||||
if (value == null || value.isBlank()) {
|
||||
throw new AwsException("ValidationException", name + " is required.", 400);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(String resourceType, String physicalId, String region) {
|
||||
if (physicalId == null || physicalId.isBlank()) {
|
||||
return;
|
||||
}
|
||||
if (SCALABLE_TARGET.equals(resourceType)) {
|
||||
String[] parts = physicalId.split("\\|", -1);
|
||||
if (parts.length == 3) {
|
||||
// Deregistering takes the target's policies and their alarms with it, as on AWS.
|
||||
CfnDeletes.safeDelete("Scalable target", physicalId,
|
||||
() -> service.deregisterScalableTarget(parts[2], parts[0], parts[1], region),
|
||||
"ObjectNotFoundException");
|
||||
}
|
||||
return;
|
||||
}
|
||||
deletePolicyByArn(physicalId, region);
|
||||
}
|
||||
|
||||
/**
|
||||
* A policy's physical id is its ARN, and the service deletes by the triple plus the name, so the
|
||||
* policy is looked up by ARN rather than parsed out of it. A policy already gone, which
|
||||
* deregistering its target does, is not an error: the stack is being torn down either way.
|
||||
*/
|
||||
private void deletePolicyByArn(String policyArn, String region) {
|
||||
service.findPolicyByArn(policyArn, region).ifPresent(policy ->
|
||||
CfnDeletes.safeDelete("Scaling policy", policyArn,
|
||||
() -> service.deleteScalingPolicy(policy.getPolicyName(), policy.getServiceNamespace(),
|
||||
policy.getResourceId(), policy.getScalableDimension(), region),
|
||||
"ObjectNotFoundException"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasReplacementUpdate(StackResource resource) {
|
||||
return ReplacementCleanup.hasReplacement(resource);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String updateCleanupPhysicalId(StackResource resource) {
|
||||
return ReplacementCleanup.cleanupPhysicalId(resource);
|
||||
}
|
||||
|
||||
@Override
|
||||
public UpdateCleanupResult completeUpdate(StackResource resource) {
|
||||
return ReplacementCleanup.complete(resource, this::delete);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearUpdate(StackResource resource) {
|
||||
ReplacementCleanup.clear(resource);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean rollbackUpdate(StackResource resource) {
|
||||
return ReplacementCleanup.rollback(resource, this::delete);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user