@@ -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],
@@ -272,7 +332,7 @@ type DeploymentFollowResponseUnion struct {
272332 // This field is from variant [DeploymentFollowResponseAppVersionSummaryEvent].
273333 ID string `json:"id"`
274334 // This field is from variant [DeploymentFollowResponseAppVersionSummaryEvent].
275- Actions []DeploymentFollowResponseAppVersionSummaryEventAction `json:"actions"`
335+ Actions []shared. AppAction `json:"actions"`
276336 // This field is from variant [DeploymentFollowResponseAppVersionSummaryEvent].
277337 AppName string `json:"app_name"`
278338 // This field is from variant [DeploymentFollowResponseAppVersionSummaryEvent].
@@ -336,7 +396,7 @@ type DeploymentFollowResponseAppVersionSummaryEvent struct {
336396 // Unique identifier for the app version
337397 ID string `json:"id,required"`
338398 // List of actions available on the app
339- Actions []DeploymentFollowResponseAppVersionSummaryEventAction `json:"actions,required"`
399+ Actions []shared. AppAction `json:"actions,required"`
340400 // Name of the application
341401 AppName string `json:"app_name,required"`
342402 // Event type identifier (always "app_version_summary").
@@ -370,24 +430,6 @@ func (r *DeploymentFollowResponseAppVersionSummaryEvent) UnmarshalJSON(data []by
370430 return apijson .UnmarshalRoot (data , r )
371431}
372432
373- // An action available on the app
374- type DeploymentFollowResponseAppVersionSummaryEventAction struct {
375- // Name of the action
376- Name string `json:"name,required"`
377- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
378- JSON struct {
379- Name respjson.Field
380- ExtraFields map [string ]respjson.Field
381- raw string
382- } `json:"-"`
383- }
384-
385- // Returns the unmodified JSON received from the API
386- func (r DeploymentFollowResponseAppVersionSummaryEventAction ) RawJSON () string { return r .JSON .raw }
387- func (r * DeploymentFollowResponseAppVersionSummaryEventAction ) UnmarshalJSON (data []byte ) error {
388- return apijson .UnmarshalRoot (data , r )
389- }
390-
391433type DeploymentNewParams struct {
392434 // Relative path to the entrypoint of the application
393435 EntrypointRelPath string `json:"entrypoint_rel_path,required"`
@@ -432,6 +474,20 @@ const (
432474 DeploymentNewParamsRegionAwsUsEast1a DeploymentNewParamsRegion = "aws.us-east-1a"
433475)
434476
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+
435491type DeploymentFollowParams struct {
436492 // Show logs since the given time (RFC timestamps or durations like 5m).
437493 Since param.Opt [string ] `query:"since,omitzero" json:"-"`
0 commit comments