class EnsureSingleStorageVersionDecorator extends
    CustomResourceDefinitionDecorator<CustomResourceDefinitionSpecFluent<?>> {
  public EnsureSingleStorageVersionDecorator(String name) {
    super(name);
  }

  @Override
  public void andThenVisit(CustomResourceDefinitionSpecFluent<?> spec, ObjectMeta resourceMeta) {<FILL_FUNCTION_BODY>}

  @Override
  public Class<? extends Decorator>[] after() {
    return new Class[] {
        CustomResourceDefinitionVersionDecorator.class
    };
  }

  @Override
  public String toString() {
    return getClass().getName() + " [name:" + getName() + "]";
  }
}

    List<CustomResourceDefinitionVersion> versions = spec.buildVersions();

    List<String> storageVersions = versions.stream()
        .filter(v -> Optional.ofNullable(v.getStorage()).orElse(true))
        .map(CustomResourceDefinitionVersion::getName)
        .collect(Collectors.toList());

    if (storageVersions.size() > 1) {
      throw new IllegalStateException(String.format(
          "'%s' custom resource has versions %s marked as storage. Only one version can be marked as storage per custom resource.",
          resourceMeta.getName(), storageVersions));
    }
  
<methods>public void <init>(java.lang.String) ,public void andThenVisit(CustomResourceDefinitionSpecFluent<?>, ObjectMeta) <variables>