mirror of
https://github.com/coder/coder.git
synced 2025-07-12 00:14:10 +00:00
chore: refactor time.Duration -> int64 milliseconds for FE consumption (#1944)
* Changes all public-facing codersdk types to use a plain int64 (milliseconds) instead of time.Duration. * Makes autostart_schedule a *string as it may not be present. * Adds a utils/ptr package with some useful methods.
This commit is contained in:
@ -65,10 +65,10 @@ type CreateTemplateRequest struct {
|
||||
|
||||
// CreateWorkspaceRequest provides options for creating a new workspace.
|
||||
type CreateWorkspaceRequest struct {
|
||||
TemplateID uuid.UUID `json:"template_id" validate:"required"`
|
||||
Name string `json:"name" validate:"username,required"`
|
||||
AutostartSchedule *string `json:"autostart_schedule"`
|
||||
TTL *time.Duration `json:"ttl"`
|
||||
TemplateID uuid.UUID `json:"template_id" validate:"required"`
|
||||
Name string `json:"name" validate:"username,required"`
|
||||
AutostartSchedule *string `json:"autostart_schedule"`
|
||||
TTLMillis *int64 `json:"ttl_ms,omitempty"`
|
||||
// ParameterValues allows for additional parameters to be provided
|
||||
// during the initial provision.
|
||||
ParameterValues []CreateParameterRequest `json:"parameter_values,omitempty"`
|
||||
|
@ -26,8 +26,8 @@ type Workspace struct {
|
||||
LatestBuild WorkspaceBuild `json:"latest_build"`
|
||||
Outdated bool `json:"outdated"`
|
||||
Name string `json:"name"`
|
||||
AutostartSchedule string `json:"autostart_schedule"`
|
||||
TTL *time.Duration `json:"ttl"`
|
||||
AutostartSchedule *string `json:"autostart_schedule,omitempty"`
|
||||
TTLMillis *int64 `json:"ttl_ms,omitempty"`
|
||||
}
|
||||
|
||||
// CreateWorkspaceBuildRequest provides options to update the latest workspace build.
|
||||
@ -139,7 +139,7 @@ func (c *Client) WatchWorkspace(ctx context.Context, id uuid.UUID) (<-chan Works
|
||||
|
||||
// UpdateWorkspaceAutostartRequest is a request to update a workspace's autostart schedule.
|
||||
type UpdateWorkspaceAutostartRequest struct {
|
||||
Schedule string `json:"schedule"`
|
||||
Schedule *string `json:"schedule"`
|
||||
}
|
||||
|
||||
// UpdateWorkspaceAutostart sets the autostart schedule for workspace by id.
|
||||
@ -159,7 +159,7 @@ func (c *Client) UpdateWorkspaceAutostart(ctx context.Context, id uuid.UUID, req
|
||||
|
||||
// UpdateWorkspaceTTLRequest is a request to update a workspace's TTL.
|
||||
type UpdateWorkspaceTTLRequest struct {
|
||||
TTL *time.Duration `json:"ttl"`
|
||||
TTLMillis *int64 `json:"ttl_ms"`
|
||||
}
|
||||
|
||||
// UpdateWorkspaceTTL sets the ttl for workspace by id.
|
||||
|
Reference in New Issue
Block a user