From 84dcb387e8606bc6f438464e2847854abb4d90d3 Mon Sep 17 00:00:00 2001 From: BG Date: Thu, 20 Nov 2025 14:02:34 +0100 Subject: [PATCH 1/2] Make droplet's lifecycle information available --- resources/droplet_resource.go | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/resources/droplet_resource.go b/resources/droplet_resource.go index afcbe7c88e7..289a85ff8a4 100644 --- a/resources/droplet_resource.go +++ b/resources/droplet_resource.go @@ -1,9 +1,9 @@ package resources import ( - "encoding/json" + "encoding/json" - "code.cloudfoundry.org/cli/v8/api/cloudcontroller" + "code.cloudfoundry.org/cli/v8/api/cloudcontroller" "code.cloudfoundry.org/cli/v8/api/cloudcontroller/ccv3/constant" ) @@ -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,11 +43,18 @@ 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"` + Lifecycle DropletLifecycle `json:"lifecycle,omitempty"` Image string `json:"image,omitempty"` Stack string `json:"stack,omitempty"` State constant.DropletState `json:"state,omitempty"` @@ -62,6 +71,7 @@ func (d Droplet) MarshallJSON() ([]byte, error) { GUID: d.GUID, Buildpacks: d.Buildpacks, CreatedAt: d.CreatedAt, + Lifecycle: d.Lifecycle, Image: d.Image, 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 297ece9e853c288f0ef532aaba431cb765ee2a58 Mon Sep 17 00:00:00 2001 From: BG Date: Thu, 11 Dec 2025 08:08:42 +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 289a85ff8a4..0a31bba82c7 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) {