models

package
v0.0.0-...-4df811a Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2023 License: MIT Imports: 15 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ErrorIsActivityLog

func ErrorIsActivityLog(err error) bool

Types

type AccountType

type AccountType string
const (
	GitHubAccountType AccountType = "github"
	GitlabAccountType AccountType = "gitlab"
	CustomAccountType AccountType = "custom"
)

type ActionFilter

type ActionFilter string
const (
	ActionFilterGetRoles                     ActionFilter = "GetRoles"
	ActionFilterDoUsersExist                 ActionFilter = "DoUsersExist"
	ActionFilterPutMemberSetRole             ActionFilter = "PutMemberSetRole"
	ActionFilterPostProject                  ActionFilter = "PostProject"
	ActionFilterGetProjects                  ActionFilter = "GetProjects"
	ActionFilterGetProjectMembers            ActionFilter = "GetProjectMembers"
	ActionFilterPostProjectMembers           ActionFilter = "PostProjectMembers"
	ActionFilterDeleteProjectsMembers        ActionFilter = "DeleteProjectsMembers"
	ActionFilterGetAccessibleEnvironments    ActionFilter = "GetAccessibleEnvironments"
	ActionFilterDeleteProject                ActionFilter = "DeleteProject"
	ActionFilterGetProjectsOrganization      ActionFilter = "GetProjectsOrganization"
	ActionFilterGetDevices                   ActionFilter = "GetDevices"
	ActionFilterDeleteDevice                 ActionFilter = "DeleteDevice"
	ActionFilterGetOrganizations             ActionFilter = "GetOrganizations"
	ActionFilterPostOrganization             ActionFilter = "PostOrganization"
	ActionFilterGetEnvironmentPublicKeys     ActionFilter = "GetEnvironmentPublicKeys"
	ActionFilterPostInvite                   ActionFilter = "PostInvite"
	ActionFilterGetMessagesFromProjectByUser ActionFilter = "GetMessagesFromProjectByUser"
	ActionFilterWriteMessages                ActionFilter = "WriteMessages"
	ActionFilterDeleteMessage                ActionFilter = "DeleteMessage"
	ActionFilterPostSubscription             ActionFilter = "PostSubscription"
	ActionFilterGetPollSubscriptionSuccess   ActionFilter = "GetPollSubscriptionSuccess"
	ActionFilterManageSubscription           ActionFilter = "ManageSubscription"
	ActionFilterPostUser                     ActionFilter = "PostUser"
	ActionFilterPostUserToken                ActionFilter = "PostUserToken"
	ActionFilterPostLoginRequest             ActionFilter = "PostLoginRequest"
	ActionFilterGetLoginRequest              ActionFilter = "GetLoginRequest"
	ActionFilterGetUserKeys                  ActionFilter = "GetUserKeys"
)

func (ActionFilter) Validate

func (af ActionFilter) Validate() (ok bool)

type ActivityLog

type ActivityLog struct {
	ID            uint        `json:"id" gorm:"primaryKey"`
	UserID        *uint       `json:"user_id"`
	User          User        `json:"user"`
	ProjectID     *uint       `json:"project_id"`
	Project       Project     `json:"project"`
	EnvironmentID *uint       `json:"environment_id"`
	Environment   Environment `json:"environment"`
	Action        string      `json:"action"`
	Success       bool        `json:"success"`
	Message       string      `json:"error"`
	CreatedAt     time.Time   `json:"created_at"`
	UpdatedAt     time.Time   `json:"updated_at"`
}

func (*ActivityLog) BeforeCreate

func (pm *ActivityLog) BeforeCreate(tx *gorm.DB) (err error)

func (*ActivityLog) BeforeUpdate

func (pm *ActivityLog) BeforeUpdate(tx *gorm.DB) (err error)

func (*ActivityLog) Deserialize

func (pm *ActivityLog) Deserialize(in io.Reader) error

func (ActivityLog) Error

func (pm ActivityLog) Error() string

func (*ActivityLog) Lite

func (pm *ActivityLog) Lite() (l ActivityLogLite)

func (*ActivityLog) Ptr

func (pm *ActivityLog) Ptr() unsafe.Pointer

func (*ActivityLog) Serialize

func (pm *ActivityLog) Serialize(out *string) (err error)

func (*ActivityLog) SetError

func (pm *ActivityLog) SetError(err error) *ActivityLog

type ActivityLogLite

