From ff10755be8ee141c83b1faae3e47dad3ba00dc07 Mon Sep 17 00:00:00 2001 From: Cian Johnston Date: Mon, 11 Mar 2024 22:20:07 +0000 Subject: [PATCH] chore(codersdk): explain format of codersdk.UpdateWorkspaceAutostartRequest.Schedule --- coderd/apidoc/docs.go | 1 + coderd/apidoc/swagger.json | 1 + codersdk/workspaces.go | 3 +++ docs/api/schemas.md | 6 +++--- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/coderd/apidoc/docs.go b/coderd/apidoc/docs.go index 79e24f32d0af4..1ed25f09fc696 100644 --- a/coderd/apidoc/docs.go +++ b/coderd/apidoc/docs.go @@ -12573,6 +12573,7 @@ const docTemplate = `{ "type": "object", "properties": { "schedule": { + "description": "Schedule is expected to be of the form ` + "`" + `CRON_TZ=\u003cIANA Timezone\u003e \u003cmin\u003e \u003chour\u003e * * \u003cdow\u003e` + "`" + `\nExample: ` + "`" + `CRON_TZ=US/Central 30 9 * * 1-5` + "`" + ` represents 0930 in the timezone US/Central\non weekdays (Mon-Fri). ` + "`" + `CRON_TZ` + "`" + ` defaults to UTC if not present.", "type": "string" } } diff --git a/coderd/apidoc/swagger.json b/coderd/apidoc/swagger.json index 20934d817be49..fce1864aa8291 100644 --- a/coderd/apidoc/swagger.json +++ b/coderd/apidoc/swagger.json @@ -11396,6 +11396,7 @@ "type": "object", "properties": { "schedule": { + "description": "Schedule is expected to be of the form `CRON_TZ=\u003cIANA Timezone\u003e \u003cmin\u003e \u003chour\u003e * * \u003cdow\u003e`\nExample: `CRON_TZ=US/Central 30 9 * * 1-5` represents 0930 in the timezone US/Central\non weekdays (Mon-Fri). `CRON_TZ` defaults to UTC if not present.", "type": "string" } } diff --git a/codersdk/workspaces.go b/codersdk/workspaces.go index d5008b3234fa9..ecdc99d7775d0 100644 --- a/codersdk/workspaces.go +++ b/codersdk/workspaces.go @@ -253,6 +253,9 @@ func (c *Client) UpdateWorkspace(ctx context.Context, id uuid.UUID, req UpdateWo // UpdateWorkspaceAutostartRequest is a request to update a workspace's autostart schedule. type UpdateWorkspaceAutostartRequest struct { + // Schedule is expected to be of the form `CRON_TZ= * * ` + // Example: `CRON_TZ=US/Central 30 9 * * 1-5` represents 0930 in the timezone US/Central + // on weekdays (Mon-Fri). `CRON_TZ` defaults to UTC if not present. Schedule *string `json:"schedule"` } diff --git a/docs/api/schemas.md b/docs/api/schemas.md index 8dbc25d3713b4..890cd0fd859eb 100644 --- a/docs/api/schemas.md +++ b/docs/api/schemas.md @@ -6547,9 +6547,9 @@ If the schedule is empty, the user will be updated to use the default schedule.| ### Properties -| Name | Type | Required | Restrictions | Description | -| ---------- | ------ | -------- | ------------ | ----------- | -| `schedule` | string | false | | | +| Name | Type | Required | Restrictions | Description | +| ---------- | ------ | -------- | ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `schedule` | string | false | | Schedule is expected to be of the form `CRON_TZ= * * ` Example: `CRON_TZ=US/Central 30 9 * * 1-5` represents 0930 in the timezone US/Central on weekdays (Mon-Fri). `CRON_TZ` defaults to UTC if not present. | ## codersdk.UpdateWorkspaceDormancy