-
Notifications
You must be signed in to change notification settings - Fork 890
docs: API workspace agents and builds #5538
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
a3fbe72
fbe1d70
96daf47
663ec87
fc00d7e
67a85b9
ce8c7ea
d2a9af5
f37c6b3
596cdbd
eb4ba48
e314c24
97cd7ac
ae06598
a88968c
4519636
6bb31ce
fb2e7c3
d38b26c
20dcb3a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,15 +35,15 @@ const ( | |
) | ||
|
||
type WorkspaceAgent struct { | ||
ID uuid.UUID `json:"id"` | ||
CreatedAt time.Time `json:"created_at"` | ||
UpdatedAt time.Time `json:"updated_at"` | ||
FirstConnectedAt *time.Time `json:"first_connected_at,omitempty"` | ||
LastConnectedAt *time.Time `json:"last_connected_at,omitempty"` | ||
DisconnectedAt *time.Time `json:"disconnected_at,omitempty"` | ||
Status WorkspaceAgentStatus `json:"status"` | ||
ID uuid.UUID `json:"id" format:"uuid"` | ||
CreatedAt time.Time `json:"created_at" format:"date-time"` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perhaps I've asked before, but is there a way to automatically transform these based on the Go type? It seems unfortunate we'd have to tag every new struct, and we will almost certainly miss to add the tag to fields in the future. It'd be nice if There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm afraid that we would need a fork to apply this feature, let's say, I'm not sure why it hasn't been implemented this way. Even official examples suggest using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can certainly understand why it's not the default (due to middlewares and handlers that can do whatever). But it'd be nice to enable such a feature. Do you think they'd be open to it if we made a PR? Seems like many people could benefit. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. At the moment, we're using version - "value": 0
+ "value": -9223372036854776000 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, if There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let me prepare a draft PR and we can discuss the upgrade there. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
UpdatedAt time.Time `json:"updated_at" format:"date-time"` | ||
FirstConnectedAt *time.Time `json:"first_connected_at,omitempty" format:"date-time"` | ||
LastConnectedAt *time.Time `json:"last_connected_at,omitempty" format:"date-time"` | ||
DisconnectedAt *time.Time `json:"disconnected_at,omitempty" format:"date-time"` | ||
Status WorkspaceAgentStatus `json:"status" enums:"connecting,connected,disconnected,timeout"` | ||
Name string `json:"name"` | ||
ResourceID uuid.UUID `json:"resource_id"` | ||
ResourceID uuid.UUID `json:"resource_id" format:"uuid"` | ||
InstanceID string `json:"instance_id,omitempty"` | ||
Architecture string `json:"architecture"` | ||
EnvironmentVariables map[string]string `json:"environment_variables"` | ||
|
@@ -115,6 +115,7 @@ type WorkspaceAgentConnectionInfo struct { | |
} | ||
|
||
// @typescript-ignore PostWorkspaceAgentVersionRequest | ||
// @Description x-apidocgen:skip | ||
type PostWorkspaceAgentVersionRequest struct { | ||
Version string `json:"version"` | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -65,13 +65,15 @@ type WorkspaceBuild struct { | |
InitiatorID uuid.UUID `json:"initiator_id" format:"uuid"` | ||
InitiatorUsername string `json:"initiator_name"` | ||
Job ProvisionerJob `json:"job"` | ||
Reason BuildReason `db:"reason" json:"reason"` | ||
Reason BuildReason `db:"reason" json:"reason" enums:"initiator,autostart,autostop"` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice work! Once we get the docs in shape, it'd be nice to try to process the Go code to find these enums automatically. Btw, would it be possible to move this enum description to the type? Like: // BuildReason ...
// @enum initiator,autostart,autostop
type BuildReason string Perhaps not supported by swaggo. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There are some magic undocumented extensions like See swaggo/swag#984 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Indeed, that seems useful with enums that are number based and have string representations in (de-)serialization. |
||
Resources []WorkspaceResource `json:"resources"` | ||
Deadline NullTime `json:"deadline,omitempty" format:"date-time"` | ||
Status WorkspaceStatus `json:"status" enums:"pending,starting,running,stopping,stopped,failed,canceling,canceled,deleting,deleted"` | ||
DailyCost int32 `json:"daily_cost"` | ||
} | ||
|
||
// WorkspaceResource describes resources used to create a workspace, for instance: | ||
// containers, images, volumes. | ||
type WorkspaceResource struct { | ||
ID uuid.UUID `json:"id" format:"uuid"` | ||
CreatedAt time.Time `json:"created_at" format:"date-time"` | ||
|
@@ -86,6 +88,7 @@ type WorkspaceResource struct { | |
DailyCost int32 `json:"daily_cost"` | ||
} | ||
|
||
// WorkspaceResourceMetadata annotates the workspace resource with custom key-value pairs. | ||
type WorkspaceResourceMetadata struct { | ||
Key string `json:"key"` | ||
Value string `json:"value"` | ||
|
Uh oh!
There was an error while loading. Please reload this page.