models

package
v0.0.0-...-85a151d Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2021 License: MIT Imports: 14 Imported by: 5

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 DeleteNotificationChannel

func DeleteNotificationChannel(notificationChannel *NotificationChannel) error

func DeleteProject

func DeleteProject(project *Project) error

func DeleteRepository

func DeleteRepository(repository *Repository) error

func DeleteSshKey

func DeleteSshKey(key *SshKey) error

func DeleteSurvey

func DeleteSurvey(survey *Survey) error

func DeleteSurveyInput

func DeleteSurveyInput(surveyInput *SurveyInput) error

func DeleteTeam

func DeleteTeam(team *Team) error

func DeleteTemplate

func DeleteTemplate(template *Template) error

func DeleteUser

func DeleteUser(user *User) error

func GetApplicationNotifications

func GetApplicationNotifications(id uint) *[]ApplicationNotification

func GetDB

func GetDB() *gorm.DB

func GetInventoriesByApplicationId

func GetInventoriesByApplicationId(id uint) *[]Inventory

func GetProjectNotifications

func GetProjectNotifications(id uint) *[]ProjectNotification

func GetSettingBoolValue

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

func GetSettingValue

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

func GetSurveyInputsByTemplateID

func GetSurveyInputsByTemplateID(id uint) (*[]SurveyInput, error)

func GetTemplateNotifications

func GetTemplateNotifications(id uint) *[]TemplateNotification

func InitDatabase

func InitDatabase()

func SaveApplication

func SaveApplication(application *Application) error

func SaveApplicationInventory

func SaveApplicationInventory(applicationInventory *ApplicationInventory) error

func SaveApplicationNotification

func SaveApplicationNotification(notification *ApplicationNotification) error

func SaveInventory

func SaveInventory(inventory *Inventory) error

func SaveJob

func SaveJob(job *Job) error

func SaveJobLog

func SaveJobLog(jobLog *JobLog)

func SaveNotificationChannel

func SaveNotificationChannel(notificationChannel *NotificationChannel) error

func SaveProject

func SaveProject(project *Project) error

func SaveProjectNotification

func SaveProjectNotification(notification *ProjectNotification) error

func SavePushSubscription

func SavePushSubscription(endpoint string, sub string, userID uint) error

func SaveRepository

func SaveRepository(repository *Repository) error

func SaveSettings

func SaveSettings(settings *[]Setting) error

func SaveSshKey

func SaveSshKey(key *SshKey) error

func SaveSurvey

func SaveSurvey(survey *Survey) error

func SaveSurveyInput

func SaveSurveyInput(surveyInput *SurveyInput) error

func SaveTeam

func SaveTeam(team *Team) error

func SaveTemplate

func SaveTemplate(template *Template) error

func SaveTemplateNotification

func SaveTemplateNotification(notification *TemplateNotification) 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
	Permissions        Permissions
	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"`
	RepositoryGroup    string `gorm:"type:text"`
}

func GetApplication

func GetApplication(id uint) *Application

func GetApplications

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

type ApplicationInventory

type ApplicationInventory struct {
	gorm.Model
	IsActive        bool
	Application     Application
	ApplicationID   uint
	Inventory       Inventory
	InventoryID     uint
	Name            string `gorm:"type:text"`
	ApplicationUrls string `gorm:"type:text"`
	ExtraVariables  string `gorm:"type:text"`
	Playbook        string `gorm:"type:text"`
	Key             SshKey
	KeyID           uint
	VaultKey        SshKey
	VaultKeyID      uint
}

func GetApplicationInventories

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

func GetApplicationInventory

func GetApplicationInventory(id uint) *ApplicationInventory

type ApplicationNotification

type ApplicationNotification struct {
	ApplicationID uint `gorm:"primary_key"`
	RelatedNotification
}

type Inventory

type Inventory struct {
	gorm.Model
	Permissions            Permissions
	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
	Template       Template
	TemplateID     uint
	Key            SshKey
	KeyID          uint
	VaultKey       SshKey
	VaultKeyID     uint
	User           User
	UserID         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 NotificationChannel

type NotificationChannel struct {
	gorm.Model
	Name        string `gorm:"type:text"`
	Description string `gorm:"type:text"`
	Type        string `gorm:"type:text"`
	Recipients  string `gorm:"type:text"`
	WebhookURL  string `gorm:"type:text"`
	UserID      uint
}

func GetNotificationChannel

func GetNotificationChannel(id uint) *NotificationChannel

func GetNotificationChannels

func GetNotificationChannels() []*NotificationChannel

type Password

type Password string

func (Password) MarshalJSON

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

Marshaler ignores the field value completely.

type Permissions

type Permissions struct {
	Read  bool
	Write bool
	Admin bool
	Use   bool
}

func (*Permissions) UnmarshalJSON

func (*Permissions) UnmarshalJSON(data []byte) error

Unmarshaler 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 ProjectNotification

type ProjectNotification struct {
	ProjectID uint `gorm:"primary_key"`
	RelatedNotification
}

type PushSubscription

type PushSubscription struct {
	gorm.Model
	Endpoint string `gorm:"type:text"`
	Sub      string `gorm:"type:text"`
	UserID   uint
}

func FindByEndpoint

func FindByEndpoint(endpoint string) *PushSubscription

func FindByUserID

func FindByUserID(id uint) []*PushSubscription

type RelatedNotification

type RelatedNotification struct {
	NotificationChannel   NotificationChannel
	NotificationChannelID uint `gorm:"primary_key"`
	StartEnabled          bool
	SuccessEnabled        bool
	FailEnabled           bool
}

func GetRelatedNotifications

func GetRelatedNotifications(job Job) (error, []RelatedNotification)

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"`
	NexusName 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
	Permissions Permissions
	Title       string `gorm:"type:text"`
	Key         Key    `gorm:"type:text"`
}

func GetSshKey

func GetSshKey(id uint) *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 Survey

type Survey struct {
	gorm.Model
	Enabled    bool
	Inputs     []SurveyInput
	TemplateID uint
}

func GetSurveyByTemplateID

func GetSurveyByTemplateID(id uint) *Survey

type SurveyInput

type SurveyInput struct {
	gorm.Model
	Label        string `gorm:"type:text"`
	Hint         string `gorm:"type:text"`
	VariableName string `gorm:"type:text"`
	Type         string `gorm:"type:text"`
	Options      string `gorm:"type:text"`
	SurveyID     uint
}

func GetSurveyInput

func GetSurveyInput(id uint) *SurveyInput

type Team

type Team struct {
	gorm.Model
	Name string `gorm:"type:text"`
}

func GetTeam

func GetTeam(id uint) *Team

func GetTeams

func GetTeams() []*Team

type Template

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

func GetTemplate

func GetTemplate(id uint) *Template

func GetTemplates

func GetTemplates() []*Template

type TemplateNotification

type TemplateNotification struct {
	TemplateID uint `gorm:"primary_key"`
	RelatedNotification
}

type User

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

func GetUser

func GetUser(id uint) *User

func GetUserByUsername

func GetUserByUsername(username string) *User

func GetUsers

func GetUsers() []*User

type UserType

type UserType string
const (
	UserTypeAdmin   UserType = "admin"
	UserTypeAuditor UserType = "auditor"
	UserTypeRegular UserType = "regular"
)

Jump to

Keyboard shortcuts

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