11package resources
22
33import (
4- "encoding/json"
4+ "encoding/json"
55
6- "code.cloudfoundry.org/cli/v8/api/cloudcontroller"
6+ "code.cloudfoundry.org/cli/v8/api/cloudcontroller"
77 "code.cloudfoundry.org/cli/v8/api/cloudcontroller/ccv3/constant"
88)
99
@@ -18,6 +18,8 @@ type Droplet struct {
1818 CreatedAt string `json:"created_at"`
1919 // GUID is the unique droplet identifier.
2020 GUID string `json:"guid"`
21+ // An object describing the lifecycle that was used when staging the droplet
22+ Lifecycle DropletLifecycle `json:"lifecycle"`
2123 // Image is the Docker image name.
2224 Image string `json:"image"`
2325 // Stack is the root filesystem to use with the buildpack.
@@ -41,11 +43,18 @@ type DropletBuildpack struct {
4143 Version string `json:"version"`
4244}
4345
46+ // An object describing the lifecycle that was used when staging the droplet
47+ // possible values for type: "buildpack", "cnb", "docker"
48+ type DropletLifecycle struct {
49+ Type string `json:"type"`
50+ }
51+
4452func (d Droplet ) MarshallJSON () ([]byte , error ) {
4553 type ccDroplet struct {
4654 GUID string `json:"guid,omitempty"`
4755 Buildpacks []DropletBuildpack `json:"buildpacks,omitempty"`
4856 CreatedAt string `json:"created_at,omitempty"`
57+ Lifecycle DropletLifecycle `json:"lifecycle,omitempty"`
4958 Image string `json:"image,omitempty"`
5059 Stack string `json:"stack,omitempty"`
5160 State constant.DropletState `json:"state,omitempty"`
@@ -62,6 +71,7 @@ func (d Droplet) MarshallJSON() ([]byte, error) {
6271 GUID : d .GUID ,
6372 Buildpacks : d .Buildpacks ,
6473 CreatedAt : d .CreatedAt ,
74+ Lifecycle : d .Lifecycle ,
6575 Image : d .Image ,
6676 Stack : d .Stack ,
6777 State : d .State ,
@@ -98,6 +108,7 @@ func (d *Droplet) UnmarshalJSON(data []byte) error {
98108 Buildpacks []DropletBuildpack `json:"buildpacks,omitempty"`
99109 CreatedAt string `json:"created_at,omitempty"`
100110 Image string `json:"image,omitempty"`
111+ Lifecycle DropletLifecycle `json:"lifecycle,omitempty"`
101112 Stack string `json:"stack,omitempty"`
102113 State constant.DropletState `json:"state,omitempty"`
103114 Relationships struct {
@@ -118,6 +129,7 @@ func (d *Droplet) UnmarshalJSON(data []byte) error {
118129 d .Buildpacks = alias .Buildpacks
119130 d .CreatedAt = alias .CreatedAt
120131 d .Image = alias .Image
132+ d .Lifecycle = alias .Lifecycle
121133 d .Stack = alias .Stack
122134 d .State = alias .State
123135 d .AppGUID = alias .Relationships .App .Data .GUID
0 commit comments