dao

package
v0.2.7 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KratosPasswordType = "password"
	KratosOidcType     = "oidc"
)

Variables

This section is empty.

Functions

func Create

func Create(ctx context.Context, db bun.IDB, entity interface{}) (interface{}, error)

func CreateBootstrapAgent

func CreateBootstrapAgent(ctx context.Context, db bun.IDB, ba *models.BootstrapAgent) error

func CreateKubeconfigRevocation

func CreateKubeconfigRevocation(ctx context.Context, db bun.IDB, kr *models.KubeconfigRevocation) error

func CreateKubeconfigSetting

func CreateKubeconfigSetting(ctx context.Context, db bun.IDB, ks *models.KubeconfigSetting) error

func CreateOrUpdateBootstrapAgentTemplate

func CreateOrUpdateBootstrapAgentTemplate(ctx context.Context, db bun.IDB, template *models.BootstrapAgentTemplate) error

func CreateOrUpdateBootstrapInfra

func CreateOrUpdateBootstrapInfra(ctx context.Context, db bun.IDB, infra *models.BootstrapInfra) error

func CreatekubectlClusterSettings

func CreatekubectlClusterSettings(ctx context.Context, db bun.IDB, kc *models.KubectlClusterSetting) error

func Delete

func Delete(ctx context.Context, db bun.IDB, id uuid.UUID, entity interface{}) error

func DeleteBootstrapAgent

func DeleteBootstrapAgent(ctx context.Context, db bun.IDB, templateRef string, opts *commonv3.QueryOptions) error

func DeleteBootstrapAgentTempate

func DeleteBootstrapAgentTempate(ctx context.Context, db bun.IDB, opts *commonv3.QueryOptions, infraRef string) error

func DeleteR

func DeleteR(ctx context.Context, db bun.IDB, id uuid.UUID, entity interface{}) error

DeleteR delete and returns the changed items

func DeleteX

func DeleteX(ctx context.Context, db bun.IDB, field string, value interface{}, entity interface{}) error

func DeleteXR

func DeleteXR(ctx context.Context, db bun.IDB, field string, value interface{}, entity interface{}) error

DeleteXR delete with selector and returns the changed items

func GetAcccountsWithApprovalPermission

func GetAcccountsWithApprovalPermission(ctx context.Context, db bun.IDB, orgID, partnerID uuid.UUID) ([]string, error)

func GetAccountBasics

func GetAccountBasics(ctx context.Context, db bun.IDB, accountID uuid.UUID) (*models.Account, error)

func GetAccountGroups

func GetAccountGroups(ctx context.Context, db bun.IDB, accountID uuid.UUID) ([]models.GroupAccount, error)

func GetAccountPermissions

func GetAccountPermissions(ctx context.Context, db bun.IDB, accountID, orgID, partnerID uuid.UUID) ([]models.AccountPermission, error)

func GetAccountPermissionsByProjectIDPermissions

func GetAccountPermissionsByProjectIDPermissions(ctx context.Context, db bun.IDB, accountID, orgID, partnerID uuid.UUID, projects []uuid.UUID, permissions []string) ([]models.AccountPermission, error)

func GetAccountProjectNamespaces

func GetAccountProjectNamespaces(ctx context.Context, db bun.IDB, projectID uuid.UUID, accountID uuid.UUID) ([]string, error)

func GetAccountProjectsByPermission

func GetAccountProjectsByPermission(ctx context.Context, db bun.IDB, accountID, orgID, partnerID uuid.UUID, permission string) ([]models.AccountPermission, error)

func GetAttributesByName added in v0.1.9

func GetAttributesByName(ctx context.Context, db bun.IDB, name string, entity interface{}, columns ...string) (interface{}, error)

func GetAuditLogAggregations added in v0.1.8

func GetAuditLogAggregations(ctx context.Context, db *bun.DB, tag, field string, filters query.QueryFilters) ([]models.AggregatorData, error)

func GetAuditLogs added in v0.1.8

func GetAuditLogs(ctx context.Context, db *bun.DB, tag string, filters query.QueryFilters) ([]models.AuditLog, error)

func GetBootstrapAgent

func GetBootstrapAgent(ctx context.Context, db bun.IDB, templateRef string, opts *commonv3.QueryOptions) (*models.BootstrapAgent, error)

func GetBootstrapAgentCountForClusterID

func GetBootstrapAgentCountForClusterID(ctx context.Context, db bun.IDB, clusterID string, orgID uuid.UUID) (int, error)

func GetBootstrapAgentForClusterID

