admin

package
v0.0.0-...-260b785 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IntegrationInterface

type IntegrationInterface interface {
	HandleConfigAuth(ctx context.Context, resource, op string, claims map[string]interface{}, attr map[string]string) config.IntegrationAuthResponse
	InvokeHook(ctx context.Context, params model.RequestParams) config.IntegrationAuthResponse
}

IntegrationInterface s used to describe the features of integration manager we need.

type Manager

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

Manager manages all admin transactions

func New

func New(nodeID, clusterID string, isDev bool, adminUserInfo *config.AdminUser) *Manager

New creates a new admin manager instance

func (*Manager) CheckIfAdmin

func (m *Manager) CheckIfAdmin(ctx context.Context, token string) error

CheckIfAdmin simply checks the token

func (*Manager) CheckIfCachingCanBeEnabled

func (m *Manager) CheckIfCachingCanBeEnabled(ctx context.Context) error

CheckIfCachingCanBeEnabled checks if the user can configure caching module

func (*Manager) GenerateToken

func (m *Manager) GenerateToken(ctx context.Context, token string, tokenClaims map[string]interface{}) (string, error)

GenerateToken creates a token with the appropriate claims

func (*Manager) GetClusterID

func (m *Manager) GetClusterID() string

GetClusterID returns the cluster id

func (*Manager) GetCredentials

func (m *Manager) GetCredentials() map[string]interface{}

GetCredentials gets user name & pass

func (*Manager) GetIntegrationToken

func (m *Manager) GetIntegrationToken(id string) (string, error)

GetIntegrationToken returns the admin token required by an intergation

func (*Manager) GetInternalAccessToken

func (m *Manager) GetInternalAccessToken() (string, error)

GetInternalAccessToken returns the token that can be used internally by Space Cloud

func (*Manager) GetPermissions

func (m *Manager) GetPermissions(ctx context.Context, params model.RequestParams) (int, interface{}, error)

GetPermissions returns the permissions the user has. The permissions is for the format `projectId:resource`. This only applies to the config level endpoints.

func (*Manager) GetSecret

func (m *Manager) GetSecret() string

GetSecret returns the admin secret

func (*Manager) IsDBConfigValid

func (m *Manager) IsDBConfigValid(config config.DatabaseConfigs) error

IsDBConfigValid checks if the database config is valid

func (*Manager) IsTokenValid

func (m *Manager) IsTokenValid(ctx context.Context, token, resource, op string, attr map[string]string) (model.RequestParams, error)

IsTokenValid checks if the token is valid

func (*Manager) LoadEnv

func (m *Manager) LoadEnv() (bool, string, error)

LoadEnv gets the env

func (*Manager) Login

func (m *Manager) Login(ctx context.Context, user, pass string) (int, string, error)

Login handles the admin login operation

func (*Manager) RefreshToken

func (m *Manager) RefreshToken(ctx context.Context, token string) (string, error)

RefreshToken is used to create a new token based on an existing one

func (*Manager) SetIntegrationConfig

func (m *Manager) SetIntegrationConfig(integrations config.Integrations)

SetIntegrationConfig sets integration config

func (*Manager) SetIntegrationMan

func (m *Manager) SetIntegrationMan(i IntegrationInterface)

SetIntegrationMan sets integration manager

func (*Manager) SetServices

func (m *Manager) SetServices(eventType string, services model.ScServices)

SetServices sets services in admin

func (*Manager) SetSyncMan

func (m *Manager) SetSyncMan(s model.SyncManAdminInterface)

SetSyncMan sets syncman manager

func (*Manager) ValidateProjectSyncOperation

func (m *Manager) ValidateProjectSyncOperation(c *config.Config, project *config.ProjectConfig) bool

ValidateProjectSyncOperation validates if an operation is permitted based on the mode

Jump to

Keyboard shortcuts

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