public static Matcher<?> fromNode(Node node) {
        ObjectNode value = node.expectObjectNode();
        if (value.size() != 1) {
            throw new ExpectationNotMetException("Union value must have exactly one value set", node);
        }

        Map.Entry<StringNode, Node> entry = value.getMembers().entrySet().iterator().next();
        String entryKey = entry.getKey().getValue();
        Node entryValue = entry.getValue();

        switch (entryKey) {
            case "output":
                return new OutputMember(PathMatcher.fromNode(entryValue));
            case "inputOutput":
                return new InputOutputMember(PathMatcher.fromNode(entryValue));
            case "success":
                return new SuccessMember(entryValue.expectBooleanNode().getValue());
            case "errorType":
                return new ErrorTypeMember(entryValue.expectStringNode().getValue());
            default:
                return new UnknownMember(entryKey, entryValue);
        }
    }
Creates a {@code Matcher} from a {@link Node}.

@param node {@code Node} to create a {@code Matcher} from.
@return Returns the create {@code Matcher}.
@throws ExpectationNotMetException if the given {@code node} is invalid.
smithy-waiters/src/main/java/software/amazon/smithy/waiters/Matcher.java