@@ -27,6 +27,8 @@ type Application struct {
2727 State constant.ApplicationState
2828 // Credentials are used by Cloud Native Buildpacks lifecycle to pull buildpacks
2929 Credentials map [string ]interface {}
30+ // CurrentDropletGUID is the unique identifier of the droplet currently attached to the application.
31+ CurrentDropletGUID string
3032}
3133
3234// ApplicationNameOnly represents only the name field of a Cloud Controller V3 Application
@@ -42,10 +44,14 @@ func (a Application) MarshalJSON() ([]byte, error) {
4244 Metadata : a .Metadata ,
4345 }
4446
47+ ccApp .Relationships = Relationships {}
48+
4549 if a .SpaceGUID != "" {
46- ccApp .Relationships = Relationships {
47- constant .RelationshipTypeSpace : Relationship {GUID : a .SpaceGUID },
48- }
50+ ccApp .Relationships [constant .RelationshipTypeSpace ] = Relationship {GUID : a .SpaceGUID }
51+ }
52+
53+ if a .CurrentDropletGUID != "" {
54+ ccApp .Relationships [constant .RelationshipTypeCurrentDroplet ] = Relationship {GUID : a .CurrentDropletGUID }
4955 }
5056
5157 if a .LifecycleType == constant .AppLifecycleTypeDocker {
@@ -81,6 +87,9 @@ func (a *Application) UnmarshalJSON(data []byte) error {
8187 a .LifecycleType = lifecycle .Type
8288 a .Name = ccApp .Name
8389 a .SpaceGUID = ccApp .Relationships [constant .RelationshipTypeSpace ].GUID
90+ if _ , ok := ccApp .Relationships [constant .RelationshipTypeCurrentDroplet ]; ok {
91+ a .CurrentDropletGUID = ccApp .Relationships [constant .RelationshipTypeCurrentDroplet ].GUID
92+ }
8493 a .State = ccApp .State
8594 a .Metadata = ccApp .Metadata
8695
0 commit comments