mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
feat: add template builder deployment config and telemetry types (#25082)
This commit is contained in:
Generated
+14
@@ -17820,6 +17820,9 @@ const docTemplate = `{
|
||||
"telemetry": {
|
||||
"$ref": "#/definitions/codersdk.TelemetryConfig"
|
||||
},
|
||||
"template_builder": {
|
||||
"$ref": "#/definitions/codersdk.TemplateBuilderConfig"
|
||||
},
|
||||
"terms_of_service_url": {
|
||||
"type": "string"
|
||||
},
|
||||
@@ -22480,6 +22483,17 @@ const docTemplate = `{
|
||||
"$ref": "#/definitions/codersdk.TransitionStats"
|
||||
}
|
||||
},
|
||||
"codersdk.TemplateBuilderConfig": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"disabled": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"registry_url": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"codersdk.TemplateExample": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
||||
Generated
+14
@@ -16179,6 +16179,9 @@
|
||||
"telemetry": {
|
||||
"$ref": "#/definitions/codersdk.TelemetryConfig"
|
||||
},
|
||||
"template_builder": {
|
||||
"$ref": "#/definitions/codersdk.TemplateBuilderConfig"
|
||||
},
|
||||
"terms_of_service_url": {
|
||||
"type": "string"
|
||||
},
|
||||
@@ -20668,6 +20671,17 @@
|
||||
"$ref": "#/definitions/codersdk.TransitionStats"
|
||||
}
|
||||
},
|
||||
"codersdk.TemplateBuilderConfig": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"disabled": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"registry_url": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"codersdk.TemplateExample": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
||||
@@ -1541,6 +1541,16 @@ func New(options *Options) *API {
|
||||
})
|
||||
})
|
||||
})
|
||||
if !api.DeploymentValues.TemplateBuilder.Disabled.Value() {
|
||||
r.Route("/templatebuilder", func(r chi.Router) {
|
||||
r.Use(
|
||||
apiKeyMiddleware,
|
||||
)
|
||||
// Endpoints added by DEVEX-275 (bases), DEVEX-276
|
||||
// (modules), DEVEX-277/279 (compose).
|
||||
})
|
||||
}
|
||||
|
||||
r.Route("/users", func(r chi.Router) {
|
||||
r.Get("/first", api.firstUser)
|
||||
r.Post("/first", api.postFirstUser)
|
||||
|
||||
@@ -1610,6 +1610,7 @@ type Snapshot struct {
|
||||
ChatModelConfigs []ChatModelConfig `json:"chat_model_configs"`
|
||||
ChatDiffStatusSummary *ChatDiffStatusSummary `json:"chat_diff_status_summary"`
|
||||
UserSecretsSummary *UserSecretsSummary `json:"user_secrets_summary"`
|
||||
TemplateBuilderSessions []TemplateBuilderSession `json:"template_builder_sessions"`
|
||||
}
|
||||
|
||||
// Deployment contains information about the host running Coder.
|
||||
@@ -2497,6 +2498,21 @@ type UserSecretsSummary struct {
|
||||
SecretsPerUserP90 int64 `json:"secrets_per_user_p90"`
|
||||
}
|
||||
|
||||
// TemplateBuilderSession tracks a single event in the template builder
|
||||
// wizard. Two events are emitted per session: one on wizard entry and
|
||||
// one on compose completion. User-supplied variable values are never
|
||||
// included.
|
||||
type TemplateBuilderSession struct {
|
||||
ID uuid.UUID `json:"id"`
|
||||
EventType string `json:"event_type"`
|
||||
UserID uuid.UUID `json:"user_id"`
|
||||
BaseTemplateID string `json:"base_template_id,omitempty"`
|
||||
ModuleIDs []string `json:"module_ids,omitempty"`
|
||||
DurationSeconds float64 `json:"duration_seconds,omitempty"`
|
||||
Success bool `json:"success,omitempty"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
}
|
||||
|
||||
func ConvertAIBridgeInterceptionsSummary(endTime time.Time, provider, model, client string, summary database.CalculateAIBridgeInterceptionsTelemetrySummaryRow) AIBridgeInterceptionsSummary {
|
||||
return AIBridgeInterceptionsSummary{
|
||||
ID: uuid.New(),
|
||||
|
||||
Reference in New Issue
Block a user