public ProgressEvent handleRequest()

in aws-iot-certificate/src/main/java/com/amazonaws/iot/certificate/UpdateHandler.java [37:72]


    public ProgressEvent<ResourceModel, CallbackContext> handleRequest(
            final AmazonWebServicesClientProxy proxy,
            final ResourceHandlerRequest<ResourceModel> request,
            final CallbackContext callbackContext,
            final Logger logger) {

        final ResourceModel newModel = request.getDesiredResourceState();
        final ResourceModel prevModel = request.getPreviousResourceState();

        // Only the status can be updated
        if (!newModel.getStatus().equals(prevModel.getStatus())) {
            UpdateCertificateRequest updateRequest = UpdateCertificateRequest.builder()
                    .certificateId(prevModel.getId())
                    .newStatus(newModel.getStatus())
                    .build();

            try {
                proxy.injectCredentialsAndInvokeV2(updateRequest, iotClient::updateCertificate);

            } catch (final ServiceUnavailableException e) {
                throw new CfnGeneralServiceException(OPERATION, e);
            } catch (final InternalFailureException e) {
                throw new CfnServiceInternalErrorException(OPERATION, e);
            } catch (final InvalidRequestException | CertificateStateException e) {
                throw new CfnInvalidRequestException(e.getMessage(), e);
            } catch (final ResourceNotFoundException e) {
                throw new CfnNotFoundException(ResourceModel.TYPE_NAME, updateRequest.certificateId());
            } catch (final ThrottlingException e) {
                throw new CfnThrottlingException(OPERATION, e);
            } catch (final UnauthorizedException e) {
                throw new CfnAccessDeniedException(OPERATION, e);
            }
        }

        return ProgressEvent.defaultSuccessHandler(newModel);
    }