models

package
v0.0.0-...-51f14e4 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2019 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteApplication

func DeleteApplication(application *Application) error

func DeleteApplicationInventory

func DeleteApplicationInventory(applicationInventory *ApplicationInventory) error

func DeleteInventory

func DeleteInventory(inventory *Inventory) error

func DeleteProject

func DeleteProject(project *Project) error

func DeleteRepository

func DeleteRepository(repository *Repository) error

func DeleteSshKey

func DeleteSshKey(key *SshKey) error

func DeleteTemplate

func DeleteTemplate(template *Template) error

func DeleteUser

func DeleteUser(user *User) error

func GetDB

func GetDB() *gorm.DB

func GetInventoriesByApplicationId

func GetInventoriesByApplicationId(id uint) *[]Inventory

func GetSettingBoolValue

func GetSettingBoolValue(groupName string, key string, defaultValue bool) bool

func GetSettingValue

func GetSettingValue(groupName string, key string, defaultValue string) string

func SaveApplication

func SaveApplication(application *Application) error

func SaveApplicationInventory

func SaveApplicationInventory(applicationInventory *ApplicationInventory) error

func SaveInventory

func SaveInventory(inventory *Inventory) error

func SaveJob

func SaveJob(job *Job) error

func SaveJobLog

func SaveJobLog(jobLog *JobLog)

func SaveProject

func SaveProject(project *Project) error

func SaveRepository

func SaveRepository(repository *Repository) error

func SaveSettings

func SaveSettings(settings *[]Setting) error

func SaveSshKey

func SaveSshKey(key *SshKey) error

func SaveTemplate

func SaveTemplate(template *Template) error

func SaveUser

func SaveUser(user *User) error

func UpdateJobStatus

func UpdateJobStatus(job *Job, updates map[string]interface{}) error

Types

type Application

type Application struct {
	gorm.Model
	Name               string `gorm:"type:text"`
	AnsibleName        string `gorm:"type:text"`
	Project            Project
	ProjectID          uint
	Repository         Repository
	RepositoryID       uint
	RepositoryArtifact string
	Inventories        []ApplicationInventory
	AnsiblePlaybook    string `gorm:"type:text"`
}

func GetApplication

func GetApplication(id uint) *Application

func GetApplications

func GetApplications() ([]*Application, error)

type ApplicationInventory

type ApplicationInventory struct {
	IsActive        bool
	Application     Application
	ApplicationID   uint `gorm:"primary_key"`
	Inventory       Inventory
	InventoryID     uint   `gorm:"primary_key"`
	ApplicationUrls string `gorm:"type:text"`
	Key             SshKey
	KeyID           uint
	DeletedAt       time.Time
}

func GetApplicationInventories

func GetApplicationInventories() ([]*ApplicationInventory, error)

func GetApplicationInventory

func GetApplicationInventory(id uint) *ApplicationInventory

type Inventory

type Inventory struct {
	gorm.Model
	Name                   string `gorm:"type:text"`
	Project                Project
	ProjectID              uint
	SourceFile             string
	ApplicationInventories []ApplicationInventory
}

func GetInventories

func GetInventories() []*Inventory

func GetInventory

func GetInventory(id uint) *Inventory

type Job

type Job struct {
	gorm.Model
	Type           JobType
	StartedAt      time.Time
	FinishedAt     time.Time
	Application    Application
	ApplicationID  uint
	Playbook       string `gorm:"type:text"`
	Project        Project
	ProjectID      uint
	Inventory      Inventory
	InventoryID    uint
	Key            SshKey
	KeyID          uint
	Status         Status
	Version        string `gorm:"type:text"`
	ExtraVariables string `gorm:"type:text"`
}

func GetJob

func GetJob(id uint) *Job

func GetJobs

func GetJobs(page utils.Page, filters []utils.Filter) ([]*Job, *pagination.Paginator)

func GetLatestDeployments

func GetLatestDeployments() []*Job

func GetLatestSCMPulls

func GetLatestSCMPulls() []*Job

type JobLog

type JobLog struct {
	gorm.Model `json:"-"`
	Job        Job    `json:"-"`
	JobID      uint   `json:"-";gorm:"index:job"`
	Order      uint   `;json:"-"`
	Message    string `gorm:"type:text"`
}

func GetJobLogs

func GetJobLogs(jobID uint) []*JobLog

type JobType

type JobType string
const (
	TypeDeployment JobType = "Deployment"
	TypeJob        JobType = "Job"
	TypeSCMPull    JobType = "SCMPull"
)

type Key

type Key string

func (Key) MarshalJSON

func (Key) MarshalJSON() ([]byte, error)

Marshaler ignores the field value completely.

type Password

type Password string

func (Password) MarshalJSON

func (Password) MarshalJSON() ([]byte, error)

Marshaler ignores the field value completely.

type Project

type Project struct {
	gorm.Model
	Name       string `gorm:"type:text"`
	RepoUrl    string `gorm:"type:text"`
	RepoBranch string `gorm:"type:text"`
	RepoUser   string `gorm:"type:text"`
	SshKeyID   uint
	SshKey     SshKey
}

func GetProject

func GetProject(id uint) *Project

func GetProjects

func GetProjects() []*Project

type ProjectFile

type ProjectFile string

type Repository

type Repository struct {
	gorm.Model
	Name     string `gorm:"type:text"`
	Type     string `gorm:"type:text"`
	Url      string `gorm:"type:text"`
	Username string `gorm:"type:text"`
	Password string `gorm:"type:text"`
}

func GetRepositories

func GetRepositories() []*Repository

func GetRepository

func GetRepository(id uint) *Repository

type Setting

type Setting struct {
	gorm.Model
	SettingGroup   SettingGroup
	SettingGroupID uint
	Key            string `gorm:"type:text"`
	Value          string `gorm:"type:text"`
	BoolValue      bool
	ValueType      string `gorm:"type:text"`
	Label          string `gorm:"type:text"`
	Description    string `gorm:"type:text"`
}

type SettingGroup

type SettingGroup struct {
	gorm.Model
	Name     string `gorm:"type:text"`
	Settings []Setting
}

func GetSettingGroups

func GetSettingGroups() []*SettingGroup

type SshKey

type SshKey struct {
	gorm.Model
	Title string `gorm:"type:text"`
	Key   Key    `gorm:"type:text"`
}

func GetSshKey

func GetSshKey(id uint64) *SshKey

func GetSshKeys

func GetSshKeys() []*SshKey

type Status

type Status uint
const (
	StatusPending    Status = 0
	StatusProcessing Status = 1
	StatusCompleted  Status = 2
	StatusFailed     Status = 3
)

type Template

type Template struct {
	gorm.Model
	Name                 string `gorm:"type:text"`
	Project              Project
	ProjectID            uint
	Inventory            Inventory
	InventoryID          uint
	SshKey               SshKey
	SshKeyID             uint
	Playbook             string `gorm:"type:text"`
	PromptSshKey         bool
	PromptPlaybook       bool
	PromptInventory      bool
	PromptProject        bool
	PromptExtraVariables bool
	ExtraVariables       string `gorm:"type:text"`
}

func GetTemplate

func GetTemplate(id uint) *Template

func GetTemplates

func GetTemplates() []*Template

type User

type User struct {
	gorm.Model
	Name     string
	Surname  string
	Username string `gorm:"unique_index"`
	Email    string
	Password Password
	IsActive bool
}

func GetUser

func GetUser(id uint) *User

func GetUserByUsername

func GetUserByUsername(username string) *User

func GetUsers

func GetUsers() []*User

Jump to

Keyboard shortcuts

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