func GetBootstrapAgentForClusterID(ctx context.Context, db bun.IDB, clusterID string, orgID uuid.UUID) (*models.BootstrapAgent, error)

func GetBootstrapAgentForToken

func GetBootstrapAgentForToken(ctx context.Context, db bun.IDB, token string) (*models.BootstrapAgent, error)

func GetBootstrapAgentTemplateForHost

func GetBootstrapAgentTemplateForHost(ctx context.Context, db bun.IDB, host string) (*models.BootstrapAgentTemplate, error)

func GetBootstrapAgentTemplateForToken

func GetBootstrapAgentTemplateForToken(ctx context.Context, db bun.IDB, token string) (*models.BootstrapAgentTemplate, error)

func GetBootstrapAgents

func GetBootstrapAgents(ctx context.Context, db bun.IDB, opts *commonv3.QueryOptions, templateRef string) (ret []models.BootstrapAgent, count int, err error)

func GetByID

func GetByID(ctx context.Context, db bun.IDB, id uuid.UUID, entity interface{}) (interface{}, error)

func GetByName

func GetByName(ctx context.Context, db bun.IDB, name string, entity interface{}) (interface{}, error)

func GetByNamePartnerOrg

func GetByNamePartnerOrg(ctx context.Context, db bun.IDB, name string, pid uuid.NullUUID, oid uuid.NullUUID, entity interface{}) (interface{}, error)

func GetDefaultAccountProject

func GetDefaultAccountProject(ctx context.Context, db bun.IDB, accountID uuid.UUID) (models.AccountPermission, error)

func GetDefaultUserGroup

func GetDefaultUserGroup(ctx context.Context, db bun.IDB, orgID uuid.UUID) (*models.Group, error)

func GetDefaultUserGroupAccount

func GetDefaultUserGroupAccount(ctx context.Context, db bun.IDB, accountID, groupID uuid.UUID) (*models.GroupAccount, error)

func GetFileteredProjects

func GetFileteredProjects(ctx context.Context, db bun.IDB, account, partner, org uuid.UUID) ([]models.Project, error)

func GetGroupPermissions

func GetGroupPermissions(ctx context.Context, db bun.IDB, groupNames []string, orgID, partnerID uuid.UUID) ([]models.GroupPermission, error)

func GetGroupPermissionsByProjectIDPermissions

func GetGroupPermissionsByProjectIDPermissions(ctx context.Context, db bun.IDB, groupNames []string, orgID, partnerID uuid.UUID, projects []string, permissions []string) ([]models.GroupPermission, error)

func GetGroupProjectNamespaces

func GetGroupProjectNamespaces(ctx context.Context, db bun.IDB, projectID uuid.UUID, accountID uuid.UUID) ([]string, error)

func GetGroupProjectsByPermission

func GetGroupProjectsByPermission(ctx context.Context, db bun.IDB, groupNames []string, orgID, partnerID uuid.UUID, permission string) ([]models.GroupPermission, error)

func GetGroupRoles

func GetGroupRoles(ctx context.Context, db bun.IDB, id uuid.UUID) ([]*userv3.ProjectNamespaceRole, error)

func GetGroups

func GetGroups(ctx context.Context, db bun.IDB, id uuid.UUID) ([]models.Group, error)

func GetIdByName

func GetIdByName(ctx context.Context, db bun.IDB, name string, entity interface{}) (interface{}, error)

func GetIdByNamePartnerOrg

func GetIdByNamePartnerOrg(ctx context.Context, db bun.IDB, name string, pid uuid.NullUUID, oid uuid.NullUUID, entity interface{}) (interface{}, error)

func GetKubeconfigRevocation

func GetKubeconfigRevocation(ctx context.Context, db bun.IDB, orgID, accountID uuid.UUID, isSSOUser bool) (*models.KubeconfigRevocation, error)

func GetKubeconfigSetting

func GetKubeconfigSetting(ctx context.Context, db bun.IDB, orgID, accountID uuid.UUID, issSSO bool) (*models.KubeconfigSetting, error)

func GetM

func GetM(ctx context.Context, db bun.IDB, checks map[string]interface{}, entity interface{}) (interface{}, error)

M for multi ;)

func GetNameById

func GetNameById(ctx context.Context, db bun.IDB, id uuid.UUID, entity interface{}) (interface{}, error)

func GetNamesByIds

func GetNamesByIds(ctx context.Context, db bun.IDB, id []uuid.UUID, entity interface{}) ([]string, error)

func GetOrganizationId

func GetOrganizationId(ctx context.Context, db bun.IDB, name string) (uuid.UUID, error)