type ActivityLogLite struct {
	UserID          string    `json:"user_id"`
	ProjectName     string    `json:"project_name"`
	EnvironmentName string    `json:"environment_name"`
	Action          string    `json:"action"`
	Success         bool      `json:"success"`
	ErrorMessage    string    `json:"error_message"`
	CreatedAt       time.Time `json:"created_at"`
}

A lighter version of the activity log with only information that is safe to display (no db identifiers)

func (*ActivityLogLite) Deserialize

func (pm *ActivityLogLite) Deserialize(in io.Reader) error

func (*ActivityLogLite) Serialize

func (pm *ActivityLogLite) Serialize(out *string) (err error)

type AddMembersPayload

type AddMembersPayload struct {
	Members []MemberRole
}

func (*AddMembersPayload) Deserialize

func (pm *AddMembersPayload) Deserialize(in io.Reader) error

func (*AddMembersPayload) Serialize

func (pm *AddMembersPayload) Serialize(out *string) (err error)

type AddMembersResponse

type AddMembersResponse struct {
	Success bool   `json:"success"`
	Error   string `json:"error"`
}

func (*AddMembersResponse) Deserialize

func (pm *AddMembersResponse) Deserialize(in io.Reader) error

func (*AddMembersResponse) Serialize

func (pm *AddMembersResponse) Serialize(out *string) (err error)

type AddVariablePayload

type AddVariablePayload struct {
	VarName      string `json:"var_name"`
	UserEnvValue []struct {
		UserID      string `json:"user_id"`
		Environment string `json:"environment"`
		Value       []byte `json:"value"`
	} `json:"user_env_value"`
}

func (*AddVariablePayload) Deserialize

func (avp *AddVariablePayload) Deserialize(in io.Reader) error

func (*AddVariablePayload) Serialize

func (avp *AddVariablePayload) Serialize(out *string) (err error)

type AuthState

type AuthState struct {
	TemporaryCode string `json:"temporary_code"`
	Version       string `json:"version"`
}

The OAuth state value. Is base64 encoded JSON data structure which allows us to transit cli/api version information, enforcing version matching between the two

func (*AuthState) Decode

func (state *AuthState) Decode(input string) (err error)

func (AuthState) Encode

func (state AuthState) Encode() (out string, err error)

type CheckMembersPayload

type CheckMembersPayload struct {
	MemberIDs []string
}

func (*CheckMembersPayload) Deserialize

func (pm *CheckMembersPayload) Deserialize(in io.Reader) error

func (*CheckMembersPayload) Serialize

func (pm *CheckMembersPayload) Serialize(out *string) (err error)

type CheckMembersResponse

type CheckMembersResponse struct {
	Success bool   `json:"success" default:"true"`
	Error   string `json:"error"`
}

func (*CheckMembersResponse) Deserialize

func (pm *CheckMembersResponse) Deserialize(in io.Reader) error

func (*CheckMembersResponse) Serialize

func (pm *CheckMembersResponse) Serialize(out *string) (err error)

type CheckoutSession

type CheckoutSession struct {
	ID        uint                  `json:"id"         gorm:"primaryKey" faker:"-"`
	SessionID string                `json:"session_id" gorm:"unique"`
	Status    CheckoutSessionStatus `json:"status"     gorm:"default:pending" default:"pending" faker:"-"`
	CreatedAt time.Time             `json:"created_at" faker:"-"`
	UpdatedAt time.Time             `json:"updated_at" faker:"-"`
}

func (*CheckoutSession) BeforeCreate

func (pm *CheckoutSession) BeforeCreate(tx *gorm.DB) (err error)

func (*CheckoutSession) BeforeUpdate

func (pm *CheckoutSession) BeforeUpdate(tx *gorm.DB) (err error)

func (*CheckoutSession) Deserialize

func (pm *CheckoutSession) Deserialize(in io.Reader) error

func (*CheckoutSession) Serialize

func (pm *CheckoutSession) Serialize(out *string) (err error)

type CheckoutSessionStatus

type CheckoutSessionStatus string
const (
	CheckoutSessionStatusPending  CheckoutSessionStatus = "pending"
	CheckoutSessionStatusSuccess  CheckoutSessionStatus = "success"
	CheckoutSessionStatusCanceled CheckoutSessionStatus = "canceled"
)

type DestroyProjectPayload

type DestroyProjectPayload struct {
	ProjectId string `json:"project_id"`
}

func (*DestroyProjectPayload) Deserialize

func (svp *DestroyProjectPayload) Deserialize(in io.Reader) error

func (*DestroyProjectPayload) Serialize

func (svp *DestroyProjectPayload) Serialize(out *string) (err error)

