Documentation
¶
Overview ¶
Package profile provides functionality for managing Prism profiles
Package profile provides functionality for managing Prism profiles ¶
Package profile provides functionality for managing Prism profiles ¶
Package profile provides functionality for managing Prism profiles
Index ¶
- Constants
- Variables
- func Base64EncodeCredentials(creds *Credentials) (string, error)
- func EncodeCredsForDisplay(creds *Credentials) string
- type AWSCredentialsProvider
- type BasicPolicyRestrictions
- func (p *BasicPolicyRestrictions) GetPolicyViolations(templateName, instanceType, region string, hourlyCost float64) []string
- func (p *BasicPolicyRestrictions) IsCostAllowed(hourlyCost float64) bool
- func (p *BasicPolicyRestrictions) IsInstanceTypeAllowed(instanceType string) bool
- func (p *BasicPolicyRestrictions) IsRegionAllowed(region string) bool
- func (p *BasicPolicyRestrictions) IsTemplateAllowed(templateName string) bool
- type BatchConfigManager
- func (m *BatchConfigManager) ApplyConfigToBatchManager(batchManager *BatchInvitationManager)
- func (m *BatchConfigManager) ApplyConfigToDeviceManager(deviceManager *BatchDeviceManager)
- func (m *BatchConfigManager) GetConfig() *BatchInvitationConfig
- func (m *BatchConfigManager) Load() error
- func (m *BatchConfigManager) ResetToDefaults() error
- func (m *BatchConfigManager) Save() error
- func (m *BatchConfigManager) UpdateConfig(updates *BatchInvitationConfig) error
- type BatchDeviceManagementResult
- type BatchDeviceManager
- func (m *BatchDeviceManager) BatchGetDeviceInfo(invitations []*InvitationToken, concurrency int) *BatchDeviceManagementResult
- func (m *BatchDeviceManager) BatchRevokeDevices(devices []DeviceOperationResult, concurrency int) *BatchDeviceManagementResult
- func (m *BatchDeviceManager) BatchValidateDevices(devices []DeviceOperationResult, concurrency int) *BatchDeviceManagementResult
- func (m *BatchDeviceManager) ExecuteBatchDeviceOperation(csvPath string, operation string, concurrency int, hasHeader bool) (*BatchDeviceManagementResult, error)
- func (m *BatchDeviceManager) ExportDeviceInfoToCSV(writer io.Writer, results *BatchDeviceManagementResult) error
- func (m *BatchDeviceManager) ExportDeviceInfoToCSVFile(csvPath string, results *BatchDeviceManagementResult) error
- func (m *BatchDeviceManager) ImportDevicesFromCSV(reader io.Reader, hasHeader bool) ([]DeviceOperationResult, error)
- func (m *BatchDeviceManager) ImportDevicesFromCSVFile(csvPath string, hasHeader bool) ([]DeviceOperationResult, error)
- type BatchInvitation
- type BatchInvitationConfig
- type BatchInvitationFactory
- type BatchInvitationManager
- func (m *BatchInvitationManager) CreateBatchInvitations(invitations []*BatchInvitation, s3ConfigPath string, parentToken string, ...) *BatchInvitationResult
- func (m *BatchInvitationManager) CreateBatchInvitationsFromCSVFile(csvPath string, s3ConfigPath string, parentToken string, concurrency int, ...) (*BatchInvitationResult, error)
- func (m *BatchInvitationManager) ExportBatchInvitationsToCSV(writer io.Writer, results *BatchInvitationResult, includeEncodedData bool) error
- func (m *BatchInvitationManager) ExportBatchInvitationsToCSVFile(csvPath string, results *BatchInvitationResult, includeEncodedData bool) (retErr error)
- func (m *BatchInvitationManager) ImportBatchInvitationsFromCSV(reader io.Reader, hasHeader bool) ([]*BatchInvitation, error)
- type BatchInvitationResult
- type CSVInvitationParser
- type CSVRecord
- type CredentialProvider
- type Credentials
- type DeviceOperationResult
- type FieldParser
- type InvitationManager
- func (m *InvitationManager) AddToProfile(encoded string, profileName string) error
- func (m *InvitationManager) CreateInvitation(name string, invType InvitationType, validDays int, s3ConfigPath string) (*InvitationToken, error)
- func (m *InvitationManager) GetInvitation(token string) (*InvitationToken, error)
- func (m *InvitationManager) ListInvitations() []InvitationToken
- func (m *InvitationManager) RevokeInvitation(token string) error
- type InvitationToken
- func DecodeFromString(encoded string) (*InvitationToken, error)
- func GenerateInvitationToken(ownerProfile, ownerAccount, name string, invType InvitationType, validDays int, ...) (*InvitationToken, error)
- func GenerateSecureInvitationToken(ownerProfile, ownerAccount, name string, invType InvitationType, validDays int, ...) (*InvitationToken, error)
- type InvitationType
- type KeyMetadata
- type KeyMetadataStore
- type ManagerEnhanced
- func (m *ManagerEnhanced) AddProfile(profile Profile) error
- func (m *ManagerEnhanced) GetCurrentProfile() (*Profile, error)
- func (m *ManagerEnhanced) GetCurrentProfileID() (string, error)
- func (m *ManagerEnhanced) GetProfile(id string) (*Profile, error)
- func (m *ManagerEnhanced) GetProfileCredentials(profileID string) (*Credentials, error)
- func (m *ManagerEnhanced) ListProfiles() ([]Profile, error)
- func (m *ManagerEnhanced) ListProfilesWithIDs() ([]ProfileWithID, error)
- func (m *ManagerEnhanced) ProfileExists(id string) bool
- func (m *ManagerEnhanced) RemoveProfile(id string) error
- func (m *ManagerEnhanced) StoreProfileCredentials(profileID string, creds *Credentials) error
- func (m *ManagerEnhanced) SwitchProfile(id string) error
- func (m *ManagerEnhanced) UpdateProfile(id string, updates Profile) error
- func (m *ManagerEnhanced) WithProfile(ctx context.Context, profileID string) (context.Context, error)
- type Profile
- type ProfileType
- type ProfileWithID
- type Profiles
- type SSHKeyManager
- type SSHKeyManagerV2
- func (m *SSHKeyManagerV2) AddInstanceToKey(profileName, instanceName string) error
- func (m *SSHKeyManagerV2) DeleteKey(profileName string) error
- func (m *SSHKeyManagerV2) ExportKey(profileName, destPath string) error
- func (m *SSHKeyManagerV2) GetKeyMetadata(profileName string) (*KeyMetadata, error)
- func (m *SSHKeyManagerV2) GetKeyPath(profileName string) (string, error)
- func (m *SSHKeyManagerV2) GetKeyPathFromAWSKeyName(awsKeyName string) (string, error)
- func (m *SSHKeyManagerV2) GetOrCreateKeyForProfile(profileName, region string) (localPath, awsKeyName string, err error)
- func (m *SSHKeyManagerV2) GetPublicKeyContent(profileName string) (string, error)
- func (m *SSHKeyManagerV2) ImportKey(profileName, region, keyFilePath string) error
- func (m *SSHKeyManagerV2) ListKeys() ([]*KeyMetadata, error)
- func (m *SSHKeyManagerV2) RemoveInstanceFromKey(profileName, instanceName string) error
- type SecureCredentialProvider
- type SecureInvitationManager
- func (m *SecureInvitationManager) CreateSecureInvitation(name string, invType InvitationType, validDays int, s3ConfigPath string, ...) (*InvitationToken, error)
- func (m *SecureInvitationManager) GetInvitationDevices(invitationToken string) ([]map[string]interface{}, error)
- func (m *SecureInvitationManager) RevokeAllDevices(invitationToken string) error
- func (m *SecureInvitationManager) RevokeDevice(invitationToken, deviceID string) error
- func (m *SecureInvitationManager) SecureAddToProfile(encoded string, profileName string) error
- func (m *SecureInvitationManager) ValidateSecureProfile(profile *Profile) error
- type StandardFieldParser
- type StandardTypeParser
- type TypeParser
Constants ¶
const ProfileContextKey contextKey = "profile"
ProfileContextKey is the key for storing profile information in context
Variables ¶
var ErrProfileExpired = errors.New("profile invitation has expired")
ErrProfileExpired indicates that an invitation profile has expired
var ErrProfileNotFound = errors.New("profile not found")
ErrProfileNotFound indicates that the requested profile doesn't exist
Functions ¶
func Base64EncodeCredentials ¶
func Base64EncodeCredentials(creds *Credentials) (string, error)
Base64EncodeCredentials encodes credentials to base64 for transport
func EncodeCredsForDisplay ¶
func EncodeCredsForDisplay(creds *Credentials) string
EncodeCredsForDisplay encodes credentials for display (masking sensitive data)
Types ¶
type AWSCredentialsProvider ¶
type AWSCredentialsProvider struct {
// contains filtered or unexported fields
}
AWSCredentialsProvider adapts our credentials to AWS SDK
func NewAWSCredentialsProvider ¶
func NewAWSCredentialsProvider(provider CredentialProvider, profileName string) *AWSCredentialsProvider
NewAWSCredentialsProvider creates a new AWS credentials provider for a profile
func (*AWSCredentialsProvider) Retrieve ¶
func (p *AWSCredentialsProvider) Retrieve(ctx interface{}) (aws.Credentials, error)
Retrieve implements the aws.CredentialsProvider interface
type BasicPolicyRestrictions ¶
type BasicPolicyRestrictions struct {
// Template restrictions
TemplateWhitelist []string `json:"template_whitelist,omitempty"` // Allowed templates
TemplateBlacklist []string `json:"template_blacklist,omitempty"` // Forbidden templates
// Instance constraints
MaxInstanceTypes []string `json:"max_instance_types,omitempty"` // Max instance size
ForbiddenRegions []string `json:"forbidden_regions,omitempty"` // Regional restrictions
// Basic budget controls
MaxHourlyCost float64 `json:"max_hourly_cost,omitempty"` // Cost ceiling
MaxDailyBudget float64 `json:"max_daily_budget,omitempty"` // Daily limit
}
BasicPolicyRestrictions defines basic policy controls included in open source
func (*BasicPolicyRestrictions) GetPolicyViolations ¶
func (p *BasicPolicyRestrictions) GetPolicyViolations(templateName, instanceType, region string, hourlyCost float64) []string
GetPolicyViolations returns a list of policy violations for launch parameters
func (*BasicPolicyRestrictions) IsCostAllowed ¶
func (p *BasicPolicyRestrictions) IsCostAllowed(hourlyCost float64) bool
IsCostAllowed checks if hourly cost is within policy limits
func (*BasicPolicyRestrictions) IsInstanceTypeAllowed ¶
func (p *BasicPolicyRestrictions) IsInstanceTypeAllowed(instanceType string) bool
IsInstanceTypeAllowed checks if an instance type is allowed by policy restrictions
func (*BasicPolicyRestrictions) IsRegionAllowed ¶
func (p *BasicPolicyRestrictions) IsRegionAllowed(region string) bool
IsRegionAllowed checks if a region is allowed by policy restrictions
func (*BasicPolicyRestrictions) IsTemplateAllowed ¶
func (p *BasicPolicyRestrictions) IsTemplateAllowed(templateName string) bool
IsTemplateAllowed checks if a template is allowed by policy restrictions
type BatchConfigManager ¶
type BatchConfigManager struct {
// contains filtered or unexported fields
}
BatchConfigManager manages batch invitation configuration
func NewBatchConfigManager ¶
func NewBatchConfigManager() (*BatchConfigManager, error)
NewBatchConfigManager creates a new batch config manager
func (*BatchConfigManager) ApplyConfigToBatchManager ¶
func (m *BatchConfigManager) ApplyConfigToBatchManager(batchManager *BatchInvitationManager)
ApplyConfigToBatchManager applies configuration to a BatchInvitationManager
func (*BatchConfigManager) ApplyConfigToDeviceManager ¶
func (m *BatchConfigManager) ApplyConfigToDeviceManager(deviceManager *BatchDeviceManager)
ApplyConfigToDeviceManager applies configuration to a BatchDeviceManager
func (*BatchConfigManager) GetConfig ¶
func (m *BatchConfigManager) GetConfig() *BatchInvitationConfig
GetConfig returns a copy of the current configuration
func (*BatchConfigManager) Load ¶
func (m *BatchConfigManager) Load() error
Load loads the configuration from disk
func (*BatchConfigManager) ResetToDefaults ¶
func (m *BatchConfigManager) ResetToDefaults() error
ResetToDefaults resets the configuration to default values
func (*BatchConfigManager) Save ¶
func (m *BatchConfigManager) Save() error
Save saves the configuration to disk
func (*BatchConfigManager) UpdateConfig ¶
func (m *BatchConfigManager) UpdateConfig(updates *BatchInvitationConfig) error
UpdateConfig updates the configuration with the provided values
type BatchDeviceManagementResult ¶
type BatchDeviceManagementResult struct {
Successful []DeviceOperationResult
Failed []DeviceOperationResult
TotalProcessed int
TotalSuccessful int
TotalFailed int
}
BatchDeviceManagementResult holds the results of a batch device management operation
type BatchDeviceManager ¶
type BatchDeviceManager struct {
// contains filtered or unexported fields
}
BatchDeviceManager provides functionality for batch device operations
func NewBatchDeviceManager ¶
func NewBatchDeviceManager(secureManager *SecureInvitationManager) *BatchDeviceManager
NewBatchDeviceManager creates a new batch device manager
func NewBatchDeviceManagerWithConfig ¶
func NewBatchDeviceManagerWithConfig(secureManager *SecureInvitationManager, config *BatchInvitationConfig) *BatchDeviceManager
NewBatchDeviceManagerWithConfig creates a new batch device manager with configuration
func (*BatchDeviceManager) BatchGetDeviceInfo ¶
func (m *BatchDeviceManager) BatchGetDeviceInfo( invitations []*InvitationToken, concurrency int, ) *BatchDeviceManagementResult
BatchGetDeviceInfo retrieves information for multiple devices
func (*BatchDeviceManager) BatchRevokeDevices ¶
func (m *BatchDeviceManager) BatchRevokeDevices( devices []DeviceOperationResult, concurrency int, ) *BatchDeviceManagementResult
BatchRevokeDevices revokes multiple devices across multiple invitations
func (*BatchDeviceManager) BatchValidateDevices ¶
func (m *BatchDeviceManager) BatchValidateDevices( devices []DeviceOperationResult, concurrency int, ) *BatchDeviceManagementResult
BatchValidateDevices validates multiple devices across multiple invitations
func (*BatchDeviceManager) ExecuteBatchDeviceOperation ¶
func (m *BatchDeviceManager) ExecuteBatchDeviceOperation( csvPath string, operation string, concurrency int, hasHeader bool, ) (*BatchDeviceManagementResult, error)
ExecuteBatchDeviceOperation processes device operations from a CSV file
func (*BatchDeviceManager) ExportDeviceInfoToCSV ¶
func (m *BatchDeviceManager) ExportDeviceInfoToCSV( writer io.Writer, results *BatchDeviceManagementResult, ) error
ExportDeviceInfoToCSV exports device information to a CSV file
func (*BatchDeviceManager) ExportDeviceInfoToCSVFile ¶
func (m *BatchDeviceManager) ExportDeviceInfoToCSVFile( csvPath string, results *BatchDeviceManagementResult, ) error
ExportDeviceInfoToCSVFile exports device information to a CSV file
func (*BatchDeviceManager) ImportDevicesFromCSV ¶
func (m *BatchDeviceManager) ImportDevicesFromCSV( reader io.Reader, hasHeader bool, ) ([]DeviceOperationResult, error)
ImportDevicesFromCSV imports device operations from a CSV file
func (*BatchDeviceManager) ImportDevicesFromCSVFile ¶
func (m *BatchDeviceManager) ImportDevicesFromCSVFile( csvPath string, hasHeader bool, ) ([]DeviceOperationResult, error)
ImportDevicesFromCSVFile imports device operations from a CSV file
type BatchInvitation ¶
type BatchInvitation struct {
// Required fields
Name string
Type InvitationType
// Optional fields with defaults
ValidDays int // Default: 30
CanInvite bool // Default: false (true for admin)
Transferable bool // Default: false
DeviceBound bool // Default: true
MaxDevices int // Default: 1
// Internal fields for processing
S3ConfigPath string
ParentToken string
// Result fields
Token string
EncodedData string
Error error
}
BatchInvitation represents a single invitation in a batch
type BatchInvitationConfig ¶
type BatchInvitationConfig struct {
// General settings
DefaultConcurrency int `json:"defaultConcurrency"`
DefaultValidDays int `json:"defaultValidDays"`
// Security settings
DefaultDeviceBound bool `json:"defaultDeviceBound"`
DefaultMaxDevices int `json:"defaultMaxDevices"`
DefaultCanInvite bool `json:"defaultCanInvite"`
DefaultTransferable bool `json:"defaultTransferable"`
// CSV settings
DefaultHasHeader bool `json:"defaultHasHeader"`
DefaultDelimiter string `json:"defaultDelimiter"`
IncludeEncodedData bool `json:"includeEncodedData"`
DefaultOutputDirectory string `json:"defaultOutputDirectory"`
// Admin settings
RequireAdminAuth bool `json:"requireAdminAuth"`
AdminInvitationToken string `json:"adminInvitationToken"`
NotificationWebhook string `json:"notificationWebhook"`
AuditLoggingEnabled bool `json:"auditLoggingEnabled"`
LogDirectory string `json:"logDirectory"`
// Performance settings
BatchSizeLimit int `json:"batchSizeLimit"`
EnableRateLimiting bool `json:"enableRateLimiting"`
MaxOperationsPerHour int `json:"maxOperationsPerHour"`
// Last updated
LastUpdated time.Time `json:"lastUpdated"`
}
BatchInvitationConfig contains configuration settings for batch invitation operations
func DefaultBatchInvitationConfig ¶
func DefaultBatchInvitationConfig() *BatchInvitationConfig
DefaultBatchInvitationConfig returns the default configuration
type BatchInvitationFactory ¶
type BatchInvitationFactory struct {
// contains filtered or unexported fields
}
BatchInvitationFactory creates batch invitations using Factory Pattern (SOLID: Single Responsibility + Open/Closed)
func NewBatchInvitationFactory ¶
func NewBatchInvitationFactory() *BatchInvitationFactory
NewBatchInvitationFactory creates a new invitation factory
func (*BatchInvitationFactory) CreateInvitation ¶
func (f *BatchInvitationFactory) CreateInvitation(record *CSVRecord) (*BatchInvitation, error)
CreateInvitation creates a batch invitation from CSV record using Factory Pattern (SOLID: Single Responsibility)
type BatchInvitationManager ¶
type BatchInvitationManager struct {
// contains filtered or unexported fields
}
BatchInvitationManager provides functionality for batch invitation operations
func NewBatchInvitationManager ¶
func NewBatchInvitationManager(secureManager *SecureInvitationManager) *BatchInvitationManager
NewBatchInvitationManager creates a new batch invitation manager
func NewBatchInvitationManagerWithConfig ¶
func NewBatchInvitationManagerWithConfig(secureManager *SecureInvitationManager, config *BatchInvitationConfig) *BatchInvitationManager
NewBatchInvitationManagerWithConfig creates a new batch invitation manager with configuration
func (*BatchInvitationManager) CreateBatchInvitations ¶
func (m *BatchInvitationManager) CreateBatchInvitations( invitations []*BatchInvitation, s3ConfigPath string, parentToken string, concurrency int, ) *BatchInvitationResult
CreateBatchInvitations creates multiple invitations in a batch
func (*BatchInvitationManager) CreateBatchInvitationsFromCSVFile ¶
func (m *BatchInvitationManager) CreateBatchInvitationsFromCSVFile( csvPath string, s3ConfigPath string, parentToken string, concurrency int, hasHeader bool, ) (*BatchInvitationResult, error)
CreateBatchInvitationsFromCSVFile creates batch invitations from a CSV file
func (*BatchInvitationManager) ExportBatchInvitationsToCSV ¶
func (m *BatchInvitationManager) ExportBatchInvitationsToCSV( writer io.Writer, results *BatchInvitationResult, includeEncodedData bool, ) error
ExportBatchInvitationsToCSV exports batch invitation results to a CSV file
func (*BatchInvitationManager) ExportBatchInvitationsToCSVFile ¶
func (m *BatchInvitationManager) ExportBatchInvitationsToCSVFile( csvPath string, results *BatchInvitationResult, includeEncodedData bool, ) (retErr error)
ExportBatchInvitationsToCSVFile exports batch invitation results to a CSV file
func (*BatchInvitationManager) ImportBatchInvitationsFromCSV ¶
func (m *BatchInvitationManager) ImportBatchInvitationsFromCSV( reader io.Reader, hasHeader bool, ) ([]*BatchInvitation, error)
ImportBatchInvitationsFromCSV imports batch invitations from a CSV file ImportBatchInvitationsFromCSV imports batch invitations using Factory Pattern (SOLID: Single Responsibility)
type BatchInvitationResult ¶
type BatchInvitationResult struct {
Successful []*BatchInvitation
Failed []*BatchInvitation
TotalProcessed int
TotalSuccessful int
TotalFailed int
}
BatchInvitationResult holds the results of a batch invitation creation
type CSVInvitationParser ¶
type CSVInvitationParser struct {
// contains filtered or unexported fields
}
CSVInvitationParser handles CSV parsing using Strategy Pattern (SOLID: Single Responsibility)
func NewCSVInvitationParser ¶
func NewCSVInvitationParser(reader io.Reader, hasHeader bool) *CSVInvitationParser
NewCSVInvitationParser creates a new CSV parser
func (*CSVInvitationParser) ParseRecords ¶
func (p *CSVInvitationParser) ParseRecords() ([]*CSVRecord, error)
ParseRecords parses all CSV records (Single Responsibility)
type CSVRecord ¶
type CSVRecord struct {
Name string
Type string
ValidDays string
CanInvite string
Transferable string
DeviceBound string
MaxDevices string
}
CSVRecord represents a parsed CSV record
type CredentialProvider ¶
type CredentialProvider interface {
// GetCredentials retrieves credentials for a profile
GetCredentials(profileName string) (*Credentials, error)
// StoreCredentials stores credentials for a profile
StoreCredentials(profileName string, creds *Credentials) error
// ClearCredentials removes credentials for a profile
ClearCredentials(profileName string) error
}
CredentialProvider defines the interface for storing and retrieving credentials
func NewCredentialProvider ¶
func NewCredentialProvider() (CredentialProvider, error)
NewCredentialProvider creates a new secure credential provider
type Credentials ¶
type Credentials struct {
AccessKeyID string `json:"access_key_id"`
SecretAccessKey string `json:"secret_access_key"`
SessionToken string `json:"session_token,omitempty"`
Expiration *time.Time `json:"expiration,omitempty"`
}
Credentials holds AWS credentials data
func Base64DecodeCredentials ¶
func Base64DecodeCredentials(encoded string) (*Credentials, error)
Base64DecodeCredentials decodes credentials from base64
type DeviceOperationResult ¶
type DeviceOperationResult struct {
DeviceID string
Token string
Name string
Operation string // "revoke", "validate", "info"
Success bool
Error error
Details map[string]interface{}
ProcessedAt time.Time
}
DeviceOperationResult holds the result of a single device operation
type FieldParser ¶
type FieldParser interface {
ParseFields(invitation *BatchInvitation, record *CSVRecord) (*BatchInvitation, error)
}
FieldParser defines the interface for parsing optional fields using Strategy Pattern (SOLID: Open/Closed)
type InvitationManager ¶
type InvitationManager struct {
// contains filtered or unexported fields
}
InvitationManager handles the creation and storage of invitations
func NewInvitationManager ¶
func NewInvitationManager(profileManager *ManagerEnhanced) (*InvitationManager, error)
NewInvitationManager creates a new invitation manager
func (*InvitationManager) AddToProfile ¶
func (m *InvitationManager) AddToProfile(encoded string, profileName string) error
AddToProfile accepts an invitation and creates a profile from it
func (*InvitationManager) CreateInvitation ¶
func (m *InvitationManager) CreateInvitation(name string, invType InvitationType, validDays int, s3ConfigPath string) (*InvitationToken, error)
CreateInvitation generates and stores a new invitation
func (*InvitationManager) GetInvitation ¶
func (m *InvitationManager) GetInvitation(token string) (*InvitationToken, error)
GetInvitation retrieves an invitation by token
func (*InvitationManager) ListInvitations ¶
func (m *InvitationManager) ListInvitations() []InvitationToken
ListInvitations returns all valid invitations
func (*InvitationManager) RevokeInvitation ¶
func (m *InvitationManager) RevokeInvitation(token string) error
RevokeInvitation removes an invitation
type InvitationToken ¶
type InvitationToken struct {
// Token is the unique identifier for this invitation
Token string `json:"token"`
// OwnerProfile is the profile ID of the creator
OwnerProfile string `json:"owner_profile"`
// OwnerAccount is the AWS account ID of the owner
OwnerAccount string `json:"owner_account"`
// S3ConfigPath is the optional path to shared config in S3
S3ConfigPath string `json:"s3_config_path,omitempty"`
// Type defines the permission level
Type InvitationType `json:"type"`
// Name is a human-readable name for this invitation
Name string `json:"name"`
// Created is when this invitation was generated
Created time.Time `json:"created"`
// Expires is when this invitation will no longer be valid
Expires time.Time `json:"expires"`
// Security attributes for enhanced invitations (v0.4.3+)
CanInvite bool `json:"can_invite,omitempty"`
Transferable bool `json:"transferable,omitempty"`
DeviceBound bool `json:"device_bound,omitempty"`
MaxDevices int `json:"max_devices,omitempty"`
// Parentage tracking for invitation chains
ParentToken string `json:"parent_token,omitempty"`
// Basic policy restrictions (open source feature)
PolicyRestrictions *BasicPolicyRestrictions `json:"policy_restrictions,omitempty"`
}
InvitationToken represents a secure invitation with metadata
func DecodeFromString ¶
func DecodeFromString(encoded string) (*InvitationToken, error)
DecodeFromString decodes an invitation token from a string
func GenerateInvitationToken ¶
func GenerateInvitationToken(ownerProfile, ownerAccount, name string, invType InvitationType, validDays int, s3ConfigPath string) (*InvitationToken, error)
GenerateInvitationToken creates a new secure invitation token
func GenerateSecureInvitationToken ¶
func GenerateSecureInvitationToken(ownerProfile, ownerAccount, name string, invType InvitationType, validDays int, s3ConfigPath string, canInvite, transferable, deviceBound bool, maxDevices int, parentToken string) (*InvitationToken, error)
GenerateSecureInvitationToken creates an enhanced invitation token with security features
func (*InvitationToken) EncodeToString ¶
func (i *InvitationToken) EncodeToString() (string, error)
EncodeToString encodes the invitation token to a shareable string
func (*InvitationToken) GetDescription ¶
func (i *InvitationToken) GetDescription() string
GetDescription returns a human-readable description of the invitation
func (*InvitationToken) GetExpirationDuration ¶
func (i *InvitationToken) GetExpirationDuration() time.Duration
GetExpirationDuration returns the duration until this invitation expires
func (*InvitationToken) IsValid ¶
func (i *InvitationToken) IsValid() bool
IsValid checks if the invitation token is still valid
type InvitationType ¶
type InvitationType string
InvitationType specifies the type of invitation being generated
const ( // InvitationTypeReadOnly allows read-only access to resources InvitationTypeReadOnly InvitationType = "read_only" // InvitationTypeReadWrite allows read and write access to resources InvitationTypeReadWrite InvitationType = "read_write" // InvitationTypeAdmin allows full access to resources InvitationTypeAdmin InvitationType = "admin" )
type KeyMetadata ¶
type KeyMetadata struct {
AWSKeyName string `json:"aws_key_name"`
Profile string `json:"profile"`
Region string `json:"region"`
CreatedAt time.Time `json:"created_at"`
KeyType string `json:"type"`
Instances []string `json:"instances"`
LocalPath string `json:"-"` // Not serialized, computed from profile
PublicKey string `json:"-"` // Not serialized, loaded on demand
}
KeyMetadata tracks SSH key information and usage
type KeyMetadataStore ¶
type KeyMetadataStore struct {
Keys map[string]*KeyMetadata `json:"keys"`
Version string `json:"version"`
}
KeyMetadataStore tracks all Prism SSH keys
type ManagerEnhanced ¶
type ManagerEnhanced struct {
// contains filtered or unexported fields
}
ManagerEnhanced extends the Manager with additional functionality for v0.4.2
func NewManagerEnhanced ¶
func NewManagerEnhanced() (*ManagerEnhanced, error)
NewManagerEnhanced creates a new enhanced profile manager
func (*ManagerEnhanced) AddProfile ¶
func (m *ManagerEnhanced) AddProfile(profile Profile) error
AddProfile creates a new profile
func (*ManagerEnhanced) GetCurrentProfile ¶
func (m *ManagerEnhanced) GetCurrentProfile() (*Profile, error)
GetCurrentProfile returns the currently active profile
func (*ManagerEnhanced) GetCurrentProfileID ¶
func (m *ManagerEnhanced) GetCurrentProfileID() (string, error)
GetCurrentProfileID returns the ID of the currently active profile
func (*ManagerEnhanced) GetProfile ¶
func (m *ManagerEnhanced) GetProfile(id string) (*Profile, error)
GetProfile returns a specific profile by ID
func (*ManagerEnhanced) GetProfileCredentials ¶
func (m *ManagerEnhanced) GetProfileCredentials(profileID string) (*Credentials, error)
GetProfileCredentials retrieves credentials for a profile
func (*ManagerEnhanced) ListProfiles ¶
func (m *ManagerEnhanced) ListProfiles() ([]Profile, error)
ListProfiles returns all available profiles
func (*ManagerEnhanced) ListProfilesWithIDs ¶
func (m *ManagerEnhanced) ListProfilesWithIDs() ([]ProfileWithID, error)
ListProfilesWithIDs returns all available profiles with their IDs
func (*ManagerEnhanced) ProfileExists ¶
func (m *ManagerEnhanced) ProfileExists(id string) bool
ProfileExists checks if a profile exists
func (*ManagerEnhanced) RemoveProfile ¶
func (m *ManagerEnhanced) RemoveProfile(id string) error
RemoveProfile deletes a profile and its associated credentials
func (*ManagerEnhanced) StoreProfileCredentials ¶
func (m *ManagerEnhanced) StoreProfileCredentials(profileID string, creds *Credentials) error
StoreProfileCredentials stores credentials for a profile
func (*ManagerEnhanced) SwitchProfile ¶
func (m *ManagerEnhanced) SwitchProfile(id string) error
SwitchProfile activates a profile by ID
func (*ManagerEnhanced) UpdateProfile ¶
func (m *ManagerEnhanced) UpdateProfile(id string, updates Profile) error
UpdateProfile modifies an existing profile
func (*ManagerEnhanced) WithProfile ¶
func (m *ManagerEnhanced) WithProfile(ctx context.Context, profileID string) (context.Context, error)
WithProfile returns a new context with profile information
type Profile ¶
type Profile struct {
// Type is the profile type (personal or invitation)
Type ProfileType `json:"type"`
// Name is the display name for the profile
Name string `json:"name"`
// AWSProfile is the AWS CLI profile name to use
AWSProfile string `json:"aws_profile"`
// Region is the default AWS region for this profile
Region string `json:"region"`
// Default indicates if this is the default profile
Default bool `json:"default"`
// CreatedAt is when the profile was created
CreatedAt time.Time `json:"created_at"`
// UpdatedAt is when the profile was last updated
UpdatedAt time.Time `json:"updated_at,omitempty"`
// ExpiresAt is when invitation profiles expire (optional)
ExpiresAt *time.Time `json:"expires_at,omitempty"`
// InvitationID is the invitation ID for invitation profiles (optional)
InvitationID string `json:"invitation_id,omitempty"`
// OrganizationID is the organization ID for invitation profiles (optional)
OrganizationID string `json:"organization_id,omitempty"`
// LastUsed is when the profile was last used
LastUsed *time.Time `json:"last_used,omitempty"`
// InvitationToken for invitation profiles
InvitationToken string `json:"invitation_token,omitempty"`
// OwnerAccount for invitation profiles
OwnerAccount string `json:"owner_account,omitempty"`
// S3ConfigPath for invitation profiles
S3ConfigPath string `json:"s3_config_path,omitempty"`
// DeviceBound indicates if the profile is bound to a device
DeviceBound bool `json:"device_bound,omitempty"`
// Transferable indicates if the profile can be transferred
Transferable bool `json:"transferable,omitempty"`
// BindingRef is a reference to device binding information
BindingRef string `json:"binding_ref,omitempty"`
// SSH key configuration
SSHKeyName string `json:"ssh_key_name,omitempty"` // AWS key pair name
SSHKeyPath string `json:"ssh_key_path,omitempty"` // Local private key path
UseDefaultKey bool `json:"use_default_key,omitempty"` // Use default SSH key (~/.ssh/id_rsa)
// Basic policy restrictions inherited from invitation (open source feature)
PolicyRestrictions *BasicPolicyRestrictions `json:"policy_restrictions,omitempty"`
}
Profile represents a Prism profile configuration
type ProfileType ¶
type ProfileType string
ProfileType represents the type of a profile
const ( // ProfileTypePersonal represents a personal AWS profile ProfileTypePersonal ProfileType = "personal" // ProfileTypeInvitation represents an invitation-based profile ProfileTypeInvitation ProfileType = "invitation" )
type ProfileWithID ¶
ProfileWithID represents a profile with its ID
type Profiles ¶
type Profiles struct {
// Profiles is a map of profile ID to profile
Profiles map[string]Profile `json:"profiles"`
// CurrentProfile is the ID of the currently active profile
CurrentProfile string `json:"current_profile"`
// Version is the profiles file format version
Version int `json:"version"`
}
Profiles represents the collection of all profiles
type SSHKeyManager ¶
type SSHKeyManager struct {
// contains filtered or unexported fields
}
SSHKeyManager handles SSH key operations for profiles
func NewSSHKeyManager ¶
func NewSSHKeyManager() (*SSHKeyManager, error)
NewSSHKeyManager creates a new SSH key manager
func (*SSHKeyManager) GetPublicKeyContent ¶
func (m *SSHKeyManager) GetPublicKeyContent(publicKeyPath string) (string, error)
GetPublicKeyContent returns the content of the public key for AWS upload
func (*SSHKeyManager) GetSSHKeyForProfile ¶
func (m *SSHKeyManager) GetSSHKeyForProfile(profile *Profile) (keyPath string, keyName string, err error)
GetSSHKeyForProfile returns the SSH key configuration for a profile
type SSHKeyManagerV2 ¶
type SSHKeyManagerV2 struct {
// contains filtered or unexported fields
}
SSHKeyManagerV2 manages SSH keys with normalized storage and naming
func NewSSHKeyManagerV2 ¶
func NewSSHKeyManagerV2() (*SSHKeyManagerV2, error)
NewSSHKeyManagerV2 creates a new normalized SSH key manager
func (*SSHKeyManagerV2) AddInstanceToKey ¶
func (m *SSHKeyManagerV2) AddInstanceToKey(profileName, instanceName string) error
AddInstanceToKey associates an instance with a key
func (*SSHKeyManagerV2) DeleteKey ¶
func (m *SSHKeyManagerV2) DeleteKey(profileName string) error
DeleteKey deletes a key (with safety checks for instance associations)
func (*SSHKeyManagerV2) ExportKey ¶
func (m *SSHKeyManagerV2) ExportKey(profileName, destPath string) error
ExportKey exports a key to a specified location
func (*SSHKeyManagerV2) GetKeyMetadata ¶
func (m *SSHKeyManagerV2) GetKeyMetadata(profileName string) (*KeyMetadata, error)
GetKeyMetadata returns metadata for a specific key
func (*SSHKeyManagerV2) GetKeyPath ¶
func (m *SSHKeyManagerV2) GetKeyPath(profileName string) (string, error)
GetKeyPath returns the local path for a profile's SSH key
func (*SSHKeyManagerV2) GetKeyPathFromAWSKeyName ¶
func (m *SSHKeyManagerV2) GetKeyPathFromAWSKeyName(awsKeyName string) (string, error)
GetKeyPathFromAWSKeyName converts AWS KeyName to local key path
func (*SSHKeyManagerV2) GetOrCreateKeyForProfile ¶
func (m *SSHKeyManagerV2) GetOrCreateKeyForProfile(profileName, region string) (localPath, awsKeyName string, err error)
GetOrCreateKeyForProfile gets or creates a normalized SSH key for a profile and region
func (*SSHKeyManagerV2) GetPublicKeyContent ¶
func (m *SSHKeyManagerV2) GetPublicKeyContent(profileName string) (string, error)
GetPublicKeyContent returns the public key content for AWS upload
func (*SSHKeyManagerV2) ImportKey ¶
func (m *SSHKeyManagerV2) ImportKey(profileName, region, keyFilePath string) error
ImportKey imports an existing SSH key for a profile
func (*SSHKeyManagerV2) ListKeys ¶
func (m *SSHKeyManagerV2) ListKeys() ([]*KeyMetadata, error)
ListKeys returns all Prism SSH keys
func (*SSHKeyManagerV2) RemoveInstanceFromKey ¶
func (m *SSHKeyManagerV2) RemoveInstanceFromKey(profileName, instanceName string) error
RemoveInstanceFromKey removes an instance association from a key
type SecureCredentialProvider ¶
type SecureCredentialProvider struct {
// contains filtered or unexported fields
}
SecureCredentialProvider is a platform-specific secure credential provider
func (*SecureCredentialProvider) ClearCredentials ¶
func (p *SecureCredentialProvider) ClearCredentials(profileName string) error
ClearCredentials removes credentials for a profile
func (*SecureCredentialProvider) GetCredentials ¶
func (p *SecureCredentialProvider) GetCredentials(profileName string) (*Credentials, error)
GetCredentials retrieves credentials for a profile using platform-specific secure storage
func (*SecureCredentialProvider) StoreCredentials ¶
func (p *SecureCredentialProvider) StoreCredentials(profileName string, creds *Credentials) error
StoreCredentials stores credentials for a profile using platform-specific secure storage
type SecureInvitationManager ¶
type SecureInvitationManager struct {
*InvitationManager
// contains filtered or unexported fields
}
SecureInvitationManager extends the standard invitation manager with security features
func NewSecureInvitationManager ¶
func NewSecureInvitationManager(profileManager *ManagerEnhanced) (*SecureInvitationManager, error)
NewSecureInvitationManager creates a new secure invitation manager
func (*SecureInvitationManager) CreateSecureInvitation ¶
func (m *SecureInvitationManager) CreateSecureInvitation( name string, invType InvitationType, validDays int, s3ConfigPath string, canInvite bool, transferable bool, deviceBound bool, maxDevices int, parentToken string, ) (*InvitationToken, error)
CreateSecureInvitation generates a new invitation with security features
func (*SecureInvitationManager) GetInvitationDevices ¶
func (m *SecureInvitationManager) GetInvitationDevices(invitationToken string) ([]map[string]interface{}, error)
GetInvitationDevices gets the list of devices registered for an invitation
func (*SecureInvitationManager) RevokeAllDevices ¶
func (m *SecureInvitationManager) RevokeAllDevices(invitationToken string) error
RevokeAllDevices revokes all devices from using an invitation
func (*SecureInvitationManager) RevokeDevice ¶
func (m *SecureInvitationManager) RevokeDevice(invitationToken, deviceID string) error
RevokeDevice revokes a specific device from using an invitation
func (*SecureInvitationManager) SecureAddToProfile ¶
func (m *SecureInvitationManager) SecureAddToProfile(encoded string, profileName string) error
SecureAddToProfile accepts an invitation and creates a profile with security binding
func (*SecureInvitationManager) ValidateSecureProfile ¶
func (m *SecureInvitationManager) ValidateSecureProfile(profile *Profile) error
ValidateSecureProfile validates that a secure profile can be used on this device
type StandardFieldParser ¶
type StandardFieldParser struct{}
StandardFieldParser implements standard field parsing logic (Strategy Pattern)
func (*StandardFieldParser) ParseFields ¶
func (p *StandardFieldParser) ParseFields(invitation *BatchInvitation, record *CSVRecord) (*BatchInvitation, error)
type StandardTypeParser ¶
type StandardTypeParser struct{}
StandardTypeParser implements standard type parsing logic (Strategy Pattern)
func (*StandardTypeParser) ParseType ¶
func (p *StandardTypeParser) ParseType(typeStr string) (InvitationType, error)
type TypeParser ¶
type TypeParser interface {
ParseType(typeStr string) (InvitationType, error)
}
TypeParser defines the interface for parsing invitation types using Strategy Pattern (SOLID: Open/Closed)
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package export provides functionality for exporting and importing Prism profiles.
|
Package export provides functionality for exporting and importing Prism profiles. |
|
Package security provides comprehensive audit logging for security events
|
Package security provides comprehensive audit logging for security events |