model

package
v0.0.0-...-e7c744b Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Migrate

func Migrate(db *gorm.DB, logger logrus.FieldLogger) error

Migrate executes the table migrations for the application models.

Types

type ClusterModel

type ClusterModel struct {
	ID             uint   `gorm:"primary_key"`
	UID            string `gorm:"unique_index:idx_clusters_uid"`
	CreatedAt      time.Time
	UpdatedAt      time.Time
	DeletedAt      *time.Time `gorm:"unique_index:idx_clusters_unique_id" sql:"index"`
	StartedAt      *time.Time
	Name           string `gorm:"unique_index:idx_clusters_unique_id"`
	Location       string
	Cloud          string
	Distribution   string
	OrganizationId uint `gorm:"unique_index:idx_clusters_unique_id"`
	SecretId       string
	ConfigSecretId string
	SshSecretId    string
	Status         string
	RbacEnabled    bool
	StatusMessage  string                                   `sql:"type:text;"`
	AKS            azureadapter.AKSClusterModel             `gorm:"foreignkey:ID"`
	Kubernetes     kubernetesadapter.KubernetesClusterModel `gorm:"foreignkey:ID"`
	CreatedBy      uint
	Tags           ClusterTags `gorm:"type:json"`
}

ClusterModel describes the common cluster model Note: this model is being moved to github.com/banzaicloud/pipeline/internal/cluster/clusteradapter.ClusterModel

func (*ClusterModel) AfterFind

func (cs *ClusterModel) AfterFind() error

AfterFind converts metadata json string into map in case of Kubernetes and sets NodeInstanceType and/or Location field(s) to unknown if they are empty

func (*ClusterModel) BeforeCreate

func (cs *ClusterModel) BeforeCreate() (err error)

func (*ClusterModel) Delete

func (cs *ClusterModel) Delete() error

Delete cluster from DB

func (*ClusterModel) Save

func (cs *ClusterModel) Save() error

Save the cluster to DB

func (*ClusterModel) String

func (cs *ClusterModel) String() string

String method prints formatted cluster fields

func (ClusterModel) TableName

func (ClusterModel) TableName() string

TableName sets ClusterModel's table name

func (*ClusterModel) UpdateConfigSecret

func (cs *ClusterModel) UpdateConfigSecret(configSecretId string) error

UpdateConfigSecret updates the model's config secret id in database

func (*ClusterModel) UpdateSshSecret

func (cs *ClusterModel) UpdateSshSecret(sshSecretId string) error

UpdateSshSecret updates the model's ssh secret id in database

func (*ClusterModel) UpdateStatus

func (cs *ClusterModel) UpdateStatus(status, statusMessage string) error

UpdateStatus updates the model's status and status message in database

type ClusterTags

type ClusterTags map[string]string

func (*ClusterTags) Scan

func (fs *ClusterTags) Scan(src interface{}) error

func (ClusterTags) Value

func (fs ClusterTags) Value() (driver.Value, error)

Jump to

Keyboard shortcuts

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