mirror of
https://github.com/coder/coder.git
synced 2025-03-29 21:19:07 +00:00
Closes https://github.com/coder/coder/issues/15074 We have a hard-coded list of countries at https://github.com/coder/coder/blob/main/site/src/pages/SetupPage/countries.tsx. This means Go code in coder/coder doesn't have an easy way of utilizing it. ## Solution Generate countries.tsx from Go code. Generated by `scripts/apitypings`
40 lines
857 B
Go Template
40 lines
857 B
Go Template
// Code generated by typegen/main.go. DO NOT EDIT.
|
|
package rbac
|
|
|
|
import "github.com/coder/coder/v2/coderd/rbac/policy"
|
|
|
|
// Objecter returns the RBAC object for itself.
|
|
type Objecter interface {
|
|
RBACObject() Object
|
|
}
|
|
|
|
var (
|
|
{{- range $element := . }}
|
|
{{- $Name := pascalCaseName $element.FunctionName }}
|
|
// Resource{{ $Name }}
|
|
// Valid Actions
|
|
{{- range $action, $value := .Actions }}
|
|
// - "{{ actionEnum $action }}" :: {{ $value.Description }}
|
|
{{- end }}
|
|
Resource{{ $Name }} = Object {
|
|
Type: "{{ $element.Type }}",
|
|
}
|
|
{{ end -}}
|
|
)
|
|
|
|
func AllResources() []Objecter {
|
|
return []Objecter{
|
|
{{- range $element := . }}
|
|
Resource{{ pascalCaseName $element.FunctionName }},
|
|
{{- end }}
|
|
}
|
|
}
|
|
|
|
func AllActions() []policy.Action {
|
|
return []policy.Action {
|
|
{{- range $element := actionsList }}
|
|
policy.{{ $element.Enum }},
|
|
{{- end }}
|
|
}
|
|
}
|