cf-java-client
cf-java-client copied to clipboard
Feature request: Add support for arbitrary parameters when binding services via manifest.yml
Hello,
I want to report this error when we push an app manifest with binding parameters. It seems that the manifest yaml doesn't get parsed correctly because the format is not supported
java.lang.ClassCastException: Cannot cast java.util.LinkedHashMap to java.lang.String
at java.lang.Class.cast(Class.java:3369)
at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1382)
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)
at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:485)
at org.cloudfoundry.operations.applications.ApplicationManifestUtils.lambda$asList$2(ApplicationManifestUtils.java:160)
at java.util.Optional.ifPresent(Optional.java:159)
at org.cloudfoundry.operations.applications.ApplicationManifestUtils.as(ApplicationManifestUtils.java:131)
at org.cloudfoundry.operations.applications.ApplicationManifestUtils.asList(ApplicationManifestUtils.java:157)
at org.cloudfoundry.operations.applications.ApplicationManifestUtils.asListOfString(ApplicationManifestUtils.java:164)
at org.cloudfoundry.operations.applications.ApplicationManifestUtils.toApplicationManifest(ApplicationManifestUtils.java:346)
at org.cloudfoundry.operations.applications.ApplicationManifestUtils.lambda$doRead$9(ApplicationManifestUtils.java:236)
at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1382)
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:566)
at org.cloudfoundry.operations.applications.ApplicationManifestUtils.doRead(ApplicationManifestUtils.java:240)
at org.cloudfoundry.operations.applications.ApplicationManifestUtils.read(ApplicationManifestUtils.java:73)
at org.cloudfoundry.operations.applications.ApplicationManifestUtils$read.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
Manifest format:
---
applications:
- name: my-app
services:
- name: my-service1
parameters:
foo: bar
herp: derp
- name: my-service2
parameters:
foo: bar
For more details on the binding params please read: https://docs.cloudfoundry.org/devguide/services/application-binding.html#-binding-with-application-manifest
Best regards.
Acknowledged.
I believe the format you want is only valid in the v3 manifest though. My understanding is that the v2 manifest format for the services block is just a list of service names. That is why you're getting this error because we are compatible with the v2 manifest format which just expects a list of names.
It's likely that we'll never actually support the v3 manifest format in client code because with the v3 API the manifest is intended to be parsed on the server (i.e. the manifest is sent to the server). When we get the v3 push and rolling update operations (#1103) supported, this should work by proxy.
I'll leave this issue open though to confirm when that's done.