@@ -65,6 +65,14 @@ func (r *DeploymentService) Get(ctx context.Context, id string, opts ...option.R
6565 return
6666}
6767
68+ // List deployments. Optionally filter by application name.
69+ func (r * DeploymentService ) List (ctx context.Context , query DeploymentListParams , opts ... option.RequestOption ) (res * []DeploymentListResponse , err error ) {
70+ opts = append (r .Options [:], opts ... )
71+ path := "deployments"
72+ err = requestconfig .ExecuteNewRequest (ctx , http .MethodGet , path , query , & res , opts ... )
73+ return
74+ }
75+
6876// Establishes a Server-Sent Events (SSE) stream that delivers real-time logs and
6977// status updates for a deployment. The stream terminates automatically once the
7078// deployment reaches a terminal state.
@@ -253,6 +261,58 @@ const (
253261 DeploymentGetResponseStatusStopped DeploymentGetResponseStatus = "stopped"
254262)
255263
264+ // Deployment record information.
265+ type DeploymentListResponse struct {
266+ // Unique identifier for the deployment
267+ ID string `json:"id,required"`
268+ // Timestamp when the deployment was created
269+ CreatedAt time.Time `json:"created_at,required" format:"date-time"`
270+ // Deployment region code
271+ Region constant.AwsUsEast1a `json:"region,required"`
272+ // Current status of the deployment
273+ //
274+ // Any of "queued", "in_progress", "running", "failed", "stopped".
275+ Status DeploymentListResponseStatus `json:"status,required"`
276+ // Relative path to the application entrypoint
277+ EntrypointRelPath string `json:"entrypoint_rel_path"`
278+ // Environment variables configured for this deployment
279+ EnvVars map [string ]string `json:"env_vars"`
280+ // Status reason
281+ StatusReason string `json:"status_reason"`
282+ // Timestamp when the deployment was last updated
283+ UpdatedAt time.Time `json:"updated_at,nullable" format:"date-time"`
284+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
285+ JSON struct {
286+ ID respjson.Field
287+ CreatedAt respjson.Field
288+ Region respjson.Field
289+ Status respjson.Field
290+ EntrypointRelPath respjson.Field
291+ EnvVars respjson.Field
292+ StatusReason respjson.Field
293+ UpdatedAt respjson.Field
294+ ExtraFields map [string ]respjson.Field
295+ raw string
296+ } `json:"-"`
297+ }
298+
299+ // Returns the unmodified JSON received from the API
300+ func (r DeploymentListResponse ) RawJSON () string { return r .JSON .raw }
301+ func (r * DeploymentListResponse ) UnmarshalJSON (data []byte ) error {
302+ return apijson .UnmarshalRoot (data , r )
303+ }
304+
305+ // Current status of the deployment
306+ type DeploymentListResponseStatus string
307+
308+ const (
309+ DeploymentListResponseStatusQueued DeploymentListResponseStatus = "queued"
310+ DeploymentListResponseStatusInProgress DeploymentListResponseStatus = "in_progress"
311+ DeploymentListResponseStatusRunning DeploymentListResponseStatus = "running"
312+ DeploymentListResponseStatusFailed DeploymentListResponseStatus = "failed"
313+ DeploymentListResponseStatusStopped DeploymentListResponseStatus = "stopped"
314+ )
315+
256316// DeploymentFollowResponseUnion contains all possible properties and values from
257317// [shared.LogEvent], [DeploymentStateEvent],
258318// [DeploymentFollowResponseAppVersionSummaryEvent], [shared.ErrorEvent],
@@ -414,6 +474,20 @@ const (
414474 DeploymentNewParamsRegionAwsUsEast1a DeploymentNewParamsRegion = "aws.us-east-1a"
415475)
416476
477+ type DeploymentListParams struct {
478+ // Filter results by application name.
479+ AppName param.Opt [string ] `query:"app_name,omitzero" json:"-"`
480+ paramObj
481+ }
482+
483+ // URLQuery serializes [DeploymentListParams]'s query parameters as `url.Values`.
484+ func (r DeploymentListParams ) URLQuery () (v url.Values , err error ) {
485+ return apiquery .MarshalWithSettings (r , apiquery.QuerySettings {
486+ ArrayFormat : apiquery .ArrayQueryFormatComma ,
487+ NestedFormat : apiquery .NestedQueryFormatBrackets ,
488+ })
489+ }
490+
417491type DeploymentFollowParams struct {
418492 // Show logs since the given time (RFC timestamps or durations like 5m).
419493 Since param.Opt [string ] `query:"since,omitzero" json:"-"`
0 commit comments