aws-datasync-locationobjectstorage/src/main/java/software/amazon/datasync/locationobjectstorage/ListHandler.java [24:63]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    public ProgressEvent<ResourceModel, CallbackContext> handleRequest(
            final AmazonWebServicesClientProxy proxy,
            final ResourceHandlerRequest<ResourceModel> request,
            final CallbackContext callbackContext,
            final Logger logger) {

        final String nextToken = request.getNextToken();
        final DataSyncClient client = ClientBuilder.getClient();

        final ListLocationsRequest listLocationsRequest = Translator.translateToListRequest(nextToken);

        final ListLocationsResponse response;
        try {
            response = proxy.injectCredentialsAndInvokeV2(listLocationsRequest, client::listLocations);
        } catch (InvalidRequestException e) {
            throw new CfnInvalidRequestException(e.getMessage(), e.getCause());
        } catch (InternalException e) {
            throw new CfnServiceInternalErrorException(e.getMessage(), e.getCause());
        } catch (DataSyncException e) {
            throw Translator.translateDataSyncExceptionToCfnException(e);
        }

        final List<ResourceModel> models = new ArrayList<>();
        for (LocationListEntry loc : response.locations()) {
            // Add only if it is an Object Storage location
            if (loc.locationUri().startsWith("object-storage://")) {
                ResourceModel model = ResourceModel.builder()
                        .locationArn(loc.locationArn())
                        .locationUri(loc.locationUri())
                        .build();
                models.add(model);
            }
        }

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



aws-datasync-locationsmb/src/main/java/software/amazon/datasync/locationsmb/ListHandler.java [24:63]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    public ProgressEvent<ResourceModel, CallbackContext> handleRequest(
            final AmazonWebServicesClientProxy proxy,
            final ResourceHandlerRequest<ResourceModel> request,
            final CallbackContext callbackContext,
            final Logger logger) {

        final String nextToken = request.getNextToken();
        final DataSyncClient client = ClientBuilder.getClient();

        final ListLocationsRequest listLocationsRequest = Translator.translateToListRequest(nextToken);

        final ListLocationsResponse response;
        try {
            response = proxy.injectCredentialsAndInvokeV2(listLocationsRequest, client::listLocations);
        } catch (InvalidRequestException e) {
            throw new CfnInvalidRequestException(e.getMessage(), e.getCause());
        } catch (InternalException e) {
            throw new CfnServiceInternalErrorException(e.getMessage(), e.getCause());
        } catch (DataSyncException e) {
            throw Translator.translateDataSyncExceptionToCfnException(e);
        }

        final List<ResourceModel> models = new ArrayList<>();
        for (LocationListEntry loc : response.locations()) {
            // Add only if it is an SMB location
            if (loc.locationUri().startsWith("smb://")) {
                ResourceModel model = ResourceModel.builder()
                        .locationArn(loc.locationArn())
                        .locationUri(loc.locationUri())
                        .build();
                models.add(model);
            }
        }

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



aws-datasync-locationhdfs/src/main/java/software/amazon/datasync/locationhdfs/ListHandler.java [24:63]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    public ProgressEvent<ResourceModel, CallbackContext> handleRequest(
            final AmazonWebServicesClientProxy proxy,
            final ResourceHandlerRequest<ResourceModel> request,
            final CallbackContext callbackContext,
            final Logger logger) {

        final String nextToken = request.getNextToken();
        final DataSyncClient client = ClientBuilder.getClient();

        final ListLocationsRequest listLocationsRequest = Translator.translateToListRequest(nextToken);

        final ListLocationsResponse response;
        try {
            response = proxy.injectCredentialsAndInvokeV2(listLocationsRequest, client::listLocations);
        } catch (InvalidRequestException e) {
            throw new CfnInvalidRequestException(e.getMessage(), e.getCause());
        } catch (InternalException e) {
            throw new CfnServiceInternalErrorException(e.getMessage(), e.getCause());
        } catch (DataSyncException e) {
            throw Translator.translateDataSyncExceptionToCfnException(e);
        }

        final List<ResourceModel> models = new ArrayList<>();
        for (LocationListEntry loc : response.locations()) {
            // Add only if it is an HDFS location
            if (loc.locationUri().startsWith("hdfs://")) {
                ResourceModel model = ResourceModel.builder()
                        .locationArn(loc.locationArn())
                        .locationUri(loc.locationUri())
                        .build();
                models.add(model);
            }
        }

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



aws-datasync-locationnfs/src/main/java/software/amazon/datasync/locationnfs/ListHandler.java [24:63]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    public ProgressEvent<ResourceModel, CallbackContext> handleRequest(
        final AmazonWebServicesClientProxy proxy,
        final ResourceHandlerRequest<ResourceModel> request,
        final CallbackContext callbackContext,
        final Logger logger) {

        final String nextToken = request.getNextToken();
        final DataSyncClient client = ClientBuilder.getClient();

        final ListLocationsRequest listLocationsRequest = Translator.translateToListRequest(nextToken);

        final ListLocationsResponse response;
        try {
            response = proxy.injectCredentialsAndInvokeV2(listLocationsRequest, client::listLocations);
        } catch (InvalidRequestException e) {
            throw new CfnInvalidRequestException(e.getMessage(), e.getCause());
        } catch (InternalException e) {
            throw new CfnServiceInternalErrorException(e.getMessage(), e.getCause());
        } catch (DataSyncException e) {
            throw Translator.translateDataSyncExceptionToCfnException(e);
        }

        final List<ResourceModel> models = new ArrayList<>();
        for (LocationListEntry loc : response.locations()) {
            // Add only if it is an NFS location
            if (loc.locationUri().startsWith("nfs://")) {
                ResourceModel model = ResourceModel.builder()
                        .locationArn(loc.locationArn())
                        .locationUri(loc.locationUri())
                        .build();
                models.add(model);
            }
        }

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



