public ProgressEvent handleRequest()

in aws-timestream-table/src/main/java/software/amazon/timestream/table/ReadHandler.java [37:79]


    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;

        ResourceModel result;
        final ResourceModel model = request.getDesiredResourceState();
        final DescribeTableRequest describeTableRequest =
                new DescribeTableRequest().withDatabaseName(model.getDatabaseName()).withTableName(
                        model.getTableName());

        try {
            final DescribeTableResult describeTableResult =
                    this.proxy.injectCredentialsAndInvoke(describeTableRequest, timestreamClient::describeTable);

            final Table tableRecord = describeTableResult.getTable();
            final List<Tag> tags = getTags(tableRecord.getArn());
            model.setTags(tags == null || tags.isEmpty() ? null : tags);
            model.setArn(tableRecord.getArn());
            model.setName(tableRecord.getTableName());
            result = model;
        } catch (ResourceNotFoundException ex) {
            // could be either database does not exist or table does not exist.
            throw new CfnNotFoundException(ex);
        } catch (ValidationException | InvalidEndpointException ex) {
            throw new CfnInvalidRequestException(request.toString(), ex);
        } catch (AccessDeniedException ex) {
            throw new CfnAccessDeniedException(DESCRIBE_TABLE, ex);
        } catch (ThrottlingException ex) {
            throw new CfnThrottlingException(DESCRIBE_TABLE, ex);
        } catch (InternalServerException ex) {
            throw new CfnInternalFailureException(ex);
        }

        return ProgressEvent.<ResourceModel, CallbackContext>builder()
            .resourceModel(result)
            .status(OperationStatus.SUCCESS)
            .build();
    }