public ProgressEvent handleRequest()

in aws-timestream-table/src/main/java/software/amazon/timestream/table/ListHandler.java [40:87]


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

        timestreamClient = TimestreamClientFactory.get(proxy, logger);
        this.proxy = proxy;

        ListTablesResult result;
        final ListTablesRequest listTablesRequest =
                new ListTablesRequest()
                        .withDatabaseName(request.getDesiredResourceState().getDatabaseName())
                        .withNextToken(request.getNextToken())
                        .withMaxResults(MAX_ITEMS);

        try {
            result = this.proxy.injectCredentialsAndInvoke(listTablesRequest, timestreamClient::listTables);
        } catch(InternalServerException ex) {
            throw new CfnInternalFailureException(ex);
        } catch (ThrottlingException ex) {
            throw new CfnThrottlingException(LIST_TABLES, ex);
        } catch (ValidationException | InvalidEndpointException ex) {
            throw new CfnInvalidRequestException(request.toString(), ex);
        } catch (ResourceNotFoundException ex) {
            throw new CfnNotFoundException(DATABASE, request.getDesiredResourceState().getDatabaseName(), ex);
        } catch (AccessDeniedException ex) {
            throw new CfnAccessDeniedException(LIST_TABLES, ex);
        }

        final List<ResourceModel> models =
                result
                        .getTables()
                        .stream()
                        .map(record ->
                                ResourceModel.builder()
                                        .databaseName(record.getDatabaseName())
                                        .tableName(record.getTableName())
                                        .retentionProperties(RetentionPropertiesModelConverter.convert(record.getRetentionProperties()))
                                        .build())
                        .collect(Collectors.toList());

        return ProgressEvent.<ResourceModel, CallbackContext>builder()
            .resourceModels(models)
            .nextToken(result.getNextToken())
            .status(OperationStatus.SUCCESS)
            .build();
    }