server

package
v0.0.0-...-be2ef80 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: Apache-2.0 Imports: 41 Imported by: 1

Documentation

Index

Constants

View Source
const (
	ProjectUpdateRunningState    ProjectUpdateState = "running"
	ProjectUpdateNotRunningState ProjectUpdateState = "not_running"

	ProjectUpdateStageApplyStagedRules     ProjectUpdateStage = "apply_staged_rules"
	ProjectUpdateStageUpdateDomainServices ProjectUpdateStage = "update_domain_services"
	ProjectUpdateStageUpdateDone           ProjectUpdateStage = "done"
	ProjectUpdateStageUpdateNone           ProjectUpdateStage = "none"
)

Variables

View Source
var (
	ProjectUpdateWorkflowName = cereal.NewWorkflowName("ProjectUpdate")
	ProjectUpdateInstanceName = "SingletonV1"
	ApplyStagedRulesTaskName  = cereal.NewTaskName("authz/ApplyStagedRules")
)
View Source
var ErrMessageBoxFull = errors.New("Message box full")
View Source
var ParallelProjectUpdateDomainServices = []string{}
View Source
var SerializedProjectUpdateDomainServices = []string{
	"compliance",
	"ingest",
	"nodemanager",
	"feed",
}

Functions

func GRPC

func GRPC(ctx context.Context,
	addr string, l logger.Logger, connFactory *secureconn.Factory,
	e engine.Engine, migrationsConfig migration.Config,
	dataMigrationsConfig datamigration.Config, cerealAddress string,
	projectLimit int) error

GRPC creates and listens on grpc server.

func InputValidationInterceptor

func InputValidationInterceptor() grpc.UnaryServerInterceptor

InputValidationInterceptor is a middleware for running the protobuf validation.

func NewGRPCServer

func NewGRPCServer(ctx context.Context,
	connFactory *secureconn.Factory, l logger.Logger,
	e engine.Engine, migrationsConfig migration.Config,
	dataMigrationsConfig datamigration.Config, cerealAddress string,
	projectLimit int) (*grpc.Server, error)

NewGRPCServer creates a grpc server.

func NewMemstoreProjectsServer

func NewMemstoreProjectsServer(
	ctx context.Context,
	l logger.Logger,
	projectUpdateCerealManager *cereal.Manager,
	pr PolicyRefresher,
) (api.ProjectsServiceServer, error)

NewMemstoreProjectsServer returns an instance of api.ProjectsServer

func NewPostgresAuthzServer

NewPostgresAuthzServer returns a new Authz server.

func NewPostgresProjectsServer

func NewPostgresProjectsServer(
	ctx context.Context,
	l logger.Logger,
	projectUpdateCerealManager *cereal.Manager,
	pr PolicyRefresher,
) (api.ProjectsServiceServer, error)

NewPostgresProjectsServer instantiates a ProjectsServer using a PG store

func NewWorkflowExecutor

func NewWorkflowExecutor() (*patterns.ChainWorkflowExecutor, error)

func SystemPolicies

func SystemPolicies() []*storage.Policy

SystemPolicies returns a list of system policies that should always exist by default. These should not be visible to the enduser and therefore exist outside of the database.

Types

type ApplyStagedRulesParams

type ApplyStagedRulesParams struct {
}

type ApplyStagedRulesResult

type ApplyStagedRulesResult struct {
}

type ApplyStagedRulesTaskExecutor

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

func (*ApplyStagedRulesTaskExecutor) Run

func (s *ApplyStagedRulesTaskExecutor) Run(ctx context.Context, task cereal.Task) (interface{}, error)

type CerealProjectUpdateManager

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

func (*CerealProjectUpdateManager) Cancel

func (m *CerealProjectUpdateManager) Cancel() error

func (*CerealProjectUpdateManager) Start

func (m *CerealProjectUpdateManager) Start() error

func (*CerealProjectUpdateManager) Status

type EmptyProjectUpdateStatus

type EmptyProjectUpdateStatus struct{}

func (*EmptyProjectUpdateStatus) Cancelled

func (*EmptyProjectUpdateStatus) Cancelled() bool

func (*EmptyProjectUpdateStatus) EstimatedTimeComplete

func (*EmptyProjectUpdateStatus) EstimatedTimeComplete() time.Time

func (*EmptyProjectUpdateStatus) Failed

func (*EmptyProjectUpdateStatus) Failed() bool

func (*EmptyProjectUpdateStatus) FailureMessage

func (*EmptyProjectUpdateStatus) FailureMessage() string

func (*EmptyProjectUpdateStatus) PercentageComplete

func (*EmptyProjectUpdateStatus) PercentageComplete() float64

func (*EmptyProjectUpdateStatus) Stage

func (*EmptyProjectUpdateStatus) State

type PolicyRefresher

