@@ -135,6 +135,19 @@ private static void asBoolean(Map<String, Object> payload, String key, Consumer<
135135 as (payload , key , Boolean .class ::cast , consumer );
136136 }
137137
138+ @ SuppressWarnings ("unchecked" )
139+ private static void asDocker (Map <String , Object > payload , String key , Consumer <Docker > consumer ) {
140+ as (payload , key , value -> {
141+ Map <String , String > docker = ((Map <String , String >) value );
142+
143+ return Docker .builder ()
144+ .image (docker .get ("image" ))
145+ .password (docker .get ("password" ))
146+ .username (docker .get ("username" ))
147+ .build ();
148+ }, consumer );
149+ }
150+
138151 private static void asInteger (Map <String , Object > payload , String key , Consumer <Integer > consumer ) {
139152 as (payload , key , Integer .class ::cast , consumer );
140153 }
@@ -292,6 +305,14 @@ private static void merge(List<Object> first, List<Object> second) {
292305 });
293306 }
294307
308+ private static Function <Path , Object > pathToString () {
309+ return path -> Optional .ofNullable (path ).map (Path ::toString ).orElse (null );
310+ }
311+
312+ private static Function <ApplicationHealthCheck , Object > protectApplicationHealthCheck () {
313+ return applicationHealthCheck -> Optional .ofNullable (applicationHealthCheck ).map (ApplicationHealthCheck ::getValue ).orElse (null );
314+ }
315+
295316 private static void putIfPresent (Map <String , Object > yaml , String key , Object value ) {
296317 putIfPresent (yaml , key , value , Function .identity ());
297318 }
@@ -305,6 +326,7 @@ private static ApplicationManifest.Builder toApplicationManifest(Map<String, Obj
305326 asString (application , "buildpack" , builder ::buildpack );
306327 asString (application , "command" , builder ::command );
307328 asMemoryInteger (application , "disk_quota" , builder ::disk );
329+ asDocker (application , "docker" , builder ::docker );
308330 asString (application , "domain" , builder ::domain );
309331 asListOfString (application , "domains" , builder ::domain );
310332 asMapOfStringString (application , "env" , builder ::environmentVariable );
@@ -343,14 +365,14 @@ private static Map<String, Object> toYaml(ApplicationManifest applicationManifes
343365 putIfPresent (yaml , "domains" , applicationManifest .getDomains ());
344366 putIfPresent (yaml , "env" , applicationManifest .getEnvironmentVariables ());
345367 putIfPresent (yaml , "health-check-http-endpoint" , applicationManifest .getHealthCheckHttpEndpoint ());
346- putIfPresent (yaml , "health-check-type" , applicationManifest .getHealthCheckType () != null ? applicationManifest . getHealthCheckType (). getValue () : null );
368+ putIfPresent (yaml , "health-check-type" , applicationManifest .getHealthCheckType (), protectApplicationHealthCheck () );
347369 putIfPresent (yaml , "hosts" , applicationManifest .getHosts ());
348370 putIfPresent (yaml , "instances" , applicationManifest .getInstances ());
349371 putIfPresent (yaml , "memory" , applicationManifest .getMemory ());
350372 putIfPresent (yaml , "name" , applicationManifest .getName ());
351373 putIfPresent (yaml , "no-hostname" , applicationManifest .getNoHostname ());
352374 putIfPresent (yaml , "no-route" , applicationManifest .getNoRoute ());
353- putIfPresent (yaml , "path" , applicationManifest .getPath () != null ? applicationManifest . getPath (). toString () : null );
375+ putIfPresent (yaml , "path" , applicationManifest .getPath (), pathToString () );
354376 putIfPresent (yaml , "random-route" , applicationManifest .getRandomRoute ());
355377 putIfPresent (yaml , "route-path" , applicationManifest .getRoutePath ());
356378 putIfPresent (yaml , "routes" , applicationManifest .getRoutes (), ApplicationManifestUtils ::toRoutesYaml );
0 commit comments