entity

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 22, 2023 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ParticipantFATESecretNameATS    = "traffic-server-cert"
	ParticipantFATESecretNamePulsar = "pulsar-cert"
	ParticipantFATESecretNameFMLMgr = "fml-manager-cert"
	ParticipantFATESecretNamePortal = "site-portal-cert"
)
View Source
const (
	ParticipantOpenFLSecretNameDirector = "director-cert"
	ParticipantOpenFLSecretNameJupyter  = "notebook-cert"
	ParticipantOpenFLSecretNameEnvoy    = "envoy-cert"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ByModelID added in v0.3.0

type ByModelID []Chart

func (ByModelID) Len added in v0.3.0

func (c ByModelID) Len() int

func (ByModelID) Less added in v0.3.0

func (c ByModelID) Less(i, j int) bool

func (ByModelID) Swap added in v0.3.0

func (c ByModelID) Swap(i, j int)

type Certificate

type Certificate struct {
	gorm.Model
	UUID              string              `gorm:"type:varchar(36);index;unique"`
	Name              string              `gorm:"type:varchar(255);not null"`
	SerialNumberStr   string              `gorm:"type:varchar(255)"`
	PEM               string              `gorm:"type:text"`
	ChainPEM          string              `gorm:"type:text"`
	Chain             []*x509.Certificate `gorm:"-"`
	*x509.Certificate `gorm:"-"`
}

Certificate is the certificate managed by this service

func (*Certificate) AfterFind

func (c *Certificate) AfterFind(tx *gorm.DB) error

func (*Certificate) BeforeSave

func (c *Certificate) BeforeSave(tx *gorm.DB) error

func (*Certificate) EncodePEM

func (c *Certificate) EncodePEM() ([]byte, error)

EncodePEM saves the PEM content in the related fields and returns the complete PEM content

type CertificateAuthority

type CertificateAuthority struct {
	gorm.Model
	UUID              string `gorm:"type:varchar(36);index;unique"`
	Name              string `gorm:"type:varchar(255);not null"`
	Description       string `gorm:"type:text"`
	Type              CertificateAuthorityType
	ConfigurationJSON string `gorm:"type:text;column:config_json"`
}

CertificateAuthority represent a certificate authority

func (*CertificateAuthority) Client

Client returns a client to work with a CA service, with basic validation executed

func (*CertificateAuthority) RootCert

func (ca *CertificateAuthority) RootCert() (*x509.Certificate, error)

type CertificateAuthorityClient

type CertificateAuthorityClient interface {
	stepcaapiv1.CertificateAuthorityService
}

CertificateAuthorityClient provides interface functions to work with a CA service

type CertificateAuthorityConfigurationStepCA

type CertificateAuthorityConfigurationStepCA struct {
	ServiceURL            string `json:"service_url" mapstructure:"service_url"`
	ServiceCertificatePEM string `json:"service_cert_pem" mapstructure:"service_cert_pem"`
	ProvisionerName       string `json:"provisioner_name" mapstructure:"provisioner_name"`
	ProvisionerPassword   string `json:"provisioner_password" mapstructure:"provisioner_password"`
}

CertificateAuthorityConfigurationStepCA contains basic configuration for a StepCA service

type CertificateAuthorityType

type CertificateAuthorityType uint8

CertificateAuthorityType is the certificate authority type

const (
	CertificateAuthorityTypeUnknown CertificateAuthorityType = iota
	CertificateAuthorityTypeStepCA
)

type CertificateBinding

type CertificateBinding struct {
	gorm.Model
	UUID            string `gorm:"type:varchar(36);index;unique"`
	CertificateUUID string `gorm:"type:varchar(36);not null"`
	ParticipantUUID string `gorm:"type:varchar(36);not null"`
	ServiceType     CertificateBindingServiceType
	FederationUUID  string         `gorm:"type:varchar(36)"`
	FederationType  FederationType `gorm:"type:varchar(255)"`
}

CertificateBinding is the binding relationship between certificate and the service

type CertificateBindingServiceType

type CertificateBindingServiceType uint8
const (
	CertificateBindingServiceTypeUnknown CertificateBindingServiceType = iota
	CertificateBindingServiceTypeATS
	CertificateBindingServiceTypePulsarServer
	CertificateBindingServiceFMLManagerServer
	CertificateBindingServiceFMLManagerClient
	CertificateBindingServiceSitePortalServer
	CertificateBindingServiceSitePortalClient
)
const (
	CertificateBindingServiceTypeOpenFLDirector CertificateBindingServiceType = iota + 101
	CertificateBindingServiceTypeOpenFLJupyter
	CertificateBindingServiceTypeOpenFLEnvoy
)

openfl

func (CertificateBindingServiceType) String

type Chart

type Chart struct {
	gorm.Model
	UUID                string `gorm:"type:varchar(36);index;unique"`
	Name                string `gorm:"type:varchar(255);not null"`
	Description         string `gorm:"type:text"`
	Type                ChartType
	ChartName           string `gorm:"type:varchar(255)"`
	Version             string `gorm:"type:varchar(32);not null"`
	AppVersion          string `gorm:"type:varchar(32);not null"`
	Chart               string `gorm:"type:text;not null"`
	InitialYamlTemplate string `gorm:"type:text;not null"`
	Values              string `gorm:"type:text;not null"`
	ValuesTemplate      string `gorm:"type:text;not null"`
	ArchiveContent      []byte `gorm:"type:mediumblob"`
	Private             bool
}

Chart is the helm chart

type ChartType

type ChartType uint8

ChartType is the supported deployment type

const (
	ChartTypeUnknown ChartType = iota
	ChartTypeFATEExchange
	ChartTypeFATECluster
	ChartTypeOpenFLDirector
	ChartTypeOpenFLEnvoy
)

type EndpointBase

type EndpointBase struct {
	gorm.Model
	UUID              string       `json:"uuid" gorm:"type:varchar(36);index;unique"`
	InfraProviderUUID string       `gorm:"type:varchar(36)"`
	Namespace         string       `json:"namespace" gorm:"type:varchar(255)"`
	Name              string       `json:"name" gorm:"type:varchar(255);unique;not null"`
	Description       string       `json:"description" gorm:"type:text"`
	Version           string       `json:"version" gorm:"type:varchar(255)"`
	Type              EndpointType `gorm:"type:varchar(255)"`
	Status            EndpointStatus
}

EndpointBase contains common information of an endpoint

type EndpointKubeFATE

type EndpointKubeFATE struct {
	EndpointBase
	Config                KubeFATEConfig `gorm:"type:text"`
	DeploymentYAML        string         `gorm:"type:text"`
	IngressControllerYAML string         `gorm:"type:text"`
}

EndpointKubeFATE is an KubeFATE type of endpoint

type EndpointKubeFATEIngressControllerServiceMode

type EndpointKubeFATEIngressControllerServiceMode uint8

EndpointKubeFATEIngressControllerServiceMode is the service mode of the ingress controller

const (
	// EndpointKubeFATEIngressControllerServiceModeSkip means there is an ingress controller in the infra, and we skip installing it by ourselves
	EndpointKubeFATEIngressControllerServiceModeSkip EndpointKubeFATEIngressControllerServiceMode = iota
	EndpointKubeFATEIngressControllerServiceModeLoadBalancer
	EndpointKubeFATEIngressControllerServiceModeModeNodePort
	// EndpointKubeFATEIngressControllerServiceModeModeNonexistent means there is no ingress controller at all, we will use other method to access the KubeFATE service
	EndpointKubeFATEIngressControllerServiceModeModeNonexistent
)

type EndpointStatus

type EndpointStatus uint8

EndpointStatus is the status of the endpoint

const (
	EndpointStatusUnknown EndpointStatus = iota
	EndpointStatusCreating
	EndpointStatusReady
	EndpointStatusDismissed
	EndpointStatusUnavailable
	EndpointStatusDeleting
)

func (EndpointStatus) String

func (s EndpointStatus) String() string

type EndpointType

type EndpointType string

EndpointType is the enum types of the provider

const (
	EndpointTypeUnknown  EndpointType = "Unknown"
	EndpointTypeKubeFATE EndpointType = "KubeFATE"
)

type EntityType

type EntityType uint8

EntityType is the entity which records events

const (
	EntityTypeUnknown EntityType = iota
	EntityTypeEndpoint
	EntityTypeExchange
	EntityTypeCluster
)
const (
	EntityTypeOpenFLDirector EntityType = iota + 101
	EntityTypeOpenFLEnvoy
)

openfl

func (EntityType) String

func (t EntityType) String() string

type Event

type Event struct {
	gorm.Model
	UUID       string `gorm:"type:varchar(36);index;unique"`
	Type       EventType
	EntityUUID string `gorm:"type:varchar(36);column:entity_uuid"`
	EntityType EntityType
	Data       string `gorm:"type:text" `
}

Event records events related to a certain entity

type EventData

type EventData struct {
	Description string `json:"description"`
	LogLevel    string `json:"log_level"`
}

EventData is detail info of an event

type EventLogLevel

type EventLogLevel uint8

EventLogLevel is the level of the log event

const (
	EventLogLevelUnknown EventLogLevel = iota
	EventLogLevelInfo
	EventLogLevelError
)

func (EventLogLevel) String

func (t EventLogLevel) String() string

type EventType

type EventType uint8

EventType is the supported Event type

const (
	EventTypeUnknown EventType = iota
	EventTypeLogMessage
)

type Federation

type Federation struct {
	gorm.Model
	UUID        string                    `gorm:"type:varchar(36);index;unique"`
	Name        string                    `gorm:"type:varchar(255);not null"`
	Description string                    `gorm:"type:text"`
	Type        FederationType            `gorm:"type:varchar(255);not null"`
	Repo        repo.FederationRepository `gorm:"-"`
}

Federation is a logic concept that contains multiple FML participants

type FederationFATE

type FederationFATE struct {
	Federation
	Domain string `gorm:"type:varchar(255);not null"`
}

FederationFATE represents a FATE federation

func (*FederationFATE) Create

func (federation *FederationFATE) Create() error

Create creates the FATE federation record in the repo

type FederationOpenFL

type FederationOpenFL struct {
	Federation
	Domain                       string `gorm:"type:varchar(255);not null"`
	UseCustomizedShardDescriptor bool
	ShardDescriptorConfig        *valueobject.ShardDescriptorConfig `gorm:"type:text"`
}

FederationOpenFL represents an OpenFL federation

func (*FederationOpenFL) Create

func (federation *FederationOpenFL) Create() error

Create creates the OpenFL federation record in the repo

func (FederationOpenFL) TableName

func (FederationOpenFL) TableName() string

type FederationType

type FederationType string

FederationType is the type of federation

const (
	FederationTypeFATE   FederationType = "FATE"
	FederationTypeOpenFL FederationType = "OpenFL"
)

type InfraProviderBase

type InfraProviderBase struct {
	gorm.Model
	UUID        string            `json:"uuid" gorm:"type:varchar(36);index;unique"`
	Name        string            `json:"name" gorm:"type:varchar(255);unique;not null"`
	Description string            `json:"description" gorm:"type:text"`
	Type        InfraProviderType `gorm:"type:varchar(255)"`
}

InfraProviderBase contains common information of an infra provider

type InfraProviderKubernetes

type InfraProviderKubernetes struct {
	InfraProviderBase
	Config             valueobject.KubeConfig         `json:"config" gorm:"type:text"`
	ConfigSHA256       string                         `json:"config_sha_256" gorm:"type:varchar(64)"`
	APIHost            string                         `json:"api_host" gorm:"type:varchar(256)"`
	RegistryConfigFATE valueobject.KubeRegistryConfig `json:"registry_config_fate" gorm:"type:text"`
	// TODO: add server version?
	Repo repo.InfraProviderRepository `json:"-" gorm:"-"`
}

InfraProviderKubernetes is a provider that is using a kubernetes cluster

func (*InfraProviderKubernetes) AfterFind

func (p *InfraProviderKubernetes) AfterFind(tx *gorm.DB) error

func (*InfraProviderKubernetes) BeforeSave

func (p *InfraProviderKubernetes) BeforeSave(tx *gorm.DB) error

func (*InfraProviderKubernetes) Create

func (p *InfraProviderKubernetes) Create() error

Create checks the config and saves the object to the repo

func (*InfraProviderKubernetes) Update

func (p *InfraProviderKubernetes) Update() error

Update checks the config and update the object to the repo

func (*InfraProviderKubernetes) Validate

func (p *InfraProviderKubernetes) Validate() error

Validate checks if the necessary information is provided correctly

type InfraProviderType

type InfraProviderType string

InfraProviderType is the enum types of the provider

const (
	InfraProviderTypeUnknown InfraProviderType = "Unknown"
	InfraProviderTypeK8s     InfraProviderType = "Kubernetes"
)

type KubeFATEConfig

type KubeFATEConfig struct {
	IngressAddress    string `json:"ingress_address"`
	IngressRuleHost   string `json:"ingress_rule_host"`
	UsePortForwarding bool   `json:"use_port_forwarding"`
}

KubeFATEConfig records basic info of a KubeFATE config

func (*KubeFATEConfig) Scan

func (c *KubeFATEConfig) Scan(v interface{}) error

func (KubeFATEConfig) Value

func (c KubeFATEConfig) Value() (driver.Value, error)

type Participant

type Participant struct {
	gorm.Model
	UUID           string                    `gorm:"type:varchar(36);index;unique"`
	Name           string                    `gorm:"type:varchar(255);not null"`
	Description    string                    `gorm:"type:text"`
	FederationUUID string                    `gorm:"type:varchar(36)"`
	EndpointUUID   string                    `gorm:"type:varchar(36)"`
	ChartUUID      string                    `gorm:"type:varchar(36)"`
	Namespace      string                    `gorm:"type:varchar(255)"`
	ClusterUUID    string                    `gorm:"type:varchar(36)"`
	JobUUID        string                    `gorm:"type:varchar(36)"`
	DeploymentYAML string                    `gorm:"type:text"`
	IsManaged      bool                      `gorm:"type:bool"`
	ExtraAttribute ParticipantExtraAttribute `gorm:"type:text"`
}

Participant represent a federation participant

type ParticipantCertBindingMode

type ParticipantCertBindingMode uint8

ParticipantCertBindingMode is the certificate binding mode

const (
	CertBindingModeUnknown ParticipantCertBindingMode = iota
	CertBindingModeSkip
	CertBindingModeReuse
	CertBindingModeCreate
)

type ParticipantComponentCertInfo

type ParticipantComponentCertInfo struct {
	BindingMode ParticipantCertBindingMode `json:"binding_mode"`
	UUID        string                     `json:"uuid"`
	CommonName  string                     `json:"common_name"`
}

ParticipantComponentCertInfo contains certificate information of a component in participant

type ParticipantDefaultServiceType

type ParticipantDefaultServiceType uint8

ParticipantDefaultServiceType is the default service type of the exposed services in the participant

const (
	ParticipantDefaultServiceTypeUnknown ParticipantDefaultServiceType = iota
	ParticipantDefaultServiceTypeLoadBalancer
	ParticipantDefaultServiceTypeNodePort
)

func (ParticipantDefaultServiceType) String

type ParticipantExtraAttribute

type ParticipantExtraAttribute struct {
	IsNewNamespace    bool `json:"is_new_namespace"`
	UseRegistrySecret bool `json:"use_registry_secret"`
}

ParticipantExtraAttribute record some extra attributes of the participant

func (*ParticipantExtraAttribute) Scan

func (a *ParticipantExtraAttribute) Scan(v interface{}) error

func (ParticipantExtraAttribute) Value

type ParticipantFATE

type ParticipantFATE struct {
	Participant
	PartyID     int
	Type        ParticipantFATEType
	Status      ParticipantFATEStatus
	CertConfig  ParticipantFATECertConfig       `gorm:"type:text"`
	AccessInfo  ParticipantFATEModulesAccessMap `gorm:"type:text"`
	IngressInfo ParticipantFATEIngressMap       `gorm:"type:text"`
}

ParticipantFATE represent a FATE type participant

func (ParticipantFATE) GetSitePortalAdminPassword added in v0.2.0

func (p ParticipantFATE) GetSitePortalAdminPassword() (string, error)

GetSitePortalAdminPassword returns the admin password of the deployed site portal service

type ParticipantFATECertConfig

type ParticipantFATECertConfig struct {
	ProxyServerCertInfo      ParticipantComponentCertInfo `json:"proxy_server_cert_info"`
	FMLManagerServerCertInfo ParticipantComponentCertInfo `json:"fml_manager_server_cert_info"`
	FMLManagerClientCertInfo ParticipantComponentCertInfo `json:"fml_manager_client_cert_info"`

	PulsarServerCertInfo     ParticipantComponentCertInfo `json:"pulsar_server_cert_info"`
	SitePortalServerCertInfo ParticipantComponentCertInfo `json:"site_portal_server_cert_info"`
	SitePortalClientCertInfo ParticipantComponentCertInfo `json:"site_portal_client_cert_info"`
}

ParticipantFATECertConfig contains all the certificate configuration of a FATE participant

func (*ParticipantFATECertConfig) Scan

func (c *ParticipantFATECertConfig) Scan(v interface{}) error

func (ParticipantFATECertConfig) Value

type ParticipantFATEIngress

type ParticipantFATEIngress struct {
	Hosts     []string `json:"hosts"`
	Addresses []string `json:"addresses"`
	TLS       bool     `json:"tls"`
}

ParticipantFATEIngress contains ingress info of a FATE participant module

type ParticipantFATEIngressMap

type ParticipantFATEIngressMap map[string]ParticipantFATEIngress

func (*ParticipantFATEIngressMap) Scan

func (c *ParticipantFATEIngressMap) Scan(v interface{}) error

func (ParticipantFATEIngressMap) Value

type ParticipantFATEModulesAccessMap

type ParticipantFATEModulesAccessMap map[ParticipantFATEServiceName]ParticipantModulesAccess

ParticipantFATEModulesAccessMap contains the exposed services access information

func (*ParticipantFATEModulesAccessMap) Scan

func (c *ParticipantFATEModulesAccessMap) Scan(v interface{}) error

func (ParticipantFATEModulesAccessMap) Value

type ParticipantFATEServiceName

type ParticipantFATEServiceName string

ParticipantFATEServiceName is all the exposed FATE participant service name

const (
	ParticipantFATEServiceNameNginx  ParticipantFATEServiceName = "nginx"
	ParticipantFATEServiceNameATS    ParticipantFATEServiceName = "traffic-server"
	ParticipantFATEServiceNamePulsar ParticipantFATEServiceName = "pulsar-public-tls"
	ParticipantFATEServiceNamePortal ParticipantFATEServiceName = "frontend"
	ParticipantFATEServiceNameFMLMgr ParticipantFATEServiceName = "fml-manager-server"
)

type ParticipantFATEStatus

type ParticipantFATEStatus uint8

ParticipantFATEStatus is the status of the fate participant

const (
	ParticipantFATEStatusUnknown ParticipantFATEStatus = iota
	ParticipantFATEStatusActive
	ParticipantFATEStatusInstalling
	ParticipantFATEStatusRemoving
	ParticipantFATEStatusReconfiguring
	ParticipantFATEStatusFailed
	ParticipantFATEStatusUpgrading
)

func (ParticipantFATEStatus) String

func (t ParticipantFATEStatus) String() string

type ParticipantFATEType

type ParticipantFATEType uint8

ParticipantFATEType is the participant type

const (
	ParticipantFATETypeUnknown ParticipantFATEType = iota
	ParticipantFATETypeExchange
	ParticipantFATETypeCluster
)

func (ParticipantFATEType) String

func (t ParticipantFATEType) String() string

type ParticipantModulesAccess

type ParticipantModulesAccess struct {
	ServiceType corev1.ServiceType `json:"service_type"`
	Host        string             `json:"host"`
	Port        int                `json:"port"`
	TLS         bool               `json:"tls"`
	FQDN        string             `json:"fqdn"`
}

ParticipantModulesAccess contains access info of a participant service

type ParticipantOpenFL

type ParticipantOpenFL struct {
	Participant
	Type       ParticipantOpenFLType
	Status     ParticipantOpenFLStatus
	InfraUUID  string                            `gorm:"type:varchar(36)"`
	TokenUUID  string                            `gorm:"type:varchar(36)"`
	CertConfig ParticipantOpenFLCertConfig       `gorm:"type:text"`
	AccessInfo ParticipantOpenFLModulesAccessMap `gorm:"type:text"`
	Labels     valueobject.Labels                `gorm:"type:text"`
}

ParticipantOpenFL represent an OpenFL type participant

type ParticipantOpenFLCertConfig

type ParticipantOpenFLCertConfig struct {
	DirectorServerCertInfo ParticipantComponentCertInfo `json:"director_server_cert_info"`
	JupyterClientCertInfo  ParticipantComponentCertInfo `json:"jupyter_client_cert_info"`

	EnvoyClientCertInfo ParticipantComponentCertInfo `json:"envoy_client_cert_info"`
}

ParticipantOpenFLCertConfig contains configurations for certificates in an OpenFL participant

func (*ParticipantOpenFLCertConfig) Scan

func (c *ParticipantOpenFLCertConfig) Scan(v interface{}) error

func (ParticipantOpenFLCertConfig) Value

type ParticipantOpenFLModulesAccessMap

type ParticipantOpenFLModulesAccessMap map[ParticipantOpenFLServiceName]ParticipantModulesAccess

ParticipantOpenFLModulesAccessMap contains the exposed services in an OpenFL participant

func (*ParticipantOpenFLModulesAccessMap) Scan

func (c *ParticipantOpenFLModulesAccessMap) Scan(v interface{}) error

func (ParticipantOpenFLModulesAccessMap) Value

type ParticipantOpenFLServiceName

type ParticipantOpenFLServiceName string

ParticipantOpenFLServiceName is a enum of the exposed service names

const (
	ParticipantOpenFLServiceNameDirector   ParticipantOpenFLServiceName = "director"
	ParticipantOpenFLServiceNameAggregator ParticipantOpenFLServiceName = "agg"
	ParticipantOpenFLServiceNameJupyter    ParticipantOpenFLServiceName = "notebook"
)

type ParticipantOpenFLStatus

type ParticipantOpenFLStatus uint8

ParticipantOpenFLStatus is the status of the openfl participant

const (
	ParticipantOpenFLStatusUnknown ParticipantOpenFLStatus = iota
	ParticipantOpenFLStatusActive
	ParticipantOpenFLStatusRemoving
	ParticipantOpenFLStatusFailed
	ParticipantOpenFLStatusInstallingDirector
	ParticipantOpenFLStatusConfiguringInfra
	ParticipantOpenFLStatusInstallingEndpoint
	ParticipantOpenFLStatusInstallingEnvoy
)

func (ParticipantOpenFLStatus) String

func (t ParticipantOpenFLStatus) String() string

type ParticipantOpenFLType

type ParticipantOpenFLType uint8

ParticipantOpenFLType is the openfl participant type

const (
	ParticipantOpenFLTypeUnknown ParticipantOpenFLType = iota
	ParticipantOpenFLTypeDirector
	ParticipantOpenFLTypeEnvoy
)

func (ParticipantOpenFLType) String

func (t ParticipantOpenFLType) String() string

type RegistrationToken

type RegistrationToken struct {
	gorm.Model
	UUID        string `gorm:"type:varchar(36);index;unique"`
	Name        string `gorm:"type:varchar(255);not null"`
	Description string `gorm:"type:text"`
	TokenType   RegistrationTokenType
	TokenStr    string                           `gorm:"type:varchar(255)"`
	Repo        repo.RegistrationTokenRepository `gorm:"-"`
}

RegistrationToken is the token entity a participant can use to register itself

type RegistrationTokenOpenFL

type RegistrationTokenOpenFL struct {
	RegistrationToken
	FederationUUID  string `gorm:"type:varchar(36)"`
	ExpiredAt       time.Time
	Limit           int
	Labels          valueobject.Labels               `gorm:"type:text"`
	ParticipantRepo repo.ParticipantOpenFLRepository `gorm:"-"`
}

RegistrationTokenOpenFL contains extra information for a token used in OpenFL federations

func (*RegistrationTokenOpenFL) Create

func (token *RegistrationTokenOpenFL) Create() error

Create creates the OpenFL federation record in the repo

func (*RegistrationTokenOpenFL) Display

func (token *RegistrationTokenOpenFL) Display() string

Display returns a string representing the token and its type

func (RegistrationTokenOpenFL) TableName

func (RegistrationTokenOpenFL) TableName() string

func (*RegistrationTokenOpenFL) Validate

func (token *RegistrationTokenOpenFL) Validate() error

Validate returns whether this token is still valid

type RegistrationTokenType

type RegistrationTokenType uint8

RegistrationTokenType is an enum of token types

const (
	RegistrationTokenTypeUnknown RegistrationTokenType = iota
	RegistrationTokenTypeRand16
)

func RegistrationTokenParse

func RegistrationTokenParse(tokenDisplayedStr string) (RegistrationTokenType, string, error)

RegistrationTokenParse pares a complete token string and returns the token type and the token string

func (RegistrationTokenType) DisplayStr

func (t RegistrationTokenType) DisplayStr() string

DisplayStr returns a string representing the type

func (RegistrationTokenType) Generate

func (t RegistrationTokenType) Generate() string

Generate generates the token string based on the token type

type User

type User struct {
	gorm.Model
	UUID string `gorm:"type:varchar(36);index;unique"`
	// Name is the user's name
	Name string `gorm:"type:varchar(255);unique;not null"`
	// Password is the user's hashed password
	Password string `gorm:"type:varchar(255)"`
	// Repo is the repository to persistent related data
	Repo repo.UserRepository `gorm:"-"`
}

User is a representation of the user available in the lifecycle manager

func (*User) LoadById

func (u *User) LoadById() error

LoadById reads the info from the repo

func (*User) UpdatePwdInfo

func (u *User) UpdatePwdInfo(curPassword, newPassword string) error

UpdatePwdInfo changes a users password

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL