@coder/backstage-plugin-coder
Version:
Create and manage Coder workspaces from Backstage
1,488 lines (1,487 loc) • 108 kB
TypeScript
/// <reference types="react" />
import * as react from 'react';
import react__default, { PropsWithChildren, ComponentProps, HTMLAttributes, ReactNode } from 'react';
import { QueryClient, UseQueryResult, QueryKey, UseQueryOptions, QueryFunctionContext } from '@tanstack/react-query';
import * as valibot from 'valibot';
import { Output } from 'valibot';
import * as _material_ui_core from '@material-ui/core';
import * as _backstage_core_plugin_api from '@backstage/core-plugin-api';
import { AxiosInstance } from 'axios';
import dayjs from 'dayjs';
interface ACLAvailable {
readonly users: readonly ReducedUser[];
readonly groups: readonly Group[];
}
interface APIKey {
readonly id: string;
readonly user_id: string;
readonly last_used: string;
readonly expires_at: string;
readonly created_at: string;
readonly updated_at: string;
readonly login_type: LoginType;
readonly scope: APIKeyScope;
readonly token_name: string;
readonly lifetime_seconds: number;
}
interface APIKeyWithOwner extends APIKey {
readonly username: string;
}
interface AddLicenseRequest {
readonly license: string;
}
interface AgentStatsReportResponse {
readonly num_comms: number;
readonly rx_bytes: number;
readonly tx_bytes: number;
}
interface AppHostResponse {
readonly host: string;
}
interface AppearanceConfig {
readonly application_name: string;
readonly logo_url: string;
readonly service_banner: BannerConfig;
readonly notification_banners: readonly BannerConfig[];
readonly support_links?: readonly LinkConfig[];
}
interface ArchiveTemplateVersionsRequest {
readonly all: boolean;
}
interface ArchiveTemplateVersionsResponse {
readonly template_id: string;
readonly archived_ids: readonly string[];
}
interface AssignableRoles extends Role {
readonly assignable: boolean;
readonly built_in: boolean;
}
type AuditDiff = Record<string, AuditDiffField>;
interface AuditDiffField {
readonly old?: any;
readonly new?: any;
readonly secret: boolean;
}
interface AuditLog {
readonly id: string;
readonly request_id: string;
readonly time: string;
readonly organization_id: string;
readonly ip: any;
readonly user_agent: string;
readonly resource_type: ResourceType;
readonly resource_id: string;
readonly resource_target: string;
readonly resource_icon: string;
readonly action: AuditAction;
readonly diff: AuditDiff;
readonly status_code: number;
readonly additional_fields: Record<string, string>;
readonly description: string;
readonly resource_link: string;
readonly is_deleted: boolean;
readonly user?: User;
}
interface AuditLogResponse {
readonly audit_logs: readonly AuditLog[];
readonly count: number;
}
interface AuditLogsRequest extends Pagination {
readonly q?: string;
}
interface AuthMethod {
readonly enabled: boolean;
}
interface AuthMethods {
readonly terms_of_service_url?: string;
readonly password: AuthMethod;
readonly github: AuthMethod;
readonly oidc: OIDCAuthMethod;
}
interface AuthorizationCheck {
readonly object: AuthorizationObject;
readonly action: RBACAction;
}
interface AuthorizationObject {
readonly resource_type: RBACResource;
readonly owner_id?: string;
readonly organization_id?: string;
readonly resource_id?: string;
}
interface AuthorizationRequest {
readonly checks: Record<string, AuthorizationCheck>;
}
type AuthorizationResponse = Record<string, boolean>;
interface AvailableExperiments {
readonly safe: readonly Experiment[];
}
interface BannerConfig {
readonly enabled: boolean;
readonly message?: string;
readonly background_color?: string;
}
interface BuildInfoResponse {
readonly external_url: string;
readonly version: string;
readonly dashboard_url: string;
readonly workspace_proxy: boolean;
readonly agent_api_version: string;
readonly upgrade_message: string;
readonly deployment_id: string;
}
interface ConnectionLatency {
readonly p50: number;
readonly p95: number;
}
interface ConvertLoginRequest {
readonly to_type: LoginType;
readonly password: string;
}
interface CreateFirstUserRequest {
readonly email: string;
readonly username: string;
readonly password: string;
readonly trial: boolean;
readonly trial_info: CreateFirstUserTrialInfo;
}
interface CreateFirstUserResponse {
readonly user_id: string;
readonly organization_id: string;
}
interface CreateFirstUserTrialInfo {
readonly first_name: string;
readonly last_name: string;
readonly phone_number: string;
readonly job_title: string;
readonly company_name: string;
readonly country: string;
readonly developers: string;
}
interface CreateGroupRequest {
readonly name: string;
readonly display_name: string;
readonly avatar_url: string;
readonly quota_allowance: number;
}
interface CreateOrganizationRequest {
readonly name: string;
}
interface CreateTemplateRequest {
readonly name: string;
readonly display_name?: string;
readonly description?: string;
readonly icon?: string;
readonly template_version_id: string;
readonly default_ttl_ms?: number;
readonly activity_bump_ms?: number;
readonly autostop_requirement?: TemplateAutostopRequirement;
readonly autostart_requirement?: TemplateAutostartRequirement;
readonly allow_user_cancel_workspace_jobs?: boolean;
readonly allow_user_autostart?: boolean;
readonly allow_user_autostop?: boolean;
readonly failure_ttl_ms?: number;
readonly dormant_ttl_ms?: number;
readonly delete_ttl_ms?: number;
readonly disable_everyone_group_access: boolean;
readonly require_active_version: boolean;
}
interface CreateTemplateVersionDryRunRequest {
readonly workspace_name: string;
readonly rich_parameter_values: readonly WorkspaceBuildParameter[];
readonly user_variable_values?: readonly VariableValue[];
}
interface CreateTemplateVersionRequest {
readonly name?: string;
readonly message?: string;
readonly template_id?: string;
readonly storage_method: ProvisionerStorageMethod;
readonly file_id?: string;
readonly example_id?: string;
readonly provisioner: ProvisionerType;
readonly tags: Record<string, string>;
readonly user_variable_values?: readonly VariableValue[];
}
interface CreateTestAuditLogRequest {
readonly action?: AuditAction;
readonly resource_type?: ResourceType;
readonly resource_id?: string;
readonly additional_fields?: Record<string, string>;
readonly time?: string;
readonly build_reason?: BuildReason;
}
interface CreateTokenRequest {
readonly lifetime: number;
readonly scope: APIKeyScope;
readonly token_name: string;
}
interface CreateUserRequest {
readonly email: string;
readonly username: string;
readonly password: string;
readonly login_type: LoginType;
readonly disable_login: boolean;
readonly organization_id: string;
}
interface CreateWorkspaceBuildRequest {
readonly template_version_id?: string;
readonly transition: WorkspaceTransition;
readonly dry_run?: boolean;
readonly state?: string;
readonly orphan?: boolean;
readonly rich_parameter_values?: readonly WorkspaceBuildParameter[];
readonly log_level?: ProvisionerLogLevel;
}
interface CreateWorkspaceProxyRequest {
readonly name: string;
readonly display_name: string;
readonly icon: string;
}
interface CreateWorkspaceRequest {
readonly template_id?: string;
readonly template_version_id?: string;
readonly name: string;
readonly autostart_schedule?: string;
readonly ttl_ms?: number;
readonly rich_parameter_values?: readonly WorkspaceBuildParameter[];
readonly automatic_updates?: AutomaticUpdates;
}
interface DAUEntry {
readonly date: string;
readonly amount: number;
}
interface DAURequest {
readonly TZHourOffset: number;
}
interface DAUsResponse {
readonly entries: readonly DAUEntry[];
readonly tz_hour_offset: number;
}
interface DERP {
readonly server: DERPServerConfig;
readonly config: DERPConfig;
}
interface DERPConfig {
readonly block_direct: boolean;
readonly force_websockets: boolean;
readonly url: string;
readonly path: string;
}
interface DERPRegion {
readonly preferred: boolean;
readonly latency_ms: number;
}
interface DERPServerConfig {
readonly enable: boolean;
readonly region_id: number;
readonly region_code: string;
readonly region_name: string;
readonly stun_addresses: string[];
readonly relay_url: string;
}
interface DangerousConfig {
readonly allow_path_app_sharing: boolean;
readonly allow_path_app_site_owner_access: boolean;
readonly allow_all_cors: boolean;
}
interface DeleteWorkspaceAgentPortShareRequest {
readonly agent_name: string;
readonly port: number;
}
interface DeploymentConfig {
readonly config?: DeploymentValues;
readonly options?: SerpentOptionSet;
}
interface DeploymentStats {
readonly aggregated_from: string;
readonly collected_at: string;
readonly next_update_at: string;
readonly workspaces: WorkspaceDeploymentStats;
readonly session_count: SessionCountDeploymentStats;
}
interface DeploymentValues {
readonly verbose?: boolean;
readonly access_url?: string;
readonly wildcard_access_url?: string;
readonly docs_url?: string;
readonly redirect_to_access_url?: boolean;
readonly http_address?: string;
readonly autobuild_poll_interval?: number;
readonly job_hang_detector_interval?: number;
readonly derp?: DERP;
readonly prometheus?: PrometheusConfig;
readonly pprof?: PprofConfig;
readonly proxy_trusted_headers?: string[];
readonly proxy_trusted_origins?: string[];
readonly cache_directory?: string;
readonly in_memory_database?: boolean;
readonly pg_connection_url?: string;
readonly pg_auth?: string;
readonly oauth2?: OAuth2Config;
readonly oidc?: OIDCConfig;
readonly telemetry?: TelemetryConfig;
readonly tls?: TLSConfig;
readonly trace?: TraceConfig;
readonly secure_auth_cookie?: boolean;
readonly strict_transport_security?: number;
readonly strict_transport_security_options?: string[];
readonly ssh_keygen_algorithm?: string;
readonly metrics_cache_refresh_interval?: number;
readonly agent_stat_refresh_interval?: number;
readonly agent_fallback_troubleshooting_url?: string;
readonly browser_only?: boolean;
readonly scim_api_key?: string;
readonly external_token_encryption_keys?: string[];
readonly provisioner?: ProvisionerConfig;
readonly rate_limit?: RateLimitConfig;
readonly experiments?: string[];
readonly update_check?: boolean;
readonly swagger?: SwaggerConfig;
readonly logging?: LoggingConfig;
readonly dangerous?: DangerousConfig;
readonly disable_path_apps?: boolean;
readonly session_lifetime?: SessionLifetime;
readonly disable_password_auth?: boolean;
readonly support?: SupportConfig;
readonly external_auth?: readonly ExternalAuthConfig[];
readonly config_ssh?: SSHConfig;
readonly wgtunnel_host?: string;
readonly disable_owner_workspace_exec?: boolean;
readonly proxy_health_status_interval?: number;
readonly enable_terraform_debug_mode?: boolean;
readonly user_quiet_hours_schedule?: UserQuietHoursScheduleConfig;
readonly web_terminal_renderer?: string;
readonly allow_workspace_renames?: boolean;
readonly healthcheck?: HealthcheckConfig;
readonly cli_upgrade_message?: string;
readonly terms_of_service_url?: string;
readonly config?: string;
readonly write_config?: boolean;
readonly address?: string;
}
interface Entitlements {
readonly features: Record<FeatureName, Feature>;
readonly warnings: readonly string[];
readonly errors: readonly string[];
readonly has_license: boolean;
readonly trial: boolean;
readonly require_telemetry: boolean;
readonly refreshed_at: string;
}
type Experiments = readonly Experiment[];
interface ExternalAuth {
readonly authenticated: boolean;
readonly device: boolean;
readonly display_name: string;
readonly user?: ExternalAuthUser;
readonly app_installable: boolean;
readonly installations: readonly ExternalAuthAppInstallation[];
readonly app_install_url: string;
}
interface ExternalAuthAppInstallation {
readonly id: number;
readonly account: ExternalAuthUser;
readonly configure_url: string;
}
interface ExternalAuthConfig {
readonly type: string;
readonly client_id: string;
readonly id: string;
readonly auth_url: string;
readonly token_url: string;
readonly validate_url: string;
readonly app_install_url: string;
readonly app_installations_url: string;
readonly no_refresh: boolean;
readonly scopes: readonly string[];
readonly extra_token_keys: readonly string[];
readonly device_flow: boolean;
readonly device_code_url: string;
readonly regex: string;
readonly display_name: string;
readonly display_icon: string;
}
interface ExternalAuthDevice {
readonly device_code: string;
readonly user_code: string;
readonly verification_uri: string;
readonly expires_in: number;
readonly interval: number;
}
interface ExternalAuthDeviceExchange {
readonly device_code: string;
}
interface ExternalAuthLink {
readonly provider_id: string;
readonly created_at: string;
readonly updated_at: string;
readonly has_refresh_token: boolean;
readonly expires: string;
readonly authenticated: boolean;
readonly validate_error: string;
}
interface ExternalAuthLinkProvider {
readonly id: string;
readonly type: string;
readonly device: boolean;
readonly display_name: string;
readonly display_icon: string;
readonly allow_refresh: boolean;
readonly allow_validate: boolean;
}
interface ExternalAuthUser {
readonly login: string;
readonly avatar_url: string;
readonly profile_url: string;
readonly name: string;
}
interface Feature {
readonly entitlement: Entitlement;
readonly enabled: boolean;
readonly limit?: number;
readonly actual?: number;
}
interface GenerateAPIKeyResponse {
readonly key: string;
}
interface GetUsersResponse {
readonly users: readonly User[];
readonly count: number;
}
interface GitSSHKey {
readonly user_id: string;
readonly created_at: string;
readonly updated_at: string;
readonly public_key: string;
}
interface Group {
readonly id: string;
readonly name: string;
readonly display_name: string;
readonly organization_id: string;
readonly members: readonly ReducedUser[];
readonly avatar_url: string;
readonly quota_allowance: number;
readonly source: GroupSource;
}
interface Healthcheck {
readonly url: string;
readonly interval: number;
readonly threshold: number;
}
interface HealthcheckConfig {
readonly refresh: number;
readonly threshold_database: number;
}
interface IssueReconnectingPTYSignedTokenRequest {
readonly url: string;
readonly agentID: string;
}
interface IssueReconnectingPTYSignedTokenResponse {
readonly signed_token: string;
}
interface JFrogXrayScan {
readonly workspace_id: string;
readonly agent_id: string;
readonly critical: number;
readonly high: number;
readonly medium: number;
readonly results_url: string;
}
interface License {
readonly id: number;
readonly uuid: string;
readonly uploaded_at: string;
readonly claims: Record<string, any>;
}
interface LinkConfig {
readonly name: string;
readonly target: string;
readonly icon: string;
}
interface ListUserExternalAuthResponse {
readonly providers: readonly ExternalAuthLinkProvider[];
readonly links: readonly ExternalAuthLink[];
}
interface LoggingConfig {
readonly log_filter: string[];
readonly human: string;
readonly json: string;
readonly stackdriver: string;
}
interface LoginWithPasswordRequest {
readonly email: string;
readonly password: string;
}
interface LoginWithPasswordResponse {
readonly session_token: string;
}
interface MinimalUser {
readonly id: string;
readonly username: string;
readonly avatar_url: string;
}
interface OAuth2AppEndpoints {
readonly authorization: string;
readonly token: string;
readonly device_authorization: string;
}
interface OAuth2Config {
readonly github: OAuth2GithubConfig;
}
interface OAuth2GithubConfig {
readonly client_id: string;
readonly client_secret: string;
readonly allowed_orgs: string[];
readonly allowed_teams: string[];
readonly allow_signups: boolean;
readonly allow_everyone: boolean;
readonly enterprise_base_url: string;
}
interface OAuth2ProviderApp {
readonly id: string;
readonly name: string;
readonly callback_url: string;
readonly icon: string;
readonly endpoints: OAuth2AppEndpoints;
}
interface OAuth2ProviderAppFilter {
readonly user_id?: string;
}
interface OAuth2ProviderAppSecret {
readonly id: string;
readonly last_used_at?: string;
readonly client_secret_truncated: string;
}
interface OAuth2ProviderAppSecretFull {
readonly id: string;
readonly client_secret_full: string;
}
interface OAuthConversionResponse {
readonly state_string: string;
readonly expires_at: string;
readonly to_type: LoginType;
readonly user_id: string;
}
interface OIDCAuthMethod extends AuthMethod {
readonly signInText: string;
readonly iconUrl: string;
}
interface OIDCConfig {
readonly allow_signups: boolean;
readonly client_id: string;
readonly client_secret: string;
readonly client_key_file: string;
readonly client_cert_file: string;
readonly email_domain: string[];
readonly issuer_url: string;
readonly scopes: string[];
readonly ignore_email_verified: boolean;
readonly username_field: string;
readonly email_field: string;
readonly auth_url_params: Record<string, string>;
readonly ignore_user_info: boolean;
readonly group_auto_create: boolean;
readonly group_regex_filter: string;
readonly group_allow_list: string[];
readonly groups_field: string;
readonly group_mapping: Record<string, string>;
readonly user_role_field: string;
readonly user_role_mapping: Record<string, readonly string[]>;
readonly user_roles_default: string[];
readonly sign_in_text: string;
readonly icon_url: string;
readonly signups_disabled_text: string;
}
interface Organization {
readonly id: string;
readonly name: string;
readonly created_at: string;
readonly updated_at: string;
readonly is_default: boolean;
}
interface OrganizationMember {
readonly user_id: string;
readonly organization_id: string;
readonly created_at: string;
readonly updated_at: string;
readonly roles: readonly SlimRole[];
}
interface Pagination {
readonly after_id?: string;
readonly limit?: number;
readonly offset?: number;
}
interface PatchGroupRequest {
readonly add_users: readonly string[];
readonly remove_users: readonly string[];
readonly name: string;
readonly display_name?: string;
readonly avatar_url?: string;
readonly quota_allowance?: number;
}
interface PatchTemplateVersionRequest {
readonly name: string;
readonly message?: string;
}
interface PatchWorkspaceProxy {
readonly id: string;
readonly name: string;
readonly display_name: string;
readonly icon: string;
readonly regenerate_token: boolean;
}
interface Permission {
readonly negate: boolean;
readonly resource_type: RBACResource;
readonly action: RBACAction;
}
interface PostOAuth2ProviderAppRequest {
readonly name: string;
readonly callback_url: string;
readonly icon: string;
}
interface PprofConfig {
readonly enable: boolean;
readonly address: string;
}
interface PrometheusConfig {
readonly enable: boolean;
readonly address: string;
readonly collect_agent_stats: boolean;
readonly collect_db_metrics: boolean;
readonly aggregate_agent_stats_by: string[];
}
interface ProvisionerConfig {
readonly daemons: number;
readonly daemon_types: string[];
readonly daemon_poll_interval: number;
readonly daemon_poll_jitter: number;
readonly force_cancel_interval: number;
readonly daemon_psk: string;
}
interface ProvisionerDaemon {
readonly id: string;
readonly created_at: string;
readonly last_seen_at?: string;
readonly name: string;
readonly version: string;
readonly api_version: string;
readonly provisioners: readonly ProvisionerType[];
readonly tags: Record<string, string>;
}
interface ProvisionerJob {
readonly id: string;
readonly created_at: string;
readonly started_at?: string;
readonly completed_at?: string;
readonly canceled_at?: string;
readonly error?: string;
readonly error_code?: JobErrorCode;
readonly status: ProvisionerJobStatus;
readonly worker_id?: string;
readonly file_id: string;
readonly tags: Record<string, string>;
readonly queue_position: number;
readonly queue_size: number;
}
interface ProvisionerJobLog {
readonly id: number;
readonly created_at: string;
readonly log_source: LogSource;
readonly log_level: LogLevel;
readonly stage: string;
readonly output: string;
}
interface ProxyHealthReport {
readonly errors: readonly string[];
readonly warnings: readonly string[];
}
interface PutExtendWorkspaceRequest {
readonly deadline: string;
}
interface PutOAuth2ProviderAppRequest {
readonly name: string;
readonly callback_url: string;
readonly icon: string;
}
interface RateLimitConfig {
readonly disable_all: boolean;
readonly api: number;
}
interface ReducedUser extends MinimalUser {
readonly name: string;
readonly email: string;
readonly created_at: string;
readonly last_seen_at: string;
readonly status: UserStatus;
readonly login_type: LoginType;
readonly theme_preference: string;
}
interface Region {
readonly id: string;
readonly name: string;
readonly display_name: string;
readonly icon_url: string;
readonly healthy: boolean;
readonly path_app_url: string;
readonly wildcard_hostname: string;
}
interface RegionsResponse<R extends RegionTypes> {
readonly regions: readonly R[];
}
interface Replica {
readonly id: string;
readonly hostname: string;
readonly created_at: string;
readonly relay_address: string;
readonly region_id: number;
readonly error: string;
readonly database_latency: number;
}
interface ResolveAutostartResponse {
readonly parameter_mismatch: boolean;
}
interface Response {
readonly message: string;
readonly detail?: string;
readonly validations?: readonly ValidationError[];
}
interface Role {
readonly name: string;
readonly organization_id: string;
readonly display_name: string;
readonly site_permissions: readonly Permission[];
readonly organization_permissions: Record<string, readonly Permission[]>;
readonly user_permissions: readonly Permission[];
}
interface SSHConfig {
readonly DeploymentName: string;
readonly SSHConfigOptions: string[];
}
interface SSHConfigResponse {
readonly hostname_prefix: string;
readonly ssh_config_options: Record<string, string>;
}
interface ServerSentEvent {
readonly type: ServerSentEventType;
readonly data: any;
}
interface ServiceBannerConfig {
readonly enabled: boolean;
readonly message?: string;
readonly background_color?: string;
}
interface SessionCountDeploymentStats {
readonly vscode: number;
readonly ssh: number;
readonly jetbrains: number;
readonly reconnecting_pty: number;
}
interface SessionLifetime {
readonly disable_expiry_refresh?: boolean;
readonly default_duration: number;
readonly max_token_lifetime?: number;
}
interface SlimRole {
readonly name: string;
readonly display_name: string;
}
interface SupportConfig {
readonly links: readonly LinkConfig[];
}
interface SwaggerConfig {
readonly enable: boolean;
}
interface TLSConfig {
readonly enable: boolean;
readonly address: string;
readonly redirect_http: boolean;
readonly cert_file: string[];
readonly client_auth: string;
readonly client_ca_file: string;
readonly key_file: string[];
readonly min_version: string;
readonly client_cert_file: string;
readonly client_key_file: string;
readonly supported_ciphers: string[];
readonly allow_insecure_ciphers: boolean;
}
interface TelemetryConfig {
readonly enable: boolean;
readonly trace: boolean;
readonly url: string;
}
interface Template {
readonly id: string;
readonly created_at: string;
readonly updated_at: string;
readonly organization_id: string;
readonly name: string;
readonly display_name: string;
readonly provisioner: ProvisionerType;
readonly active_version_id: string;
readonly active_user_count: number;
readonly build_time_stats: TemplateBuildTimeStats;
readonly description: string;
readonly deprecated: boolean;
readonly deprecation_message: string;
readonly icon: string;
readonly default_ttl_ms: number;
readonly activity_bump_ms: number;
readonly autostop_requirement: TemplateAutostopRequirement;
readonly autostart_requirement: TemplateAutostartRequirement;
readonly created_by_id: string;
readonly created_by_name: string;
readonly allow_user_autostart: boolean;
readonly allow_user_autostop: boolean;
readonly allow_user_cancel_workspace_jobs: boolean;
readonly failure_ttl_ms: number;
readonly time_til_dormant_ms: number;
readonly time_til_dormant_autodelete_ms: number;
readonly require_active_version: boolean;
readonly max_port_share_level: WorkspaceAgentPortShareLevel;
}
interface TemplateACL {
readonly users: readonly TemplateUser[];
readonly group: readonly TemplateGroup[];
}
interface TemplateAppUsage {
readonly template_ids: readonly string[];
readonly type: TemplateAppsType;
readonly display_name: string;
readonly slug: string;
readonly icon: string;
readonly seconds: number;
readonly times_used: number;
}
interface TemplateAutostartRequirement {
readonly days_of_week: readonly string[];
}
interface TemplateAutostopRequirement {
readonly days_of_week: readonly string[];
readonly weeks: number;
}
type TemplateBuildTimeStats = Record<WorkspaceTransition, TransitionStats>;
interface TemplateExample {
readonly id: string;
readonly url: string;
readonly name: string;
readonly description: string;
readonly icon: string;
readonly tags: readonly string[];
readonly markdown: string;
}
interface TemplateGroup extends Group {
readonly role: TemplateRole;
}
interface TemplateInsightsIntervalReport {
readonly start_time: string;
readonly end_time: string;
readonly template_ids: readonly string[];
readonly interval: InsightsReportInterval;
readonly active_users: number;
}
interface TemplateInsightsReport {
readonly start_time: string;
readonly end_time: string;
readonly template_ids: readonly string[];
readonly active_users: number;
readonly apps_usage: readonly TemplateAppUsage[];
readonly parameters_usage: readonly TemplateParameterUsage[];
}
interface TemplateInsightsRequest {
readonly start_time: string;
readonly end_time: string;
readonly template_ids: readonly string[];
readonly interval: InsightsReportInterval;
readonly sections: readonly TemplateInsightsSection[];
}
interface TemplateInsightsResponse {
readonly report?: TemplateInsightsReport;
readonly interval_reports?: readonly TemplateInsightsIntervalReport[];
}
interface TemplateParameterUsage {
readonly template_ids: readonly string[];
readonly display_name: string;
readonly name: string;
readonly type: string;
readonly description: string;
readonly options?: readonly TemplateVersionParameterOption[];
readonly values: readonly TemplateParameterValue[];
}
interface TemplateParameterValue {
readonly value: string;
readonly count: number;
}
interface TemplateUser extends User {
readonly role: TemplateRole;
}
interface TemplateVersion {
readonly id: string;
readonly template_id?: string;
readonly organization_id?: string;
readonly created_at: string;
readonly updated_at: string;
readonly name: string;
readonly message: string;
readonly job: ProvisionerJob;
readonly readme: string;
readonly created_by: MinimalUser;
readonly archived: boolean;
readonly warnings?: readonly TemplateVersionWarning[];
}
interface TemplateVersionExternalAuth {
readonly id: string;
readonly type: string;
readonly display_name: string;
readonly display_icon: string;
readonly authenticate_url: string;
readonly authenticated: boolean;
readonly optional?: boolean;
}
interface TemplateVersionParameter {
readonly name: string;
readonly display_name?: string;
readonly description: string;
readonly description_plaintext: string;
readonly type: string;
readonly mutable: boolean;
readonly default_value: string;
readonly icon: string;
readonly options: readonly TemplateVersionParameterOption[];
readonly validation_error?: string;
readonly validation_regex?: string;
readonly validation_min?: number;
readonly validation_max?: number;
readonly validation_monotonic?: ValidationMonotonicOrder;
readonly required: boolean;
readonly ephemeral: boolean;
}
interface TemplateVersionParameterOption {
readonly name: string;
readonly description: string;
readonly value: string;
readonly icon: string;
}
interface TemplateVersionVariable {
readonly name: string;
readonly description: string;
readonly type: string;
readonly value: string;
readonly default_value: string;
readonly required: boolean;
readonly sensitive: boolean;
}
interface TemplateVersionsByTemplateRequest extends Pagination {
readonly template_id: string;
readonly include_archived: boolean;
}
interface TokenConfig {
readonly max_token_lifetime: number;
}
interface TokensFilter {
readonly include_all: boolean;
}
interface TraceConfig {
readonly enable: boolean;
readonly honeycomb_api_key: string;
readonly capture_logs: boolean;
readonly data_dog: boolean;
}
interface TransitionStats {
readonly P50?: number;
readonly P95?: number;
}
interface UpdateActiveTemplateVersion {
readonly id: string;
}
interface UpdateAppearanceConfig {
readonly application_name: string;
readonly logo_url: string;
readonly service_banner: BannerConfig;
readonly notification_banners: readonly BannerConfig[];
}
interface UpdateCheckResponse {
readonly current: boolean;
readonly version: string;
readonly url: string;
}
interface UpdateOrganizationRequest {
readonly name: string;
}
interface UpdateRoles {
readonly roles: readonly string[];
}
interface UpdateTemplateACL {
readonly user_perms?: Record<string, TemplateRole>;
readonly group_perms?: Record<string, TemplateRole>;
}
interface UpdateTemplateMeta {
readonly name?: string;
readonly display_name?: string;
readonly description?: string;
readonly icon?: string;
readonly default_ttl_ms?: number;
readonly activity_bump_ms?: number;
readonly autostop_requirement?: TemplateAutostopRequirement;
readonly autostart_requirement?: TemplateAutostartRequirement;
readonly allow_user_autostart?: boolean;
readonly allow_user_autostop?: boolean;
readonly allow_user_cancel_workspace_jobs?: boolean;
readonly failure_ttl_ms?: number;
readonly time_til_dormant_ms?: number;
readonly time_til_dormant_autodelete_ms?: number;
readonly update_workspace_last_used_at: boolean;
readonly update_workspace_dormant_at: boolean;
readonly require_active_version?: boolean;
readonly deprecation_message?: string;
readonly disable_everyone_group_access: boolean;
readonly max_port_share_level?: WorkspaceAgentPortShareLevel;
}
interface UpdateUserAppearanceSettingsRequest {
readonly theme_preference: string;
}
interface UpdateUserPasswordRequest {
readonly old_password: string;
readonly password: string;
}
interface UpdateUserProfileRequest {
readonly username: string;
readonly name: string;
}
interface UpdateUserQuietHoursScheduleRequest {
readonly schedule: string;
}
interface UpdateWorkspaceAutomaticUpdatesRequest {
readonly automatic_updates: AutomaticUpdates;
}
interface UpdateWorkspaceAutostartRequest {
readonly schedule?: string;
}
interface UpdateWorkspaceDormancy {
readonly dormant: boolean;
}
interface UpdateWorkspaceProxyResponse {
readonly proxy: WorkspaceProxy;
readonly proxy_token: string;
}
interface UpdateWorkspaceRequest {
readonly name?: string;
}
interface UpdateWorkspaceTTLRequest {
readonly ttl_ms?: number;
}
interface UploadResponse {
readonly hash: string;
}
interface UpsertWorkspaceAgentPortShareRequest {
readonly agent_name: string;
readonly port: number;
readonly share_level: WorkspaceAgentPortShareLevel;
readonly protocol: WorkspaceAgentPortShareProtocol;
}
interface User extends ReducedUser {
readonly organization_ids: readonly string[];
readonly roles: readonly SlimRole[];
}
interface UserActivity {
readonly template_ids: readonly string[];
readonly user_id: string;
readonly username: string;
readonly avatar_url: string;
readonly seconds: number;
}
interface UserActivityInsightsReport {
readonly start_time: string;
readonly end_time: string;
readonly template_ids: readonly string[];
readonly users: readonly UserActivity[];
}
interface UserActivityInsightsRequest {
readonly start_time: string;
readonly end_time: string;
readonly template_ids: readonly string[];
}
interface UserActivityInsightsResponse {
readonly report: UserActivityInsightsReport;
}
interface UserLatency {
readonly template_ids: readonly string[];
readonly user_id: string;
readonly username: string;
readonly avatar_url: string;
readonly latency_ms: ConnectionLatency;
}
interface UserLatencyInsightsReport {
readonly start_time: string;
readonly end_time: string;
readonly template_ids: readonly string[];
readonly users: readonly UserLatency[];
}
interface UserLatencyInsightsRequest {
readonly start_time: string;
readonly end_time: string;
readonly template_ids: readonly string[];
}
interface UserLatencyInsightsResponse {
readonly report: UserLatencyInsightsReport;
}
interface UserLoginType {
readonly login_type: LoginType;
}
interface UserParameter {
readonly name: string;
readonly value: string;
}
interface UserQuietHoursScheduleConfig {
readonly default_schedule: string;
readonly allow_user_custom: boolean;
}
interface UserQuietHoursScheduleResponse {
readonly raw_schedule: string;
readonly user_set: boolean;
readonly user_can_set: boolean;
readonly time: string;
readonly timezone: string;
readonly next: string;
}
interface UserRoles {
readonly roles: readonly string[];
readonly organization_roles: Record<string, readonly string[]>;
}
interface UsersRequest extends Pagination {
readonly q?: string;
}
interface ValidationError {
readonly field: string;
readonly detail: string;
}
interface VariableValue {
readonly name: string;
readonly value: string;
}
interface Workspace {
readonly id: string;
readonly created_at: string;
readonly updated_at: string;
readonly owner_id: string;
readonly owner_name: string;
readonly owner_avatar_url: string;
readonly organization_id: string;
readonly template_id: string;
readonly template_name: string;
readonly template_display_name: string;
readonly template_icon: string;
readonly template_allow_user_cancel_workspace_jobs: boolean;
readonly template_active_version_id: string;
readonly template_require_active_version: boolean;
readonly latest_build: WorkspaceBuild;
readonly outdated: boolean;
readonly name: string;
readonly autostart_schedule?: string;
readonly ttl_ms?: number;
readonly last_used_at: string;
readonly deleting_at?: string;
readonly dormant_at?: string;
readonly health: WorkspaceHealth;
readonly automatic_updates: AutomaticUpdates;
readonly allow_renames: boolean;
readonly favorite: boolean;
}
interface WorkspaceAgent {
readonly id: string;
readonly created_at: string;
readonly updated_at: string;
readonly first_connected_at?: string;
readonly last_connected_at?: string;
readonly disconnected_at?: string;
readonly started_at?: string;
readonly ready_at?: string;
readonly status: WorkspaceAgentStatus;
readonly lifecycle_state: WorkspaceAgentLifecycle;
readonly name: string;
readonly resource_id: string;
readonly instance_id?: string;
readonly architecture: string;
readonly environment_variables: Record<string, string>;
readonly operating_system: string;
readonly logs_length: number;
readonly logs_overflowed: boolean;
readonly directory?: string;
readonly expanded_directory?: string;
readonly version: string;
readonly api_version: string;
readonly apps: readonly WorkspaceApp[];
readonly latency?: Record<string, DERPRegion>;
readonly connection_timeout_seconds: number;
readonly troubleshooting_url: string;
readonly subsystems: readonly AgentSubsystem[];
readonly health: WorkspaceAgentHealth;
readonly display_apps: readonly DisplayApp[];
readonly log_sources: readonly WorkspaceAgentLogSource[];
readonly scripts: readonly WorkspaceAgentScript[];
readonly startup_script_behavior: WorkspaceAgentStartupScriptBehavior;
}
interface WorkspaceAgentHealth {
readonly healthy: boolean;
readonly reason?: string;
}
interface WorkspaceAgentListeningPort {
readonly process_name: string;
readonly network: string;
readonly port: number;
}
interface WorkspaceAgentListeningPortsResponse {
readonly ports: readonly WorkspaceAgentListeningPort[];
}
interface WorkspaceAgentLog {
readonly id: number;
readonly created_at: string;
readonly output: string;
readonly level: LogLevel;
readonly source_id: string;
}
interface WorkspaceAgentLogSource {
readonly workspace_agent_id: string;
readonly id: string;
readonly created_at: string;
readonly display_name: string;
readonly icon: string;
}
interface WorkspaceAgentMetadata {
readonly result: WorkspaceAgentMetadataResult;
readonly description: WorkspaceAgentMetadataDescription;
}
interface WorkspaceAgentMetadataDescription {
readonly display_name: string;
readonly key: string;
readonly script: string;
readonly interval: number;
readonly timeout: number;
}
interface WorkspaceAgentMetadataResult {
readonly collected_at: string;
readonly age: number;
readonly value: string;
readonly error: string;
}
interface WorkspaceAgentPortShare {
readonly workspace_id: string;
readonly agent_name: string;
readonly port: number;
readonly share_level: WorkspaceAgentPortShareLevel;
readonly protocol: WorkspaceAgentPortShareProtocol;
}
interface WorkspaceAgentPortShares {
readonly shares: readonly WorkspaceAgentPortShare[];
}
interface WorkspaceAgentScript {
readonly log_source_id: string;
readonly log_path: string;
readonly script: string;
readonly cron: string;
readonly run_on_start: boolean;
readonly run_on_stop: boolean;
readonly start_blocks_login: boolean;
readonly timeout: number;
}
interface WorkspaceApp {
readonly id: string;
readonly url: string;
readonly external: boolean;
readonly slug: string;
readonly display_name: string;
readonly command?: string;
readonly icon?: string;
readonly subdomain: boolean;
readonly subdomain_name?: string;
readonly sharing_level: WorkspaceAppSharingLevel;
readonly healthcheck: Healthcheck;
readonly health: WorkspaceAppHealth;
}
interface WorkspaceBuild {
readonly id: string;
readonly created_at: string;
readonly updated_at: string;
readonly workspace_id: string;
readonly workspace_name: string;
readonly workspace_owner_id: string;
readonly workspace_owner_name: string;
readonly workspace_owner_avatar_url: string;
readonly template_version_id: string;
readonly template_version_name: string;
readonly build_number: number;
readonly transition: WorkspaceTransition;
readonly initiator_id: string;
readonly initiator_name: string;
readonly job: ProvisionerJob;
readonly reason: BuildReason;
readonly resources: readonly WorkspaceResource[];
readonly deadline?: string;
readonly max_deadline?: string;
readonly status: WorkspaceStatus;
readonly daily_cost: number;
}
interface WorkspaceBuildParameter {
readonly name: string;
readonly value: string;
}
interface WorkspaceBuildsRequest extends Pagination {
readonly since?: string;
}
interface WorkspaceConnectionLatencyMS {
readonly P50: number;
readonly P95: number;
}
interface WorkspaceDeploymentStats {
readonly pending: number;
readonly building: number;
readonly running: number;
readonly failed: number;
readonly stopped: number;
readonly connection_latency_ms: WorkspaceConnectionLatencyMS;
readonly rx_bytes: number;
readonly tx_bytes: number;
}
interface WorkspaceFilter {
readonly q?: string;
}
interface WorkspaceHealth {
readonly healthy: boolean;
readonly failing_agents: readonly string[];
}
interface WorkspaceOptions {
readonly include_deleted?: boolean;
}
interface WorkspaceProxy extends Region {
readonly derp_enabled: boolean;
readonly derp_only: boolean;
readonly status?: WorkspaceProxyStatus;
readonly created_at: string;
readonly updated_at: string;
readonly deleted: boolean;
readonly version: string;
}
interface WorkspaceProxyBuildInfo {
readonly workspace_proxy: boolean;
readonly dashboard_url: string;
}
interface WorkspaceProxyStatus {
readonly status: ProxyHealthStatus;
readonly report?: ProxyHealthReport;
readonly checked_at: string;
}
interface WorkspaceQuota {
readonly credits_consumed: number;
readonly budget: number;
}
interface WorkspaceResource {
readonly id: string;
readonly created_at: string;
readonly job_id: string;
readonly workspace_transition: WorkspaceTransition;
readonly type: string;
readonly name: string;
readonly hide: boolean;
readonly icon: string;
readonly agents?: readonly WorkspaceAgent[];
readonly metadata?: readonly WorkspaceResourceMetadata[];
readonly daily_cost: number;
}
interface WorkspaceResourceMetadata {
readonly key: string;
readonly value: string;
readonly sensitive: boolean;
}
interface WorkspacesRequest extends Pagination {
readonly q?: string;
}
interface WorkspacesResponse {
readonly workspaces: readonly Workspace[];
readonly count: number;
}
type APIKeyScope = 'all' | 'application_connect';
declare const APIKeyScopes: APIKeyScope[];
type AgentSubsystem = 'envbox' | 'envbuilder' | 'exectrace';
declare const AgentSubsystems: AgentSubsystem[];
type AuditAction = 'create' | 'delete' | 'login' | 'logout' | 'register' | 'start' | 'stop' | 'write';
declare const AuditActions: AuditAction[];
type AutomaticUpdates = 'always' | 'never';
declare const AutomaticUpdateses: AutomaticUpdates[];
type BuildReason = 'autostart' | 'autostop' | 'initiator';
declare const BuildReasons: BuildReason[];
type DisplayApp = 'port_forwarding_helper' | 'ssh_helper' | 'vscode' | 'vscode_insiders' | 'web_terminal';
declare const DisplayApps: DisplayApp[];
type EnhancedExternalAuthProvider = 'azure-devops' | 'azure-devops-entra' | 'bitbucket-cloud' | 'bitbucket-server' | 'gitea' | 'github' | 'gitlab' | 'jfrog' | 'slack';
declare const EnhancedExternalAuthProviders: EnhancedExternalAuthProvider[];
type Entitlement = 'entitled' | 'grace_period' | 'not_entitled';
declare const entitlements: Entitlement[];
type Experiment = 'auto-fill-parameters' | 'custom-roles' | 'example' | 'multi-organization';
declare const experiments: Experiment[];
type FeatureName = 'access_control' | 'advanced_template_scheduling' | 'appearance' | 'audit_log' | 'browser_only' | 'control_shared_ports' | 'custom_roles' | 'external_provisioner_daemons' | 'external_token_encryption' | 'high_availability' | 'multiple_external_auth' | 'scim' | 'template_rbac' | 'user_limit' | 'user_role_management' | 'workspace_batch_actions' | 'workspace_proxy';
declare const FeatureNames: FeatureName[];
type GroupSource = 'oidc' | 'user';
declare const GroupSources: GroupSource[];
type InsightsReportInterval = 'day' | 'week';
declare const InsightsReportIntervals: InsightsReportInterval[];
type JobErrorCode = 'REQUIRED_TEMPLATE_VARIABLES';
declare const JobErrorCodes: JobErrorCode[];
type LogLevel = 'debug' | 'error' | 'info' | 'trace' | 'warn';
declare const LogLevels: LogLevel[];
type LogSource = 'provisioner' | 'provisioner_daemon';
declare const LogSources: LogSource[];
type LoginType = '' | 'github' | 'none' | 'oidc' | 'password' | 'token';
declare const LoginTypes: LoginType[];
type OAuth2ProviderGrantType = 'authorization_code' | 'refresh_token';
declare const OAuth2ProviderGrantTypes: OAuth2ProviderGrantType[];
type OAuth2ProviderResponseType = 'code';
declare const OAuth2ProviderResponseTypes: OAuth2ProviderResponseType[];
type PostgresAuth = 'awsiamrds' | 'password';
declare const PostgresAuths: PostgresAuth[];
type ProvisionerJobStatus = 'canceled' | 'canceling' | 'failed' | 'pending' | 'running' | 'succeeded' | 'unknown';
declare const ProvisionerJobStatuses: ProvisionerJobStatus[];
type ProvisionerLogLevel = 'debug';
declare const ProvisionerLogLevels: ProvisionerLogLevel[];
type ProvisionerStorageMethod = 'file';
declare const ProvisionerStorageMethods: ProvisionerStorageMethod[];
type ProvisionerType = 'echo' | 'terraform';
declare const ProvisionerTypes: ProvisionerType[];
type ProxyHealthStatus = 'ok' | 'unhealthy' | 'unreachable' | 'unregistered';
declare const ProxyHealthStatuses: ProxyHealthStatus[];
type RBACAction = 'application_connect' | 'assign' | 'create' | 'delete' | 'read' | 'read_personal' | 'ssh' | 'start' | 'stop' | 'update' | 'update_personal' | 'use' | 'view_insights';
declare const RBACActions: RBACAction[];
type RBACResource = '*' | 'api_key' | 'assign_org_role' | 'assign_role' | 'audit_log' | 'debug_info' | 'deployment_config' | 'deployment_stats' | 'file' | 'group' | 'license' | 'oauth2_app' | 'oauth2_app_code_token' | 'oauth2_app_secret' | 'organization' | 'organization_member' | 'provisioner_daemon' | 'replicas' | 'system' | 'tailnet_coordinator' | 'template' | 'user' | 'workspace' | 'workspace_dormant' | 'workspace_proxy';
declare const RBACResources: RBACResource[];
type ResourceType = 'api_key' | 'convert_login' | 'git_ssh_key' | 'group' | 'health_settings' | 'license' | 'oauth2_provider_app' | 'oauth2_provider_app_secret' | 'organization' | 'template' | 'template_version' | 'user' | 'workspace' | 'workspace_build' | 'workspace_proxy';
declare const ResourceTypes: ResourceType[];
type ServerSentEventType = 'data' | 'error' | 'ping';
declare const ServerSentEventTypes: ServerSentEventType[];
type TemplateAppsType = 'app' | 'builtin';
declare const TemplateAppsTypes: TemplateAppsType[];
type TemplateInsightsSection = 'interval_reports' | 'report';
declare const TemplateInsightsSections: TemplateInsightsSection[];
type TemplateRole = '' | 'admin' | 'use';
declare const TemplateRoles: TemplateRole[];
type TemplateVersionWarning = 'UNSUPPORTED_WORKSPACES';
declare const TemplateVersionWarnings: TemplateVersionWarning[];
type UserStatus = 'active' | 'dormant' | 'suspended';
declare const UserStatuses: UserStatus[];
type ValidationMonotonicOrder = 'decreasing' | 'increasing';
declare const ValidationMonotonicOrders: ValidationMonotonicOrder[];
type WorkspaceAgentLifecycle = 'created' | 'off' | 'ready' | 'shutdown_error' | 'shutdown_timeout' | 'shutting_down' | 'start_error' | 'start_timeout' | 'starting';
declare const WorkspaceAgentLifecycles: WorkspaceAgentLifecycle[];
type WorkspaceAgentPortShareLevel = 'authenticated' | 'owner' | 'public';
declare const WorkspaceAgentPortShareLevels: WorkspaceAgentPortShareLevel[];
type WorkspaceAgentPortShareProtocol = 'http' | 'https';
declare const WorkspaceAgentPortShareProtocols: WorkspaceAgentPortShareProtocol[];
type WorkspaceAgentStartupScriptBehavior = 'blocking' | 'non-blocking';
declare const WorkspaceAgentStartupScriptBehaviors: WorkspaceAgentStartupScriptBehavior[];
type WorkspaceAgentStatus = 'connected' | 'connecting' | 'disconnected' | 'timeout';
declare const WorkspaceAgentStatuses: WorkspaceAgentStatus[];
type WorkspaceAppHealth = 'disabled' | 'healthy' | 'initializing' | 'unhealthy';
declare const WorkspaceAppHealths: WorkspaceAppHealth[];
type WorkspaceAppSharingLevel = 'authenticated' | 'owner' | 'public';
declare const WorkspaceAppSharingLevels: WorkspaceAppSharingLevel[];
type WorkspaceStatus = 'canceled' | 'canceling' | 'deleted' | 'deleting' | 'failed' | 'pending' | 'running' | 'starting' | 'stopped' | 'stopping';
declare const WorkspaceStatuses: WorkspaceStatus[];
type WorkspaceTransition = 'delete' | 'start' | '