in aws-iotwireless-destination/src/main/java/software/amazon/iotwireless/destination/ListHandler.java [23:56]
public ProgressEvent<ResourceModel, CallbackContext> handleRequest(
final AmazonWebServicesClientProxy proxy,
final ResourceHandlerRequest<ResourceModel> request,
final CallbackContext callbackContext,
final ProxyClient<IotWirelessClient> proxyClient,
final Logger logger) {
ResourceModel model = request.getDesiredResourceState();
final ListDestinationsRequest listDestinationsRequest = Translator.translateToListRequest(request.getNextToken());
try {
ListDestinationsResponse listDestinationsResponse = proxy.injectCredentialsAndInvokeV2(listDestinationsRequest, proxyClient.client()::listDestinations);
final List<ResourceModel> models = listDestinationsResponse.destinationList().stream()
.map(destination -> ResourceModel.builder()
.name(destination.name())
.arn(destination.arn())
.expressionType(destination.expressionTypeAsString())
.description(destination.description())
.roleArn(destination.roleArn())
.build())
.collect(Collectors.toList());
String nextToken = listDestinationsResponse.nextToken();
return ProgressEvent.<ResourceModel, CallbackContext>builder()
.resourceModels(models)
.nextToken(nextToken)
.status(OperationStatus.SUCCESS)
.build();
} catch (final Exception e) {
throw handleException(e, listDestinationsRequest);
}
}