mirror of
https://github.com/coder/coder.git
synced 2025-07-12 00:14:10 +00:00
* feat: Add project models * Add project query functions * Add organization parameter query * Add project URL parameter parse * Add project create and list endpoints * Add test for organization provided * Remove unimplemented routes * Decrease conn timeout * Add test for UnbiasedModulo32 * Fix expected value * Add single user endpoint * Add query for project versions * Fix linting errors * Add comments * Add test for invalid archive * Check unauthenticated endpoints * Add check if no change happened * Ensure context close ends listener * Fix parallel test run * Test empty * Fix organization param comment
215 lines
8.2 KiB
Go
215 lines
8.2 KiB
Go
// Code generated by sqlc. DO NOT EDIT.
|
|
|
|
package database
|
|
|
|
import (
|
|
"database/sql"
|
|
"encoding/json"
|
|
"fmt"
|
|
"time"
|
|
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
type LoginType string
|
|
|
|
const (
|
|
LoginTypeBuiltIn LoginType = "built-in"
|
|
LoginTypeSaml LoginType = "saml"
|
|
LoginTypeOIDC LoginType = "oidc"
|
|
)
|
|
|
|
func (e *LoginType) Scan(src interface{}) error {
|
|
switch s := src.(type) {
|
|
case []byte:
|
|
*e = LoginType(s)
|
|
case string:
|
|
*e = LoginType(s)
|
|
default:
|
|
return fmt.Errorf("unsupported scan type for LoginType: %T", src)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
type ParameterTypeSystem string
|
|
|
|
const (
|
|
ParameterTypeSystemHCL ParameterTypeSystem = "hcl"
|
|
)
|
|
|
|
func (e *ParameterTypeSystem) Scan(src interface{}) error {
|
|
switch s := src.(type) {
|
|
case []byte:
|
|
*e = ParameterTypeSystem(s)
|
|
case string:
|
|
*e = ParameterTypeSystem(s)
|
|
default:
|
|
return fmt.Errorf("unsupported scan type for ParameterTypeSystem: %T", src)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
type ProjectStorageMethod string
|
|
|
|
const (
|
|
ProjectStorageMethodInlineArchive ProjectStorageMethod = "inline-archive"
|
|
)
|
|
|
|
func (e *ProjectStorageMethod) Scan(src interface{}) error {
|
|
switch s := src.(type) {
|
|
case []byte:
|
|
*e = ProjectStorageMethod(s)
|
|
case string:
|
|
*e = ProjectStorageMethod(s)
|
|
default:
|
|
return fmt.Errorf("unsupported scan type for ProjectStorageMethod: %T", src)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
type ProvisionerType string
|
|
|
|
const (
|
|
ProvisionerTypeTerraform ProvisionerType = "terraform"
|
|
ProvisionerTypeCdrBasic ProvisionerType = "cdr-basic"
|
|
)
|
|
|
|
func (e *ProvisionerType) Scan(src interface{}) error {
|
|
switch s := src.(type) {
|
|
case []byte:
|
|
*e = ProvisionerType(s)
|
|
case string:
|
|
*e = ProvisionerType(s)
|
|
default:
|
|
return fmt.Errorf("unsupported scan type for ProvisionerType: %T", src)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
type UserStatus string
|
|
|
|
const (
|
|
UserstatusActive UserStatus = "active"
|
|
UserstatusDormant UserStatus = "dormant"
|
|
UserstatusDecommissioned UserStatus = "decommissioned"
|
|
)
|
|
|
|
func (e *UserStatus) Scan(src interface{}) error {
|
|
switch s := src.(type) {
|
|
case []byte:
|
|
*e = UserStatus(s)
|
|
case string:
|
|
*e = UserStatus(s)
|
|
default:
|
|
return fmt.Errorf("unsupported scan type for UserStatus: %T", src)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
type APIKey struct {
|
|
ID string `db:"id" json:"id"`
|
|
HashedSecret []byte `db:"hashed_secret" json:"hashed_secret"`
|
|
UserID string `db:"user_id" json:"user_id"`
|
|
Application bool `db:"application" json:"application"`
|
|
Name string `db:"name" json:"name"`
|
|
LastUsed time.Time `db:"last_used" json:"last_used"`
|
|
ExpiresAt time.Time `db:"expires_at" json:"expires_at"`
|
|
CreatedAt time.Time `db:"created_at" json:"created_at"`
|
|
UpdatedAt time.Time `db:"updated_at" json:"updated_at"`
|
|
LoginType LoginType `db:"login_type" json:"login_type"`
|
|
OIDCAccessToken string `db:"oidc_access_token" json:"oidc_access_token"`
|
|
OIDCRefreshToken string `db:"oidc_refresh_token" json:"oidc_refresh_token"`
|
|
OIDCIDToken string `db:"oidc_id_token" json:"oidc_id_token"`
|
|
OIDCExpiry time.Time `db:"oidc_expiry" json:"oidc_expiry"`
|
|
DevurlToken bool `db:"devurl_token" json:"devurl_token"`
|
|
}
|
|
|
|
type License struct {
|
|
ID int32 `db:"id" json:"id"`
|
|
License json.RawMessage `db:"license" json:"license"`
|
|
CreatedAt time.Time `db:"created_at" json:"created_at"`
|
|
}
|
|
|
|
type Organization struct {
|
|
ID string `db:"id" json:"id"`
|
|
Name string `db:"name" json:"name"`
|
|
Description string `db:"description" json:"description"`
|
|
CreatedAt time.Time `db:"created_at" json:"created_at"`
|
|
UpdatedAt time.Time `db:"updated_at" json:"updated_at"`
|
|
Default bool `db:"default" json:"default"`
|
|
AutoOffThreshold int64 `db:"auto_off_threshold" json:"auto_off_threshold"`
|
|
CpuProvisioningRate float32 `db:"cpu_provisioning_rate" json:"cpu_provisioning_rate"`
|
|
MemoryProvisioningRate float32 `db:"memory_provisioning_rate" json:"memory_provisioning_rate"`
|
|
WorkspaceAutoOff bool `db:"workspace_auto_off" json:"workspace_auto_off"`
|
|
}
|
|
|
|
type OrganizationMember struct {
|
|
OrganizationID string `db:"organization_id" json:"organization_id"`
|
|
UserID string `db:"user_id" json:"user_id"`
|
|
CreatedAt time.Time `db:"created_at" json:"created_at"`
|
|
UpdatedAt time.Time `db:"updated_at" json:"updated_at"`
|
|
Roles []string `db:"roles" json:"roles"`
|
|
}
|
|
|
|
type Project struct {
|
|
ID uuid.UUID `db:"id" json:"id"`
|
|
CreatedAt time.Time `db:"created_at" json:"created_at"`
|
|
UpdatedAt time.Time `db:"updated_at" json:"updated_at"`
|
|
OrganizationID string `db:"organization_id" json:"organization_id"`
|
|
Name string `db:"name" json:"name"`
|
|
Provisioner ProvisionerType `db:"provisioner" json:"provisioner"`
|
|
ActiveVersionID uuid.NullUUID `db:"active_version_id" json:"active_version_id"`
|
|
}
|
|
|
|
type ProjectHistory struct {
|
|
ID uuid.UUID `db:"id" json:"id"`
|
|
ProjectID uuid.UUID `db:"project_id" json:"project_id"`
|
|
CreatedAt time.Time `db:"created_at" json:"created_at"`
|
|
UpdatedAt time.Time `db:"updated_at" json:"updated_at"`
|
|
Name string `db:"name" json:"name"`
|
|
Description string `db:"description" json:"description"`
|
|
StorageMethod ProjectStorageMethod `db:"storage_method" json:"storage_method"`
|
|
StorageSource []byte `db:"storage_source" json:"storage_source"`
|
|
ImportJobID uuid.UUID `db:"import_job_id" json:"import_job_id"`
|
|
}
|
|
|
|
type ProjectParameter struct {
|
|
ID uuid.UUID `db:"id" json:"id"`
|
|
CreatedAt time.Time `db:"created_at" json:"created_at"`
|
|
ProjectHistoryID uuid.UUID `db:"project_history_id" json:"project_history_id"`
|
|
Name string `db:"name" json:"name"`
|
|
Description string `db:"description" json:"description"`
|
|
DefaultSource sql.NullString `db:"default_source" json:"default_source"`
|
|
AllowOverrideSource bool `db:"allow_override_source" json:"allow_override_source"`
|
|
DefaultDestination sql.NullString `db:"default_destination" json:"default_destination"`
|
|
AllowOverrideDestination bool `db:"allow_override_destination" json:"allow_override_destination"`
|
|
DefaultRefresh string `db:"default_refresh" json:"default_refresh"`
|
|
RedisplayValue bool `db:"redisplay_value" json:"redisplay_value"`
|
|
ValidationError string `db:"validation_error" json:"validation_error"`
|
|
ValidationCondition string `db:"validation_condition" json:"validation_condition"`
|
|
ValidationTypeSystem ParameterTypeSystem `db:"validation_type_system" json:"validation_type_system"`
|
|
ValidationValueType string `db:"validation_value_type" json:"validation_value_type"`
|
|
}
|
|
|
|
type User struct {
|
|
ID string `db:"id" json:"id"`
|
|
Email string `db:"email" json:"email"`
|
|
Name string `db:"name" json:"name"`
|
|
Revoked bool `db:"revoked" json:"revoked"`
|
|
LoginType LoginType `db:"login_type" json:"login_type"`
|
|
HashedPassword []byte `db:"hashed_password" json:"hashed_password"`
|
|
CreatedAt time.Time `db:"created_at" json:"created_at"`
|
|
UpdatedAt time.Time `db:"updated_at" json:"updated_at"`
|
|
TemporaryPassword bool `db:"temporary_password" json:"temporary_password"`
|
|
AvatarHash string `db:"avatar_hash" json:"avatar_hash"`
|
|
SshKeyRegeneratedAt time.Time `db:"ssh_key_regenerated_at" json:"ssh_key_regenerated_at"`
|
|
Username string `db:"username" json:"username"`
|
|
DotfilesGitUri string `db:"dotfiles_git_uri" json:"dotfiles_git_uri"`
|
|
Roles []string `db:"roles" json:"roles"`
|
|
Status UserStatus `db:"status" json:"status"`
|
|
Relatime time.Time `db:"relatime" json:"relatime"`
|
|
GpgKeyRegeneratedAt time.Time `db:"gpg_key_regenerated_at" json:"gpg_key_regenerated_at"`
|
|
Decomissioned bool `db:"_decomissioned" json:"_decomissioned"`
|
|
Shell string `db:"shell" json:"shell"`
|
|
}
|