@Test public void handleRequest_FailedDelete_AmazonServiceException() { final DeleteHandler handler = new DeleteHandler(); doThrow(new AmazonServiceException("test error")) .when(proxy) .injectCredentialsAndInvokeV2( ArgumentMatchers.any(), ArgumentMatchers.any() ); final ResourceModel model = ResourceModel.builder() .name("test-set") .build(); final ResourceHandlerRequest<ResourceModel> request = ResourceHandlerRequest.<ResourceModel>builder() .desiredResourceState(model) .build(); assertThrows(AmazonServiceException.class, () -> { handler.handleRequest(proxy, request, null, logger); }); }
@Override public ProgressEvent<ResourceModel, CallbackContext> handleRequest( final AmazonWebServicesClientProxy proxy, final ResourceHandlerRequest<ResourceModel> request, final CallbackContext callbackContext, final Logger logger) { final SesClient client = ClientBuilder.getClient(); final ResourceModel model = request.getDesiredResourceState(); try { final DeleteConfigurationSetRequest deleteConfigurationSetRequest = DeleteConfigurationSetRequest.builder() .configurationSetName(model.getName()) .build(); proxy.injectCredentialsAndInvokeV2(deleteConfigurationSetRequest, client::deleteConfigurationSet); logger.log(String.format("%s [%s] deleted successfully", ResourceModel.TYPE_NAME, getPrimaryIdentifier(model).toString())); } catch (final ConfigurationSetDoesNotExistException e) { throw new CfnNotFoundException(ResourceModel.TYPE_NAME, model.getName()); } return ProgressEvent.defaultSuccessHandler(null); }
DeleteHandler extends BaseHandler<CallbackContext> { @Override public ProgressEvent<ResourceModel, CallbackContext> handleRequest( final AmazonWebServicesClientProxy proxy, final ResourceHandlerRequest<ResourceModel> request, final CallbackContext callbackContext, final Logger logger) { final SesClient client = ClientBuilder.getClient(); final ResourceModel model = request.getDesiredResourceState(); try { final DeleteConfigurationSetRequest deleteConfigurationSetRequest = DeleteConfigurationSetRequest.builder() .configurationSetName(model.getName()) .build(); proxy.injectCredentialsAndInvokeV2(deleteConfigurationSetRequest, client::deleteConfigurationSet); logger.log(String.format("%s [%s] deleted successfully", ResourceModel.TYPE_NAME, getPrimaryIdentifier(model).toString())); } catch (final ConfigurationSetDoesNotExistException e) { throw new CfnNotFoundException(ResourceModel.TYPE_NAME, model.getName()); } return ProgressEvent.defaultSuccessHandler(null); } }
DeleteHandler extends BaseHandler<CallbackContext> { @Override public ProgressEvent<ResourceModel, CallbackContext> handleRequest( final AmazonWebServicesClientProxy proxy, final ResourceHandlerRequest<ResourceModel> request, final CallbackContext callbackContext, final Logger logger) { final SesClient client = ClientBuilder.getClient(); final ResourceModel model = request.getDesiredResourceState(); try { final DeleteConfigurationSetRequest deleteConfigurationSetRequest = DeleteConfigurationSetRequest.builder() .configurationSetName(model.getName()) .build(); proxy.injectCredentialsAndInvokeV2(deleteConfigurationSetRequest, client::deleteConfigurationSet); logger.log(String.format("%s [%s] deleted successfully", ResourceModel.TYPE_NAME, getPrimaryIdentifier(model).toString())); } catch (final ConfigurationSetDoesNotExistException e) { throw new CfnNotFoundException(ResourceModel.TYPE_NAME, model.getName()); } return ProgressEvent.defaultSuccessHandler(null); }  }
DeleteHandler extends BaseHandler<CallbackContext> { @Override public ProgressEvent<ResourceModel, CallbackContext> handleRequest( final AmazonWebServicesClientProxy proxy, final ResourceHandlerRequest<ResourceModel> request, final CallbackContext callbackContext, final Logger logger) { final SesClient client = ClientBuilder.getClient(); final ResourceModel model = request.getDesiredResourceState(); try { final DeleteConfigurationSetRequest deleteConfigurationSetRequest = DeleteConfigurationSetRequest.builder() .configurationSetName(model.getName()) .build(); proxy.injectCredentialsAndInvokeV2(deleteConfigurationSetRequest, client::deleteConfigurationSet); logger.log(String.format("%s [%s] deleted successfully", ResourceModel.TYPE_NAME, getPrimaryIdentifier(model).toString())); } catch (final ConfigurationSetDoesNotExistException e) { throw new CfnNotFoundException(ResourceModel.TYPE_NAME, model.getName()); } return ProgressEvent.defaultSuccessHandler(null); }  @Override ProgressEvent<ResourceModel, CallbackContext> handleRequest(
        final AmazonWebServicesClientProxy proxy,
        final ResourceHandlerRequest<ResourceModel> request,
        final CallbackContext callbackContext,
        final Logger logger); }
DeleteHandler extends BaseHandler<CallbackContext> { @Override public ProgressEvent<ResourceModel, CallbackContext> handleRequest( final AmazonWebServicesClientProxy proxy, final ResourceHandlerRequest<ResourceModel> request, final CallbackContext callbackContext, final Logger logger) { final SesClient client = ClientBuilder.getClient(); final ResourceModel model = request.getDesiredResourceState(); try { final DeleteConfigurationSetRequest deleteConfigurationSetRequest = DeleteConfigurationSetRequest.builder() .configurationSetName(model.getName()) .build(); proxy.injectCredentialsAndInvokeV2(deleteConfigurationSetRequest, client::deleteConfigurationSet); logger.log(String.format("%s [%s] deleted successfully", ResourceModel.TYPE_NAME, getPrimaryIdentifier(model).toString())); } catch (final ConfigurationSetDoesNotExistException e) { throw new CfnNotFoundException(ResourceModel.TYPE_NAME, model.getName()); } return ProgressEvent.defaultSuccessHandler(null); }  @Override ProgressEvent<ResourceModel, CallbackContext> handleRequest(
        final AmazonWebServicesClientProxy proxy,
        final ResourceHandlerRequest<ResourceModel> request,
        final CallbackContext callbackContext,
        final Logger logger);  }