type PolicyRefresher interface {
	Refresh(context.Context) error
	RefreshAsync() error
}

func NewPolicyRefresher

func NewPolicyRefresher(ctx context.Context, log logger.Logger, engine engine.Writer, store storage.Storage) (PolicyRefresher, error)

func NewPostgresPolicyRefresher

func NewPostgresPolicyRefresher(ctx context.Context, log logger.Logger, engine engine.Writer) (PolicyRefresher, error)

type PolicyServer

type PolicyServer interface {
	api.PoliciesServiceServer

	EngineUpdateInterceptor() grpc.UnaryServerInterceptor
}

PolicyServer is the server interface for policies: what we defined via protobuf + the update interceptor

func NewMemstorePolicyServer

func NewMemstorePolicyServer(
	ctx context.Context,
	l logger.Logger,
	pr PolicyRefresher,
	e engine.Writer) (PolicyServer, error)

NewMemstorePolicyServer returns an instance of server.Server

func NewPoliciesServer

func NewPoliciesServer(
	ctx context.Context,
	l logger.Logger,
	pr PolicyRefresher,
	s storage.Storage,
	e engine.Writer) (PolicyServer, error)

NewPoliciesServer returns a new IAM Policy server.

func NewPostgresPolicyServer

func NewPostgresPolicyServer(
	ctx context.Context,
	l logger.Logger,
	pr PolicyRefresher,
	e engine.Writer) (PolicyServer, error)

NewPostgresPolicyServer instantiates a server.Server that connects to a postgres backend

type ProjectState

type ProjectState struct {
	ProjectUpdateManager ProjectUpdateMgr
	ProjectPurger        project_purger_workflow.ProjectPurger
	// contains filtered or unexported fields
}

ProjectState holds the server state for projects

func (*ProjectState) ApplyRulesCancel

func (*ProjectState) ApplyRulesStart

func (*ProjectState) ApplyRulesStatus

func (*ProjectState) CreateProject

func (s *ProjectState) CreateProject(ctx context.Context,
	req *api.CreateProjectReq) (*api.CreateProjectResp, error)

func (*ProjectState) CreateRule

func (s *ProjectState) CreateRule(ctx context.Context, req *api.CreateRuleReq) (*api.CreateRuleResp, error)

func (*ProjectState) DeleteProject

func (s *ProjectState) DeleteProject(ctx context.Context,
	req *api.DeleteProjectReq) (*api.DeleteProjectResp, error)

func (*ProjectState) DeleteRule

func (s *ProjectState) DeleteRule(ctx context.Context, req *api.DeleteRuleReq) (*api.DeleteRuleResp, error)

func (*ProjectState) GetProject

func (s *ProjectState) GetProject(ctx context.Context,
	req *api.GetProjectReq) (*api.GetProjectResp, error)

func (*ProjectState) GetRule

func (s *ProjectState) GetRule(ctx context.Context, req *api.GetRuleReq) (*api.GetRuleResp, error)

func (*ProjectState) ListProjects

func (s *ProjectState) ListProjects(
	ctx context.Context, _ *api.ListProjectsReq) (*api.ListProjectsResp, error)

func (*ProjectState) ListProjectsForIntrospection

func (s *ProjectState) ListProjectsForIntrospection(
	ctx context.Context, req *api.ListProjectsReq) (*api.ListProjectsResp, error)

func (*ProjectState) ListRules

func (s *ProjectState) ListRules(ctx context.Context, req *api.ListRulesReq) (*api.ListRulesResp, error)

func (*ProjectState) ListRulesForAllProjects

func (*ProjectState) ListRulesForProject

func (*ProjectState) UpdateProject

func (s *ProjectState) UpdateProject(ctx context.Context,
	req *api.UpdateProjectReq) (*api.UpdateProjectResp, error)

func (*ProjectState) UpdateRule

func (s *ProjectState) UpdateRule(ctx context.Context, req *api.UpdateRuleReq) (*api.UpdateRuleResp, error)

type ProjectUpdateMgr

type ProjectUpdateMgr interface {
	Cancel() error
	Start() error
	Status() (ProjectUpdateStatus, error)
}

func RegisterCerealProjectUpdateManager

func RegisterCerealProjectUpdateManager(manager *cereal.Manager, log logger.Logger, s storage.Storage, pr PolicyRefresher) (ProjectUpdateMgr, error)

type ProjectUpdateStage

type ProjectUpdateStage string

type ProjectUpdateState

type ProjectUpdateState string

type ProjectUpdateStatus

type ProjectUpdateStatus interface {
	Failed() bool
	Cancelled() bool
	FailureMessage() string
	PercentageComplete() float64
	EstimatedTimeComplete() time.Time
	State() ProjectUpdateState
	Stage() ProjectUpdateStage
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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