Documentation
¶
Index ¶
- Constants
- Variables
- func CreateApiKeyAuditEvent(ctx context.Context, al *zap.Logger, action string, id string)
- func CreateClusterAuditEvent(ctx context.Context, al *zap.Logger, action string, name string, id uuid.UUID, ...)
- func CreateGroupAuditEvent(ctx context.Context, al *zap.Logger, db bun.IDB, action string, name string, ...)
- func CreateIdpAuditEvent(ctx context.Context, al *zap.Logger, action string, name string, id uuid.UUID)
- func CreateLocationAuditEvent(ctx context.Context, al *zap.Logger, action string, name string, id uuid.UUID)
- func CreateOidcAuditEvent(ctx context.Context, al *zap.Logger, action string, name string, id uuid.UUID)
- func CreateOrganizationAuditEvent(ctx context.Context, al *zap.Logger, action string, name string, id uuid.UUID, ...)
- func CreatePartnerAuditEvent(ctx context.Context, al *zap.Logger, action string, name string, id uuid.UUID)
- func CreateProjectAuditEvent(ctx context.Context, al *zap.Logger, action string, name string, id uuid.UUID)
- func CreateRoleAuditEvent(ctx context.Context, al *zap.Logger, action string, name string, id uuid.UUID, ...)
- func CreateUserAuditEvent(ctx context.Context, al *zap.Logger, db bun.IDB, action string, name string, ...)
- func DownloadCliConfigAuditEvent(ctx context.Context, al *zap.Logger, action string, user string)
- func DownloadKubeconfigAuditEvent(ctx context.Context, al *zap.Logger, user string)
- func GetSessionDataFromContext(ctx context.Context) (*commonv3.SessionData, bool)
- func IsInternalRequest(ctx context.Context) bool
- func RevokeKubeconfigAuditEvent(ctx context.Context, al *zap.Logger, user string)
- type AccountPermissionService
- type ApUpdate
- type ApiKeyService
- type AuditLogService
- type AuthzService
- type BootstrapService
- type ClusterService
- type ElasticSearchQuery
- type GroupPermissionService
- type GroupService
- type IdpService
- type KubeconfigRevocationService
- type KubeconfigSettingService
- type KubectlClusterSettingsService
- type MetroService
- type NamespaceService
- type OIDCProviderService
- type OrganizationService
- type PartnerService
- type ProjectService
- type RelayAuditService
- type RoleService
- type RolepermissionService
- type UserService
Constants ¶
const ( AuditActionCreate = "create" AuditActionDelete = "delete" AuditActionUpdate = "update" AuditActionDownload = "download" )
Variables ¶
var KEKFunc cryptoutil.PasswordFunc
Functions ¶
func CreateApiKeyAuditEvent ¶
func CreateClusterAuditEvent ¶
func CreateGroupAuditEvent ¶
func CreateIdpAuditEvent ¶
func CreateLocationAuditEvent ¶
func CreateLocationAuditEvent(ctx context.Context, al *zap.Logger, action string, name string, id uuid.UUID)
TODO: figure out how this is to be added
func CreateOidcAuditEvent ¶
func CreatePartnerAuditEvent ¶
func CreateProjectAuditEvent ¶
func CreateRoleAuditEvent ¶
func CreateUserAuditEvent ¶
func DownloadCliConfigAuditEvent ¶ added in v0.1.3
func DownloadKubeconfigAuditEvent ¶ added in v0.1.3
func GetSessionDataFromContext ¶
func GetSessionDataFromContext(ctx context.Context) (*commonv3.SessionData, bool)
func IsInternalRequest ¶
Types ¶
type AccountPermissionService ¶
type AccountPermissionService interface { GetAccountPermissions(ctx context.Context, accountID string, orgID, partnerID string) ([]sentry.AccountPermission, error) IsPartnerSuperAdmin(ctx context.Context, accountID, partnerID string) (isPartnerAdmin, isSuperAdmin bool, err error) GetAccountProjectsByPermission(ctx context.Context, accountID, orgID, partnerID string, permission string) ([]sentry.AccountPermission, error) GetAccountPermissionsByProjectIDPermissions(ctx context.Context, accountID, orgID, partnerID string, projects, permissions []string) ([]sentry.AccountPermission, error) GetAcccountsWithApprovalPermission(ctx context.Context, orgID, partnerID string) ([]string, error) GetSSOAcccountsWithApprovalPermission(ctx context.Context, orgID, partnerID string) ([]string, error) IsOrgAdmin(ctx context.Context, accountID, partnerID string) (isOrgAdmin bool, err error) GetAccount(ctx context.Context, accountID string) (*models.Account, error) GetAccountGroups(ctx context.Context, accountID string) ([]string, error) IsAccountActive(ctx context.Context, accountID, orgID string) (bool, error) IsSSOAccount(ctx context.Context, accountID string) (bool, error) }
AccountPermissionService is the interface for account permission operations
func NewAccountPermissionService ¶
func NewAccountPermissionService(db *bun.DB) AccountPermissionService
NewKubeconfigRevocation return new kubeconfig revocation service
type ApiKeyService ¶
type ApiKeyService interface { // create api key Create(ctx context.Context, req *rpcv3.ApiKeyRequest) (*models.ApiKey, error) // get by user Get(ctx context.Context, req *rpcv3.ApiKeyRequest) (*models.ApiKey, error) // get by key GetByKey(ctx context.Context, req *rpcv3.ApiKeyRequest) (*models.ApiKey, error) // delete api key Delete(ctx context.Context, req *rpcv3.ApiKeyRequest) (*rpcv3.UserDeleteApiKeysResponse, error) // list api keys List(ctx context.Context, req *rpcv3.ApiKeyRequest) (*rpcv3.UserListApiKeysResponse, error) }
ApiKeyService is the interface for api key operations
func NewApiKeyService ¶
func NewApiKeyService(db *bun.DB, al *zap.Logger) ApiKeyService
NewApiKeyService return new api key service
type AuditLogService ¶
type AuditLogService interface { GetAuditLog(req *v1.GetAuditLogSearchRequest) (res *v1.GetAuditLogSearchResponse, err error) GetAuditLogByProjects(req *v1.GetAuditLogSearchRequest) (res *v1.GetAuditLogSearchResponse, err error) }
func NewAuditLogDatabaseService ¶ added in v0.1.8
func NewAuditLogDatabaseService(db *bun.DB, tag string) (AuditLogService, error)
func NewAuditLogElasticSearchService ¶ added in v0.1.8
func NewAuditLogElasticSearchService(url string, auditPattern string, logPrefix string) (AuditLogService, error)
type AuthzService ¶
type AuthzService interface { Enforce(context.Context, *authzpbv1.EnforceRequest) (*authzpbv1.BoolReply, error) ListPolicies(context.Context, *authzpbv1.Policy) (*authzpbv1.Policies, error) CreatePolicies(context.Context, *authzpbv1.Policies) (*authzpbv1.BoolReply, error) DeletePolicies(context.Context, *authzpbv1.Policy) (*authzpbv1.BoolReply, error) ListUserGroups(context.Context, *authzpbv1.UserGroup) (*authzpbv1.UserGroups, error) CreateUserGroups(ctx context.Context, p *authzpbv1.UserGroups) (*authzpbv1.BoolReply, error) DeleteUserGroups(ctx context.Context, p *authzpbv1.UserGroup) (*authzpbv1.BoolReply, error) ListRolePermissionMappings(ctx context.Context, p *authzpbv1.FilteredRolePermissionMapping) (*authzpbv1.RolePermissionMappingList, error) CreateRolePermissionMappings(ctx context.Context, p *authzpbv1.RolePermissionMappingList) (*authzpbv1.BoolReply, error) DeleteRolePermissionMappings(ctx context.Context, p *authzpbv1.FilteredRolePermissionMapping) (*authzpbv1.BoolReply, error) }
func NewAuthzService ¶
func NewAuthzService(db *bun.DB, en *casbin.CachedEnforcer) AuthzService
type BootstrapService ¶
type BootstrapService interface { // bootstrap infra methods PatchBootstrapInfra(ctx context.Context, infra *sentry.BootstrapInfra) error GetBootstrapInfra(ctx context.Context, name string) (*sentry.BootstrapInfra, error) // bootstrap template methods PatchBootstrapAgentTemplate(ctx context.Context, template *sentry.BootstrapAgentTemplate) error GetBootstrapAgentTemplate(ctx context.Context, name string) (*sentry.BootstrapAgentTemplate, error) GetBootstrapAgentTemplateForToken(ctx context.Context, token string) (*sentry.BootstrapAgentTemplate, error) GetBootstrapAgentTemplateForHost(ctx context.Context, host string) (*sentry.BootstrapAgentTemplate, error) SelectBootstrapAgentTemplates(ctx context.Context, opts ...query.Option) (*sentry.BootstrapAgentTemplateList, error) // bootstrap agent methods CreateBootstrapAgent(ctx context.Context, agent *sentry.BootstrapAgent) error GetBootstrapAgent(ctx context.Context, templateRef string, opts ...query.Option) (*sentry.BootstrapAgent, error) GetBootstrapAgents(ctx context.Context, templateRef string, opts ...query.Option) (*sentry.BootstrapAgentList, error) GetBootstrapAgentForToken(ctx context.Context, token string) (*sentry.BootstrapAgent, error) GetBootstrapAgentCountForClusterID(ctx context.Context, clusterID string, orgID string) (int, error) GetBootstrapAgentForClusterID(ctx context.Context, clusterID string, orgID string) (*sentry.BootstrapAgent, error) SelectBootstrapAgents(ctx context.Context, templateRef string, opts ...query.Option) (*sentry.BootstrapAgentList, error) RegisterBootstrapAgent(ctx context.Context, token string) error DeleteBootstrapAgent(ctx context.Context, templateRef string, opts ...query.Option) error PatchBootstrapAgent(ctx context.Context, ba *sentry.BootstrapAgent, templateRef string, opts ...query.Option) error }
BootstrapService is the interface for bootstrap operations
func NewBootstrapService ¶
func NewBootstrapService(db *bun.DB) BootstrapService
NewBootstrapService return new bootstrap service
type ClusterService ¶
type ClusterService interface { // create Cluster Create(ctx context.Context, cluster *infrav3.Cluster) (*infrav3.Cluster, error) // get cluster Select(ctx context.Context, cluster *infrav3.Cluster, isExtended bool) (*infrav3.Cluster, error) // get cluster Get(ctx context.Context, opts ...query.Option) (*infrav3.Cluster, error) // create or update cluster Update(ctx context.Context, cluster *infrav3.Cluster) (*infrav3.Cluster, error) // delete cluster Delete(ctx context.Context, cluster *infrav3.Cluster) error // list cluster List(ctx context.Context, opts ...query.Option) (*infrav3.ClusterList, error) //update cluster status UpdateClusterConditionStatus(ctx context.Context, current *infrav3.Cluster) error // update cluster annotations UpdateClusterAnnotations(ctx context.Context, cluster *infrav3.Cluster) error //listen clusters ListenClusters(ctx context.Context, mChan chan<- commonv3.Metadata) //Get cluster projects GetClusterProjects(ctx context.Context, cluster *infrav3.Cluster) ([]models.ProjectCluster, error) //Validate and update cluster status UpdateStatus(ctx context.Context, current *infrav3.Cluster, opts ...query.Option) error // Create bootstrap agent for cluster CreateBootstrapAgentForCluster(ctx context.Context, cluster *infrav3.Cluster) error // Get relay config for cluster GetRelaysConfigForCluster(ctx context.Context, cluster *infrav3.Cluster) ([]common.Relay, error) // Update projects for bootstrap agents for cluster UpdateProjectsForBootstrapAgentForCluster(ctx context.Context, cluster *infrav3.Cluster) error //Add event handlers AddEventHandler(evh event.Handler) }
func NewClusterService ¶
func NewClusterService(db *bun.DB, data *common.DownloadData, bs BootstrapService, al *zap.Logger) ClusterService
NewClusterService return new cluster service
type ElasticSearchQuery ¶
func NewElasticSearchQuery ¶
func NewElasticSearchQuery(url string, indexPattern string, logPrefix string) (ElasticSearchQuery, error)
type GroupPermissionService ¶
type GroupPermissionService interface { GetGroupPermissions(ctx context.Context, groupNames []string, orgID, partnerID string) ([]sentry.GroupPermission, error) GetGroupProjectsByPermission(ctx context.Context, groupNames []string, orgID, partnerID string, permission string) ([]sentry.GroupPermission, error) GetGroupPermissionsByProjectIDPermissions(ctx context.Context, groupNames []string, orgID, partnerID string, projects []string, permissions []string) ([]sentry.GroupPermission, error) GetProjectByGroup(ctx context.Context, groupNames []string, orgID, partnerID string) ([]sentry.GroupPermission, error) }
GroupPermissionService is the interface for group permission operations
func NewGroupPermissionService ¶
func NewGroupPermissionService(db *bun.DB) GroupPermissionService
NewKubeconfigRevocation return new kubeconfig revocation service
type GroupService ¶
type GroupService interface { // create group Create(context.Context, *userv3.Group) (*userv3.Group, error) // get group by id GetByID(context.Context, *userv3.Group) (*userv3.Group, error) // get group by name GetByName(context.Context, *userv3.Group) (*userv3.Group, error) // create or update group Update(context.Context, *userv3.Group) (*userv3.Group, error) // delete group Delete(context.Context, *userv3.Group) (*userv3.Group, error) // list groups List(context.Context, ...query.Option) (*userv3.GroupList, error) }
GroupService is the interface for group operations
func NewGroupService ¶
func NewGroupService(db *bun.DB, azc AuthzService, al *zap.Logger) GroupService
NewGroupService return new group service
type IdpService ¶
type IdpService interface { Create(context.Context, *systemv3.Idp) (*systemv3.Idp, error) GetByID(context.Context, *systemv3.Idp) (*systemv3.Idp, error) GetByName(context.Context, *systemv3.Idp) (*systemv3.Idp, error) List(context.Context) (*systemv3.IdpList, error) Update(context.Context, *systemv3.Idp) (*systemv3.Idp, error) Delete(context.Context, *systemv3.Idp) error }
func NewIdpService ¶
type KubeconfigRevocationService ¶
type KubeconfigRevocationService interface { Get(ctx context.Context, orgID string, accountID string, isSSOUser bool) (*sentry.KubeconfigRevocation, error) Patch(ctx context.Context, kr *sentry.KubeconfigRevocation) error }
KubeconfigRevocation is the interface for bootstrap operations
func NewKubeconfigRevocationService ¶
func NewKubeconfigRevocationService(db *bun.DB, al *zap.Logger) KubeconfigRevocationService
NewKubeconfigRevocation return new kubeconfig revocation service
type KubeconfigSettingService ¶
type KubeconfigSettingService interface { Get(ctx context.Context, orgID string, accountID string, isSSO bool) (*sentry.KubeconfigSetting, error) Patch(ctx context.Context, ks *sentry.KubeconfigSetting) error }
KubeconfigSettingService is the interface for kube config setting operations
func NewKubeconfigSettingService ¶
func NewKubeconfigSettingService(db *bun.DB) KubeconfigSettingService
NewKubeconfigSettingService return new kubeconfig setting service
type KubectlClusterSettingsService ¶
type KubectlClusterSettingsService interface { Get(ctx context.Context, orgID string, clusterID string) (*sentry.KubectlClusterSettings, error) Patch(ctx context.Context, kc *sentry.KubectlClusterSettings) error }
KubectlClusterSettingsService is the interface for kubectl cluster setting operations
func NewkubectlClusterSettingsService ¶
func NewkubectlClusterSettingsService(db *bun.DB) KubectlClusterSettingsService
NewKubectlClusterSettingsService return new kubectl cluster setting service
type MetroService ¶
type MetroService interface { // create metro Create(ctx context.Context, metro *infrav3.Location) (*infrav3.Location, error) // get metro by id GetById(ctx context.Context, id uuid.UUID) (*infrav3.Location, error) // get metro by name GetByName(ctx context.Context, name string) (*infrav3.Location, error) // get metro id by name GetIDByName(ctx context.Context, name string) (uuid.UUID, error) // create or update metro Update(ctx context.Context, metro *infrav3.Location) (*infrav3.Location, error) // delete metro Delete(ctx context.Context, metro *infrav3.Location) (*infrav3.Location, error) // list metro List(ctx context.Context, partner string) (*infrav3.LocationList, error) }
MetroService is the interface for metro operations
func NewMetroService ¶
func NewMetroService(db *bun.DB) MetroService
NewProjectService return new project service
type NamespaceService ¶
type NamespaceService interface { // GetProjectNamespaces GetProjectNamespaces(ctx context.Context, projectID uuid.UUID) ([]string, error) GetAccountProjectNamespaces(ctx context.Context, projectID uuid.UUID, accountID uuid.UUID) ([]string, error) GetGroupProjectNamespaces(ctx context.Context, projectID uuid.UUID, accountID uuid.UUID) ([]string, error) }
NamespaceService is the interface for namespace operations
func NewNamespaceService ¶
func NewNamespaceService(db *bun.DB) NamespaceService
NewNamespaceService return new namespace service
type OIDCProviderService ¶
type OIDCProviderService interface { Create(context.Context, *systemv3.OIDCProvider) (*systemv3.OIDCProvider, error) GetByID(context.Context, *systemv3.OIDCProvider) (*systemv3.OIDCProvider, error) GetByName(context.Context, *systemv3.OIDCProvider) (*systemv3.OIDCProvider, error) List(context.Context) (*systemv3.OIDCProviderList, error) Update(context.Context, *systemv3.OIDCProvider) (*systemv3.OIDCProvider, error) Delete(context.Context, *systemv3.OIDCProvider) error }
func NewOIDCProviderService ¶
type OrganizationService ¶
type OrganizationService interface { // create organization Create(ctx context.Context, organization *systemv3.Organization) (*systemv3.Organization, error) // get organization by id GetByID(ctx context.Context, id string) (*systemv3.Organization, error) // get organization by id GetByName(ctx context.Context, name string) (*systemv3.Organization, error) // create or update organization Update(ctx context.Context, organization *systemv3.Organization) (*systemv3.Organization, error) // delete organization Delete(ctx context.Context, organization *systemv3.Organization) (*systemv3.Organization, error) // list organization List(ctx context.Context, organization *systemv3.Organization) (*systemv3.OrganizationList, error) }
OrganizationService is the interface for organization operations
func NewOrganizationService ¶
func NewOrganizationService(db *bun.DB, al *zap.Logger) OrganizationService
NewOrganizationService return new organization service
type PartnerService ¶
type PartnerService interface { // create partner Create(ctx context.Context, partner *systemv3.Partner) (*systemv3.Partner, error) // get partner by id GetByID(ctx context.Context, partnerId string) (*systemv3.Partner, error) // get partner by id GetByName(ctx context.Context, name string) (*systemv3.Partner, error) // create or update partner Update(ctx context.Context, partner *systemv3.Partner) (*systemv3.Partner, error) // delete partner Delete(ctx context.Context, partner *systemv3.Partner) (*systemv3.Partner, error) // list partner GetOnlyPartner(ctx context.Context) (*systemv3.Partner, error) }
PartnerService is the interface for partner operations
func NewPartnerService ¶
func NewPartnerService(db *bun.DB, al *zap.Logger) PartnerService
NewPartnerService return new partner service
type ProjectService ¶
type ProjectService interface { // create project Create(ctx context.Context, project *systemv3.Project) (*systemv3.Project, error) // get project by id GetByID(ctx context.Context, id string) (*systemv3.Project, error) // get project by name GetByName(ctx context.Context, name string) (*systemv3.Project, error) // create or update project Update(ctx context.Context, project *systemv3.Project) (*systemv3.Project, error) // delete project Delete(ctx context.Context, project *systemv3.Project) (*systemv3.Project, error) // list projects List(ctx context.Context, project *systemv3.Project) (*systemv3.ProjectList, error) }
ProjectService is the interface for project operations
func NewProjectService ¶
func NewProjectService(db *bun.DB, azc AuthzService, al *zap.Logger, dev bool) ProjectService
NewProjectService return new project service
type RelayAuditService ¶
type RelayAuditService interface { GetRelayAudit(req *v1.RelayAuditRequest) (res *v1.RelayAuditResponse, err error) GetRelayAuditByProjects(req *v1.RelayAuditRequest) (res *v1.RelayAuditResponse, err error) }
func NewRelayAuditDatabaseService ¶ added in v0.1.8
func NewRelayAuditDatabaseService(db *bun.DB, tag string) (RelayAuditService, error)
func NewRelayAuditElasticSearchService ¶ added in v0.1.8
func NewRelayAuditElasticSearchService(url string, auditPattern string, logPrefix string) (RelayAuditService, error)
type RoleService ¶
type RoleService interface { // create role Create(context.Context, *rolev3.Role) (*rolev3.Role, error) // get role by id GetByID(context.Context, *rolev3.Role) (*rolev3.Role, error) // get role by name GetByName(context.Context, *rolev3.Role) (*rolev3.Role, error) // create or update role Update(context.Context, *rolev3.Role) (*rolev3.Role, error) // delete role Delete(context.Context, *rolev3.Role) (*rolev3.Role, error) // list roles List(context.Context, *rolev3.Role) (*rolev3.RoleList, error) }
RoleService is the interface for role operations
func NewRoleService ¶
func NewRoleService(db *bun.DB, azc AuthzService, al *zap.Logger) RoleService
NewRoleService return new role service
type RolepermissionService ¶
type RolepermissionService interface { // get rolepermission by name GetByName(context.Context, *rolev3.RolePermission) (*rolev3.RolePermission, error) // list rolepermissions List(context.Context, ...query.Option) (*rolev3.RolePermissionList, error) }
RolepermissionService is the interface for rolepermission operations
func NewRolepermissionService ¶
func NewRolepermissionService(db *bun.DB) RolepermissionService
NewRolepermissionService return new rolepermission service
type UserService ¶
type UserService interface { // create user Create(context.Context, *userv3.User) (*userv3.User, error) // get user by id GetByID(context.Context, *userv3.User) (*userv3.User, error) // get user by name GetByName(context.Context, *userv3.User) (*userv3.User, error) // get full user info GetUserInfo(context.Context, *userv3.User) (*userv3.UserInfo, error) // create or update user Update(context.Context, *userv3.User) (*userv3.User, error) // delete user Delete(context.Context, *userv3.User) (*userrpcv3.UserDeleteApiKeysResponse, error) // list users List(context.Context, ...query.Option) (*userv3.UserList, error) // retrieve the cli config for the logged in user RetrieveCliConfig(ctx context.Context, req *userrpcv3.ApiKeyRequest) (*common.CliConfigDownloadData, error) // Update UserGroup casbin for OIdC/Idp users UpdateIdpUserGroupPolicy(context.Context, string, string, string) error // Generate recovery link for users ForgotPassword(context.Context, *userrpcv3.UserForgotPasswordRequest) (*userrpcv3.UserForgotPasswordResponse, error) }
GroupService is the interface for group operations
func NewUserService ¶
func NewUserService(ap providers.AuthProvider, db *bun.DB, azc AuthzService, kss ApiKeyService, cfg common.CliConfigDownloadData, al *zap.Logger, dev bool) UserService
Source Files
¶
- account_permission.go
- apikey.go
- audit_log.go
- audit_log_db.go
- audit_log_es_query.go
- audit_utils.go
- authz.go
- bootstrap.go
- cluster.go
- const.go
- elastic_search_query.go
- group.go
- group_permission.go
- idp.go
- kubeconfig_revocation.go
- kubeconfig_settings.go
- kubectl_cluster_setting.go
- metro.go
- mocks.go
- namespace.go
- oidc_provider.go
- organization.go
- partner.go
- project.go
- relay_audit_db.go
- relay_audit_es_query.go
- role.go
- rolepermission.go
- test_utils.go
- user.go
- utils.go