authz

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: 11 Imported by: 10

Documentation

Index

Constants

View Source
const (
	SerializedProjectUpdateListTaskType    = "project-update-list-tasks"
	SerializedProjectUpdateRunTaskType     = "project-update-run-task"
	SerializedProjectUpdateMonitorTaskType = "project-update-monitor-task"
	SerializedProjectUpdateCancelTaskType  = "project-update-cancel-task"
)
View Source
const (
	// ProjectUpdateIDTag - The tag used to designate the project update job
	ProjectUpdateIDTag = "ProjectUpdateID"
)

Variables

View Source
var ErrNoJobIDs = errors.New("0 Job IDs returned")

Functions

func CancelUpdateProjectTagsTaskName

func CancelUpdateProjectTagsTaskName(svcName string) cereal.TaskName

func ProjectTagUpdaterStatusTaskName

func ProjectTagUpdaterStatusTaskName(svcName string) cereal.TaskName

func ProjectUpdateBackend

func ProjectUpdateBackend(conn *grpc.ClientConn) cereal.Driver

ProjectUpdateBackend takes a connection to cereal-service and returns a cereal backend with the correct domain for project updates

func RegisterSerialTaskExecutors

func RegisterSerialTaskExecutors(manager *cereal.Manager, svc string, client SerializedProjectUpdate,
	authzProjectsServiceClient authz.ProjectsServiceClient) error

func RegisterTaskExecutors

func RegisterTaskExecutors(manager *cereal.Manager, domainService string, esClient EsClient, authzProjectsServiceClient authz.ProjectsServiceClient) error

func StartProjectTagUpdaterTaskName

func StartProjectTagUpdaterTaskName(svcName string) cereal.TaskName

Types

type DomainProjectUpdateWorkflowExecutor

type DomainProjectUpdateWorkflowExecutor struct {
	PollInterval time.Duration
	// contains filtered or unexported fields
}

func NewWorkflowExecutorForDomainService

func NewWorkflowExecutorForDomainService(domainService string) *DomainProjectUpdateWorkflowExecutor

func (*DomainProjectUpdateWorkflowExecutor) OnCancel

func (*DomainProjectUpdateWorkflowExecutor) OnStart

func (*DomainProjectUpdateWorkflowExecutor) OnTaskComplete

type DomainProjectUpdateWorkflowParameters

type DomainProjectUpdateWorkflowParameters struct {
	ProjectUpdateID string
}

type DomainProjectUpdateWorkflowPayload

type DomainProjectUpdateWorkflowPayload struct {
	ProjectUpdateID             string
	JobIDs                      []string
	ConsecutiveJobCheckFailures int
	MergedJobStatus             JobStatus
	Canceled                    bool
}

type ESCancelUpdateProjectTagsTask

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

func (*ESCancelUpdateProjectTagsTask) Run

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

type ESProjectTagUpdaterStatusTask

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

func (*ESProjectTagUpdaterStatusTask) Run

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

type ESStartProjectTagUpdaterTask

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

func (*ESStartProjectTagUpdaterTask) Run

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

type EsClient

type EsClient interface {
	JobCancel(context.Context, string) error
	UpdateProjectTags(context.Context, map[string]*authz.ProjectRules) ([]string, error)
	JobStatus(context.Context, string) (JobStatus, error)
}

type JobStatus

type JobStatus struct {
	Completed             bool
	PercentageComplete    float32
	EstimatedEndTimeInSec int64
}

JobStatus - the current status of a job

func FindSlowestJobStatus

func FindSlowestJobStatus(jobStatuses []JobStatus) JobStatus

FindSlowestJobStatus - merge multiple job statuses into one. Return the status that is going to finish last.

type SerializedProjectUpdate

type SerializedProjectUpdate interface {
	ListProjectUpdateTasks(ctx context.Context) ([]SerializedProjectUpdateTask, error)
	RunProjectUpdateTask(ctx context.Context, projectUpdateID string, params map[string]string, projectTaggingRules map[string]*authz.ProjectRules) (SerializedProjectUpdateTaskID, SerializedProjectUpdateTaskStatus, error)
	MonitorProjectUpdateTask(ctx context.Context, projectUpdateID string, id SerializedProjectUpdateTaskID) (SerializedProjectUpdateTaskStatus, error)
	CancelProjectUpdateTask(ctx context.Context, projectUpdateID string, id SerializedProjectUpdateTaskID) error
}

type SerializedProjectUpdateCancelTaskTaskParams

type SerializedProjectUpdateCancelTaskTaskParams struct {
	ProjectUpdateID string
	ID              SerializedProjectUpdateTaskID
}

