public IntermediateModel build()

in codegen/src/main/java/software/amazon/awssdk/codegen/IntermediateModelBuilder.java [95:174]


    public IntermediateModel build() {
        CodegenCustomizationProcessor customization = DefaultCustomizationProcessor
            .getProcessorFor(customConfig);

        customization.preprocess(service);

        Map<String, ShapeModel> shapes = new HashMap<>();

        Map<String, OperationModel> operations = new TreeMap<>(new AddOperations(this).constructOperations());

        // Iterate through every operation and build an 'endpointOperation' if at least one operation that supports
        // endpoint discovery is found. If -any operations that require- endpoint discovery are found, then the flag
        // 'endpointCacheRequired' will be set on the 'endpointOperation'. This 'endpointOperation' summary is then
        // passed directly into the constructor of the intermediate model and is referred to by the codegen.
        OperationModel endpointOperation = null;
        boolean endpointCacheRequired = false;

        for (OperationModel o : operations.values()) {
            if (o.isEndpointOperation()) {
                endpointOperation = o;
            }

            if (o.getEndpointDiscovery() != null && o.getEndpointDiscovery().isRequired()) {
                endpointCacheRequired = true;
            }
        }

        if (endpointOperation != null) {
            endpointOperation.setEndpointCacheRequired(endpointCacheRequired);
        }

        for (IntermediateModelShapeProcessor processor : shapeProcessors) {
            shapes.putAll(processor.process(Collections.unmodifiableMap(operations),
                                            Collections.unmodifiableMap(shapes)));
        }

        // Remove deprecated operations and their paginators
        operations.entrySet().removeIf(e -> customConfig.getDeprecatedOperations().contains(e.getKey()));
        paginators.getPagination().entrySet().removeIf(e -> customConfig.getDeprecatedOperations().contains(e.getKey()));

        log.info("{} shapes found in total.", shapes.size());

        IntermediateModel fullModel = new IntermediateModel(
            constructMetadata(service, customConfig), operations, shapes,
            customConfig, endpointOperation, paginators.getPagination(), namingStrategy,
            waiters.getWaiters(), endpointRuleSet, endpointTestSuiteModel, service.getClientContextParams());

        customization.postprocess(fullModel);

        log.info("{} shapes remained after applying customizations.", fullModel.getShapes().size());

        Map<String, ShapeModel> trimmedShapes = removeUnusedShapes(fullModel);
        // Remove deprecated shapes
        trimmedShapes.entrySet().removeIf(e -> customConfig.getDeprecatedShapes().contains(e.getKey()));

        log.info("{} shapes remained after removing unused shapes.", trimmedShapes.size());

        IntermediateModel trimmedModel = new IntermediateModel(fullModel.getMetadata(),
                                                               fullModel.getOperations(),
                                                               trimmedShapes,
                                                               fullModel.getCustomizationConfig(),
                                                               endpointOperation,
                                                               fullModel.getPaginators(),
                                                               namingStrategy,
                                                               fullModel.getWaiters(),
                                                               fullModel.getEndpointRuleSetModel(),
                                                               endpointTestSuiteModel,
                                                               service.getClientContextParams());

        linkMembersToShapes(trimmedModel);
        linkOperationsToInputOutputShapes(trimmedModel);
        linkCustomAuthorizationToRequestShapes(trimmedModel);

        setSimpleMethods(trimmedModel);

        namingStrategy.validateCustomerVisibleNaming(trimmedModel);
        customizeEndpointParameters(fullModel, endpointRuleSet);
        customizeOperationContextParams(trimmedModel, fullModel.getCustomizationConfig().getCustomOperationContextParams());
        return trimmedModel;
    }