Skip to content

Commit

Permalink
Pulling a little more out of BaseHandlerStd for re-use in non-extendi…
Browse files Browse the repository at this point in the history
…ng classes.
  • Loading branch information
Keynan Pratt committed Nov 25, 2024
1 parent 5960130 commit 6452532
Show file tree
Hide file tree
Showing 6 changed files with 886 additions and 795 deletions.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ protected ProgressEvent<ResourceModel, CallbackContext> handleRequest(
try {
model.setEngine(fetchEngine(rdsProxyClient.defaultClient(), progress, proxy));
} catch (Exception e) {
return Commons.handleException(progress, e, DB_INSTANCE_FETCH_ENGINE_RULE_SET, requestLogger);
return Commons.handleException(progress, e, ErrorRuleSets.DB_INSTANCE_FETCH_ENGINE, requestLogger);
}
}
return progress;
Expand All @@ -126,7 +126,7 @@ protected ProgressEvent<ResourceModel, CallbackContext> handleRequest(
progress.getResourceModel().setMultiAZ(ResourceModelHelper.getDefaultMultiAzForEngine(engine));
}
} catch (Exception e) {
return Commons.handleException(progress, e, RESTORE_DB_INSTANCE_ERROR_RULE_SET, requestLogger);
return Commons.handleException(progress, e, ErrorRuleSets.RESTORE_DB_INSTANCE, requestLogger);
}
}
return versioned(proxy, rdsProxyClient, progress, allTags, ImmutableMap.of(
Expand Down Expand Up @@ -301,7 +301,7 @@ private ProgressEvent<ResourceModel, CallbackContext> createDbInstanceV12(
.handleError((request, exception, client, model, context) -> Commons.handleException(
ProgressEvent.progress(model, context),
exception,
CREATE_DB_INSTANCE_ERROR_RULE_SET,
ErrorRuleSets.CREATE_DB_INSTANCE,
requestLogger
))
.progress();
Expand Down Expand Up @@ -329,7 +329,7 @@ private ProgressEvent<ResourceModel, CallbackContext> createDbInstance(
.handleError((request, exception, client, model, context) -> Commons.handleException(
ProgressEvent.progress(model, context),
exception,
CREATE_DB_INSTANCE_ERROR_RULE_SET,
ErrorRuleSets.CREATE_DB_INSTANCE,
requestLogger
))
.progress();
Expand Down Expand Up @@ -361,7 +361,7 @@ private ProgressEvent<ResourceModel, CallbackContext> restoreDbInstanceFromSnaps
.handleError((request, exception, client, model, context) -> Commons.handleException(
ProgressEvent.progress(model, context),
exception,
RESTORE_DB_INSTANCE_ERROR_RULE_SET,
ErrorRuleSets.RESTORE_DB_INSTANCE,
requestLogger
))
.progress();
Expand Down Expand Up @@ -389,7 +389,7 @@ private ProgressEvent<ResourceModel, CallbackContext> restoreDbInstanceFromSnaps
.handleError((request, exception, client, model, context) -> Commons.handleException(
ProgressEvent.progress(model, context),
exception,
RESTORE_DB_INSTANCE_ERROR_RULE_SET,
ErrorRuleSets.RESTORE_DB_INSTANCE,
requestLogger
))
.progress();
Expand Down Expand Up @@ -417,7 +417,7 @@ private ProgressEvent<ResourceModel, CallbackContext> restoreDbInstanceToPointIn
.handleError((request, exception, client, model, context) -> Commons.handleException(
ProgressEvent.progress(model, context),
exception,
RESTORE_DB_INSTANCE_ERROR_RULE_SET,
ErrorRuleSets.RESTORE_DB_INSTANCE,
requestLogger
))
.progress();
Expand Down Expand Up @@ -446,7 +446,7 @@ private ProgressEvent<ResourceModel, CallbackContext> createDbInstanceReadReplic
.handleError((request, exception, client, model, context) -> Commons.handleException(
ProgressEvent.progress(model, context),
exception,
CREATE_DB_INSTANCE_READ_REPLICA_ERROR_RULE_SET,
ErrorRuleSets.CREATE_DB_INSTANCE_READ_REPLICA,
requestLogger
))
.progress();
Expand All @@ -473,7 +473,7 @@ protected ProgressEvent<ResourceModel, CallbackContext> updateDbInstanceAfterCre
.handleError((modifyRequest, exception, client, model, context) -> Commons.handleException(
ProgressEvent.progress(model, context),
exception,
MODIFY_DB_INSTANCE_ERROR_RULE_SET,
ErrorRuleSets.MODIFY_DB_INSTANCE,
requestLogger
))
.progress();
Expand All @@ -496,7 +496,7 @@ protected ProgressEvent<ResourceModel, CallbackContext> updateDbInstanceAfterCre
.handleError((modifyRequest, exception, client, model, context) -> Commons.handleException(
ProgressEvent.progress(model, context),
exception,
MODIFY_DB_INSTANCE_ERROR_RULE_SET,
ErrorRuleSets.MODIFY_DB_INSTANCE,
requestLogger
))
.progress();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ protected ProgressEvent<ResourceModel, CallbackContext> handleRequest(
final var dbInstance = fetchDBInstance(rdsProxyClient.defaultClient(), progress.getResourceModel());
callbackContext.setSnapshotIdentifier(decideSnapshotIdentifier(request, dbInstance));
} catch (Exception exception) {
return Commons.handleException(progress, exception, DEFAULT_DB_INSTANCE_ERROR_RULE_SET, requestLogger);
return Commons.handleException(progress, exception, ErrorRuleSets.DEFAULT_DB_INSTANCE, requestLogger);
}
return progress;
}, CallbackContext::isDescribed, CallbackContext::setDescribed))
Expand All @@ -68,7 +68,7 @@ protected ProgressEvent<ResourceModel, CallbackContext> handleRequest(
.handleError((deleteRequest, exception, client, model, context) -> Commons.handleException(
ProgressEvent.progress(model, context),
exception,
DELETE_DB_INSTANCE_ERROR_RULE_SET,
ErrorRuleSets.DELETE_DB_INSTANCE,
requestLogger
)).progress()
)
Expand All @@ -83,7 +83,7 @@ protected ProgressEvent<ResourceModel, CallbackContext> handleRequest(
.handleError((noopRequest, exception, client, model, context) -> Commons.handleException(
ProgressEvent.progress(model, context),
exception,
DEFAULT_DB_INSTANCE_ERROR_RULE_SET,
ErrorRuleSets.DEFAULT_DB_INSTANCE,
requestLogger
))
.progress()
Expand Down
Loading

0 comments on commit 6452532

Please sign in to comment.