Documentation
¶
Overview ¶
Package state provides unified state management for Prism.
This file provides the unified state management that eliminates the unnecessary ProfileAwareStateManager wrapper while maintaining all functionality.
Index ¶
- type EnhancedProfileProvider
- type Manager
- func (m *Manager) AddUserToGroup(ctx context.Context, userID, groupID string) error
- func (m *Manager) ClearAPIKey() error
- func (m *Manager) CreateGroup(ctx context.Context, group *usermgmt.Group) (*usermgmt.Group, error)
- func (m *Manager) CreateUser(ctx context.Context, user *usermgmt.User) (*usermgmt.User, error)
- func (m *Manager) DeleteGroup(ctx context.Context, id string) error
- func (m *Manager) DeleteUser(ctx context.Context, id string) error
- func (m *Manager) GetAPIKey() (string, time.Time, error)
- func (m *Manager) GetGroup(ctx context.Context, id string) (*usermgmt.Group, error)
- func (m *Manager) GetGroupByName(ctx context.Context, name string) (*usermgmt.Group, error)
- func (m *Manager) GetGroupUsers(ctx context.Context, groupID string, pagination *usermgmt.PaginationOptions) (*usermgmt.PaginatedUsers, error)
- func (m *Manager) GetGroups(ctx context.Context, filter *usermgmt.GroupFilter, ...) (*usermgmt.PaginatedGroups, error)
- func (m *Manager) GetUser(ctx context.Context, id string) (*usermgmt.User, error)
- func (m *Manager) GetUserByEmail(ctx context.Context, email string) (*usermgmt.User, error)
- func (m *Manager) GetUserByUsername(ctx context.Context, username string) (*usermgmt.User, error)
- func (m *Manager) GetUserGroups(ctx context.Context, userID string) ([]*usermgmt.Group, error)
- func (m *Manager) GetUsers(ctx context.Context, filter *usermgmt.UserFilter, ...) (*usermgmt.PaginatedUsers, error)
- func (m *Manager) IsUserInGroup(ctx context.Context, userID, groupID string) (bool, error)
- func (m *Manager) LoadState() (*types.State, error)
- func (m *Manager) LoadUserState() (*UserState, error)
- func (m *Manager) RemoveInstance(name string) error
- func (m *Manager) RemoveStorageVolume(name string) error
- func (m *Manager) RemoveUserFromGroup(ctx context.Context, userID, groupID string) error
- func (m *Manager) SaveAPIKey(apiKey string) error
- func (m *Manager) SaveInstance(instance types.Instance) error
- func (m *Manager) SaveState(state *types.State) error
- func (m *Manager) SaveStorageVolume(volume types.StorageVolume) error
- func (m *Manager) SaveUserState(state *UserState) error
- func (m *Manager) UpdateConfig(config types.Config) error
- func (m *Manager) UpdateGroup(ctx context.Context, group *usermgmt.Group) (*usermgmt.Group, error)
- func (m *Manager) UpdateUser(ctx context.Context, user *usermgmt.User) (*usermgmt.User, error)
- type ProfileProvider
- type StaticProfileProvider
- type UnifiedManager
- func GetDefaultManager() (*UnifiedManager, error)
- func GetManagerWithProfiles(provider ProfileProvider) (*UnifiedManager, error)
- func NewProfileAwareManager() (*UnifiedManager, error)
- func NewUnifiedManager() (*UnifiedManager, error)
- func NewUnifiedManagerWithEnhancedProfiles() (*UnifiedManager, error)
- func NewUnifiedManagerWithProfiles(provider ProfileProvider) (*UnifiedManager, error)
- func (um *UnifiedManager) GetCurrentProfile() (string, error)
- func (um *UnifiedManager) LoadState() (*types.State, error)
- func (um *UnifiedManager) LoadStateForProfile() (*types.State, error)
- func (um *UnifiedManager) SaveState(state *types.State) error
- func (um *UnifiedManager) SaveStateForProfile(state *types.State) error
- type UserGroupMembershipManager
- type UserMappingUpdater
- type UserState
- type UserUpdateOrchestrator
- type UserUpdateValidator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EnhancedProfileProvider ¶
type EnhancedProfileProvider struct {
// contains filtered or unexported fields
}
EnhancedProfileProvider integrates with the ManagerEnhanced profile system
func NewEnhancedProfileProvider ¶
func NewEnhancedProfileProvider() (*EnhancedProfileProvider, error)
NewEnhancedProfileProvider creates a profile provider using the ManagerEnhanced system
func (*EnhancedProfileProvider) GetCurrentProfile ¶
func (epp *EnhancedProfileProvider) GetCurrentProfile() (string, error)
GetCurrentProfile returns the current profile's AWS profile name
func (*EnhancedProfileProvider) GetProfileManager ¶
func (epp *EnhancedProfileProvider) GetProfileManager() *profile.ManagerEnhanced
GetProfileManager returns the underlying profile manager for advanced operations
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager handles state persistence
func (*Manager) AddUserToGroup ¶
AddUserToGroup adds a user to a group
func (*Manager) ClearAPIKey ¶
ClearAPIKey removes the API key from the configuration
func (*Manager) CreateGroup ¶
CreateGroup creates a new group
func (*Manager) CreateUser ¶
CreateUser creates a new user
func (*Manager) DeleteGroup ¶
DeleteGroup deletes a group
func (*Manager) DeleteUser ¶
DeleteUser deletes a user
func (*Manager) GetGroupByName ¶
GetGroupByName gets a group by name
func (*Manager) GetGroupUsers ¶
func (m *Manager) GetGroupUsers(ctx context.Context, groupID string, pagination *usermgmt.PaginationOptions) (*usermgmt.PaginatedUsers, error)
GetGroupUsers gets the users in a group
func (*Manager) GetGroups ¶
func (m *Manager) GetGroups(ctx context.Context, filter *usermgmt.GroupFilter, pagination *usermgmt.PaginationOptions) (*usermgmt.PaginatedGroups, error)
GetGroups gets groups matching the specified filter
func (*Manager) GetUserByEmail ¶
GetUserByEmail gets a user by email
func (*Manager) GetUserByUsername ¶
GetUserByUsername gets a user by username
func (*Manager) GetUserGroups ¶
GetUserGroups gets the groups a user belongs to
func (*Manager) GetUsers ¶
func (m *Manager) GetUsers(ctx context.Context, filter *usermgmt.UserFilter, pagination *usermgmt.PaginationOptions) (*usermgmt.PaginatedUsers, error)
GetUsers gets users matching the specified filter
func (*Manager) IsUserInGroup ¶
IsUserInGroup checks if a user is in a group
func (*Manager) LoadUserState ¶
LoadUserState loads the user state from disk
func (*Manager) RemoveInstance ¶
RemoveInstance removes an instance from state
func (*Manager) RemoveStorageVolume ¶
RemoveStorageVolume removes a storage volume from state
func (*Manager) RemoveUserFromGroup ¶
RemoveUserFromGroup removes a user from a group
func (*Manager) SaveAPIKey ¶
SaveAPIKey saves a new API key to the configuration
func (*Manager) SaveInstance ¶
SaveInstance saves a single instance to state
func (*Manager) SaveStorageVolume ¶
func (m *Manager) SaveStorageVolume(volume types.StorageVolume) error
SaveStorageVolume saves a single storage volume to state
func (*Manager) SaveUserState ¶
SaveUserState saves the user state to disk
func (*Manager) UpdateConfig ¶
UpdateConfig updates the configuration
func (*Manager) UpdateGroup ¶
UpdateGroup updates an existing group
type ProfileProvider ¶
type ProfileProvider interface {
GetCurrentProfile() (string, error) // Returns current profile ID
}
ProfileProvider interface allows plugging in different profile systems
type StaticProfileProvider ¶
type StaticProfileProvider struct {
// contains filtered or unexported fields
}
StaticProfileProvider is a simple profile provider for testing
func NewStaticProfileProvider ¶
func NewStaticProfileProvider(profile string) *StaticProfileProvider
NewStaticProfileProvider creates a profile provider that returns a fixed profile
func (*StaticProfileProvider) GetCurrentProfile ¶
func (spp *StaticProfileProvider) GetCurrentProfile() (string, error)
GetCurrentProfile returns the static profile
type UnifiedManager ¶
type UnifiedManager struct {
*Manager // Embed the base manager for all core functionality
// contains filtered or unexported fields
}
UnifiedManager provides state management with optional profile integration. This replaces both the base Manager and the ProfileAwareStateManager wrapper.
func GetDefaultManager ¶
func GetDefaultManager() (*UnifiedManager, error)
GetDefaultManager returns a unified manager (replaces state.NewManager)
func GetManagerWithProfiles ¶
func GetManagerWithProfiles(provider ProfileProvider) (*UnifiedManager, error)
GetManagerWithProfiles returns a unified manager with profile support
func NewProfileAwareManager ¶
func NewProfileAwareManager() (*UnifiedManager, error)
Legacy compatibility - this replaces ProfileAwareStateManager
func NewUnifiedManager ¶
func NewUnifiedManager() (*UnifiedManager, error)
NewUnifiedManager creates a unified state manager
func NewUnifiedManagerWithEnhancedProfiles ¶
func NewUnifiedManagerWithEnhancedProfiles() (*UnifiedManager, error)
Convenience function to create unified state manager with enhanced profile integration
func NewUnifiedManagerWithProfiles ¶
func NewUnifiedManagerWithProfiles(provider ProfileProvider) (*UnifiedManager, error)
NewUnifiedManagerWithProfiles creates a unified manager with profile integration
func (*UnifiedManager) GetCurrentProfile ¶
func (um *UnifiedManager) GetCurrentProfile() (string, error)
GetCurrentProfile returns the current profile if a provider is set
func (*UnifiedManager) LoadState ¶
func (um *UnifiedManager) LoadState() (*types.State, error)
LoadState loads state (profile-aware if provider is set)
func (*UnifiedManager) LoadStateForProfile ¶
func (um *UnifiedManager) LoadStateForProfile() (*types.State, error)
LoadStateForProfile loads state with profile context (if available)
func (*UnifiedManager) SaveState ¶
func (um *UnifiedManager) SaveState(state *types.State) error
SaveState saves state (profile-aware if provider is set)
func (*UnifiedManager) SaveStateForProfile ¶
func (um *UnifiedManager) SaveStateForProfile(state *types.State) error
SaveStateForProfile saves state with profile context (if available)
type UserGroupMembershipManager ¶
type UserGroupMembershipManager struct {
// contains filtered or unexported fields
}
UserGroupMembershipManager manages user group relationships (Single Responsibility - SOLID)
func (*UserGroupMembershipManager) UpdateGroupMembership ¶
func (g *UserGroupMembershipManager) UpdateGroupMembership(ctx context.Context, state *UserState, user *usermgmt.User) error
UpdateGroupMembership synchronizes user group memberships
type UserMappingUpdater ¶
type UserMappingUpdater struct{}
UserMappingUpdater updates username and email mappings (Single Responsibility - SOLID)
func (*UserMappingUpdater) UpdateMappings ¶
func (u *UserMappingUpdater) UpdateMappings(state *UserState, oldUser, newUser *usermgmt.User)
UpdateMappings updates username and email mappings in state
type UserState ¶
type UserState struct {
// Users is a map of user ID to user
Users map[string]*usermgmt.User `json:"users"`
// Groups is a map of group ID to group
Groups map[string]*usermgmt.Group `json:"groups"`
// UserGroups is a map of user ID to list of group IDs
UserGroups map[string][]string `json:"user_groups"`
// UsersByUsername is a map of username to user ID
UsersByUsername map[string]string `json:"users_by_username"`
// UsersByEmail is a map of email to user ID
UsersByEmail map[string]string `json:"users_by_email"`
// GroupsByName is a map of group name to group ID
GroupsByName map[string]string `json:"groups_by_name"`
}
UserState represents the user state stored on disk
type UserUpdateOrchestrator ¶
type UserUpdateOrchestrator struct {
// contains filtered or unexported fields
}
UserUpdateOrchestrator coordinates user update operations (Strategy Pattern - SOLID)
func NewUserUpdateOrchestrator ¶
func NewUserUpdateOrchestrator(manager *Manager) *UserUpdateOrchestrator
NewUserUpdateOrchestrator creates user update orchestrator
type UserUpdateValidator ¶
type UserUpdateValidator struct{}
UserUpdateValidator validates user update operations (Single Responsibility - SOLID)
func (*UserUpdateValidator) ValidateUpdate ¶
func (v *UserUpdateValidator) ValidateUpdate(state *UserState, user *usermgmt.User) error
ValidateUpdate performs all validation checks for user updates