mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
feat(cli): add shell completions (#14341)
This commit is contained in:
@@ -42,7 +42,7 @@ func ProvisionerTypeValid[T ProvisionerType | string](pt T) error {
|
||||
type MinimalOrganization struct {
|
||||
ID uuid.UUID `table:"id" json:"id" validate:"required" format:"uuid"`
|
||||
Name string `table:"name,default_sort" json:"name"`
|
||||
DisplayName string `table:"display_name" json:"display_name"`
|
||||
DisplayName string `table:"display name" json:"display_name"`
|
||||
Icon string `table:"icon" json:"icon"`
|
||||
}
|
||||
|
||||
@@ -50,8 +50,8 @@ type MinimalOrganization struct {
|
||||
type Organization struct {
|
||||
MinimalOrganization `table:"m,recursive_inline"`
|
||||
Description string `table:"description" json:"description"`
|
||||
CreatedAt time.Time `table:"created_at" json:"created_at" validate:"required" format:"date-time"`
|
||||
UpdatedAt time.Time `table:"updated_at" json:"updated_at" validate:"required" format:"date-time"`
|
||||
CreatedAt time.Time `table:"created at" json:"created_at" validate:"required" format:"date-time"`
|
||||
UpdatedAt time.Time `table:"updated at" json:"updated_at" validate:"required" format:"date-time"`
|
||||
IsDefault bool `table:"default" json:"is_default" validate:"required"`
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ type OrganizationMember struct {
|
||||
OrganizationID uuid.UUID `table:"organization id" json:"organization_id" format:"uuid"`
|
||||
CreatedAt time.Time `table:"created at" json:"created_at" format:"date-time"`
|
||||
UpdatedAt time.Time `table:"updated at" json:"updated_at" format:"date-time"`
|
||||
Roles []SlimRole `table:"organization_roles" json:"roles"`
|
||||
Roles []SlimRole `table:"organization roles" json:"roles"`
|
||||
}
|
||||
|
||||
type OrganizationMemberWithUserData struct {
|
||||
|
||||
@@ -275,8 +275,8 @@ func (c *Client) ServeProvisionerDaemon(ctx context.Context, req ServeProvisione
|
||||
|
||||
type ProvisionerKey struct {
|
||||
ID uuid.UUID `json:"id" table:"-" format:"uuid"`
|
||||
CreatedAt time.Time `json:"created_at" table:"created_at" format:"date-time"`
|
||||
OrganizationID uuid.UUID `json:"organization" table:"organization_id" format:"uuid"`
|
||||
CreatedAt time.Time `json:"created_at" table:"created at" format:"date-time"`
|
||||
OrganizationID uuid.UUID `json:"organization" table:"organization id" format:"uuid"`
|
||||
Name string `json:"name" table:"name,default_sort"`
|
||||
Tags map[string]string `json:"tags" table:"tags"`
|
||||
// HashedSecret - never include the access token in the API response
|
||||
|
||||
+9
-9
@@ -53,22 +53,22 @@ type Permission struct {
|
||||
// Role is a longer form of SlimRole that includes permissions details.
|
||||
type Role struct {
|
||||
Name string `json:"name" table:"name,default_sort" validate:"username"`
|
||||
OrganizationID string `json:"organization_id,omitempty" table:"organization_id" format:"uuid"`
|
||||
DisplayName string `json:"display_name" table:"display_name"`
|
||||
SitePermissions []Permission `json:"site_permissions" table:"site_permissions"`
|
||||
OrganizationID string `json:"organization_id,omitempty" table:"organization id" format:"uuid"`
|
||||
DisplayName string `json:"display_name" table:"display name"`
|
||||
SitePermissions []Permission `json:"site_permissions" table:"site permissions"`
|
||||
// OrganizationPermissions are specific for the organization in the field 'OrganizationID' above.
|
||||
OrganizationPermissions []Permission `json:"organization_permissions" table:"organization_permissions"`
|
||||
UserPermissions []Permission `json:"user_permissions" table:"user_permissions"`
|
||||
OrganizationPermissions []Permission `json:"organization_permissions" table:"organization permissions"`
|
||||
UserPermissions []Permission `json:"user_permissions" table:"user permissions"`
|
||||
}
|
||||
|
||||
// CustomRoleRequest is used to edit custom roles.
|
||||
type CustomRoleRequest struct {
|
||||
Name string `json:"name" table:"name,default_sort" validate:"username"`
|
||||
DisplayName string `json:"display_name" table:"display_name"`
|
||||
SitePermissions []Permission `json:"site_permissions" table:"site_permissions"`
|
||||
DisplayName string `json:"display_name" table:"display name"`
|
||||
SitePermissions []Permission `json:"site_permissions" table:"site permissions"`
|
||||
// OrganizationPermissions are specific to the organization the role belongs to.
|
||||
OrganizationPermissions []Permission `json:"organization_permissions" table:"organization_permissions"`
|
||||
UserPermissions []Permission `json:"user_permissions" table:"user_permissions"`
|
||||
OrganizationPermissions []Permission `json:"organization_permissions" table:"organization permissions"`
|
||||
UserPermissions []Permission `json:"user_permissions" table:"user permissions"`
|
||||
}
|
||||
|
||||
// FullName returns the role name scoped to the organization ID. This is useful if
|
||||
|
||||
@@ -118,6 +118,8 @@ func BitmapToWeekdays(bitmap uint8) []string {
|
||||
return days
|
||||
}
|
||||
|
||||
var AllDaysOfWeek = []string{"monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"}
|
||||
|
||||
type TemplateAutostartRequirement struct {
|
||||
// DaysOfWeek is a list of days of the week in which autostart is allowed
|
||||
// to happen. If no days are specified, autostart is not allowed.
|
||||
|
||||
@@ -32,7 +32,7 @@ type WorkspaceProxyStatus struct {
|
||||
Status ProxyHealthStatus `json:"status" table:"status,default_sort"`
|
||||
// Report provides more information about the health of the workspace proxy.
|
||||
Report ProxyHealthReport `json:"report,omitempty" table:"report"`
|
||||
CheckedAt time.Time `json:"checked_at" table:"checked_at" format:"date-time"`
|
||||
CheckedAt time.Time `json:"checked_at" table:"checked at" format:"date-time"`
|
||||
}
|
||||
|
||||
// ProxyHealthReport is a report of the health of the workspace proxy.
|
||||
@@ -48,16 +48,16 @@ type ProxyHealthReport struct {
|
||||
type WorkspaceProxy struct {
|
||||
// Extends Region with extra information
|
||||
Region `table:"region,recursive_inline"`
|
||||
DerpEnabled bool `json:"derp_enabled" table:"derp_enabled"`
|
||||
DerpOnly bool `json:"derp_only" table:"derp_only"`
|
||||
DerpEnabled bool `json:"derp_enabled" table:"derp enabled"`
|
||||
DerpOnly bool `json:"derp_only" table:"derp only"`
|
||||
|
||||
// Status is the latest status check of the proxy. This will be empty for deleted
|
||||
// proxies. This value can be used to determine if a workspace proxy is healthy
|
||||
// and ready to use.
|
||||
Status WorkspaceProxyStatus `json:"status,omitempty" table:"proxy,recursive"`
|
||||
|
||||
CreatedAt time.Time `json:"created_at" format:"date-time" table:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at" format:"date-time" table:"updated_at"`
|
||||
CreatedAt time.Time `json:"created_at" format:"date-time" table:"created at"`
|
||||
UpdatedAt time.Time `json:"updated_at" format:"date-time" table:"updated at"`
|
||||
Deleted bool `json:"deleted" table:"deleted"`
|
||||
Version string `json:"version" table:"version"`
|
||||
}
|
||||
@@ -187,8 +187,8 @@ type RegionsResponse[R RegionTypes] struct {
|
||||
type Region struct {
|
||||
ID uuid.UUID `json:"id" format:"uuid" table:"id"`
|
||||
Name string `json:"name" table:"name,default_sort"`
|
||||
DisplayName string `json:"display_name" table:"display_name"`
|
||||
IconURL string `json:"icon_url" table:"icon_url"`
|
||||
DisplayName string `json:"display_name" table:"display name"`
|
||||
IconURL string `json:"icon_url" table:"icon url"`
|
||||
Healthy bool `json:"healthy" table:"healthy"`
|
||||
|
||||
// PathAppURL is the URL to the base path for path apps. Optional
|
||||
@@ -200,7 +200,7 @@ type Region struct {
|
||||
// E.g. *.us.example.com
|
||||
// E.g. *--suffix.au.example.com
|
||||
// Optional. Does not need to be on the same domain as PathAppURL.
|
||||
WildcardHostname string `json:"wildcard_hostname" table:"wildcard_hostname"`
|
||||
WildcardHostname string `json:"wildcard_hostname" table:"wildcard hostname"`
|
||||
}
|
||||
|
||||
func (c *Client) Regions(ctx context.Context) ([]Region, error) {
|
||||
|
||||
Reference in New Issue
Block a user