operationroles

package
v0.19.913 Latest Latest
Warning

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

Go to latest
Published: May 1, 2026 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

operationroles implements various rules around what role to use for a particular operation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EntityOperationRoleMap

type EntityOperationRoleMap map[app.OperationType]string

func EntityOperationRoleMapFromHstore

func EntityOperationRoleMapFromHstore(hstore map[string]*string) EntityOperationRoleMap

type RoleSelection

type RoleSelection struct {
	RoleName           string `temporaljson:"role_name"`
	UnrenderedRoleName string `temporaljson:"unrendered_role_name"`
	// RoleArn is arn/id/unique identifier for the role depending on cloud provider
	RoleARN string                           `temporaljson:"role_arn"`
	Source  RoleSelectionSource              `temporaljson:"source"`
	Trace   []app.InstallRoleSelectionRecord `temporaljson:"trace"`
}

func GetRoleForAction added in v0.19.872

func GetRoleForAction(
	l *zap.Logger,
	appCfg *app.AppConfig,
	run *app.InstallActionWorkflowRun,
	stack *app.InstallStack,
	installState *state.State,
) (*RoleSelection, app.OperationType, error)

GetRoleForAction selects the role for an action workflow trigger operation.

func GetRoleForDeploy added in v0.19.872

func GetRoleForDeploy(
	l *zap.Logger,
	appCfg *app.AppConfig,
	installDeploy *app.InstallDeploy,
	compCfgConn *app.ComponentConfigConnection,
	stack *app.InstallStack,
	installState *state.State,
) (*RoleSelection, app.OperationType, error)

GetRoleForDeploy selects the role for a component deploy or teardown operation.

func GetRoleForSandbox added in v0.19.872

func GetRoleForSandbox(
	l *zap.Logger,
	appCfg *app.AppConfig,
	run *app.InstallSandboxRun,
	stack *app.InstallStack,
	installState *state.State,
) (*RoleSelection, app.OperationType, error)

GetRoleForSandbox selects the role for a sandbox provision/reprovision/deprovision operation.

func SelectDefaultRole added in v0.19.872

func SelectDefaultRole(ctx *SelectionContext) (*RoleSelection, error)

func SelectRole

func SelectRole(ctx *SelectionContext, l *zap.Logger) (*RoleSelection, error)

SelectRole determines which role to use based on precedence rules Precedence (highest to lowest): 1. Runtime override (CLI --role flag or UI selection) 2. Entity-level config (component/sandbox/action specific) 3. Matrix rules (app-level operation_roles config) 4. Default roles (provision/maintenance/deprovision)

type RoleSelectionSource

type RoleSelectionSource string

RoleSelectionSource represents where a role selection came from

const (
	// selected at runtime
	RoleSelectionSourceRuntime RoleSelectionSource = "runtime"
	// defined in entity definition, in component, action or sandbox
	RoleSelectionSourceEntity RoleSelectionSource = "entity"
	// defined in app config rules
	RoleSelectionSourceMatrix RoleSelectionSource = "matrix"
	// existing behavior
	RoleSelectionSourceDefault RoleSelectionSource = "default"
	// break glass
	RoleSelectionSourceBreakGlass RoleSelectionSource = "breakglass"
)

type SelectionContext

type SelectionContext struct {
	Operation app.OperationType

	// "component", "sandbox", "action"
	PrincipalType principal.Type
	// Component/action name (empty for sandbox)
	PrincipalName string

	// Configuration sources (in precedence order)
	// --role flag from CLI/UI (highest precedence)
	RuntimeRole string
	// Component/sandbox/action config
	EntityRoles EntityOperationRoleMap
	// App-level rules from DB
	MatrixRules []*app.AppOperationRoleRule
	// DefaultRole is the role selected if none of the rules associate with the principal and operation
	DefaultRole string
	// Break Glass role
	BreakGlassRole string

	StackOutputs *app.InstallStackOutputs

	AppConfig *app.AppConfig

	// Install state for rendering role names with templating
	InstallState *state.State
}

SelectionContext contains all information needed for role selection

type SelectionError added in v0.19.872

type SelectionError struct {
	Err   error
	Trace []app.InstallRoleSelectionRecord
}

func (*SelectionError) Error added in v0.19.872

func (e *SelectionError) Error() string

func (*SelectionError) Unwrap added in v0.19.872

func (e *SelectionError) Unwrap() error

Jump to

Keyboard shortcuts

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