zitadel/internal/domain/instance_domain.go

28 lines
565 B
Go
Raw Normal View History

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 {
return strings.ToLower(strings.ReplaceAll(instanceName, " ", "-") + "." + iamDomain)
}