Documentation
¶
Index ¶
- Constants
- Variables
- type Core
- func (c *Core) ApproveOrRejectAction(ctx context.Context, approvalUUID, decidedBy string, ...) error
- func (c *Core) AssignNamespaceRole(ctx context.Context, subjectID string, subjectType string, namespaceID string, ...) error
- func (c *Core) CancelFlowExecution(ctx context.Context, execID string) error
- func (c *Core) CheckPermission(ctx context.Context, userID string, namespaceID string, ...) (bool, error)
- func (c *Core) CreateCredential(ctx context.Context, cred models.Credential, namespaceID string) (models.Credential, error)
- func (c *Core) CreateFlow(ctx context.Context, f models.Flow, namespaceID string) error
- func (c *Core) CreateFlowSecret(ctx context.Context, flowID string, secret models.FlowSecret, ...) (models.FlowSecret, error)
- func (c *Core) CreateGroup(ctx context.Context, name, description string) (models.GroupWithUsers, error)
- func (c *Core) CreateNamespace(ctx context.Context, namespace *models.Namespace) (models.Namespace, error)
- func (c *Core) CreateNode(ctx context.Context, node *models.Node, namespaceID string) (models.Node, error)
- func (c *Core) CreateUser(ctx context.Context, name, username string, loginType models.UserLoginType, ...) (models.UserWithGroups, error)
- func (c *Core) DeleteCredential(ctx context.Context, id string, namespaceID string) error
- func (c *Core) DeleteFlow(ctx context.Context, flowID, namespaceID string) error
- func (c *Core) DeleteFlowSecret(ctx context.Context, id string, namespaceID string) error
- func (c *Core) DeleteGroupByUUID(ctx context.Context, groupUUID string) error
- func (c *Core) DeleteNamespace(ctx context.Context, id string) error
- func (c *Core) DeleteNode(ctx context.Context, id string, namespaceID string) error
- func (c *Core) DeleteUserByUUID(ctx context.Context, userUUID string) error
- func (c *Core) GetAllExecutionSummaryPaginated(ctx context.Context, namespaceID string, filter string, limit, offset int) ([]models.ExecutionSummary, int64, int64, error)
- func (c *Core) GetAllGroups(ctx context.Context) ([]models.Group, error)
- func (c *Core) GetAllGroupsWithUsers(ctx context.Context) ([]models.GroupWithUsers, error)
- func (c *Core) GetAllUsersWithGroups(ctx context.Context) ([]models.UserWithGroups, error)
- func (c *Core) GetApprovalRequest(ctx context.Context, approvalUUID string, namespaceID string) (models.ApprovalRequest, error)
- func (c *Core) GetApprovalWithInputs(ctx context.Context, approvalUUID string, namespaceID string) (models.ApprovalDetails, error)
- func (c *Core) GetApprovalsPaginated(ctx context.Context, namespaceID, status, filter string, ...) ([]models.ApprovalPaginationDetails, int64, int64, error)
- func (c *Core) GetApprovalsRequestsForExec(ctx context.Context, execID string, namespaceID string) (models.ApprovalRequest, error)
- func (c *Core) GetCredentialByID(ctx context.Context, id string, namespaceID string) (models.Credential, error)
- func (c *Core) GetDecryptedFlowSecrets(ctx context.Context, flowID string, namespaceID string) (map[string]string, error)
- func (c *Core) GetExecutionByExecID(ctx context.Context, execID string, namespaceID string) (models.Execution, error)
- func (c *Core) GetExecutionSummaryByExecID(ctx context.Context, execID string, namespaceID string) (models.ExecutionSummary, error)
- func (c *Core) GetExecutionSummaryPaginated(ctx context.Context, f models.Flow, namespaceID string, limit, offset int) ([]models.ExecutionSummary, int64, int64, error)
- func (c *Core) GetFlowByID(id string, namespaceID string) (models.Flow, error)
- func (c *Core) GetFlowFromLogID(logID string, namespaceID string) (models.Flow, error)
- func (c *Core) GetFlowSecretByID(ctx context.Context, id string, namespaceID string) (models.FlowSecret, error)
- func (c *Core) GetFlowsPaginated(ctx context.Context, namespaceID string, limit, offset int) ([]models.Flow, int64, int64, error)
- func (c *Core) GetGroupByName(ctx context.Context, name string) (models.Group, error)
- func (c *Core) GetGroupByUUID(ctx context.Context, groupUUID string) (models.Group, error)
- func (c *Core) GetGroupWithUsers(ctx context.Context, groupUUID string) (models.GroupWithUsers, error)
- func (c *Core) GetInputForExec(ctx context.Context, execID string, namespaceID string) (map[string]interface{}, error)
- func (c *Core) GetNamespaceByID(ctx context.Context, id string) (models.Namespace, error)
- func (c *Core) GetNamespaceByName(ctx context.Context, name string) (models.Namespace, error)
- func (c *Core) GetNamespaceMembers(ctx context.Context, namespaceID string) ([]models.NamespaceMember, error)
- func (c *Core) GetNodeByID(ctx context.Context, id string, namespaceID string) (models.Node, error)
- func (c *Core) GetNodeStats(ctx context.Context, namespaceID string) (models.NodeStats, error)
- func (c *Core) GetNodesByNames(ctx context.Context, nodeNames []string, namespaceUUID uuid.UUID) ([]models.Node, error)
- func (c *Core) GetPermissionsForUser(userID string) (string, error)
- func (c *Core) GetScheduledFlows() []models.Flow
- func (c *Core) GetSchedulerFlow(ctx context.Context, flowSlug string, namespaceUUID string) (scheduler.Flow, error)
- func (c *Core) GetUserByUUID(ctx context.Context, userUUID string) (models.User, error)
- func (c *Core) GetUserByUsername(ctx context.Context, username string) (models.User, error)
- func (c *Core) GetUserByUsernameWithGroups(ctx context.Context, username string) (models.UserWithGroups, error)
- func (c *Core) GetUserNamespaces(ctx context.Context, userID string) ([]models.NamespaceWithRole, error)
- func (c *Core) GetUserWithUUIDWithGroups(ctx context.Context, userUUID string) (models.UserWithGroups, error)
- func (c *Core) GrantSuperusersAdminAccessToAllNamespaces(ctx context.Context) error
- func (c *Core) InitializeRBACPolicies() error
- func (c *Core) ListFlowSecrets(ctx context.Context, flowID string, namespaceID string) ([]models.FlowSecret, error)
- func (c *Core) ListNamespaces(ctx context.Context, userID string, name string, limit, offset int) ([]models.Namespace, int64, int64, error)
- func (c *Core) LoadFlows() error
- func (c *Core) QueueFlowExecution(ctx context.Context, f models.Flow, input map[string]interface{}, ...) (string, error)
- func (c *Core) RemoveNamespaceMember(ctx context.Context, membershipID, namespaceID string) error
- func (c *Core) RequestApproval(ctx context.Context, execID string, action models.Action, namespaceID string) (string, error)
- func (c *Core) ResumeFlowExecution(ctx context.Context, execID string, actionID string, userUUID string, ...) error
- func (c *Core) SearchCredentials(ctx context.Context, filter string, limit, offset int, namespaceID string) ([]models.Credential, int64, int64, error)
- func (c *Core) SearchFlows(ctx context.Context, namespaceID string, query string, limit, offset int) ([]models.Flow, int64, int64, error)
- func (c *Core) SearchGroup(ctx context.Context, query string, limit, offset int) ([]models.GroupWithUsers, int64, int64, error)
- func (c *Core) SearchNodes(ctx context.Context, filter string, limit, offset int, namespaceID string) ([]models.Node, int64, int64, error)
- func (c *Core) SearchUser(ctx context.Context, query string, limit, offset int) ([]models.UserWithGroups, int64, int64, error)
- func (c *Core) StreamLogs(ctx context.Context, logID string, namespaceID string) (chan models.StreamMessage, error)
- func (c *Core) SynchronizePolicies(ctx context.Context) error
- func (c *Core) UpdateCredential(ctx context.Context, id string, cred *models.Credential, namespaceID string) (models.Credential, error)
- func (c *Core) UpdateFlow(ctx context.Context, f models.Flow, namespaceID string) error
- func (c *Core) UpdateFlowSecret(ctx context.Context, id string, secret models.FlowSecret, namespaceID string) (models.FlowSecret, error)
- func (c *Core) UpdateGroup(ctx context.Context, groupUUID, name, description string) (models.GroupWithUsers, error)
- func (c *Core) UpdateNamespace(ctx context.Context, id string, namespace models.Namespace) (models.Namespace, error)
- func (c *Core) UpdateNamespaceMember(ctx context.Context, membershipID, namespaceID string, ...) error
- func (c *Core) UpdateNode(ctx context.Context, id string, node *models.Node, namespaceID string) (models.Node, error)
- func (c *Core) UpdateUser(ctx context.Context, userUUID string, name string, username string, ...) (models.UserWithGroups, error)
Constants ¶
const (
ExecutionLogPendingTimeout = 30 * time.Second
)
const (
SystemUserUUID = "00000000-0000-0000-0000-000000000000"
)
const (
TimeFormat = "2006-01-02T15:04:05Z"
)
Variables ¶
var ( ErrNoPendingApproval = errors.New("no pending approval") ErrNil = errors.New("not found") )
var (
ErrFlowNotFound = errors.New("flow not found")
)
Functions ¶
This section is empty.
Types ¶
type Core ¶
type Core struct {
LogManager streamlogger.LogManager
// contains filtered or unexported fields
}
func (*Core) ApproveOrRejectAction ¶
func (c *Core) ApproveOrRejectAction(ctx context.Context, approvalUUID, decidedBy string, status models.ApprovalType, namespaceID string) error
ApproveOrRejectAction handles approval or rejection of an action request by a user. It takes the approval UUID, the ID of the user making the decision, and the approval status. The function updates the database with the decision. Once approved, the task is moved to a resume queue for further processing.
func (*Core) AssignNamespaceRole ¶
func (c *Core) AssignNamespaceRole(ctx context.Context, subjectID string, subjectType string, namespaceID string, role models.NamespaceRole) error
AssignNamespaceRole assigns a role to a user or group in a namespace
func (*Core) CancelFlowExecution ¶
CancelFlowExecution cancels the given execution using the scheduler
func (*Core) CheckPermission ¶
func (c *Core) CheckPermission(ctx context.Context, userID string, namespaceID string, resource models.Resource, action models.RBACAction) (bool, error)
CheckPermission checks if a user has permission to perform an action on a resource in a namespace
func (*Core) CreateCredential ¶
func (c *Core) CreateCredential(ctx context.Context, cred models.Credential, namespaceID string) (models.Credential, error)
func (*Core) CreateFlow ¶
func (*Core) CreateFlowSecret ¶
func (c *Core) CreateFlowSecret(ctx context.Context, flowID string, secret models.FlowSecret, namespaceID string) (models.FlowSecret, error)
func (*Core) CreateGroup ¶
func (*Core) CreateNamespace ¶
func (*Core) CreateNode ¶
func (*Core) CreateUser ¶
func (c *Core) CreateUser(ctx context.Context, name, username string, loginType models.UserLoginType, userRole models.UserRoleType, groups []string) (models.UserWithGroups, error)
func (*Core) DeleteCredential ¶
func (*Core) DeleteFlow ¶
func (*Core) DeleteFlowSecret ¶
func (*Core) DeleteGroupByUUID ¶
func (*Core) DeleteNode ¶
func (*Core) DeleteUserByUUID ¶
func (*Core) GetAllExecutionSummaryPaginated ¶
func (*Core) GetAllGroups ¶
func (*Core) GetAllGroupsWithUsers ¶
func (*Core) GetAllUsersWithGroups ¶
func (*Core) GetApprovalRequest ¶
func (c *Core) GetApprovalRequest(ctx context.Context, approvalUUID string, namespaceID string) (models.ApprovalRequest, error)
GetApprovalRequest returns an approval request using the approval UUID and namespace UUID
func (*Core) GetApprovalWithInputs ¶
func (c *Core) GetApprovalWithInputs(ctx context.Context, approvalUUID string, namespaceID string) (models.ApprovalDetails, error)
GetApprovalWithInputs returns an approval request with additional info like flow name and id and inputs for the execution
func (*Core) GetApprovalsPaginated ¶
func (*Core) GetApprovalsRequestsForExec ¶
func (c *Core) GetApprovalsRequestsForExec(ctx context.Context, execID string, namespaceID string) (models.ApprovalRequest, error)
GetApprovalsRequestsForExec returns approval requests for a given execution
func (*Core) GetCredentialByID ¶
func (*Core) GetDecryptedFlowSecrets ¶
func (*Core) GetExecutionByExecID ¶
func (*Core) GetExecutionSummaryByExecID ¶
func (*Core) GetExecutionSummaryPaginated ¶
func (*Core) GetFlowByID ¶
GetFlowByID returns a flow from memory using the flow slug (id) and namespace
func (*Core) GetFlowFromLogID ¶
func (*Core) GetFlowSecretByID ¶
func (*Core) GetFlowsPaginated ¶
func (*Core) GetGroupByName ¶
func (*Core) GetGroupByUUID ¶
func (*Core) GetGroupWithUsers ¶
func (*Core) GetInputForExec ¶
func (*Core) GetNamespaceByID ¶
func (*Core) GetNamespaceByName ¶
func (*Core) GetNamespaceMembers ¶
func (c *Core) GetNamespaceMembers(ctx context.Context, namespaceID string) ([]models.NamespaceMember, error)
GetNamespaceMembers returns all members of a namespace
func (*Core) GetNodeByID ¶
func (*Core) GetNodeStats ¶
func (*Core) GetNodesByNames ¶
func (c *Core) GetNodesByNames(ctx context.Context, nodeNames []string, namespaceUUID uuid.UUID) ([]models.Node, error)
GetNodesByNames retrieves nodes by their names and returns a slice of models.Node This is used as a lookup function for converting flows to task models
func (*Core) GetPermissionsForUser ¶
GetPermissions returns the casbin policies for the user
func (*Core) GetScheduledFlows ¶
GetScheduledFlows returns all flows that have a cron schedule configured
func (*Core) GetSchedulerFlow ¶
func (c *Core) GetSchedulerFlow(ctx context.Context, flowSlug string, namespaceUUID string) (scheduler.Flow, error)
GetSchedulerFlow loads a flow and converts it to scheduler.Flow format This function can be used as a FlowLoaderFn for the scheduler
func (*Core) GetUserByUUID ¶
func (*Core) GetUserByUsername ¶
func (*Core) GetUserByUsernameWithGroups ¶
func (*Core) GetUserNamespaces ¶
func (c *Core) GetUserNamespaces(ctx context.Context, userID string) ([]models.NamespaceWithRole, error)
GetUserNamespaces returns all namespaces a user has access to with their roles
func (*Core) GetUserWithUUIDWithGroups ¶
func (*Core) GrantSuperusersAdminAccessToAllNamespaces ¶
GrantSuperusersAdminAccessToAllNamespaces queries for all users with superuser role and adds a grouping policy to them to have admin access to all namespaces
func (*Core) InitializeRBACPolicies ¶
InitializeRBACPolicies sets up the base policies for each role These policies apply to all namespaces using wildcard "*"
func (*Core) ListFlowSecrets ¶
func (*Core) ListNamespaces ¶
func (*Core) QueueFlowExecution ¶
func (c *Core) QueueFlowExecution(ctx context.Context, f models.Flow, input map[string]interface{}, userUUID string, namespaceID string) (string, error)
QueueFlowExecution adds a flow in the execution queue. The ID returned is the execution queue ID. Exec ID should be universally unique, this is used to create the log stream and identify each execution
func (*Core) RemoveNamespaceMember ¶
RemoveNamespaceMember removes a user or group from a namespace
func (*Core) RequestApproval ¶
func (*Core) ResumeFlowExecution ¶
func (c *Core) ResumeFlowExecution(ctx context.Context, execID string, actionID string, userUUID string, namespaceID string) error
ResumeFlowExecution moves the task to a resume queue for further processing.
func (*Core) SearchCredentials ¶
func (*Core) SearchFlows ¶
func (*Core) SearchGroup ¶
func (*Core) SearchNodes ¶
func (*Core) SearchUser ¶
func (*Core) StreamLogs ¶
func (c *Core) StreamLogs(ctx context.Context, logID string, namespaceID string) (chan models.StreamMessage, error)
StreamLogs reads values from a stream from the beginning and returns a channel to which all the messages are sent. logID is the ID sent to the NewFlowExecution task
func (*Core) SynchronizePolicies ¶
SynchronizePolicies synchronizes Casbin policies from the namespace_members table This ensures that the RBAC policies in Casbin match the role assignments stored in the database
func (*Core) UpdateCredential ¶
func (c *Core) UpdateCredential(ctx context.Context, id string, cred *models.Credential, namespaceID string) (models.Credential, error)
func (*Core) UpdateFlow ¶
func (*Core) UpdateFlowSecret ¶
func (c *Core) UpdateFlowSecret(ctx context.Context, id string, secret models.FlowSecret, namespaceID string) (models.FlowSecret, error)
func (*Core) UpdateGroup ¶
func (*Core) UpdateNamespace ¶
func (*Core) UpdateNamespaceMember ¶
func (c *Core) UpdateNamespaceMember(ctx context.Context, membershipID, namespaceID string, role models.NamespaceRole) error
UpdateNamespaceMember updates the role of a user or group in a namespace