private ProgressEvent constructResourceModelFromResponse()

in aws-devopsguru-notificationchannel/src/main/java/software/amazon/devopsguru/notificationchannel/ListHandler.java [61:80]


    private ProgressEvent<ResourceModel, CallbackContext> constructResourceModelFromResponse(
            final ListNotificationChannelsResponse awsResponse) {
        final List<ResourceModel> models = new ArrayList<>();

        awsResponse.channels().forEach(channel -> {
            if(channel.config().sns() != null) {
                SnsChannelConfig sns = SnsChannelConfig.builder().topicArn(channel.config().sns().topicArn()).build();
                models.add(ResourceModel.builder()
                        .config(new NotificationChannelConfig(sns))
                        .id(channel.id())
                        .build());
            }
        });

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