use of com.amazonaws.services.cloudwatch.model.ResourceNotFoundException in project aws-sdk-android by aws-amplify.
the class ResourceNotFoundExceptionUnmarshaller method unmarshall.
public AmazonServiceException unmarshall(Node node) throws Exception {
// Bail out if this isn't the right error code that this
// marshaller understands.
String errorCode = parseErrorCode(node);
if (errorCode == null || !errorCode.equals("ResourceNotFound"))
return null;
ResourceNotFoundException e = (ResourceNotFoundException) super.unmarshall(node);
return e;
}
use of com.amazonaws.services.cloudwatch.model.ResourceNotFoundException in project titus-control-plane by Netflix.
the class CloudWatchClient method deleteAlarm.
@Override
public Completable deleteAlarm(String policyRefId, String jobId) {
DeleteAlarmsRequest deleteAlarmsRequest = new DeleteAlarmsRequest();
deleteAlarmsRequest.setAlarmNames(Arrays.asList(buildCloudWatchName(policyRefId, jobId)));
return wrapWithExponentialRetry(String.format("deleteAlarm in policy %s for job %s", policyRefId, jobId), Observable.create(emitter -> awsCloudWatch.deleteAlarmsAsync(deleteAlarmsRequest, new AsyncHandler<DeleteAlarmsRequest, DeleteAlarmsResult>() {
@Override
public void onError(Exception exception) {
deleteErrorCounter.increment();
if (exception instanceof ResourceNotFoundException) {
emitter.onError(AutoScalePolicyException.unknownScalingPolicy(policyRefId, exception.getMessage()));
} else {
emitter.onError(AutoScalePolicyException.errorDeletingAlarm(policyRefId, exception.getMessage()));
}
}
@Override
public void onSuccess(DeleteAlarmsRequest request, DeleteAlarmsResult deleteAlarmsResult) {
int httpStatusCode = deleteAlarmsResult.getSdkHttpMetadata().getHttpStatusCode();
log.info("Deleted cloud watch alarm for job-id {}, status {}", jobId, httpStatusCode);
deleteAlarmCounter.increment();
emitter.onCompleted();
}
}), Emitter.BackpressureMode.NONE)).toCompletable();
}
Aggregations