type Device

type Device struct {
	ID         uint           `json:"id"           gorm:"primaryKey" faker:"-"`
	PublicKey  []byte         `json:"public_key"   gorm:"type:bytea"`
	Name       string         `json:"name"`
	UID        string         `json:"uid" faker:"uuid_hyphenated"`
	Users      []User         `json:"users"        gorm:"many2many:user_devices;" faker:"-"`
	LastUsedAt time.Time      `json:"last_used_at"`
	CreatedAt  time.Time      `json:"created_at"`
	UpdatedAt  time.Time      `json:"updated_at"`
	DeletedAt  gorm.DeletedAt `json:"-" faker:"-"`
}

func (*Device) BeforeCreate

func (pm *Device) BeforeCreate(tx *gorm.DB) (err error)

func (*Device) BeforeUpdate

func (pm *Device) BeforeUpdate(tx *gorm.DB) (err error)

func (*Device) Deserialize

func (pm *Device) Deserialize(in io.Reader) error

func (*Device) Serialize

func (pm *Device) Serialize(out *string) (err error)

type Environment

type Environment struct {
	ID                uint            `json:"id"                  gorm:"primaryKey" faker:"-"`
	Name              string          `json:"name"                gorm:"not null"   faker:"oneof: dev, staging, prod"`
	EnvironmentTypeID uint            `json:"environment_type_id"`
	EnvironmentType   EnvironmentType `json:"environment_type"                      faker:"-"`
	ProjectID         uint            `json:"project_id"`
	Project           Project         `json:"project"                               faker:"-"`
	VersionID         string          `json:"version_id"                            faker:"word,unique"`
	EnvironmentID     string          `json:"environment_id"                        faker:"word,unique"`

	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

func (*Environment) BeforeCreate

func (e *Environment) BeforeCreate(tx *gorm.DB) (err error)

func (*Environment) BeforeUpdate

func (e *Environment) BeforeUpdate(tx *gorm.DB) (err error)

func (*Environment) Deserialize

func (e *Environment) Deserialize(in io.Reader) error

func (*Environment) Serialize

func (u *Environment) Serialize(out *string) (err error)

type EnvironmentFilter

type EnvironmentFilter string
const (
	EnvironmentFilterDev     EnvironmentFilter = "dev"
	EnvironmentFilterStaging EnvironmentFilter = "staging"
	EnvironmentFilterProd    EnvironmentFilter = "prod"
)

func (EnvironmentFilter) Validate

func (ef EnvironmentFilter) Validate() (ok bool)

type EnvironmentType

type EnvironmentType struct {
	ID        uint      `json:"id"         gorm:"primaryKey"`
	Name      string    `json:"name"       gorm:"not null"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

func (*EnvironmentType) BeforeCreate

func (e *EnvironmentType) BeforeCreate(tx *gorm.DB) (err error)

func (*EnvironmentType) BeforeUpdate

func (e *EnvironmentType) BeforeUpdate(tx *gorm.DB) (err error)

func (*EnvironmentType) Deserialize

func (e *EnvironmentType) Deserialize(in io.Reader) error

func (*EnvironmentType) Serialize

func (u *EnvironmentType) Serialize(out *string) (err error)

type EnvironmentUserSecret

type EnvironmentUserSecret struct {
	EnvironmentID uint      `json:"environmentID" gorm:"primaryKey"`
	UserID        uint      `json:"userID"        gorm:"primaryKey"`
	SecretID      uint      `json:"secretID"      gorm:"primaryKey"`
	Value         []byte    `json:"value"`
	CreatedAt     time.Time `json:"createdAt"`
	UpdatedAt     time.Time `json:"updatedAt"`
}

func (*EnvironmentUserSecret) BeforeCreate

func (eus *EnvironmentUserSecret) BeforeCreate(tx *gorm.DB) (err error)

func (*EnvironmentUserSecret) BeforeUpdate

func (eus *EnvironmentUserSecret) BeforeUpdate(tx *gorm.DB) (err error)

func (*EnvironmentUserSecret) Deserialize

func (eus *EnvironmentUserSecret) Deserialize(in io.Reader) error

func (*EnvironmentUserSecret) Serialize

func (pes *EnvironmentUserSecret) Serialize(out *string) (err error)

type File

type File struct {
	Path string `json:"path"`
	// TODO: maybe have consistent names for struct fields and json fields
	Value string `json:"content"`
}

type GetActivityLogResponse

type GetActivityLogResponse struct {
	Logs []ActivityLogLite
}

func (*GetActivityLogResponse) Deserialize

func (pm *GetActivityLogResponse) Deserialize(in io.Reader) error

func (*GetActivityLogResponse) Serialize

func (pm *GetActivityLogResponse) Serialize(out *string) (err error)

type GetDevicesResponse

type GetDevicesResponse struct {
	Devices []Device
}

func (*GetDevicesResponse) Deserialize

func (e *GetDevicesResponse) Deserialize(in io.Reader) error

func (*GetDevicesResponse) Serialize

func (u *GetDevicesResponse) Serialize(out *string) (err error)

type GetEnvironmentsResponse

type GetEnvironmentsResponse struct {
	Environments []Environment `json:"environments"`
}

func (*GetEnvironmentsResponse) Deserialize

func (e *GetEnvironmentsResponse) Deserialize(in io.Reader) error

func (*GetEnvironmentsResponse) Serialize

func (u *GetEnvironmentsResponse) Serialize(out *string) (err error)

type GetInviteResponse

type GetInviteResponse struct {
	UserUIDs []string `json:"user_uids"`
}

func (*GetInviteResponse) Deserialize

func (e *GetInviteResponse) Deserialize(in io.Reader) error

func (*GetInviteResponse) Serialize

func (u *GetInviteResponse) Serialize(out *string) error

type GetLogsOptions

type GetLogsOptions struct {
	Actions      []ActionFilter      `json:"actions"`
	Environments []EnvironmentFilter `json:"environments"`
	Users        []string            `json:"users"`
	Limit        uint64              `json:"limit" default:"200"`
}

func NewGetLogsOption

func NewGetLogsOption() *GetLogsOptions

func (*GetLogsOptions) Deserialize

func (pm *GetLogsOptions) Deserialize(in io.Reader) error

func (*GetLogsOptions) Serialize

func (pm *GetLogsOptions) Serialize(out *string) (err error)

func (*GetLogsOptions) SetActions

func (o *GetLogsOptions) SetActions(actions string) *GetLogsOptions

func (*GetLogsOptions) SetEnvironments

func (o *GetLogsOptions) SetEnvironments(environments string) *GetLogsOptions

func (*GetLogsOptions) SetLimit

func (o *GetLogsOptions) SetLimit(limit uint64) *GetLogsOptions

func (*GetLogsOptions) SetUsers

func (o *GetLogsOptions) SetUsers(users string) *GetLogsOptions

type GetMembersResponse

type GetMembersResponse struct {
	Members []ProjectMember `json:"members"`
}

func (*GetMembersResponse) Deserialize

func (p *GetMembersResponse) Deserialize(in io.Reader) error

func (*GetMembersResponse) Serialize

func (p *GetMembersResponse) Serialize(out *string) error

type GetMessageByEnvironmentResponse

type GetMessageByEnvironmentResponse struct {
	Environments map[string]GetMessageResponse
}

func (*GetMessageByEnvironmentResponse) Deserialize

func (e *GetMessageByEnvironmentResponse) Deserialize(in io.Reader) error

func (*GetMessageByEnvironmentResponse) Serialize

func (u *GetMessageByEnvironmentResponse) Serialize(out *string) error

type GetMessageResponse

type GetMessageResponse struct {
	Message     Message     `json:"message,omitempty"`
	Environment Environment `json:"environment"`
}

type GetOrganizationByNameResponse

type GetOrganizationByNameResponse struct {
	Organization Organization
}

func (*GetOrganizationByNameResponse) Deserialize

func (e *GetOrganizationByNameResponse) Deserialize(in io.Reader) error

func (*GetOrganizationByNameResponse) Serialize

func (u *GetOrganizationByNameResponse) Serialize(out *string) (err error)

type GetOrganizationsResponse

type GetOrganizationsResponse struct {
	Organizations []Organization
}

func (*GetOrganizationsResponse) Deserialize

func (e *GetOrganizationsResponse) Deserialize(in io.Reader) error

func (*GetOrganizationsResponse) Serialize

func (u *GetOrganizationsResponse) Serialize(out *string) (err error)

type GetProjectsResponse

type GetProjectsResponse struct {
	Projects []Project
}

func (*GetProjectsResponse) Deserialize

func (e *GetProjectsResponse) Deserialize(in io.Reader) error

func (*GetProjectsResponse) Serialize

func (u *GetProjectsResponse) Serialize(out *string) (err error)

type GetRolesResponse

type GetRolesResponse struct {
	Roles []Role
}

API Types

func (*GetRolesResponse) Deserialize

func (e *GetRolesResponse) Deserialize(in io.Reader) error

func (*GetRolesResponse) Serialize

func (u *GetRolesResponse) Serialize(out *string) (err error)

type InvitePayload

type InvitePayload struct {
	Email       string
	ProjectName string
}

func (*InvitePayload) Deserialize

func (pm *InvitePayload) Deserialize(in io.Reader) error

func (*InvitePayload) Serialize

func (pm *InvitePayload) Serialize(out *string) (err error)

type KeyRing

type KeyRing struct {
	Cipher string `json:"cipher" gorm:"column:keys_cipher"`
	Sign   string `json:"sign"   gorm:"column:keys_sign"`
}

type LoginPayload

type LoginPayload struct {
	AccountType AccountType
	Token       *oauth2.Token
	PublicKey   []byte
	Device      string
	DeviceUID   string
}

type LoginRequest

type LoginRequest struct {
	ID            uint      `json:"id"             gorm:"primaryKey" faker:"-"`
	TemporaryCode string    `json:"temporary_code" gorm:"not null"`
	AuthCode      string    `json:"auth_code"`
	Answered      bool      `json:"answered"       gorm:"default:false"`
	CreatedAt     time.Time `json:"created_at"`
	UpdatedAt     time.Time `json:"updated_at"`
}

func NewLoginRequest

func NewLoginRequest() (LoginRequest, error)

func (*LoginRequest) BeforeCreate

func (lr *LoginRequest) BeforeCreate(tx *gorm.DB) (err error)

func (*LoginRequest) BeforeUpdate

func (lr *LoginRequest) BeforeUpdate(tx *gorm.DB) (err error)

func (*LoginRequest) Deserialize

func (lr *LoginRequest) Deserialize(in io.Reader) error

func (*LoginRequest) Serialize

func (lr *LoginRequest) Serialize(out *string) (err error)

type ManageSubscriptionResponse

type ManageSubscriptionResponse struct {
	Url string `json:"url"`
}

func (*ManageSubscriptionResponse) Deserialize

func (e *ManageSubscriptionResponse) Deserialize(in io.Reader) error

func (*ManageSubscriptionResponse) Serialize

func (u *ManageSubscriptionResponse) Serialize(out *string) (err error)

type MemberRole

type MemberRole struct {
	MemberID string // <username>@<service>
	RoleID   uint
}

API Types

type Message

type Message struct {
	ID                uint        `json:"id"                  gorm:"primaryKey"               faker:"-"`
	Payload           []byte      `                           gorm:"-"`
	Sender            User        `json:"sender"                                              faker:"-"`
	SenderID          uint        `json:"sender_id"`
	Recipient         User        `json:"recipient"                                           faker:"-"`
	RecipientID       uint        `json:"recipient_id"`
	Environment       Environment `json:"environment"         gorm:"References:EnvironmentID" faker:"-"`
	EnvironmentID     string      `json:"environment_id"`
	Uuid              string      `json:"uuid"`
	RecipientDeviceID uint        `json:"recipient_device_id"`
	SenderDeviceID    uint        `json:"sender_device_id"`
	CreatedAt         time.Time   `json:"created_at"`
	UpdatedAt         time.Time   `json:"updated_at"`
}

func (*Message) BeforeCreate

func (msg *Message) BeforeCreate(tx *gorm.DB) (err error)

func (*Message) BeforeUpdate

func (msg *Message) BeforeUpdate(tx *gorm.DB) (err error)

func (*Message) Deserialize

func (msg *Message) Deserialize(in io.Reader) error

func (*Message) Serialize

func (msg *Message) Serialize(out *string) (err error)

type MessagePayload

type MessagePayload struct {
	Files   []File      `json:"files"`
	Secrets []SecretVal `json:"secrets"`
}

func (*MessagePayload) Deserialize

func (e *MessagePayload) Deserialize(in io.Reader) error

func (*MessagePayload) Serialize

func (u *MessagePayload) Serialize(out *string) (err error)

type MessageToWritePayload

type MessageToWritePayload struct {
	Payload                  []byte `json:"payload"`
	SenderDeviceUID          string `json:"sender_device_uid"`
	RecipientDeviceID        uint   `json:"recipient_device_id"`
	UserID                   string `json:"userid"`
	RecipientID              uint   `json:"recipient_id"`
	EnvironmentID            string `json:"environment_id"`
	UpdateEnvironmentVersion bool   `json:"update_environment_version"`
}

type MessagesToWritePayload

type MessagesToWritePayload struct {
	Messages []MessageToWritePayload `json:"messages"`
}

func (*MessagesToWritePayload) Deserialize

func (e *MessagesToWritePayload) Deserialize(in io.Reader) error

func (*MessagesToWritePayload) Serialize

func (u *MessagesToWritePayload) Serialize(out *string) (err error)

type Organization

type Organization struct {
	ID             uint      `json:"id"              gorm:"primaryKey" faker:"-"`
	Name           string    `json:"name"            gorm:"unique"`
	Paid           bool      `json:"paid" faker:"-"`
	Private        bool      `json:"private" faker:"-"`
	CustomerID     string    `json:"customer_id" faker:""`
	SubscriptionID string    `json:"subscription_id" faker:""`
	UserID         uint      `json:"user_id"`
	User           User      `json:"user"`
	CreatedAt      time.Time `json:"created_at"`
	UpdatedAt      time.Time `json:"updated_at"`
}

func (*Organization) BeforeCreate

func (pm *Organization) BeforeCreate(tx *gorm.DB) (err error)

func (*Organization) BeforeUpdate

func (pm *Organization) BeforeUpdate(tx *gorm.DB) (err error)

func (*Organization) Deserialize

func (pm *Organization) Deserialize(in io.Reader) error

func (*Organization) Serialize

func (pm *Organization) Serialize(out *string) (err error)

type Project

type Project struct {
	ID                  uint            `json:"id"                     gorm:"primaryKey"                                       faker:"-"`
	UUID                string          `json:"uuid"                   gorm:"not null;unique"                                  faker:"word,unique"`
	TTL                 int             `json:"ttl"                    gorm:"column:ttl;not null;default:7"                                        default:"7"`
	DaysBeforeTTLExpiry int             `json:"days_before_ttl_expiry" gorm:"column:days_before_ttl_expiry;not null;default:2"                     default:"2"`
	Name                string          `json:"name"                   gorm:"not null"`
	Members             []ProjectMember `json:"members"                                                                        faker:"-"`
	UserID              uint            `json:"user_id"`
	User                User            `json:"user"                                                                           faker:"-"`
	Environments        []Environment   `json:"environments"                                                                   faker:"-"`
	OrganizationID      uint            `json:"organization_id"`
	Organization        Organization    `json:"organization"`
	CreatedAt           time.Time       `json:"created_at"`
	UpdatedAt           time.Time       `json:"updated_at"`
}

func (*Project) BeforeCreate

func (p *Project) BeforeCreate(tx *gorm.DB) (err error)

func (*Project) BeforeUpdate

func (p *Project) BeforeUpdate(tx *gorm.DB) (err error)

func (*Project) Deserialize

func (p *Project) Deserialize(in io.Reader) error

func (*Project) GetEnvironment

func (p *Project) GetEnvironment(environmentName string) *Environment

func (*Project) Serialize

func (p *Project) Serialize(out *string) (err error)

type ProjectMember

type ProjectMember struct {
	ID        uint      `json:"id"         gorm:"primaryKey"`
	User      User      `json:"user"`
	UserID    uint      `json:"user_id"    gorm:"uniqueIndex:project_members_user_id_project_id_key"`
	Project   Project   `json:"project"`
	ProjectID uint      `json:"project_id" gorm:"uniqueIndex:project_members_user_id_project_id_key"`
	Role      Role      `json:"role"`
	RoleID    uint      `json:"role_id"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

func (*ProjectMember) BeforeCreate

func (pm *ProjectMember) BeforeCreate(tx *gorm.DB) (err error)

func (*ProjectMember) BeforeUpdate

func (pm *ProjectMember) BeforeUpdate(tx *gorm.DB) (err error)

func (*ProjectMember) Deserialize

func (pm *ProjectMember) Deserialize(in io.Reader) error

func (*ProjectMember) Serialize

func (pm *ProjectMember) Serialize(out *string) (err error)

type ProjectMembers

type ProjectMembers []ProjectMember

func (ProjectMembers) GroupByRole

func (pms ProjectMembers) GroupByRole() map[Role]ProjectMembers

type PublicKeys

type PublicKeys struct {
	Keys []UserDevices `json:"keys"`
}

func (*PublicKeys) Deserialize

func (p *PublicKeys) Deserialize(in io.Reader) error

func (*PublicKeys) Serialize

func (p *PublicKeys) Serialize(out *string) error

type RemoveDeviceResponse

type RemoveDeviceResponse struct {
	Success bool   `json:"success"`
	Error   string `json:"error"`
}

func (*RemoveDeviceResponse) Deserialize

func (pm *RemoveDeviceResponse) Deserialize(in io.Reader) error

func (*RemoveDeviceResponse) Serialize

func (pm *RemoveDeviceResponse) Serialize(out *string) (err error)

type RemoveMembersPayload

type RemoveMembersPayload struct {
	Members []string
}

func (*RemoveMembersPayload) Deserialize

func (pm *RemoveMembersPayload) Deserialize(in io.Reader) error

func (*RemoveMembersPayload) Serialize

func (pm *RemoveMembersPayload) Serialize(out *string) (err error)

type RemoveMembersResponse

type RemoveMembersResponse struct {
	Success bool   `json:"success"`
	Error   string `json:"error"`
}

func (*RemoveMembersResponse) Deserialize

func (pm *RemoveMembersResponse) Deserialize(in io.Reader) error

func (*RemoveMembersResponse) Serialize

func (pm *RemoveMembersResponse) Serialize(out *string) (err error)

type Role

type Role struct {
	ID           uint      `json:"id"             gorm:"primaryKey"`
	Name         string    `json:"name"`
	Description  string    `json:"description"`
	ParentID     uint      `json:"parent_id"`
	Parent       *Role     `json:"parent"         gorm:"references:ID;foreignKey:ParentID"`
	CanAddMember bool      `json:"can_add_member"`
	CreatedAt    time.Time `json:"created_at"`
	UpdatedAt    time.Time `json:"updated_at"`
}

func (*Role) BeforeCreate

func (u *Role) BeforeCreate(tx *gorm.DB) (err error)

func (*Role) BeforeUpdate

func (u *Role) BeforeUpdate(tx *gorm.DB) (err error)

func (*Role) Deserialize

func (e *Role) Deserialize(in io.Reader) error

func (*Role) Serialize

func (u *Role) Serialize(out *string) (err error)

type RoleSorter

type RoleSorter struct {
	// contains filtered or unexported fields
}

Sort interface

func NewRoleSorter

func NewRoleSorter(roles []Role) *RoleSorter

func (*RoleSorter) Len

func (rs *RoleSorter) Len() int

func (*RoleSorter) Less

func (rs *RoleSorter) Less(i, j int) bool

func (*RoleSorter) Sort

func (rs *RoleSorter) Sort() []Role

func (*RoleSorter) Swap

func (rs *RoleSorter) Swap(i, j int)

type Roles

type Roles []Role

func (Roles) MapWithMembersRoleNames

func (rs Roles) MapWithMembersRoleNames(
	memberRoleNames map[string]string,
) (map[string]Role, error)

type RolesEnvironmentType

type RolesEnvironmentType struct {
	ID                uint            `json:"id"                  gorm:"primaryKey"`
	RoleID            uint            `json:"role_id"`
	Role              Role            `json:"role"`
	EnvironmentTypeID uint            `json:"environment_type_id"`
	EnvironmentType   EnvironmentType `json:"environment_type"`
	Name              string          `json:"name"                gorm:"not null"`
	Read              bool            `json:"read"`
	Write             bool            `json:"write"`
	CreatedAt         time.Time       `json:"created_at"`
	UpdatedAt         time.Time       `json:"updated_at"`
}

func (*RolesEnvironmentType) BeforeCreate

func (e *RolesEnvironmentType) BeforeCreate(tx *gorm.DB) (err error)

func (*RolesEnvironmentType) BeforeUpdate

func (e *RolesEnvironmentType) BeforeUpdate(tx *gorm.DB) (err error)

func (*RolesEnvironmentType) Deserialize

func (e *RolesEnvironmentType) Deserialize(in io.Reader) error

func (*RolesEnvironmentType) Serialize

func (u *RolesEnvironmentType) Serialize(out *string) (err error)

type Secret

type Secret struct {
	ID        uint       `gorm:"primaryKey" join:"id"`
	Name      string     `gorm:"not null"             json:"name"`
	Type      SecretType `gorm:"not null"             json:"type"`
	CreatedAt time.Time  `gorm:"not null"             json:"created_at"`
	UpdatedAt time.Time  `                            json:"updated_at"`
}

func (*Secret) BeforeCreate

func (s *Secret) BeforeCreate(tx *gorm.DB) (err error)

func (*Secret) BeforeUpdate

func (s *Secret) BeforeUpdate(tx *gorm.DB) (err error)

func (*Secret) Deserialize

func (u *Secret) Deserialize(in io.Reader) error

func (*Secret) Serialize

func (u *Secret) Serialize(out *string) (err error)

type SecretType

type SecretType string
const (
	SecretString SecretType = "string"
	SecretFile   SecretType = "file"
)

type SecretVal

type SecretVal struct {
	Label string `json:"label"`
	Value string `json:"value"`
}

type SetMemberRolePayload

type SetMemberRolePayload struct {
	MemberID string
	RoleName string
}

func (*SetMemberRolePayload) Deserialize

func (pm *SetMemberRolePayload) Deserialize(in io.Reader) error

func (*SetMemberRolePayload) Serialize

func (pm *SetMemberRolePayload) Serialize(out *string) (err error)

type SetVariablePayload

type SetVariablePayload struct {
	VarName   string `json:"var_name"`
	UserValue []struct {
		UserID string `json:"user_id"`
		Value  []byte `json:"value"`
	} `json:"user_env_value"`
}

func (*SetVariablePayload) Deserialize

func (svp *SetVariablePayload) Deserialize(in io.Reader) error

func (*SetVariablePayload) Serialize

func (svp *SetVariablePayload) Serialize(out *string) (err error)

type StartSubscriptionResponse

type StartSubscriptionResponse struct {
	SessionID string `json:"session_id"`
	Url       string `json:"url"`
}

func (*StartSubscriptionResponse) Deserialize

func (e *StartSubscriptionResponse) Deserialize(in io.Reader) error

func (*StartSubscriptionResponse) Serialize

func (u *StartSubscriptionResponse) Serialize(out *string) (err error)

type User

type User struct {
	ID            uint           `json:"id"            gorm:"primaryKey"              faker:"-"`
	AccountType   AccountType    `json:"account_type"  gorm:"default:custom"          faker:"oneof: github, gitlab"`
	UserID        string         `json:"user_id"       gorm:"uniqueIndex"`
	ExtID         string         `json:"ext_id"                                       faker:"uuid_digit"`
	Username      string         `json:"username"                                     faker:"username"`
	Fullname      string         `json:"fullname"      gorm:"not null"                faker:"name"`
	Email         string         `json:"email"         gorm:"not null"                faker:"email"`
	CreatedAt     time.Time      `json:"created_at"`
	UpdatedAt     time.Time      `json:"updated_at"`
	Devices       []Device       `json:"devices"       gorm:"many2many:user_devices;" faker:"-"`
	Organizations []Organization `json:"organizations"                                faker:"-"`
}

func (*User) BeforeCreate

func (u *User) BeforeCreate(tx *gorm.DB) (err error)

func (*User) BeforeUpdate

func (u *User) BeforeUpdate(tx *gorm.DB) (err error)

func (*User) Deserialize

func (u *User) Deserialize(in io.Reader) error

func (*User) FromId

func (u *User) FromId(id string)

func (*User) GetName

func (u *User) GetName() (name string)

func (*User) Serialize

func (u *User) Serialize(out *string) (err error)

type UserDevice

type UserDevice struct {
	ID           uint      `json:"id"         gorm:"primaryKey"`
	User         User      `json:"user"`
	UserID       uint      `json:"user_id"    gorm:"uniqueIndex:user_devices_user_id_device_id_key"`
	Device       Device    `json:"device"`
	DeviceID     uint      `json:"device_id"  gorm:"uniqueIndex:user_devices_user_id_device_id_key"`
	NewlyCreated bool      `json:"newly_created"`
	CreatedAt    time.Time `json:"created_at"`
	UpdatedAt    time.Time `json:"updated_at"`
}

func (*UserDevice) BeforeCreate

func (ud *UserDevice) BeforeCreate(tx *gorm.DB) (err error)

func (*UserDevice) BeforeUpdate

func (ud *UserDevice) BeforeUpdate(tx *gorm.DB) (err error)

func (*UserDevice) Deserialize

func (ud *UserDevice) Deserialize(in io.Reader) error

func (*UserDevice) Serialize

func (ud *UserDevice) Serialize(out *string) (err error)

type UserDevices

type UserDevices struct {
	UserID  uint     `json:"user_id"`
	UserUID string   `json:"user_uid"` // UserID as string (e.g: toto@github)
	Devices []Device `json:"publick_keys" gorm:"many2many:user_devices"`
}

func (*UserDevices) Deserialize

func (upk *UserDevices) Deserialize(in io.Reader) error

func (UserDevices) Serialize

func (upk UserDevices) Serialize(out *string) (err error)

Jump to

Keyboard shortcuts

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