func GetOrganizationName

func GetOrganizationName(ctx context.Context, db bun.IDB, id uuid.UUID) (string, error)

func GetPartnerId

func GetPartnerId(ctx context.Context, db bun.IDB, name string) (uuid.UUID, error)

func GetPartnerName

func GetPartnerName(ctx context.Context, db bun.IDB, id uuid.UUID) (string, error)

func GetProjectByGroup

func GetProjectByGroup(ctx context.Context, db bun.IDB, groupNames []string, orgID, partnerID uuid.UUID) ([]models.GroupPermission, error)

func GetProjectGroupRoles

func GetProjectGroupRoles(ctx context.Context, db bun.IDB, id uuid.UUID) ([]*userv3.ProjectNamespaceRole, error)

func GetProjectId

func GetProjectId(ctx context.Context, db bun.IDB, name string) (uuid.UUID, error)

func GetProjectName

func GetProjectName(ctx context.Context, db bun.IDB, id uuid.UUID) (string, error)

func GetProjectNamespaces

func GetProjectNamespaces(ctx context.Context, db bun.IDB, projectID uuid.UUID) ([]string, error)

func GetProjectUserRoles

func GetProjectUserRoles(ctx context.Context, db bun.IDB, id uuid.UUID) ([]*userv3.UserRole, error)

func GetQueryFilteredUsers

func GetQueryFilteredUsers(ctx context.Context, db bun.IDB, partner, org, group, role uuid.UUID, projects []uuid.UUID) ([]uuid.UUID, error)

func GetRolePermissions

func GetRolePermissions(ctx context.Context, db bun.IDB, id uuid.UUID) ([]models.ResourcePermission, error)

func GetRolePermissionsByNames added in v0.1.6

func GetRolePermissionsByNames(ctx context.Context, db bun.IDB, permissions ...string) ([]models.ResourcePermission, error)

func GetRolePermissionsByScope

func GetRolePermissionsByScope(ctx context.Context, db bun.IDB, scope string) ([]models.ResourcePermission, error)

func GetSSOAcccountsWithApprovalPermission

func GetSSOAcccountsWithApprovalPermission(ctx context.Context, db bun.IDB, orgID, partnerID uuid.UUID) ([]string, error)

func GetSSOUsersGroupProjectRole

func GetSSOUsersGroupProjectRole(ctx context.Context, db bun.IDB, orgID uuid.UUID) ([]models.SSOAccountGroupProjectRole, error)

func GetUserByEmail

func GetUserByEmail(ctx context.Context, db bun.IDB, name string, entity interface{}) (interface{}, error)

func GetUserFullByEmail

func GetUserFullByEmail(ctx context.Context, db bun.IDB, name string, entity interface{}) (interface{}, error)

func GetUserIdByEmail

func GetUserIdByEmail(ctx context.Context, db bun.IDB, name string, entity interface{}) (interface{}, error)

func GetUserLastAuthTime added in v0.1.7

func GetUserLastAuthTime(ctx context.Context, db bun.IDB, userId uuid.UUID) (time.Time, error)

func GetUserNamesByIds

func GetUserNamesByIds(ctx context.Context, db bun.IDB, id []uuid.UUID, entity interface{}) ([]string, error)

func GetUserRoles

func GetUserRoles(ctx context.Context, db bun.IDB, id uuid.UUID) ([]*userv3.ProjectNamespaceRole, error)

func GetUserType

func GetUserType(ctx context.Context, db bun.IDB, id uuid.UUID) (string, error)

func GetUsers

func GetUsers(ctx context.Context, db bun.IDB, id uuid.UUID) ([]models.KratosIdentities, error)

GetUsers gets the list of users in a given group

func GetX

func GetX(ctx context.Context, db bun.IDB, field string, value interface{}, entity interface{}) (interface{}, error)

func GetkubectlClusterSettings

func GetkubectlClusterSettings(ctx context.Context, db bun.IDB, orgID uuid.UUID, name string) (*models.KubectlClusterSetting, error)

func HardDeleteAll

func HardDeleteAll(ctx context.Context, db bun.IDB, entity interface{}) error

HardDeleteAll deletes all records in a table (primarily for use in scripts)

func IsOrgAdmin

func IsOrgAdmin(ctx context.Context, db bun.IDB, accountID, partnerID uuid.UUID) (isOrgAdmin bool, err error)

func IsOrgReadOnly added in v0.2.5

func IsOrgReadOnly(ctx context.Context, db bun.IDB, accountID, organizationID uuid.UUID, partnerID uuid.UUID) (isOrgReadOnly bool, err error)