type SerializedProjectUpdateCancelTaskTaskResult

type SerializedProjectUpdateCancelTaskTaskResult struct {
}

type SerializedProjectUpdateListTasksTaskParams

type SerializedProjectUpdateListTasksTaskParams struct{}

type SerializedProjectUpdateListTasksTaskResult

type SerializedProjectUpdateListTasksTaskResult struct {
	Tasks []SerializedProjectUpdateTask
}

type SerializedProjectUpdateMonitorTaskTaskParams

type SerializedProjectUpdateMonitorTaskTaskParams struct {
	ProjectUpdateID string
	ID              SerializedProjectUpdateTaskID
}

type SerializedProjectUpdateMonitorTaskTaskResult

type SerializedProjectUpdateMonitorTaskTaskResult struct {
	Status SerializedProjectUpdateTaskStatus
}

type SerializedProjectUpdateRunTaskTaskParams

type SerializedProjectUpdateRunTaskTaskParams struct {
	ProjectUpdateID string
	Params          map[string]string
}

type SerializedProjectUpdateRunTaskTaskResult

type SerializedProjectUpdateRunTaskTaskResult struct {
	ID     SerializedProjectUpdateTaskID
	Status SerializedProjectUpdateTaskStatus
}

type SerializedProjectUpdateTask

type SerializedProjectUpdateTask struct {
	Priority int64
	Params   map[string]string
}

type SerializedProjectUpdateTaskID

type SerializedProjectUpdateTaskID string
const SerializedProjectUpdateTaskIDUnknown SerializedProjectUpdateTaskID = ""

type SerializedProjectUpdateTaskState

type SerializedProjectUpdateTaskState string
const (
	SerializedProjectUpdateTaskRunning SerializedProjectUpdateTaskState = "running"
	SerializedProjectUpdateTaskFailed  SerializedProjectUpdateTaskState = "failed"
	SerializedProjectUpdateTaskSuccess SerializedProjectUpdateTaskState = "success"
)

type SerializedProjectUpdateTaskStatus

type SerializedProjectUpdateTaskStatus struct {
	State              SerializedProjectUpdateTaskState
	PercentageComplete float32
	Metadata           map[string]string
	Error              string
}

type SerializedProjectUpdateWorkflowExecutor

type SerializedProjectUpdateWorkflowExecutor struct {
	PollInterval time.Duration
}

SerializedProjectUpdateWorkflowExecutor is a workflow that allows running 1 task at a time across many services. Given a list of services, it first asks each service to list what tasks it would like to run. For example, a service would return a task to run for each elasticsearch index to update. After the tasks have been gathered for all services, the workflow executes them 1 at a time. Once a task is started, it is monitored until completion. The next task does not start until the completion of the previous one. If a task fails, the workflow does not continue.

func NewSerializedWorkflowExecutor

func NewSerializedWorkflowExecutor() *SerializedProjectUpdateWorkflowExecutor

func (*SerializedProjectUpdateWorkflowExecutor) OnCancel

func (*SerializedProjectUpdateWorkflowExecutor) OnStart

func (*SerializedProjectUpdateWorkflowExecutor) OnTaskComplete

type SerializedProjectUpdateWorkflowParams

type SerializedProjectUpdateWorkflowParams struct {
	ProjectUpdateID string
	DomainServices  []string
}

type SerializedProjectUpdateWorkflowPhase

type SerializedProjectUpdateWorkflowPhase string
const (
	SerializedProjectUpdateWorkflowPhaseStarting  SerializedProjectUpdateWorkflowPhase = "starting"
	SerializedProjectUpdateWorkflowPhaseRunning   SerializedProjectUpdateWorkflowPhase = "running"
	SerializedProjectUpdateWorkflowPhaseComplete  SerializedProjectUpdateWorkflowPhase = "complete"
	SerializedProjectUpdateWorkflowPhaseCanceling SerializedProjectUpdateWorkflowPhase = "canceling"
)

type SerializedProjectUpdateWorkflowState

type SerializedProjectUpdateWorkflowState struct {
	ProjectUpdateID string
	DomainServices  []string
	Phase           SerializedProjectUpdateWorkflowPhase
	Starting        serializedProjectUpdateWorkflowPhaseStartingData
	Running         serializedProjectUpdateWorkflowPhaseRunningData
	MonitorFailures int
}

type StartResult

type StartResult struct {
	IsComplete bool
	JobIDs     []string
}

type StatusParameters

type StatusParameters struct {
	JobIDs []string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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