github.com/caos/orbos@v1.5.14-0.20221103111702-e6cd0cea7ad4/internal/operator/boom/api/v1beta1/grafana/admin/admin.go (about) 1 package admin 2 3 import ( 4 "github.com/caos/orbos/pkg/secret" 5 ) 6 7 // Admin: Not defining the admin credentials results in an user admin with password admin. 8 type Admin struct { 9 Username *secret.Secret `json:"username,omitempty" yaml:"username,omitempty"` 10 Password *secret.Secret `json:"password,omitempty" yaml:"password,omitempty"` 11 //Existing Secret containing username and password 12 ExistingSecret *secret.ExistingIDSecret `json:"existingSecret,omitempty" yaml:"existingSecret,omitempty"` 13 } 14 15 func (a *Admin) IsZero() bool { 16 if (a.Username == nil || a.Username.IsZero()) && 17 (a.Username == nil || a.Username.IsZero()) && 18 a.ExistingSecret == nil { 19 return true 20 } 21 return false 22 } 23 24 func (a *Admin) InitSecrets() { 25 if a.Username == nil { 26 a.Username = &secret.Secret{} 27 } 28 if a.Password == nil { 29 a.Password = &secret.Secret{} 30 } 31 }