From a7ec6e920015def42edf405551e07ee1b0bc94c0 Mon Sep 17 00:00:00 2001 From: BG Date: Thu, 20 Nov 2025 13:47:03 +0100 Subject: [PATCH 1/2] Make droplet's lifecycle information available --- resources/droplet_resource.go | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/resources/droplet_resource.go b/resources/droplet_resource.go index fb0949b8631..b725fa8d40f 100644 --- a/resources/droplet_resource.go +++ b/resources/droplet_resource.go @@ -1,10 +1,10 @@ package resources import ( - "encoding/json" + "encoding/json" - "code.cloudfoundry.org/cli/v9/api/cloudcontroller" - "code.cloudfoundry.org/cli/v9/api/cloudcontroller/ccv3/constant" + "code.cloudfoundry.org/cli/v9/api/cloudcontroller" + "code.cloudfoundry.org/cli/v9/api/cloudcontroller/ccv3/constant" ) // Droplet represents a Cloud Controller droplet's metadata. A droplet is a set of @@ -18,6 +18,8 @@ type Droplet struct { CreatedAt string `json:"created_at"` // GUID is the unique droplet identifier. GUID string `json:"guid"` + // An object describing the lifecycle that was used when staging the droplet + Lifecycle DropletLifecycle `json:"lifecycle"` // Image is the Docker image name. Image string `json:"image"` // Stack is the root filesystem to use with the buildpack. @@ -41,12 +43,19 @@ type DropletBuildpack struct { Version string `json:"version"` } +// An object describing the lifecycle that was used when staging the droplet +// possible values for type: "buildpack", "cnd", "docker" +type DropletLifecycle struct { + Type string `json:"name"` +} + func (d Droplet) MarshallJSON() ([]byte, error) { type ccDroplet struct { GUID string `json:"guid,omitempty"` Buildpacks []DropletBuildpack `json:"buildpacks,omitempty"` CreatedAt string `json:"created_at,omitempty"` Image string `json:"image,omitempty"` + Lifecycle DropletLifecycle `json:"lifecycle,omitempty"` Stack string `json:"stack,omitempty"` State constant.DropletState `json:"state,omitempty"` Relationships *struct { @@ -63,6 +72,7 @@ func (d Droplet) MarshallJSON() ([]byte, error) { Buildpacks: d.Buildpacks, CreatedAt: d.CreatedAt, Image: d.Image, + Lifecycle: d.Lifecycle, Stack: d.Stack, State: d.State, } @@ -98,6 +108,7 @@ func (d *Droplet) UnmarshalJSON(data []byte) error { Buildpacks []DropletBuildpack `json:"buildpacks,omitempty"` CreatedAt string `json:"created_at,omitempty"` Image string `json:"image,omitempty"` + Lifecycle DropletLifecycle `json:"lifecycle,omitempty"` Stack string `json:"stack,omitempty"` State constant.DropletState `json:"state,omitempty"` Relationships struct { @@ -118,6 +129,7 @@ func (d *Droplet) UnmarshalJSON(data []byte) error { d.Buildpacks = alias.Buildpacks d.CreatedAt = alias.CreatedAt d.Image = alias.Image + d.Lifecycle = alias.Lifecycle d.Stack = alias.Stack d.State = alias.State d.AppGUID = alias.Relationships.App.Data.GUID From 7316942e00007ac2dd5feb500dd77aa9e0c638e4 Mon Sep 17 00:00:00 2001 From: BG Date: Thu, 11 Dec 2025 08:10:52 +0100 Subject: [PATCH 2/2] Fix Type; Adjust json tag --- resources/droplet_resource.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/droplet_resource.go b/resources/droplet_resource.go index b725fa8d40f..1019534c3b7 100644 --- a/resources/droplet_resource.go +++ b/resources/droplet_resource.go @@ -44,9 +44,9 @@ type DropletBuildpack struct { } // An object describing the lifecycle that was used when staging the droplet -// possible values for type: "buildpack", "cnd", "docker" +// possible values for type: "buildpack", "cnb", "docker" type DropletLifecycle struct { - Type string `json:"name"` + Type string `json:"type"` } func (d Droplet) MarshallJSON() ([]byte, error) {