mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-12 11:04:25 +00:00
3d5891eb11
* feat: start system api * feat: remove auth * feat: change gitignore * feat: run system api * feat: remove clear view form admin api * feat: search instances * feat: add instance * fix: set primary domain * Update .gitignore * fix: add instance * fix: add instance * fix: handle errors * fix: handle instance name * fix: test Co-authored-by: Livio Amstutz <livio.a@gmail.com>
30 lines
660 B
Go
30 lines
660 B
Go
package domain
|
|
|
|
import (
|
|
"strings"
|
|
)
|
|
|
|
type InstanceDomainState int32
|
|
|
|
const (
|
|
InstanceDomainStateUnspecified InstanceDomainState = iota
|
|
InstanceDomainStateActive
|
|
InstanceDomainStateRemoved
|
|
|
|
instanceDomainStateCount
|
|
)
|
|
|
|
func (f InstanceDomainState) Valid() bool {
|
|
return f >= 0 && f < instanceDomainStateCount
|
|
}
|
|
|
|
func (f InstanceDomainState) Exists() bool {
|
|
return f == InstanceDomainStateActive
|
|
}
|
|
|
|
func NewGeneratedInstanceDomain(instanceName, iamDomain string) string {
|
|
//TODO: Add random number/string to be unique
|
|
instanceName = strings.TrimSpace(instanceName)
|
|
return strings.ToLower(strings.ReplaceAll(instanceName, " ", "-") + "." + iamDomain)
|
|
}
|