From 4baf40aef8ca8c8051c87fe80532b14f8193299d Mon Sep 17 00:00:00 2001 From: Kira Pilot Date: Tue, 9 May 2023 17:50:04 +0000 Subject: [PATCH 1/5] added impending_deletion workspace field --- coderd/workspaces.go | 22 +++++++++++++++++++++- codersdk/workspaces.go | 1 + site/src/api/typesGenerated.ts | 1 + site/src/testHelpers/entities.ts | 1 + 4 files changed, 24 insertions(+), 1 deletion(-) diff --git a/coderd/workspaces.go b/coderd/workspaces.go index 89214bd6d958e..905d1ddf1c487 100644 --- a/coderd/workspaces.go +++ b/coderd/workspaces.go @@ -1169,7 +1169,10 @@ func convertWorkspace( autostartSchedule = &workspace.AutostartSchedule.String } - ttlMillis := convertWorkspaceTTLMillis(workspace.Ttl) + var ( + ttlMillis = convertWorkspaceTTLMillis(workspace.Ttl) + impendingDeletion = calculateImpendingDeletion(workspace, template) + ) return codersdk.Workspace{ ID: workspace.ID, CreatedAt: workspace.CreatedAt, @@ -1188,6 +1191,7 @@ func convertWorkspace( AutostartSchedule: autostartSchedule, TTLMillis: ttlMillis, LastUsedAt: workspace.LastUsedAt, + ImpendingDeletion: impendingDeletion, } } @@ -1200,6 +1204,22 @@ func convertWorkspaceTTLMillis(i sql.NullInt64) *int64 { return &millis } +// Calculate the time of the upcoming working deletion, if applicable; otherwise, return an empty time.Time struct. +// Workspaces may have impending deletions if InactivityTTL feature is turned on and the workspace is inactive. +func calculateImpendingDeletion(workspace database.Workspace, template database.Template) time.Time { + var ( + year, month, day = time.Now().Date() + beginningOfToday = time.Date(year, month, day, 0, 0, 0, 0, time.Now().Location()) + ) + // If InactivityTTL is turned off (set to 0), if the workspace has already been deleted, + // or if the workspace was used sometime within the last day, there is no impending deletion + if template.InactivityTTL == 0 || workspace.Deleted || workspace.LastUsedAt.After(beginningOfToday) { + return time.Time{} + } + + return workspace.LastUsedAt.Add(time.Duration(template.InactivityTTL) * time.Nanosecond) +} + func validWorkspaceTTLMillis(millis *int64, templateDefault, templateMax time.Duration) (sql.NullInt64, error) { if templateDefault == 0 && templateMax != 0 || (templateMax > 0 && templateDefault > templateMax) { templateDefault = templateMax diff --git a/codersdk/workspaces.go b/codersdk/workspaces.go index 768ebc27c86ee..9eacad4ea4bbb 100644 --- a/codersdk/workspaces.go +++ b/codersdk/workspaces.go @@ -34,6 +34,7 @@ type Workspace struct { AutostartSchedule *string `json:"autostart_schedule,omitempty"` TTLMillis *int64 `json:"ttl_ms,omitempty"` LastUsedAt time.Time `json:"last_used_at" format:"date-time"` + ImpendingDeletion time.Time `json:"impending_deletion" format:"date-time"` } type WorkspacesRequest struct { diff --git a/site/src/api/typesGenerated.ts b/site/src/api/typesGenerated.ts index 8bc4b1e6aedc7..c55457e5e3d5d 100644 --- a/site/src/api/typesGenerated.ts +++ b/site/src/api/typesGenerated.ts @@ -1104,6 +1104,7 @@ export interface Workspace { readonly autostart_schedule?: string readonly ttl_ms?: number readonly last_used_at: string + readonly impending_deletion: string } // From codersdk/workspaceagents.go diff --git a/site/src/testHelpers/entities.ts b/site/src/testHelpers/entities.ts index 3405b6a0cfcb5..302f26bb26ee8 100644 --- a/site/src/testHelpers/entities.ts +++ b/site/src/testHelpers/entities.ts @@ -719,6 +719,7 @@ export const MockWorkspace: TypesGen.Workspace = { ttl_ms: 2 * 60 * 60 * 1000, latest_build: MockWorkspaceBuild, last_used_at: "2022-05-16T15:29:10.302441433Z", + impending_deletion: "0001-01-01T00:00:00Z", } export const MockStoppedWorkspace: TypesGen.Workspace = { From 67758e018b0a11a2a64560173275aa5004a718a7 Mon Sep 17 00:00:00 2001 From: Kira Pilot Date: Tue, 9 May 2023 22:22:41 +0000 Subject: [PATCH 2/5] gen docs --- coderd/apidoc/docs.go | 4 ++++ coderd/apidoc/swagger.json | 4 ++++ docs/api/schemas.md | 3 +++ docs/api/workspaces.md | 4 ++++ 4 files changed, 15 insertions(+) diff --git a/coderd/apidoc/docs.go b/coderd/apidoc/docs.go index ee9e6db267da3..105c39122adf6 100644 --- a/coderd/apidoc/docs.go +++ b/coderd/apidoc/docs.go @@ -9326,6 +9326,10 @@ const docTemplate = `{ "type": "string", "format": "uuid" }, + "impending_deletion": { + "type": "string", + "format": "date-time" + }, "last_used_at": { "type": "string", "format": "date-time" diff --git a/coderd/apidoc/swagger.json b/coderd/apidoc/swagger.json index 40801470b3a95..00d7076d30751 100644 --- a/coderd/apidoc/swagger.json +++ b/coderd/apidoc/swagger.json @@ -8389,6 +8389,10 @@ "type": "string", "format": "uuid" }, + "impending_deletion": { + "type": "string", + "format": "date-time" + }, "last_used_at": { "type": "string", "format": "date-time" diff --git a/docs/api/schemas.md b/docs/api/schemas.md index 6a82b9a1c98ec..9d58c922054eb 100644 --- a/docs/api/schemas.md +++ b/docs/api/schemas.md @@ -4573,6 +4573,7 @@ Parameter represents a set value for the scope. "autostart_schedule": "string", "created_at": "2019-08-24T14:15:22Z", "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", + "impending_deletion": "2019-08-24T14:15:22Z", "last_used_at": "2019-08-24T14:15:22Z", "latest_build": { "build_number": 0, @@ -4714,6 +4715,7 @@ Parameter represents a set value for the scope. | `autostart_schedule` | string | false | | | | `created_at` | string | false | | | | `id` | string | false | | | +| `impending_deletion` | string | false | | | | `last_used_at` | string | false | | | | `latest_build` | [codersdk.WorkspaceBuild](#codersdkworkspacebuild) | false | | | | `name` | string | false | | | @@ -5573,6 +5575,7 @@ Parameter represents a set value for the scope. "autostart_schedule": "string", "created_at": "2019-08-24T14:15:22Z", "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", + "impending_deletion": "2019-08-24T14:15:22Z", "last_used_at": "2019-08-24T14:15:22Z", "latest_build": { "build_number": 0, diff --git a/docs/api/workspaces.md b/docs/api/workspaces.md index ba896f5afc8f2..1e89e22458d41 100644 --- a/docs/api/workspaces.md +++ b/docs/api/workspaces.md @@ -57,6 +57,7 @@ curl -X POST http://coder-server:8080/api/v2/organizations/{organization}/member "autostart_schedule": "string", "created_at": "2019-08-24T14:15:22Z", "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", + "impending_deletion": "2019-08-24T14:15:22Z", "last_used_at": "2019-08-24T14:15:22Z", "latest_build": { "build_number": 0, @@ -229,6 +230,7 @@ curl -X GET http://coder-server:8080/api/v2/users/{user}/workspace/{workspacenam "autostart_schedule": "string", "created_at": "2019-08-24T14:15:22Z", "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", + "impending_deletion": "2019-08-24T14:15:22Z", "last_used_at": "2019-08-24T14:15:22Z", "latest_build": { "build_number": 0, @@ -424,6 +426,7 @@ curl -X GET http://coder-server:8080/api/v2/workspaces \ "autostart_schedule": "string", "created_at": "2019-08-24T14:15:22Z", "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", + "impending_deletion": "2019-08-24T14:15:22Z", "last_used_at": "2019-08-24T14:15:22Z", "latest_build": { "build_number": 0, @@ -593,6 +596,7 @@ curl -X GET http://coder-server:8080/api/v2/workspaces/{workspace} \ "autostart_schedule": "string", "created_at": "2019-08-24T14:15:22Z", "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", + "impending_deletion": "2019-08-24T14:15:22Z", "last_used_at": "2019-08-24T14:15:22Z", "latest_build": { "build_number": 0, From 5bfb489763f62a9dea90e42fe000cbffb2ec05b6 Mon Sep 17 00:00:00 2001 From: Kira Pilot Date: Tue, 9 May 2023 22:51:34 +0000 Subject: [PATCH 3/5] update golden files --- cli/testdata/coder_list_--output_json.golden | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cli/testdata/coder_list_--output_json.golden b/cli/testdata/coder_list_--output_json.golden index 6ea0ced1835ee..6ac9bda8f1093 100644 --- a/cli/testdata/coder_list_--output_json.golden +++ b/cli/testdata/coder_list_--output_json.golden @@ -48,6 +48,7 @@ "name": "test-workspace", "autostart_schedule": "CRON_TZ=US/Central 30 9 * * 1-5", "ttl_ms": 28800000, - "last_used_at": "[timestamp]" + "last_used_at": "[timestamp]", + "impending_deletion": "[timestamp]" } ] From 3886a4f4432c7f41068e850d4024a989c4b3e0ac Mon Sep 17 00:00:00 2001 From: Kira Pilot Date: Wed, 10 May 2023 19:09:56 +0000 Subject: [PATCH 4/5] added test --- .vscode/settings.json | 2 + coderd/workspaces_internal_test.go | 76 ++++++++++++++++++++++++++++++ 2 files changed, 78 insertions(+) create mode 100644 coderd/workspaces_internal_test.go diff --git a/.vscode/settings.json b/.vscode/settings.json index fd36a7aac52e7..8375c7848ab52 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -20,6 +20,8 @@ "codersdk", "cronstrue", "databasefake", + "dbfake", + "dbgen", "dbtype", "DERP", "derphttp", diff --git a/coderd/workspaces_internal_test.go b/coderd/workspaces_internal_test.go new file mode 100644 index 0000000000000..ebc6719edeb83 --- /dev/null +++ b/coderd/workspaces_internal_test.go @@ -0,0 +1,76 @@ +package coderd + +import ( + "testing" + "time" + + "github.com/stretchr/testify/require" + + "github.com/coder/coder/coderd/database" +) + +func Test_calculateImpendingDeletion(t *testing.T) { + t.Parallel() + + testCases := []struct { + name string + workspace database.Workspace + template database.Template + expected time.Time + }{ + { + name: "ImpendingDeletion", + workspace: database.Workspace{ + Deleted: false, + LastUsedAt: time.Now().Add(time.Duration(-10) * time.Hour * 24), // 10 days ago + }, + template: database.Template{ + InactivityTTL: int64(9 * 24 * time.Hour), // 9 days + }, + expected: time.Now().Add(time.Duration(-1) * time.Hour * 24), // yesterday + }, + { + name: "InactivityTTLUnset", + workspace: database.Workspace{ + Deleted: false, + LastUsedAt: time.Now().Add(time.Duration(-10) * time.Hour * 24), + }, + template: database.Template{ + InactivityTTL: 0, + }, + expected: time.Time{}, + }, + { + name: "DeletedWorkspace", + workspace: database.Workspace{ + Deleted: true, + LastUsedAt: time.Now().Add(time.Duration(-10) * time.Hour * 24), + }, + template: database.Template{ + InactivityTTL: int64(9 * 24 * time.Hour), + }, + expected: time.Time{}, + }, + { + name: "ActiveWorkspace", + workspace: database.Workspace{ + Deleted: true, + LastUsedAt: time.Now().Add(time.Duration(-5) * time.Hour), // 5 hours ago + }, + template: database.Template{ + InactivityTTL: int64(1 * 24 * time.Hour), // 1 day + }, + expected: time.Time{}, + }, + } + + for _, tc := range testCases { + tc := tc + t.Run(tc.name, func(t *testing.T) { + t.Parallel() + + found := calculateImpendingDeletion(tc.workspace, tc.template) + require.WithinDuration(t, tc.expected, found, time.Second, "incorrect impending deletion") + }) + } +} From 207bac5d5b9529764a5f50ca1a529e2cf73941d2 Mon Sep 17 00:00:00 2001 From: Kira Pilot Date: Wed, 10 May 2023 20:00:06 +0000 Subject: [PATCH 5/5] PR comments --- cli/testdata/coder_list_--output_json.golden | 2 +- coderd/apidoc/docs.go | 9 ++-- coderd/apidoc/swagger.json | 9 ++-- coderd/workspaces.go | 14 +++---- coderd/workspaces_internal_test.go | 24 +++++++---- codersdk/workspaces.go | 5 ++- docs/api/schemas.md | 44 ++++++++++---------- docs/api/workspaces.md | 8 ++-- site/src/api/typesGenerated.ts | 2 +- site/src/testHelpers/entities.ts | 2 +- 10 files changed, 65 insertions(+), 54 deletions(-) diff --git a/cli/testdata/coder_list_--output_json.golden b/cli/testdata/coder_list_--output_json.golden index 6ac9bda8f1093..acf929a70edbb 100644 --- a/cli/testdata/coder_list_--output_json.golden +++ b/cli/testdata/coder_list_--output_json.golden @@ -49,6 +49,6 @@ "autostart_schedule": "CRON_TZ=US/Central 30 9 * * 1-5", "ttl_ms": 28800000, "last_used_at": "[timestamp]", - "impending_deletion": "[timestamp]" + "deleting_at": null } ] diff --git a/coderd/apidoc/docs.go b/coderd/apidoc/docs.go index 105c39122adf6..d5621c48af114 100644 --- a/coderd/apidoc/docs.go +++ b/coderd/apidoc/docs.go @@ -9322,13 +9322,14 @@ const docTemplate = `{ "type": "string", "format": "date-time" }, - "id": { + "deleting_at": { + "description": "DeletingAt indicates the time of the upcoming workspace deletion, if applicable; otherwise it is nil.\nWorkspaces may have impending deletions if Template.InactivityTTL feature is turned on and the workspace is inactive.", "type": "string", - "format": "uuid" + "format": "date-time" }, - "impending_deletion": { + "id": { "type": "string", - "format": "date-time" + "format": "uuid" }, "last_used_at": { "type": "string", diff --git a/coderd/apidoc/swagger.json b/coderd/apidoc/swagger.json index 00d7076d30751..500d775b37393 100644 --- a/coderd/apidoc/swagger.json +++ b/coderd/apidoc/swagger.json @@ -8385,13 +8385,14 @@ "type": "string", "format": "date-time" }, - "id": { + "deleting_at": { + "description": "DeletingAt indicates the time of the upcoming workspace deletion, if applicable; otherwise it is nil.\nWorkspaces may have impending deletions if Template.InactivityTTL feature is turned on and the workspace is inactive.", "type": "string", - "format": "uuid" + "format": "date-time" }, - "impending_deletion": { + "id": { "type": "string", - "format": "date-time" + "format": "uuid" }, "last_used_at": { "type": "string", diff --git a/coderd/workspaces.go b/coderd/workspaces.go index 905d1ddf1c487..378063ed7ec66 100644 --- a/coderd/workspaces.go +++ b/coderd/workspaces.go @@ -1170,8 +1170,8 @@ func convertWorkspace( } var ( - ttlMillis = convertWorkspaceTTLMillis(workspace.Ttl) - impendingDeletion = calculateImpendingDeletion(workspace, template) + ttlMillis = convertWorkspaceTTLMillis(workspace.Ttl) + deletingAt = calculateDeletingAt(workspace, template) ) return codersdk.Workspace{ ID: workspace.ID, @@ -1191,7 +1191,7 @@ func convertWorkspace( AutostartSchedule: autostartSchedule, TTLMillis: ttlMillis, LastUsedAt: workspace.LastUsedAt, - ImpendingDeletion: impendingDeletion, + DeletingAt: deletingAt, } } @@ -1204,9 +1204,9 @@ func convertWorkspaceTTLMillis(i sql.NullInt64) *int64 { return &millis } -// Calculate the time of the upcoming working deletion, if applicable; otherwise, return an empty time.Time struct. +// Calculate the time of the upcoming workspace deletion, if applicable; otherwise, return nil. // Workspaces may have impending deletions if InactivityTTL feature is turned on and the workspace is inactive. -func calculateImpendingDeletion(workspace database.Workspace, template database.Template) time.Time { +func calculateDeletingAt(workspace database.Workspace, template database.Template) *time.Time { var ( year, month, day = time.Now().Date() beginningOfToday = time.Date(year, month, day, 0, 0, 0, 0, time.Now().Location()) @@ -1214,10 +1214,10 @@ func calculateImpendingDeletion(workspace database.Workspace, template database. // If InactivityTTL is turned off (set to 0), if the workspace has already been deleted, // or if the workspace was used sometime within the last day, there is no impending deletion if template.InactivityTTL == 0 || workspace.Deleted || workspace.LastUsedAt.After(beginningOfToday) { - return time.Time{} + return nil } - return workspace.LastUsedAt.Add(time.Duration(template.InactivityTTL) * time.Nanosecond) + return ptr.Ref(workspace.LastUsedAt.Add(time.Duration(template.InactivityTTL) * time.Nanosecond)) } func validWorkspaceTTLMillis(millis *int64, templateDefault, templateMax time.Duration) (sql.NullInt64, error) { diff --git a/coderd/workspaces_internal_test.go b/coderd/workspaces_internal_test.go index ebc6719edeb83..b62835b6903ba 100644 --- a/coderd/workspaces_internal_test.go +++ b/coderd/workspaces_internal_test.go @@ -7,19 +7,20 @@ import ( "github.com/stretchr/testify/require" "github.com/coder/coder/coderd/database" + "github.com/coder/coder/coderd/util/ptr" ) -func Test_calculateImpendingDeletion(t *testing.T) { +func Test_calculateDeletingAt(t *testing.T) { t.Parallel() testCases := []struct { name string workspace database.Workspace template database.Template - expected time.Time + expected *time.Time }{ { - name: "ImpendingDeletion", + name: "DeletingAt", workspace: database.Workspace{ Deleted: false, LastUsedAt: time.Now().Add(time.Duration(-10) * time.Hour * 24), // 10 days ago @@ -27,7 +28,7 @@ func Test_calculateImpendingDeletion(t *testing.T) { template: database.Template{ InactivityTTL: int64(9 * 24 * time.Hour), // 9 days }, - expected: time.Now().Add(time.Duration(-1) * time.Hour * 24), // yesterday + expected: ptr.Ref(time.Now().Add(time.Duration(-1) * time.Hour * 24)), // yesterday }, { name: "InactivityTTLUnset", @@ -38,7 +39,7 @@ func Test_calculateImpendingDeletion(t *testing.T) { template: database.Template{ InactivityTTL: 0, }, - expected: time.Time{}, + expected: nil, }, { name: "DeletedWorkspace", @@ -49,7 +50,7 @@ func Test_calculateImpendingDeletion(t *testing.T) { template: database.Template{ InactivityTTL: int64(9 * 24 * time.Hour), }, - expected: time.Time{}, + expected: nil, }, { name: "ActiveWorkspace", @@ -60,7 +61,7 @@ func Test_calculateImpendingDeletion(t *testing.T) { template: database.Template{ InactivityTTL: int64(1 * 24 * time.Hour), // 1 day }, - expected: time.Time{}, + expected: nil, }, } @@ -69,8 +70,13 @@ func Test_calculateImpendingDeletion(t *testing.T) { t.Run(tc.name, func(t *testing.T) { t.Parallel() - found := calculateImpendingDeletion(tc.workspace, tc.template) - require.WithinDuration(t, tc.expected, found, time.Second, "incorrect impending deletion") + found := calculateDeletingAt(tc.workspace, tc.template) + if tc.expected == nil { + require.Nil(t, found, "impending deletion should be nil") + } else { + require.NotNil(t, found) + require.WithinDuration(t, *tc.expected, *found, time.Second, "incorrect impending deletion") + } }) } } diff --git a/codersdk/workspaces.go b/codersdk/workspaces.go index 9eacad4ea4bbb..ed8203981f8c6 100644 --- a/codersdk/workspaces.go +++ b/codersdk/workspaces.go @@ -34,7 +34,10 @@ type Workspace struct { AutostartSchedule *string `json:"autostart_schedule,omitempty"` TTLMillis *int64 `json:"ttl_ms,omitempty"` LastUsedAt time.Time `json:"last_used_at" format:"date-time"` - ImpendingDeletion time.Time `json:"impending_deletion" format:"date-time"` + + // DeletingAt indicates the time of the upcoming workspace deletion, if applicable; otherwise it is nil. + // Workspaces may have impending deletions if Template.InactivityTTL feature is turned on and the workspace is inactive. + DeletingAt *time.Time `json:"deleting_at" format:"date-time"` } type WorkspacesRequest struct { diff --git a/docs/api/schemas.md b/docs/api/schemas.md index 9d58c922054eb..4335041fe1ee3 100644 --- a/docs/api/schemas.md +++ b/docs/api/schemas.md @@ -4572,8 +4572,8 @@ Parameter represents a set value for the scope. { "autostart_schedule": "string", "created_at": "2019-08-24T14:15:22Z", + "deleting_at": "2019-08-24T14:15:22Z", "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", - "impending_deletion": "2019-08-24T14:15:22Z", "last_used_at": "2019-08-24T14:15:22Z", "latest_build": { "build_number": 0, @@ -4710,26 +4710,26 @@ Parameter represents a set value for the scope. ### Properties -| Name | Type | Required | Restrictions | Description | -| ------------------------------------------- | -------------------------------------------------- | -------- | ------------ | ----------- | -| `autostart_schedule` | string | false | | | -| `created_at` | string | false | | | -| `id` | string | false | | | -| `impending_deletion` | string | false | | | -| `last_used_at` | string | false | | | -| `latest_build` | [codersdk.WorkspaceBuild](#codersdkworkspacebuild) | false | | | -| `name` | string | false | | | -| `organization_id` | string | false | | | -| `outdated` | boolean | false | | | -| `owner_id` | string | false | | | -| `owner_name` | string | false | | | -| `template_allow_user_cancel_workspace_jobs` | boolean | false | | | -| `template_display_name` | string | false | | | -| `template_icon` | string | false | | | -| `template_id` | string | false | | | -| `template_name` | string | false | | | -| `ttl_ms` | integer | false | | | -| `updated_at` | string | false | | | +| Name | Type | Required | Restrictions | Description | +| ------------------------------------------- | -------------------------------------------------- | -------- | ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `autostart_schedule` | string | false | | | +| `created_at` | string | false | | | +| `deleting_at` | string | false | | Deleting at indicates the time of the upcoming workspace deletion, if applicable; otherwise it is nil. Workspaces may have impending deletions if Template.InactivityTTL feature is turned on and the workspace is inactive. | +| `id` | string | false | | | +| `last_used_at` | string | false | | | +| `latest_build` | [codersdk.WorkspaceBuild](#codersdkworkspacebuild) | false | | | +| `name` | string | false | | | +| `organization_id` | string | false | | | +| `outdated` | boolean | false | | | +| `owner_id` | string | false | | | +| `owner_name` | string | false | | | +| `template_allow_user_cancel_workspace_jobs` | boolean | false | | | +| `template_display_name` | string | false | | | +| `template_icon` | string | false | | | +| `template_id` | string | false | | | +| `template_name` | string | false | | | +| `ttl_ms` | integer | false | | | +| `updated_at` | string | false | | | ## codersdk.WorkspaceAgent @@ -5574,8 +5574,8 @@ Parameter represents a set value for the scope. { "autostart_schedule": "string", "created_at": "2019-08-24T14:15:22Z", + "deleting_at": "2019-08-24T14:15:22Z", "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", - "impending_deletion": "2019-08-24T14:15:22Z", "last_used_at": "2019-08-24T14:15:22Z", "latest_build": { "build_number": 0, diff --git a/docs/api/workspaces.md b/docs/api/workspaces.md index 1e89e22458d41..fff7d2d640695 100644 --- a/docs/api/workspaces.md +++ b/docs/api/workspaces.md @@ -56,8 +56,8 @@ curl -X POST http://coder-server:8080/api/v2/organizations/{organization}/member { "autostart_schedule": "string", "created_at": "2019-08-24T14:15:22Z", + "deleting_at": "2019-08-24T14:15:22Z", "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", - "impending_deletion": "2019-08-24T14:15:22Z", "last_used_at": "2019-08-24T14:15:22Z", "latest_build": { "build_number": 0, @@ -229,8 +229,8 @@ curl -X GET http://coder-server:8080/api/v2/users/{user}/workspace/{workspacenam { "autostart_schedule": "string", "created_at": "2019-08-24T14:15:22Z", + "deleting_at": "2019-08-24T14:15:22Z", "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", - "impending_deletion": "2019-08-24T14:15:22Z", "last_used_at": "2019-08-24T14:15:22Z", "latest_build": { "build_number": 0, @@ -425,8 +425,8 @@ curl -X GET http://coder-server:8080/api/v2/workspaces \ { "autostart_schedule": "string", "created_at": "2019-08-24T14:15:22Z", + "deleting_at": "2019-08-24T14:15:22Z", "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", - "impending_deletion": "2019-08-24T14:15:22Z", "last_used_at": "2019-08-24T14:15:22Z", "latest_build": { "build_number": 0, @@ -595,8 +595,8 @@ curl -X GET http://coder-server:8080/api/v2/workspaces/{workspace} \ { "autostart_schedule": "string", "created_at": "2019-08-24T14:15:22Z", + "deleting_at": "2019-08-24T14:15:22Z", "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", - "impending_deletion": "2019-08-24T14:15:22Z", "last_used_at": "2019-08-24T14:15:22Z", "latest_build": { "build_number": 0, diff --git a/site/src/api/typesGenerated.ts b/site/src/api/typesGenerated.ts index c55457e5e3d5d..3793f87faffde 100644 --- a/site/src/api/typesGenerated.ts +++ b/site/src/api/typesGenerated.ts @@ -1104,7 +1104,7 @@ export interface Workspace { readonly autostart_schedule?: string readonly ttl_ms?: number readonly last_used_at: string - readonly impending_deletion: string + readonly deleting_at?: string } // From codersdk/workspaceagents.go diff --git a/site/src/testHelpers/entities.ts b/site/src/testHelpers/entities.ts index 302f26bb26ee8..0315a9bcdca11 100644 --- a/site/src/testHelpers/entities.ts +++ b/site/src/testHelpers/entities.ts @@ -719,7 +719,7 @@ export const MockWorkspace: TypesGen.Workspace = { ttl_ms: 2 * 60 * 60 * 1000, latest_build: MockWorkspaceBuild, last_used_at: "2022-05-16T15:29:10.302441433Z", - impending_deletion: "0001-01-01T00:00:00Z", + deleting_at: "0001-01-01T00:00:00Z", } export const MockStoppedWorkspace: TypesGen.Workspace = { pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy