private void compileEffectiveArns(
            TopDownIndex index,
            IdentifierBindingIndex bindings,
            ServiceShape service
    ) {
        Map<ShapeId, ArnTrait> operationMappings = new HashMap<>();
        effectiveArns.put(service.getId(), operationMappings);

        // Iterate over every resource that has an ARN trait.
        for (Map.Entry<ShapeId, ArnTrait> entry : templates.get(service.getId()).entrySet()) {
            ShapeId resourceId = entry.getKey();
            ArnTrait arnTrait = entry.getValue();
            // Find all of the operations contained within the resource and determine the
            // kind of identifier binding of the operation. This dictates if the effective
            // ARN is the ARN on the resource or the parent of the resource.
            for (OperationShape operation : index.getContainedOperations(resourceId)) {
                BindingType bindingType = bindings.getOperationBindingType(resourceId, operation);
                if (bindingType == BindingType.INSTANCE) {
                    operationMappings.put(operation.getId(), arnTrait);
                } else if (bindingType == BindingType.COLLECTION) {
                    for (ResourceShape resource : index.getContainedResources(service)) {
                        if (resource.getResources().contains(entry.getKey())) {
                            resource.getTrait(ArnTrait.class)
                                    .ifPresent(trait -> operationMappings.put(operation.getId(), trait));
                        }
                    }
                }
            }
        }
    }
Resolves and indexes the ARN templates for each resource in a service.
smithy-aws-traits/src/main/java/software/amazon/smithy/aws/traits/ArnIndex.java