private static void pruneOperationsAndErrors(ServiceModel serviceModel) {
        Map<String, Shape> shapes = serviceModel.getShapes();
        Map<String, Operation> operations = copy(serviceModel.getOperations());
        serviceModel.getOperations().forEach((operationName, operation) -> {
            // Remove operation if Input shape has been pruned
            if (operation.getInput() != null) {
                String inputShape = operation.getInput().getShape();
                if (!shapes.containsKey(inputShape)) {
                    operations.remove(operationName);

                    if (operation.getOutput() != null) {
                        shapes.remove(operation.getOutput().getShape());
                    }

                    log("Pruned operation [%s] with input shape [%s]", operationName, inputShape);
                    return;
                }
            }
            // Remove operation if Output shape has been pruned
            if (operation.getOutput() != null) {
                String outputShape = operation.getOutput().getShape();
                if (!shapes.containsKey(outputShape)) {
                    operations.remove(operationName);

                    if (operation.getInput() != null) {
                        shapes.remove(operation.getInput().getShape());
                    }

                    log("Pruned operation [%s] with output shape [%s]", operationName, outputShape);
                    return;
                }
            }
            // Remove any errors that have had their shape pruned
            List<ErrorMap> errors = copy(operation.getErrors());
            operation.getErrors().forEach(error -> {
                String errorShape = error.getShape();
                if (!shapes.containsKey(errorShape)) {
                    errors.remove(error);
                    log("Pruned error [%s] from operation [%s]", errorShape, operationName);
                }
            });
            operation.setErrors(errors);
        });
        serviceModel.setOperations(operations);
    }
Prune operations that have had either their entire input or output shape pruned.
<p>
Also prune any operation-level errors that have had their corresponding shape pruned.
aws-java-sdk-code-generator/src/main/java/com/amazonaws/codegen/customization/processors/PruneUnsupportedShapesProcessor.java