in aws-logs-metricfilter/src/main/java/software/amazon/logs/metricfilter/UpdateHandler.java [48:72]
private PutMetricFilterResponse updateResource(
final ResourceModel model,
final PutMetricFilterRequest awsRequest,
final ProxyClient<CloudWatchLogsClient> proxyClient) {
PutMetricFilterResponse awsResponse;
try {
boolean exists = exists(proxyClient, model);
if (!exists) {
throw new CfnNotFoundException(ResourceModel.TYPE_NAME, model.getPrimaryIdentifier().toString());
}
logger.log(String.format("%s has successfully been updated.", ResourceModel.TYPE_NAME));
return proxyClient.injectCredentialsAndInvokeV2(awsRequest, proxyClient.client()::putMetricFilter);
} catch (final ResourceNotFoundException e) {
logger.log("Resource not found. " + e.getMessage());
throw new CfnNotFoundException(e);
} catch (final InvalidParameterException e) {
throw new CfnInvalidRequestException(ResourceModel.TYPE_NAME, e);
} catch (final LimitExceededException e) {
throw new CfnServiceLimitExceededException(e);
} catch (final ServiceUnavailableException e) {
throw new CfnServiceInternalErrorException(e);
} catch (final OperationAbortedException e) {
throw new CfnResourceConflictException(e);
}
}