@Override
    public Node toNode() {
        ObjectNode.Builder builder = Node.objectNodeBuilder();
        if (!required.isEmpty()) {
            ObjectNode.Builder requiredBuilder = Node.objectNodeBuilder();
            for (Map.Entry<String, ActionResource> requiredEntry : required.entrySet()) {
                requiredBuilder.withMember(requiredEntry.getKey(), requiredEntry.getValue().toNode());
            }
            builder.withMember(REQUIRED, requiredBuilder.build());
        }
        if (!optional.isEmpty()) {
            ObjectNode.Builder optionalBuilder = Node.objectNodeBuilder();
            for (Map.Entry<String, ActionResource> optionalEntry : optional.entrySet()) {
                optionalBuilder.withMember(optionalEntry.getKey(), optionalEntry.getValue().toNode());
            }
            builder.withMember(OPTIONAL, optionalBuilder.build());
        }
        return builder.build();
    }
Gets the resources that will be authorized against based on
optional behavior of the IAM action.

@return the optional resources.
smithy-aws-iam-traits/src/main/java/software/amazon/smithy/aws/iam/traits/ActionResources.java