func IsPartnerSuperAdmin

func IsPartnerSuperAdmin(ctx context.Context, db bun.IDB, accountID, partnerID uuid.UUID) (isPartnerAdmin, isSuperAdmin bool, err error)

func IsSSOAccount

func IsSSOAccount(ctx context.Context, db bun.IDB, id uuid.UUID) (bool, error)

func List

func List(ctx context.Context, db bun.IDB, partnerId uuid.NullUUID, organizationId uuid.NullUUID, entities interface{}) (interface{}, error)

func ListAll

func ListAll(ctx context.Context, db bun.IDB, entities interface{}) (interface{}, error)

func ListByProject

func ListByProject(ctx context.Context, db bun.IDB, partnerId uuid.NullUUID, organizationId uuid.NullUUID, projectId uuid.NullUUID, entities interface{}) error

func ListFiltered

func ListFiltered(ctx context.Context, db bun.IDB,
	partnerId uuid.NullUUID, organizationId uuid.NullUUID,
	projectId uuid.NullUUID, entities interface{},
	query string, orderBy string, order string,
	limit int, offset int) (interface{}, error)

TODO: Should we simplify this (less args)?

func ListFilteredUsers

func ListFilteredUsers(
	ctx context.Context,
	db bun.IDB,
	fusers []uuid.UUID,
	query string,
	utype string,
	orderBy string,
	order string,
	limit int,
	offset int,
) ([]models.KratosIdentities, error)

ListFilteredUsers will return the list of users fileterd by query

func ListFilteredUsersWithGroup

func ListFilteredUsersWithGroup(
	ctx context.Context,
	db bun.IDB,
	fusers []uuid.UUID,
	group uuid.UUID,
	query string,
	utype string,
	orderBy string,
	order string,
	limit int,
	offset int,
) ([]models.KratosIdentities, error)

ListFilteredUsersWithGroup is ListFilteredUsers but with Group fileter as well

func RegisterBootstrapAgent

func RegisterBootstrapAgent(ctx context.Context, db bun.Tx, token, ip, fingerprint string) error

func SelectBootstrapAgentTemplates

func SelectBootstrapAgentTemplates(ctx context.Context, db bun.IDB, opts *commonv3.QueryOptions) (ret []models.BootstrapAgentTemplate, count int, err error)

func SelectBootstrapAgents

func SelectBootstrapAgents(ctx context.Context, db bun.IDB, templateRef string, opts *commonv3.QueryOptions) (ret []models.BootstrapAgent, count int, err error)

func Update

func Update(ctx context.Context, db bun.IDB, id uuid.UUID, entity interface{}) (interface{}, error)

func UpdateBootstrapAgent

func UpdateBootstrapAgent(ctx context.Context, db bun.IDB, ba *models.BootstrapAgent, opts *commonv3.QueryOptions) error

func UpdateBootstrapAgentDeleteAt

func UpdateBootstrapAgentDeleteAt(ctx context.Context, db bun.IDB, templateRef string) error

updateBootstrapAgentDeleteAt builds query for deleting resource

func UpdateBootstrapAgentTempateDeleteAt

func UpdateBootstrapAgentTempateDeleteAt(ctx context.Context, db bun.IDB, opts *commonv3.QueryOptions) error

func UpdateBootstrapInfraDeleteAt

func UpdateBootstrapInfraDeleteAt(ctx context.Context, db bun.IDB, opts *commonv3.QueryOptions) error

updateBootstrapInfraDeleteAt builds query for deleting resource

func UpdateKubeconfigRevocation

func UpdateKubeconfigRevocation(ctx context.Context, db bun.IDB, kr *models.KubeconfigRevocation) error

func UpdateKubeconfigSetting

func UpdateKubeconfigSetting(ctx context.Context, db bun.IDB, ks *models.KubeconfigSetting) error

func UpdateX

func UpdateX(ctx context.Context, db bun.IDB, field string, value interface{}, entity interface{}) (interface{}, error)

func UpdatekubectlClusterSettings

func UpdatekubectlClusterSettings(ctx context.Context, db bun.IDB, kc *models.KubectlClusterSetting) error

Types

type ProjectOrg

type ProjectOrg struct {
	Project        string
	Organization   string
	ProjectId      string
	OrganizationId string
	PartnerId      string
}

func GetProjectOrganization

func GetProjectOrganization(ctx context.Context, db bun.IDB, name string) (ProjectOrg, error)

Jump to

Keyboard shortcuts

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