protected UpdateResourceCollectionResponse updateResourceCollectionByBatch()

in aws-devopsguru-resourcecollection/src/main/java/software/amazon/devopsguru/resourcecollection/BaseHandlerStd.java [175:206]


    protected UpdateResourceCollectionResponse updateResourceCollectionByBatch(
            final List<String> updateResourceCollectionStackNamesList,
            final String action,
            final ProxyClient<DevOpsGuruClient> proxyClient,
            final Logger logger) {
        UpdateResourceCollectionResponse awsResponse = null;
        logger.log(String.format("UpdateResourceCollectionByBatch of action [%s] and stacks [%s]", action, updateResourceCollectionStackNamesList));
        try {
            List<String> stackNames = updateResourceCollectionStackNamesList;
            for (List<String> stackNamesPartition : Lists.partition(stackNames, MAX_STACK_NAME_NUMBER_PER_API_CALL)) {
                UpdateResourceCollectionFilter updateResourceCollectionFilter =
                        UpdateResourceCollectionFilter.builder().cloudFormation(UpdateCloudFormationCollectionFilter.builder().stackNames(stackNamesPartition).build()).build();
                UpdateResourceCollectionRequest tempRequest = UpdateResourceCollectionRequest.builder()
                        .action(action)
                        .resourceCollection(updateResourceCollectionFilter)
                        .build();
                awsResponse = proxyClient.injectCredentialsAndInvokeV2(tempRequest,
                        proxyClient.client()::updateResourceCollection);
                logger.log(String.format("UpdateResourceCollectionByBatch response: %s", awsResponse.toString()));
            }
        } catch (final AccessDeniedException e) {
            throw new CfnAccessDeniedException(ResourceModel.TYPE_NAME, e);
        } catch (final ThrottlingException e) {
            throw new CfnThrottlingException(ResourceModel.TYPE_NAME, e);
        } catch (final InternalServerException e) {
            throw new CfnServiceInternalErrorException(ResourceModel.TYPE_NAME, e);
        } catch (final ValidationException e) {
            throw new CfnInvalidRequestException(ResourceModel.TYPE_NAME, e);
        }

        return awsResponse;
    }