Help us shape the future of Go! Take the 2026 Go Developer Survey

types

package
v0.5.7 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2025 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package types provides AMI-related data structures for the Universal AMI System

Package types provides project and budget management types for Prism.

This file defines the core types for project-based resource organization and budget management, enabling researchers to organize instances, storage, and costs around research projects with proper financial controls.

Package types provides Prism's core type definitions.

This package is organized into logical modules:

  • runtime.go: Instance and template runtime definitions
  • storage.go: EFS and EBS volume types
  • config.go: Configuration and state management
  • requests.go: API request/response types
  • api_version.go: API versioning types
  • errors.go: Error handling types
  • idle.go: Idle detection types
  • instance.go: Instance-specific types
  • repository.go: Repository management types

For backward compatibility, the main types are also available through this file via type aliases.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractValidationErrors

func ExtractValidationErrors(err error) map[string]string

ExtractValidationErrors extracts validation errors from an APIError Returns nil if the error is not a validation error or has no validation details

func FormatErrorForDisplay

func FormatErrorForDisplay(err error) string

FormatErrorForDisplay formats an error for display to users This provides a more user-friendly message than the raw error

func IsErrorCode

func IsErrorCode(err error, code ErrorCode) bool

IsErrorCode checks if an error is an APIError with the specified code

func IsForbiddenErr

func IsForbiddenErr(err error) bool

IsForbiddenErr checks if an error is a forbidden error

func IsNotFoundErr

func IsNotFoundErr(err error) bool

IsNotFoundErr checks if an error is a not found error

func IsRetryableErr

func IsRetryableErr(err error) bool

IsRetryableErr checks if an error can be retried

func IsUnauthorizedErr

func IsUnauthorizedErr(err error) bool

IsUnauthorizedErr checks if an error is an unauthorized error

func IsValidationErr

func IsValidationErr(err error) bool

IsValidationErr checks if an error is a validation error

Types

type AMICleanupResult

type AMICleanupResult struct {
	TotalFound            int       `json:"total_found"`
	TotalRemoved          int       `json:"total_removed"`
	StorageSavingsMonthly float64   `json:"storage_savings_monthly"`
	RemovedAMIs           []AMIInfo `json:"removed_amis"`
	CompletedAt           time.Time `json:"completed_at"`
}

AMICleanupResult represents the result of an AMI cleanup operation

type AMICostAnalysis

type AMICostAnalysis struct {
	TemplateName string `json:"template_name"`
	Region       string `json:"region"`

	// AMI deployment costs
	AMILaunchCost  float64 `json:"ami_launch_cost"`  // Per hour
	AMIStorageCost float64 `json:"ami_storage_cost"` // Per month
	AMISetupCost   float64 `json:"ami_setup_cost"`   // One-time (minimal)

	// Script deployment costs
	ScriptLaunchCost float64 `json:"script_launch_cost"` // Per hour (same as AMI)
	ScriptSetupCost  float64 `json:"script_setup_cost"`  // One-time setup cost (higher)
	ScriptSetupTime  int     `json:"script_setup_time"`  // Setup time in minutes

	// Cost comparison
	BreakEvenPoint   float64 `json:"break_even_point"` // Hours where costs are equal
	CostSavings1Hour float64 `json:"cost_savings_1h"`  // Savings for 1-hour session
	CostSavings8Hour float64 `json:"cost_savings_8h"`  // Savings for 8-hour session
	TimeSavings      int     `json:"time_savings"`     // Time saved in minutes

	// Recommendations
	Recommendation string `json:"recommendation"` // "ami_recommended", "script_recommended", "neutral"
	Reasoning      string `json:"reasoning"`
}

AMICostAnalysis represents cost analysis for AMI vs script deployment

type AMICreationRequest

type AMICreationRequest struct {
	// Source instance information
	InstanceID   string `json:"instance_id"`
	TemplateName string `json:"template_name"`

	// AMI metadata
	Name        string            `json:"name"`
	Description string            `json:"description"`
	Version     string            `json:"version,omitempty"`
	Tags        map[string]string `json:"tags,omitempty"`

	// Sharing configuration
	Public    bool     `json:"public"`
	ShareWith []string `json:"share_with,omitempty"` // AWS account IDs
	Community string   `json:"community,omitempty"`  // Community to share with

	// Multi-region deployment
	MultiRegion    []string `json:"multi_region,omitempty"`
	RegionPriority []string `json:"region_priority,omitempty"` // Preferred order for deployment

	// Creation options
	NoReboot           bool `json:"no_reboot,omitempty"`
	BlockDeviceMapping bool `json:"block_device_mapping,omitempty"`
}

AMICreationRequest represents a request to create a new AMI

type AMICreationResult

type AMICreationResult struct {
	// Primary AMI information
	AMIID        string            `json:"ami_id"`
	Name         string            `json:"name"`
	CreationTime time.Duration     `json:"creation_time"`
	Status       AMICreationStatus `json:"status"`

	// Multi-region deployment results
	RegionResults map[string]*RegionAMIResult `json:"region_results,omitempty"`

	// Community sharing results
	CommunitySharing *CommunityShareResult `json:"community_sharing,omitempty"`

	// Cost information
	StorageCost  float64 `json:"storage_cost"`  // Monthly storage cost
	CreationCost float64 `json:"creation_cost"` // One-time creation cost
	TransferCost float64 `json:"transfer_cost"` // Multi-region copy cost
}

AMICreationResult represents the result of AMI creation

type AMICreationStatus

type AMICreationStatus string

AMICreationStatus represents the status of AMI creation

const (
	AMICreationPending    AMICreationStatus = "pending"
	AMICreationInProgress AMICreationStatus = "in_progress"
	AMICreationCompleted  AMICreationStatus = "completed"
	AMICreationFailed     AMICreationStatus = "failed"
)

type AMIDeletionResult

type AMIDeletionResult struct {
	AMIID                 string    `json:"ami_id"`
	Status                string    `json:"status"`
	DeletedSnapshots      []string  `json:"deleted_snapshots,omitempty"`
	StorageSavingsMonthly float64   `json:"storage_savings_monthly"`
	CompletedAt           time.Time `json:"completed_at"`
}

AMIDeletionResult represents the result of an AMI deletion

type AMIInfo

type AMIInfo struct {
	// Basic AMI identification
	AMIID        string `json:"ami_id"`
	Name         string `json:"name"`
	Description  string `json:"description"`
	Region       string `json:"region"`
	Architecture string `json:"architecture"` // x86_64, arm64

	// AMI metadata
	Owner        string            `json:"owner"`
	CreationDate time.Time         `json:"creation_date"`
	State        string            `json:"state"`
	Public       bool              `json:"public"`
	Tags         map[string]string `json:"tags,omitempty"`

	// Performance and cost information
	LaunchTime      time.Duration `json:"launch_time"`      // Expected launch time
	MarketplaceCost float64       `json:"marketplace_cost"` // Marketplace hourly cost (if applicable)
	StorageCost     float64       `json:"storage_cost"`     // Monthly storage cost
	SourceRegion    string        `json:"source_region"`    // Different from Region if copied

	// Community AMI information (if applicable)
	CommunityInfo *CommunityAMIInfo `json:"community_info,omitempty"`

	// Validation and security
	SignatureValid bool      `json:"signature_valid"`
	SecurityScore  float64   `json:"security_score"` // 0.0-10.0
	LastTested     time.Time `json:"last_tested"`
}

AMIInfo contains detailed information about an AMI

type AMIResolutionMethod

type AMIResolutionMethod string

AMIResolutionMethod indicates how an AMI was resolved

const (
	ResolutionDirectMapping  AMIResolutionMethod = "direct_mapping"
	ResolutionDynamicSearch  AMIResolutionMethod = "dynamic_search"
	ResolutionMarketplace    AMIResolutionMethod = "marketplace"
	ResolutionCrossRegion    AMIResolutionMethod = "cross_region"
	ResolutionFallbackScript AMIResolutionMethod = "fallback_script"
	ResolutionFailed         AMIResolutionMethod = "failed"
)

type AMIResolutionResult

type AMIResolutionResult struct {
	// Resolved AMI information
	AMI *AMIInfo `json:"ami,omitempty"`

	// How the AMI was resolved
	ResolutionMethod AMIResolutionMethod `json:"resolution_method"`

	// Chain of fallback methods attempted
	FallbackChain []string `json:"fallback_chain"`

	// User warning about resolution (if applicable)
	Warning string `json:"warning,omitempty"`

	// Cost analysis
	EstimatedCost float64       `json:"estimated_cost"`
	LaunchTime    time.Duration `json:"launch_time"`
	CostSavings   float64       `json:"cost_savings,omitempty"` // vs script provisioning

	// Region information
	TargetRegion string `json:"target_region"`
	SourceRegion string `json:"source_region,omitempty"` // Different if cross-region copy
}

AMIResolutionResult represents the result of AMI resolution for a template

type AMIRestoreResult

type AMIRestoreResult struct {
	AMIID                      string    `json:"ami_id"`
	Name                       string    `json:"name"`
	Description                string    `json:"description"`
	Architecture               string    `json:"architecture"`
	EstimatedCompletionMinutes int       `json:"estimated_completion_minutes"`
	RestoreInitiatedAt         time.Time `json:"restore_initiated_at"`
}

AMIRestoreResult represents the result of AMI restoration from snapshot

type AMIReview

type AMIReview struct {
	UserID    string    `json:"user_id"`
	Rating    int       `json:"rating"` // 1-5 stars
	Review    string    `json:"review"`
	Helpful   int       `json:"helpful"` // Helpful votes
	CreatedAt time.Time `json:"created_at"`
}

AMIReview represents a community review of an AMI

type AMITestRequest

type AMITestRequest struct {
	TemplateName string   `json:"template_name"`
	Regions      []string `json:"regions,omitempty"`     // Test specific regions, empty = all
	TestLaunch   bool     `json:"test_launch,omitempty"` // Actually launch instance for testing
}

AMITestRequest represents a request to test AMI availability

type AMITestResult

type AMITestResult struct {
	TemplateName     string                       `json:"template_name"`
	OverallStatus    AMITestStatus                `json:"overall_status"`
	RegionResults    map[string]*RegionTestResult `json:"region_results"`
	TestedAt         time.Time                    `json:"tested_at"`
	TotalRegions     int                          `json:"total_regions"`
	AvailableRegions int                          `json:"available_regions"`
}

AMITestResult represents the result of AMI availability testing

type AMITestStatus

type AMITestStatus string

AMITestStatus represents overall AMI test status

const (
	AMITestStatusPassed  AMITestStatus = "passed"  // Available in all requested regions
	AMITestStatusPartial AMITestStatus = "partial" // Available in some regions
	AMITestStatusFailed  AMITestStatus = "failed"  // Not available in any region
)

type AMIUsageMetrics

type AMIUsageMetrics struct {
	// Resolution metrics
	ResolutionAttempts    map[AMIResolutionMethod]int64         `json:"resolution_attempts"`
	ResolutionSuccesses   map[AMIResolutionMethod]int64         `json:"resolution_successes"`
	AverageResolutionTime map[AMIResolutionMethod]time.Duration `json:"average_resolution_time"`

	// Launch metrics
	AMILaunches       int64         `json:"ami_launches"`
	ScriptLaunches    int64         `json:"script_launches"`
	LaunchSuccessRate float64       `json:"launch_success_rate"`
	AverageLaunchTime time.Duration `json:"average_launch_time"`

	// Cost metrics
	TotalCostSavings   float64       `json:"total_cost_savings"`
	AverageCostSavings float64       `json:"average_cost_savings"`
	TotalTimeSavings   time.Duration `json:"total_time_savings"`

	// Regional metrics
	RegionalAvailability map[string]float64 `json:"regional_availability"` // region -> availability percentage
	CrossRegionCopies    int64              `json:"cross_region_copies"`

	// Community metrics
	CommunityAMIUsage      int64 `json:"community_ami_usage"`
	CommunityContributions int64 `json:"community_contributions"`

	// Time period
	Period    string    `json:"period"` // "daily", "weekly", "monthly"
	StartTime time.Time `json:"start_time"`
	EndTime   time.Time `json:"end_time"`
}

AMIUsageMetrics represents usage metrics for AMI system

type APIError

type APIError struct {
	Code        ErrorCode         `json:"code"`
	Message     string            `json:"message"`
	Details     string            `json:"details,omitempty"`
	RequestID   string            `json:"request_id,omitempty"`
	Operation   string            `json:"operation,omitempty"`
	Resource    string            `json:"resource,omitempty"`    // Resource type (instance, volume, etc.)
	ResourceID  string            `json:"resource_id,omitempty"` // Specific resource ID (if applicable)
	Field       string            `json:"field,omitempty"`       // Field name for validation errors
	Validation  map[string]string `json:"validation,omitempty"`  // Field validation errors
	StatusCode  int               `json:"status_code,omitempty"` // HTTP status code
	Retryable   bool              `json:"retryable,omitempty"`   // Whether operation can be retried
	Suggestions []string          `json:"suggestions,omitempty"` // Suggested actions to resolve
	// contains filtered or unexported fields
}

APIError represents an API error with additional context

func NewAPIError

func NewAPIError(code ErrorCode, message string, cause error) APIError

NewAPIError creates a new APIError with the given code, message, and cause

func NewAwsError

func NewAwsError(awsErr error, operation string) APIError

NewAwsError creates a standard AWS error wrapper

func NewNotFoundError

func NewNotFoundError(resource, resourceID string) APIError

NewNotFoundError creates a standard not found error for a resource

func NewPermissionError

func NewPermissionError(resource string, operation string) APIError

NewPermissionError creates a standard permission error

func NewValidationError

func NewValidationError(message string, validationErrors map[string]string) APIError

NewValidationError creates a standard validation error

func (APIError) Error

func (e APIError) Error() string

Error implements the error interface

func (APIError) IsAuthError

func (e APIError) IsAuthError() bool

IsAuthError returns whether this is an authentication or authorization error

func (APIError) IsNotFound

func (e APIError) IsNotFound() bool

IsNotFound returns whether this is a not found error

func (APIError) IsRetryable

func (e APIError) IsRetryable() bool

IsRetryable returns whether the error can be retried

func (APIError) Unwrap

func (e APIError) Unwrap() error

Unwrap implements the errors.Unwrap interface

func (APIError) WithDetails

func (e APIError) WithDetails(details string) APIError

WithDetails adds details to an APIError and returns it

func (APIError) WithField

func (e APIError) WithField(field string) APIError

WithField adds field information for validation errors and returns it

func (APIError) WithOperation

func (e APIError) WithOperation(operation string) APIError

WithOperation adds an operation name to an APIError and returns it

func (APIError) WithRequestID

func (e APIError) WithRequestID(requestID string) APIError

WithRequestID adds a request ID to an APIError and returns it

func (APIError) WithResource

func (e APIError) WithResource(resourceType string, resourceID string) APIError

WithResource adds resource information to an APIError and returns it

func (APIError) WithStatusCode

func (e APIError) WithStatusCode(statusCode int) APIError

WithStatusCode adds HTTP status code information and returns it

func (APIError) WithSuggestions

func (e APIError) WithSuggestions(suggestions ...string) APIError

WithSuggestions adds suggested actions to resolve the error and returns it

func (APIError) WithValidation

func (e APIError) WithValidation(validationErrors map[string]string) APIError

WithValidation adds field validation errors and returns it

type APIErrorResponse

type APIErrorResponse struct {
	// Error code (e.g., "not_found", "validation_error")
	Code string `json:"code"`

	// HTTP status code
	Status int `json:"status"`

	// User-friendly error message
	Message string `json:"message"`

	// More detailed error information
	Details string `json:"details,omitempty"`

	// Request ID for tracking
	RequestID string `json:"request_id,omitempty"`

	// API version used for the request
	APIVersion string `json:"api_version,omitempty"`

	// Documentation URL for this error type
	DocsURL string `json:"docs_url,omitempty"`
}

APIErrorResponse represents a standard error response format for API errors

type APIVersionInfo

type APIVersionInfo struct {
	// Version string (e.g., "v1", "v2.1", "v2-beta")
	Version string `json:"version"`

	// Status of this version (stable, beta, alpha, deprecated)
	Status string `json:"status"`

	// IsDefault indicates if this is the default version
	IsDefault bool `json:"is_default"`

	// ReleaseDate when this version was released
	ReleaseDate time.Time `json:"release_date,omitempty"`

	// DeprecationDate when this version was deprecated (if applicable)
	DeprecationDate *time.Time `json:"deprecation_date,omitempty"`

	// SunsetDate when this version will be removed (if applicable)
	SunsetDate *time.Time `json:"sunset_date,omitempty"`

	// DocsURL is the URL to the documentation for this API version
	DocsURL string `json:"docs_url,omitempty"`
}

APIVersionInfo represents information about an API version

type APIVersionResponse

type APIVersionResponse struct {
	// All supported API versions
	Versions []APIVersionInfo `json:"versions"`

	// Default version to use when no version is specified
	DefaultVersion string `json:"default_version"`

	// Current stable version
	StableVersion string `json:"stable_version"`

	// Latest version (may be alpha/beta)
	LatestVersion string `json:"latest_version"`

	// Base URL for API documentation
	DocsBaseURL string `json:"docs_base_url,omitempty"`
}

APIVersionResponse represents the response from the API versions endpoint

type AWSService

type AWSService string

AWSService represents the underlying AWS service (technical detail)

const (
	AWSServiceEBS AWSService = "ebs" // Elastic Block Store
	AWSServiceEFS AWSService = "efs" // Elastic File System
	AWSServiceS3  AWSService = "s3"  // Simple Storage Service
)

type AppliedTemplateRecord

type AppliedTemplateRecord struct {
	TemplateName       string    `json:"template_name"`
	AppliedAt          time.Time `json:"applied_at"`
	PackageManager     string    `json:"package_manager"`
	PackagesInstalled  []string  `json:"packages_installed"`
	ServicesConfigured []string  `json:"services_configured"`
	UsersCreated       []string  `json:"users_created"`
	RollbackCheckpoint string    `json:"rollback_checkpoint"`
}

AppliedTemplateRecord represents a template that has been applied to an instance

type AuthResponse

type AuthResponse struct {
	APIKey    string    `json:"api_key"`
	CreatedAt time.Time `json:"created_at"`
	ExpiresAt time.Time `json:"expires_at,omitempty"`
	Message   string    `json:"message"`
}

AuthResponse represents an authentication response

type BackupContentsRequest

type BackupContentsRequest struct {
	BackupName string `json:"backup_name" binding:"required"`
	Path       string `json:"path"`
	Recursive  bool   `json:"recursive"`
}

BackupContentsRequest represents a request to list backup contents

type BackupContentsResponse

type BackupContentsResponse struct {
	BackupName string           `json:"backup_name"`
	Path       string           `json:"path"`
	Files      []BackupFileInfo `json:"files"`
	Count      int              `json:"count"`
	TotalSize  int64            `json:"total_size"`
}

BackupContentsResponse represents the response from listing backup contents

type BackupCreateRequest

type BackupCreateRequest struct {
	InstanceName string   `json:"instance_name" binding:"required"`
	BackupName   string   `json:"backup_name" binding:"required"`
	Description  string   `json:"description"`
	IncludePaths []string `json:"include_paths"`
	ExcludePaths []string `json:"exclude_paths"`
	Full         bool     `json:"full"`
	Incremental  bool     `json:"incremental"`
	StorageType  string   `json:"storage_type"` // "s3", "efs", "ebs"
	Encrypted    bool     `json:"encrypted"`
	Wait         bool     `json:"wait"`
}

BackupCreateRequest represents a request to create a data backup

type BackupCreateResult

type BackupCreateResult struct {
	BackupName                 string    `json:"backup_name"`
	BackupID                   string    `json:"backup_id"`
	SourceInstance             string    `json:"source_instance"`
	BackupType                 string    `json:"backup_type"`
	StorageType                string    `json:"storage_type"`
	StorageLocation            string    `json:"storage_location"`
	EstimatedCompletionMinutes int       `json:"estimated_completion_minutes"`
	EstimatedSizeBytes         int64     `json:"estimated_size_bytes"`
	StorageCostMonthly         float64   `json:"storage_cost_monthly"`
	CreatedAt                  time.Time `json:"created_at"`
	Encrypted                  bool      `json:"encrypted"`
	Message                    string    `json:"message"`
}

BackupCreateResult represents the result of creating a data backup

type BackupDeleteResult

type BackupDeleteResult struct {
	BackupName            string    `json:"backup_name"`
	BackupID              string    `json:"backup_id"`
	StorageType           string    `json:"storage_type"`
	StorageLocation       string    `json:"storage_location"`
	DeletedSizeBytes      int64     `json:"deleted_size_bytes"`
	StorageSavingsMonthly float64   `json:"storage_savings_monthly"`
	DeletedAt             time.Time `json:"deleted_at"`
}

BackupDeleteResult represents the result of deleting a backup

type BackupFileInfo

type BackupFileInfo struct {
	Path     string            `json:"path"`
	Size     int64             `json:"size"`
	Mode     string            `json:"mode"`
	Owner    string            `json:"owner"`
	Group    string            `json:"group"`
	ModTime  time.Time         `json:"mod_time"`
	IsDir    bool              `json:"is_dir"`
	Checksum string            `json:"checksum,omitempty"`
	Metadata map[string]string `json:"metadata,omitempty"`
}

BackupFileInfo represents information about a file in a backup

type BackupInfo

type BackupInfo struct {
	BackupName         string            `json:"backup_name"`
	BackupID           string            `json:"backup_id"`
	SourceInstance     string            `json:"source_instance"`
	SourceInstanceId   string            `json:"source_instance_id"`
	Description        string            `json:"description"`
	BackupType         string            `json:"backup_type"` // "full", "incremental"
	StorageType        string            `json:"storage_type"`
	StorageLocation    string            `json:"storage_location"`
	State              string            `json:"state"` // "creating", "available", "error", "deleting"
	SizeBytes          int64             `json:"size_bytes"`
	CompressedBytes    int64             `json:"compressed_bytes"`
	FileCount          int               `json:"file_count"`
	IncludedPaths      []string          `json:"included_paths"`
	ExcludedPaths      []string          `json:"excluded_paths"`
	Encrypted          bool              `json:"encrypted"`
	StorageCostMonthly float64           `json:"storage_cost_monthly"`
	CreatedAt          time.Time         `json:"created_at"`
	CompletedAt        *time.Time        `json:"completed_at,omitempty"`
	ExpiresAt          *time.Time        `json:"expires_at,omitempty"`
	Metadata           map[string]string `json:"metadata,omitempty"`
	ParentBackup       string            `json:"parent_backup,omitempty"` // For incremental backups
	ChecksumMD5        string            `json:"checksum_md5,omitempty"`
}

BackupInfo represents information about a data backup

type BackupListResponse

type BackupListResponse struct {
	Backups      []BackupInfo   `json:"backups"`
	Count        int            `json:"count"`
	TotalSize    int64          `json:"total_size_bytes"`
	TotalCost    float64        `json:"total_cost_monthly"`
	StorageTypes map[string]int `json:"storage_types"`
}

BackupListResponse represents the response from listing backups

type BackupVerifyRequest

type BackupVerifyRequest struct {
	BackupName     string   `json:"backup_name" binding:"required"`
	SelectivePaths []string `json:"selective_paths"`
	QuickCheck     bool     `json:"quick_check"`
}

BackupVerifyRequest represents a request to verify backup integrity

type BackupVerifyResult

type BackupVerifyResult struct {
	BackupName            string                 `json:"backup_name"`
	VerificationState     string                 `json:"verification_state"` // "valid", "corrupt", "partial"
	CheckedFileCount      int                    `json:"checked_file_count"`
	CorruptFileCount      int                    `json:"corrupt_file_count"`
	MissingFileCount      int                    `json:"missing_file_count"`
	VerifiedBytes         int64                  `json:"verified_bytes"`
	VerificationStarted   time.Time              `json:"verification_started"`
	VerificationCompleted *time.Time             `json:"verification_completed,omitempty"`
	CorruptFiles          []string               `json:"corrupt_files,omitempty"`
	MissingFiles          []string               `json:"missing_files,omitempty"`
	Summary               map[string]interface{} `json:"summary,omitempty"`
}

BackupVerifyResult represents the result of backup verification

type BillingInfo

type BillingInfo struct {
	MonthToDateSpend float64      `json:"month_to_date_spend"`
	ForecastedSpend  float64      `json:"forecasted_spend"`
	Credits          []CreditInfo `json:"credits"`
	BillingPeriod    string       `json:"billing_period"`
	LastUpdated      time.Time    `json:"last_updated"`
}

BillingInfo represents current billing and cost information

type BudgetActionType

type BudgetActionType string

BudgetActionType defines automatic budget control actions

const (
	// BudgetActionHibernateAll hibernates all project instances
	BudgetActionHibernateAll BudgetActionType = "hibernate_all"

	// BudgetActionStopAll stops all project instances
	BudgetActionStopAll BudgetActionType = "stop_all"

	// BudgetActionPreventLaunch prevents new instance launches
	BudgetActionPreventLaunch BudgetActionType = "prevent_launch"

	// BudgetActionNotifyOnly only sends notifications without taking action
	BudgetActionNotifyOnly BudgetActionType = "notify_only"
)

type BudgetAlert

type BudgetAlert struct {
	// Threshold is the spending percentage (0.0-1.0) that triggers the alert
	Threshold float64 `json:"threshold"`

	// Type defines the alert type
	Type BudgetAlertType `json:"type"`

	// Recipients defines who receives the alert
	Recipients []string `json:"recipients"`

	// Message is an optional custom alert message
	Message string `json:"message,omitempty"`

	// Enabled indicates if the alert is active
	Enabled bool `json:"enabled"`

	// LastTriggered is when this alert was last sent
	LastTriggered *time.Time `json:"last_triggered,omitempty"`
}

BudgetAlert defines a spending threshold that triggers notifications

type BudgetAlertType

type BudgetAlertType string

BudgetAlertType defines the type of budget alert

const (
	// BudgetAlertEmail sends email notifications
	BudgetAlertEmail BudgetAlertType = "email"

	// BudgetAlertSlack sends Slack notifications
	BudgetAlertSlack BudgetAlertType = "slack"

	// BudgetAlertWebhook sends webhook notifications
	BudgetAlertWebhook BudgetAlertType = "webhook"
)

type BudgetAutoAction

type BudgetAutoAction struct {
	// Threshold is the spending percentage (0.0-1.0) that triggers the action
	Threshold float64 `json:"threshold"`

	// Action defines what action to take
	Action BudgetActionType `json:"action"`

	// Enabled indicates if the auto action is active
	Enabled bool `json:"enabled"`

	// LastTriggered is when this action was last executed
	LastTriggered *time.Time `json:"last_triggered,omitempty"`
}

BudgetAutoAction defines automatic actions when budget thresholds are reached

type BudgetPeriod

type BudgetPeriod string

BudgetPeriod defines how budget periods are calculated

const (
	// BudgetPeriodProject tracks budget for the entire project lifetime
	BudgetPeriodProject BudgetPeriod = "project"

	// BudgetPeriodMonthly resets budget tracking monthly
	BudgetPeriodMonthly BudgetPeriod = "monthly"

	// BudgetPeriodWeekly resets budget tracking weekly
	BudgetPeriodWeekly BudgetPeriod = "weekly"

	// BudgetPeriodDaily resets budget tracking daily
	BudgetPeriodDaily BudgetPeriod = "daily"
)

type CPUAnalysis

type CPUAnalysis struct {
	AverageUtilization float64 `json:"average_utilization"`
	PeakUtilization    float64 `json:"peak_utilization"`
	P95Utilization     float64 `json:"p95_utilization"`
	P99Utilization     float64 `json:"p99_utilization"`
	IdlePercentage     float64 `json:"idle_percentage"`
	IsBottleneck       bool    `json:"is_bottleneck"`
	Recommendation     string  `json:"recommendation"`
}

CPUAnalysis represents CPU utilization analysis

type CPUMetrics

type CPUMetrics struct {
	UtilizationPercent float64 `json:"utilization_percent"`
	Load1Min           float64 `json:"load_1min"`
	Load5Min           float64 `json:"load_5min"`
	Load15Min          float64 `json:"load_15min"`
	CoreCount          int     `json:"core_count"`
	IdlePercent        float64 `json:"idle_percent"`
	WaitPercent        float64 `json:"wait_percent"`
}

CPUMetrics represents CPU performance metrics

type CommunityAMIInfo

type CommunityAMIInfo struct {
	Creator       string      `json:"creator"`
	Version       string      `json:"version"`
	Rating        float64     `json:"rating"` // 0.0-5.0
	ReviewCount   int         `json:"review_count"`
	DownloadCount int         `json:"download_count"`
	Verified      bool        `json:"verified"`
	LastUpdated   time.Time   `json:"last_updated"`
	Reviews       []AMIReview `json:"reviews,omitempty"`
}

CommunityAMIInfo contains community-specific AMI metadata

type CommunityShareResult

type CommunityShareResult struct {
	Community   string    `json:"community"`
	Status      string    `json:"status"` // submitted, approved, rejected
	SubmittedAt time.Time `json:"submitted_at"`
	ReviewURL   string    `json:"review_url,omitempty"`
	Error       string    `json:"error,omitempty"`
}

CommunityShareResult represents the result of sharing an AMI with community

type ConfidenceLevel

type ConfidenceLevel string

ConfidenceLevel represents the confidence level of a recommendation

const (
	ConfidenceLow      ConfidenceLevel = "low"
	ConfidenceMedium   ConfidenceLevel = "medium"
	ConfidenceHigh     ConfidenceLevel = "high"
	ConfidenceVeryHigh ConfidenceLevel = "very_high"
)

type Config

type Config struct {
	DefaultProfile string    `json:"default_profile"`
	DefaultRegion  string    `json:"default_region"`
	APIKey         string    `json:"api_key,omitempty"`
	APIKeyCreated  time.Time `json:"api_key_created,omitempty"`
}

Config manages application configuration

type ConnectionType

type ConnectionType string

ConnectionType represents how users connect to instances

const (
	ConnectionTypeSSH  ConnectionType = "ssh"
	ConnectionTypeWeb  ConnectionType = "web"
	ConnectionTypeBoth ConnectionType = "both"
)

type CostImpact

type CostImpact struct {
	CurrentDailyCost     float64 `json:"current_daily_cost"`
	RecommendedDailyCost float64 `json:"recommended_daily_cost"`
	DailyDifference      float64 `json:"daily_difference"`
	PercentageChange     float64 `json:"percentage_change"`
	MonthlySavings       float64 `json:"monthly_savings"`
	AnnualSavings        float64 `json:"annual_savings"`
	IsIncrease           bool    `json:"is_increase"`
	PaybackPeriodDays    float64 `json:"payback_period_days,omitempty"`
}

CostImpact represents the cost impact of a rightsizing recommendation

type CostOptimizationSummary

type CostOptimizationSummary struct {
	PotentialDailySavings         float64 `json:"potential_daily_savings"`
	PotentialMonthlySavings       float64 `json:"potential_monthly_savings"`
	PotentialAnnualSavings        float64 `json:"potential_annual_savings"`
	SavingsPercentage             float64 `json:"savings_percentage"`
	OverprovisionedInstances      int     `json:"overprovisioned_instances"`
	UnderprovisionedInstances     int     `json:"underprovisioned_instances"`
	OptimallyProvisionedInstances int     `json:"optimally_provisioned_instances"`
}

CostOptimizationSummary represents cost optimization opportunities

type CreditInfo

type CreditInfo struct {
	TotalCredits     float64    `json:"total_credits"`
	RemainingCredits float64    `json:"remaining_credits"`
	UsedCredits      float64    `json:"used_credits"`
	CreditType       string     `json:"credit_type"` // "AWS Promotional", "AWS Educate", etc.
	ExpirationDate   *time.Time `json:"expiration_date,omitempty"`
	Description      string     `json:"description"`
}

CreditInfo represents AWS credit information

type DaemonStatus

type DaemonStatus struct {
	// Version of the daemon
	Version string `json:"version"`

	// Status of the daemon (running, starting, stopping)
	Status string `json:"status"`

	// StartTime is when the daemon was started
	StartTime time.Time `json:"start_time"`

	// Uptime is the duration the daemon has been running
	Uptime string `json:"uptime,omitempty"`

	// ActiveOps is the number of currently active operations
	ActiveOps int `json:"active_ops"`

	// TotalRequests is the total number of requests processed
	TotalRequests int64 `json:"total_requests"`

	// RequestsPerMinute is the current request rate
	RequestsPerMinute float64 `json:"requests_per_minute,omitempty"`

	// AWSRegion is the current AWS region being used
	AWSRegion string `json:"aws_region"`

	// AWSProfile is the current AWS profile being used
	AWSProfile string `json:"aws_profile,omitempty"`

	// CurrentProfile is the active profile ID (if applicable)
	CurrentProfile string `json:"current_profile,omitempty"`
}

DaemonStatus represents the status of the Prism daemon

type DiscountConfig

type DiscountConfig struct {
	EC2Discount              float64 `json:"ec2_discount"`               // Percentage discount (0.0-1.0)
	EBSDiscount              float64 `json:"ebs_discount"`               // Percentage discount (0.0-1.0)
	EFSDiscount              float64 `json:"efs_discount"`               // Percentage discount (0.0-1.0)
	SavingsPlansDiscount     float64 `json:"savings_plans_discount"`     // Additional savings plan discount
	ReservedInstanceDiscount float64 `json:"reserved_instance_discount"` // RI discount
	SpotDiscount             float64 `json:"spot_discount"`              // Spot instance discount
	VolumeDiscount           float64 `json:"volume_discount"`            // Volume discount for large usage
	EducationalDiscount      float64 `json:"educational_discount"`       // Educational institution discount
	StartupDiscount          float64 `json:"startup_discount"`           // AWS Activate/startup credits
	EnterpriseDiscount       float64 `json:"enterprise_discount"`        // Enterprise agreement discount
}

DiscountConfig represents pricing discount configuration

type DualUserIntegration

type DualUserIntegration = research.DualUserIntegration

type ErrorCode

type ErrorCode string

ErrorCode defines specific error types for API operations

const (
	// Generic error codes
	ErrUnknown ErrorCode = "unknown_error" // Unknown or unclassified error

	// HTTP-like status errors
	ErrNotFound          ErrorCode = "not_found"          // Resource not found (404)
	ErrUnauthorized      ErrorCode = "unauthorized"       // Authentication required (401)
	ErrForbidden         ErrorCode = "forbidden"          // Permission denied (403)
	ErrInvalidParameters ErrorCode = "invalid_parameters" // Bad request parameters (400)
	ErrConflict          ErrorCode = "conflict"           // Resource conflict (409)
	ErrServerError       ErrorCode = "server_error"       // Internal server error (500)

	// Operation errors
	ErrTimeout      ErrorCode = "timeout"       // Operation timed out
	ErrCanceled     ErrorCode = "canceled"      // Operation was canceled
	ErrRateLimited  ErrorCode = "rate_limited"  // Too many requests
	ErrNetworkError ErrorCode = "network_error" // Network communication error

	// Resource errors
	ErrResourceExists ErrorCode = "resource_exists" // Resource already exists
	ErrResourceInUse  ErrorCode = "resource_in_use" // Resource is in use
	ErrResourceLocked ErrorCode = "resource_locked" // Resource is locked
	ErrQuotaExceeded  ErrorCode = "quota_exceeded"  // Account quota exceeded

	// Authentication/authorization errors
	ErrInvalidCredentials ErrorCode = "invalid_credentials" // Invalid login credentials
	ErrAccountDisabled    ErrorCode = "account_disabled"    // User account is disabled
	ErrPermissionDenied   ErrorCode = "permission_denied"   // User lacks permission
	ErrSessionExpired     ErrorCode = "session_expired"     // Session has expired

	// Validation errors
	ErrValidationFailed ErrorCode = "validation_failed" // Input validation failed
	ErrInvalidFormat    ErrorCode = "invalid_format"    // Input in wrong format
	ErrMissingRequired  ErrorCode = "missing_required"  // Required field missing

	// AWS specific errors
	ErrAWSError            ErrorCode = "aws_error"             // AWS API error
	ErrAWSNotConfigured    ErrorCode = "aws_not_configured"    // AWS credentials not configured
	ErrRegionNotConfigured ErrorCode = "region_not_configured" // AWS region not configured
)

func GetErrorCodeFromStatusCode

func GetErrorCodeFromStatusCode(statusCode int) ErrorCode

GetErrorCodeFromStatusCode converts HTTP status codes to appropriate error codes

type ExecRequest

type ExecRequest struct {
	Command        string            `json:"command"`                   // Command to execute
	WorkingDir     string            `json:"working_dir,omitempty"`     // Working directory
	User           string            `json:"user,omitempty"`            // User to execute as
	Environment    map[string]string `json:"environment,omitempty"`     // Environment variables
	TimeoutSeconds int               `json:"timeout_seconds,omitempty"` // Command timeout
	Interactive    bool              `json:"interactive,omitempty"`     // Interactive session
}

ExecRequest represents a request to execute a command on an instance

type ExecResult

type ExecResult struct {
	Command       string `json:"command"`
	ExitCode      int    `json:"exit_code"`
	StdOut        string `json:"stdout"`
	StdErr        string `json:"stderr"`
	Status        string `json:"status"`               // success, failed, timeout
	ExecutionTime int    `json:"execution_time"`       // Execution time in milliseconds
	CommandID     string `json:"command_id,omitempty"` // SSM command ID for reference
}

ExecResult represents the result of command execution

type FleetOverview

type FleetOverview struct {
	TotalInstances       int     `json:"total_instances"`
	RunningInstances     int     `json:"running_instances"`
	StoppedInstances     int     `json:"stopped_instances"`
	TotalDailyCost       float64 `json:"total_daily_cost"`
	TotalMonthlyCost     float64 `json:"total_monthly_cost"`
	InstancesWithMetrics int     `json:"instances_with_metrics"`
}

FleetOverview represents overview of all instances

type GPUAnalysis

type GPUAnalysis struct {
	AverageUtilization float64 `json:"average_utilization"`
	PeakUtilization    float64 `json:"peak_utilization"`
	MemoryUtilization  float64 `json:"memory_utilization"`
	TemperatureAverage float64 `json:"temperature_average"`
	PowerUsageAverage  float64 `json:"power_usage_average"`
	IsBottleneck       bool    `json:"is_bottleneck"`
	IsUnderutilized    bool    `json:"is_underutilized"`
	Recommendation     string  `json:"recommendation"`
}

GPUAnalysis represents GPU utilization analysis

type GPUMetrics

type GPUMetrics struct {
	Count                    int     `json:"count"`
	UtilizationPercent       float64 `json:"utilization_percent"`
	MemoryTotalMB            float64 `json:"memory_total_mb"`
	MemoryUsedMB             float64 `json:"memory_used_mb"`
	MemoryUtilizationPercent float64 `json:"memory_utilization_percent"`
	TemperatureCelsius       float64 `json:"temperature_celsius"`
	PowerDrawWatts           float64 `json:"power_draw_watts"`
}

GPUMetrics represents GPU performance metrics (optional)

type HibernationStatus

type HibernationStatus struct {
	HibernationSupported bool   `json:"hibernation_supported"`
	InstanceState        string `json:"instance_state"`      // Current AWS state: running, stopped, stopping, etc.
	PossiblyHibernated   bool   `json:"possibly_hibernated"` // True if stopped with hibernation support
	InstanceName         string `json:"instance_name"`
	Note                 string `json:"note,omitempty"` // Explanatory note about the status

	// Deprecated: Use PossiblyHibernated instead
	IsHibernated bool `json:"is_hibernated,omitempty"` // Kept for backward compatibility
}

HibernationStatus represents the hibernation status of an instance

type IdleDetection

type IdleDetection struct {
	Enabled        bool      `json:"enabled"`
	Policy         string    `json:"policy"`
	IdleTime       int       `json:"idle_time"`       // Minutes
	Threshold      int       `json:"threshold"`       // Minutes
	ActionSchedule time.Time `json:"action_schedule"` // When action will occur
	ActionPending  bool      `json:"action_pending"`  // Whether action is pending
}

IdleDetection represents idle detection configuration for an instance

type IdleDetectionConfig

type IdleDetectionConfig struct {
	Enabled                   bool `yaml:"enabled" json:"enabled"`
	IdleThresholdMinutes      int  `yaml:"idle_threshold_minutes" json:"idle_threshold_minutes"`
	HibernateThresholdMinutes int  `yaml:"hibernate_threshold_minutes" json:"hibernate_threshold_minutes"`
	CheckIntervalMinutes      int  `yaml:"check_interval_minutes" json:"check_interval_minutes"`
}

IdleDetectionConfig represents idle detection configuration in templates

type IdleExecutionResponse

type IdleExecutionResponse struct {
	Executed int      `json:"executed"`
	Errors   []string `json:"errors"`
	Total    int      `json:"total"`
}

IdleExecutionResponse represents the response from executing idle actions

type IdleHistoryEntry

type IdleHistoryEntry struct {
	InstanceID   string            `json:"instance_id"`
	InstanceName string            `json:"instance_name"`
	Action       string            `json:"action"`
	Time         time.Time         `json:"time"`
	IdleDuration time.Duration     `json:"idle_duration"`
	Metrics      *IdleUsageMetrics `json:"metrics,omitempty"`
}

IdleHistoryEntry represents an entry in the idle history

type IdleScheduledAction

type IdleScheduledAction struct {
	Action string    `json:"action"`
	Time   time.Time `json:"time"`
}

IdleScheduledAction represents a scheduled idle action

type IdleState

type IdleState struct {
	InstanceID   string               `json:"instance_id"`
	InstanceName string               `json:"instance_name"`
	Profile      string               `json:"profile"`
	IsIdle       bool                 `json:"is_idle"`
	IdleSince    *time.Time           `json:"idle_since,omitempty"`
	LastActivity time.Time            `json:"last_activity"`
	NextAction   *IdleScheduledAction `json:"next_action,omitempty"`
	LastMetrics  *IdleUsageMetrics    `json:"last_metrics,omitempty"`
}

IdleState represents the idle state of an instance

type IdleUsageMetrics

type IdleUsageMetrics struct {
	Timestamp   time.Time `json:"timestamp"`
	CPU         float64   `json:"cpu"`
	Memory      float64   `json:"memory"`
	Network     float64   `json:"network"`
	Disk        float64   `json:"disk"`
	GPU         *float64  `json:"gpu,omitempty"`
	HasActivity bool      `json:"has_activity"`
}

IdleUsageMetrics represents usage metrics for idle detection

type Instance

type Instance struct {
	ID                 string                  `json:"id"`
	Name               string                  `json:"name"`
	Template           string                  `json:"template"`
	Region             string                  `json:"region"`            // AWS region where instance is running
	AvailabilityZone   string                  `json:"availability_zone"` // AWS availability zone within region
	PublicIP           string                  `json:"public_ip"`
	PrivateIP          string                  `json:"private_ip"`
	State              string                  `json:"state"`
	LaunchTime         time.Time               `json:"launch_time"`
	DeletionTime       *time.Time              `json:"deletion_time,omitempty"` // When user initiated deletion
	HourlyRate         float64                 `json:"hourly_rate"`             // AWS list price per hour
	CurrentSpend       float64                 `json:"current_spend"`           // Actual accumulated cost since launch
	EffectiveRate      float64                 `json:"effective_rate"`          // Current spend ÷ hours since launch
	AttachedVolumes    []string                `json:"attached_volumes"`        // EFS volume names
	AttachedEBSVolumes []string                `json:"attached_ebs_volumes"`    // EBS volume IDs
	InstanceType       string                  `json:"instance_type"`
	InstanceLifecycle  string                  `json:"instance_lifecycle"` // "spot" or "on-demand"
	KeyName            string                  `json:"key_name"`           // EC2 key pair name
	Username           string                  `json:"username"`
	WebPort            int                     `json:"web_port"`             // Deprecated: Use Services instead
	HasWebInterface    bool                    `json:"has_web_interface"`    // Deprecated: Use Services instead
	Services           []Service               `json:"services,omitempty"`   // Web services available on this instance
	ProjectID          string                  `json:"project_id,omitempty"` // Associated project ID
	IdleDetection      *IdleDetection          `json:"idle_detection,omitempty"`
	AppliedTemplates   []AppliedTemplateRecord `json:"applied_templates,omitempty"` // Template application history

	// Cost optimization fields
	EstimatedCost     float64 `json:"estimated_cost,omitempty"` // Daily cost estimate
	IdlePolicyEnabled bool    `json:"idle_policy_enabled,omitempty"`
	SpotEligible      bool    `json:"spot_eligible,omitempty"`
	IsSpot            bool    `json:"is_spot,omitempty"`
	ARMCompatible     bool    `json:"arm_compatible,omitempty"`
	Architecture      string  `json:"architecture,omitempty"`
	AlwaysOn          bool    `json:"always_on,omitempty"`
	WorkloadType      string  `json:"workload_type,omitempty"`
	Runtime           float64 `json:"runtime,omitempty"` // Hours since launch
	StorageGB         float64 `json:"storage_gb,omitempty"`
	StorageUsedGB     float64 `json:"storage_used_gb,omitempty"`

	// Universal AMI System fields (Phase 5.1)
	AMIResolutionMethod string        `json:"ami_resolution_method,omitempty"` // How AMI was resolved
	AMIID               string        `json:"ami_id,omitempty"`                // AMI used for launch
	CostSavings         float64       `json:"cost_savings,omitempty"`          // Cost savings vs script
	BootTime            time.Duration `json:"boot_time,omitempty"`             // Time to boot from AMI

	// State transition history for accurate cost tracking
	StateHistory []StateTransition `json:"state_history,omitempty"` // History of all state changes
}

Instance represents a running cloud workstation

type InstanceConfiguration

type InstanceConfiguration struct {
	InstanceType       string  `json:"instance_type"`
	Size               string  `json:"size"`
	VCPUs              int     `json:"vcpus"`
	MemoryGB           float64 `json:"memory_gb"`
	StorageGB          float64 `json:"storage_gb"`
	NetworkPerformance string  `json:"network_performance"`
	DailyCost          float64 `json:"daily_cost"`
}

InstanceConfiguration represents current instance configuration

type InstanceCost

type InstanceCost struct {
	// InstanceName is the instance identifier
	InstanceName string `json:"instance_name"`

	// InstanceType is the AWS instance type
	InstanceType string `json:"instance_type"`

	// ComputeCost is the EC2 compute cost
	ComputeCost float64 `json:"compute_cost"`

	// StorageCost is the EBS storage cost
	StorageCost float64 `json:"storage_cost"`

	// TotalCost is the total instance cost
	TotalCost float64 `json:"total_cost"`

	// RunningHours is the number of hours the instance was running
	RunningHours float64 `json:"running_hours"`

	// HibernatedHours is the number of hours the instance was hibernated
	HibernatedHours float64 `json:"hibernated_hours"`

	// StoppedHours is the number of hours the instance was stopped
	StoppedHours float64 `json:"stopped_hours"`
}

InstanceCost represents the cost breakdown for a specific instance

type InstanceExtended

type InstanceExtended struct {
	Instance
	IdleDetection *InstanceIdleStatus `json:"idle_detection,omitempty"`
}

InstanceExtended adds monitoring information to Instance

type InstanceIdleStatus

type InstanceIdleStatus struct {
	Enabled        bool      `json:"enabled"`
	Policy         string    `json:"policy"`
	IdleTime       int       `json:"idle_time"`
	Threshold      int       `json:"threshold"`
	ActionSchedule time.Time `json:"action_schedule"`
	ActionPending  bool      `json:"action_pending"`
}

InstanceIdleStatus represents idle detection status for an instance

type InstanceLogSummary

type InstanceLogSummary struct {
	Name          string `json:"name"`
	ID            string `json:"id"`
	State         string `json:"state"`
	LogsAvailable bool   `json:"logs_available"`
}

InstanceLogSummary provides log availability summary for an instance

type InstanceMetrics

type InstanceMetrics struct {
	InstanceID   string         `json:"instance_id"`
	InstanceName string         `json:"instance_name"`
	Timestamp    time.Time      `json:"timestamp"`
	CPU          CPUMetrics     `json:"cpu"`
	Memory       MemoryMetrics  `json:"memory"`
	Storage      StorageMetrics `json:"storage"`
	Network      NetworkMetrics `json:"network"`
	GPU          *GPUMetrics    `json:"gpu,omitempty"`
	System       SystemMetrics  `json:"system"`
}

InstanceMetrics represents collected performance metrics for an instance

type InstanceRestoreRequest

type InstanceRestoreRequest struct {
	SnapshotName    string `json:"snapshot_name" binding:"required"`
	NewInstanceName string `json:"new_instance_name" binding:"required"`
	Wait            bool   `json:"wait"`
}

InstanceRestoreRequest represents a request to restore an instance from snapshot

type InstanceRestoreResult

type InstanceRestoreResult struct {
	NewInstanceName string    `json:"new_instance_name"`
	InstanceID      string    `json:"instance_id"`
	SnapshotName    string    `json:"snapshot_name"`
	SnapshotID      string    `json:"snapshot_id"`
	SourceTemplate  string    `json:"source_template"`
	State           string    `json:"state"`
	Message         string    `json:"message"`
	RestoredAt      time.Time `json:"restored_at"`
}

InstanceRestoreResult represents the result of restoring an instance from snapshot

type InstanceSnapshotDeleteResult

type InstanceSnapshotDeleteResult struct {
	SnapshotName          string    `json:"snapshot_name"`
	SnapshotID            string    `json:"snapshot_id"`
	DeletedSnapshots      []string  `json:"deleted_snapshots"`
	StorageSavingsMonthly float64   `json:"storage_savings_monthly"`
	DeletedAt             time.Time `json:"deleted_at"`
}

InstanceSnapshotDeleteResult represents the result of deleting an instance snapshot

type InstanceSnapshotInfo

type InstanceSnapshotInfo struct {
	SnapshotID          string    `json:"snapshot_id"`
	SnapshotName        string    `json:"snapshot_name"`
	SourceInstance      string    `json:"source_instance"`
	SourceInstanceId    string    `json:"source_instance_id"`
	SourceTemplate      string    `json:"source_template"`
	Description         string    `json:"description"`
	State               string    `json:"state"`
	Architecture        string    `json:"architecture"`
	StorageCostMonthly  float64   `json:"storage_cost_monthly"`
	CreatedAt           time.Time `json:"created_at"`
	AssociatedSnapshots []string  `json:"associated_snapshots,omitempty"`
}

InstanceSnapshotInfo represents information about an instance snapshot

type InstanceSnapshotListResponse

type InstanceSnapshotListResponse struct {
	Snapshots []InstanceSnapshotInfo `json:"snapshots"`
	Count     int                    `json:"count"`
}

InstanceSnapshotListResponse represents the response from listing snapshots

type InstanceSnapshotRequest

type InstanceSnapshotRequest struct {
	InstanceName string `json:"instance_name" binding:"required"`
	SnapshotName string `json:"snapshot_name" binding:"required"`
	Description  string `json:"description"`
	NoReboot     bool   `json:"no_reboot"`
	Wait         bool   `json:"wait"`
}

InstanceSnapshotRequest represents a request to create an instance snapshot

type InstanceSnapshotResult

type InstanceSnapshotResult struct {
	SnapshotID                 string    `json:"snapshot_id"`
	SnapshotName               string    `json:"snapshot_name"`
	SourceInstance             string    `json:"source_instance"`
	SourceInstanceId           string    `json:"source_instance_id"`
	Description                string    `json:"description"`
	State                      string    `json:"state"`
	EstimatedCompletionMinutes int       `json:"estimated_completion_minutes"`
	StorageCostMonthly         float64   `json:"storage_cost_monthly"`
	CreatedAt                  time.Time `json:"created_at"`
	NoReboot                   bool      `json:"no_reboot"`
}

InstanceSnapshotResult represents the result of creating an instance snapshot

type LaunchRequest

type LaunchRequest struct {
	Template       string                 `json:"template"`
	Name           string                 `json:"name"`
	Size           string                 `json:"size,omitempty"`            // XS, S, M, L, XL, GPU-S, etc.
	PackageManager string                 `json:"package_manager,omitempty"` // auto, conda, spack, apt
	Volumes        []string               `json:"volumes,omitempty"`         // EFS volume names to attach
	EBSVolumes     []string               `json:"ebs_volumes,omitempty"`     // EBS volume IDs to attach
	Region         string                 `json:"region,omitempty"`
	SubnetID       string                 `json:"subnet_id,omitempty"`
	VpcID          string                 `json:"vpc_id,omitempty"`
	ProjectID      string                 `json:"project_id,omitempty"`   // Project to associate instance with
	SSHKeyName     string                 `json:"ssh_key_name,omitempty"` // AWS key pair name to use
	Spot           bool                   `json:"spot,omitempty"`
	IdlePolicy     bool                   `json:"idle_policy,omitempty"` // Enable idle policy for automatic cost optimization
	DryRun         bool                   `json:"dry_run,omitempty"`
	Wait           bool                   `json:"wait,omitempty"`          // Wait and show launch progress
	Parameters     map[string]interface{} `json:"parameters,omitempty"`    // Template parameters
	ResearchUser   string                 `json:"research_user,omitempty"` // Research user to create and provision (Phase 5A+)

	// Universal Version System (v0.5.5)
	Version string `json:"version,omitempty"` // OS version (e.g., "24.04", "22.04", "9", "10", "latest", "lts")

	// Universal AMI System fields (Phase 5.1)
	AMIStrategy         string               `json:"ami_strategy,omitempty"`          // Override template AMI strategy
	PreferScript        bool                 `json:"prefer_script,omitempty"`         // Prefer script over AMI
	ShowAMIResolution   bool                 `json:"show_ami_resolution,omitempty"`   // Show AMI resolution details
	AMIResolutionResult *AMIResolutionResult `json:"ami_resolution_result,omitempty"` // Internal: resolved AMI info
	CustomAMI           string               `json:"custom_ami,omitempty"`            // Override AMI ID (e.g., for restore from snapshot)
}

LaunchRequest represents a request to launch an instance

type LaunchResponse

type LaunchResponse struct {
	Instance       Instance `json:"instance"`
	Message        string   `json:"message"`
	EstimatedCost  string   `json:"estimated_cost"`
	ConnectionInfo string   `json:"connection_info"`
}

LaunchResponse represents a successful launch response

type LaunchTestResult

type LaunchTestResult struct {
	InstanceID string        `json:"instance_id,omitempty"`
	LaunchTime time.Duration `json:"launch_time"`
	Success    bool          `json:"success"`
	Error      string        `json:"error,omitempty"`
	CleanedUp  bool          `json:"cleaned_up"`
}

LaunchTestResult represents the result of actual launch testing

type ListResponse

type ListResponse struct {
	Instances []Instance `json:"instances"`
	TotalCost float64    `json:"total_cost"`
}

ListResponse represents a list of instances

type LogRequest

type LogRequest struct {
	LogType string `json:"log_type,omitempty"`
	Tail    int    `json:"tail,omitempty"`
	Since   string `json:"since,omitempty"`
	Follow  bool   `json:"follow,omitempty"`
}

LogRequest represents a request for instance logs

type LogResponse

type LogResponse struct {
	InstanceName string    `json:"instance_name"`
	InstanceID   string    `json:"instance_id"`
	LogType      string    `json:"log_type"`
	Lines        []string  `json:"lines"`
	Timestamp    time.Time `json:"timestamp"`
	Follow       bool      `json:"follow"`
	Tail         int       `json:"tail,omitempty"`
}

LogResponse represents the response from a logs API call

type LogSummaryResponse

type LogSummaryResponse struct {
	Instances         []InstanceLogSummary `json:"instances"`
	AvailableLogTypes []string             `json:"available_log_types"`
}

LogSummaryResponse represents the response from listing all instance log availability

type LogTypesResponse

type LogTypesResponse struct {
	InstanceName      string   `json:"instance_name"`
	InstanceID        string   `json:"instance_id"`
	AvailableLogTypes []string `json:"available_log_types"`
	SSMEnabled        bool     `json:"ssm_enabled"`
}

LogTypesResponse represents available log types for an instance

type MemoryAnalysis

type MemoryAnalysis struct {
	AverageUtilization float64 `json:"average_utilization"`
	PeakUtilization    float64 `json:"peak_utilization"`
	P95Utilization     float64 `json:"p95_utilization"`
	P99Utilization     float64 `json:"p99_utilization"`
	SwapUsage          float64 `json:"swap_usage"`
	IsBottleneck       bool    `json:"is_bottleneck"`
	Recommendation     string  `json:"recommendation"`
}

MemoryAnalysis represents memory utilization analysis

type MemoryMetrics

type MemoryMetrics struct {
	TotalMB            float64 `json:"total_mb"`
	UsedMB             float64 `json:"used_mb"`
	FreeMB             float64 `json:"free_mb"`
	AvailableMB        float64 `json:"available_mb"`
	CachedMB           float64 `json:"cached_mb"`
	BufferedMB         float64 `json:"buffered_mb"`
	UtilizationPercent float64 `json:"utilization_percent"`
	SwapTotalMB        float64 `json:"swap_total_mb"`
	SwapUsedMB         float64 `json:"swap_used_mb"`
}

MemoryMetrics represents memory performance metrics

type MetricsCollectionStatus

type MetricsCollectionStatus struct {
	IsActive           bool      `json:"is_active"`
	LastCollectionTime time.Time `json:"last_collection_time"`
	CollectionInterval string    `json:"collection_interval"`
	TotalDataPoints    int       `json:"total_data_points"`
	DataRetentionDays  int       `json:"data_retention_days"`
	StorageLocation    string    `json:"storage_location"`
}

MetricsCollectionStatus represents the status of metrics collection

type MetricsSummary

type MetricsSummary struct {
	CPUSummary     ResourceSummary  `json:"cpu_summary"`
	MemorySummary  ResourceSummary  `json:"memory_summary"`
	StorageSummary ResourceSummary  `json:"storage_summary"`
	NetworkSummary ResourceSummary  `json:"network_summary"`
	GPUSummary     *ResourceSummary `json:"gpu_summary,omitempty"`
}

MetricsSummary represents aggregated metrics summary

type NetworkAnalysis

type NetworkAnalysis struct {
	AverageThroughput float64 `json:"average_throughput"`
	PeakThroughput    float64 `json:"peak_throughput"`
	PacketRate        float64 `json:"packet_rate"`
	IsBottleneck      bool    `json:"is_bottleneck"`
	Recommendation    string  `json:"recommendation"`
}

NetworkAnalysis represents network utilization analysis

type NetworkMetrics

type NetworkMetrics struct {
	RxBytesPerSec   float64 `json:"rx_bytes_per_sec"`
	TxBytesPerSec   float64 `json:"tx_bytes_per_sec"`
	RxPacketsPerSec float64 `json:"rx_packets_per_sec"`
	TxPacketsPerSec float64 `json:"tx_packets_per_sec"`
	TotalRxBytes    float64 `json:"total_rx_bytes"`
	TotalTxBytes    float64 `json:"total_tx_bytes"`
}

NetworkMetrics represents network performance metrics

type Project

type Project struct {
	// ID is the unique project identifier
	ID string `json:"id"`

	// Name is the human-readable project name
	Name string `json:"name"`

	// Description provides project details
	Description string `json:"description"`

	// Owner is the project owner/principal investigator
	Owner string `json:"owner"`

	// Members are additional project members with access
	Members []ProjectMember `json:"members"`

	// Budget contains the project budget configuration
	Budget *ProjectBudget `json:"budget,omitempty"`

	// Tags for project organization and reporting
	Tags map[string]string `json:"tags,omitempty"`

	// CreatedAt is when the project was created
	CreatedAt time.Time `json:"created_at"`

	// UpdatedAt is when the project was last modified
	UpdatedAt time.Time `json:"updated_at"`

	// Status indicates the project status
	Status ProjectStatus `json:"status"`

	// LaunchPrevented prevents new instance launches when true (set by budget actions)
	LaunchPrevented bool `json:"launch_prevented"`
}

Project represents a research project with associated resources and budget

type ProjectBudget

type ProjectBudget struct {
	// TotalBudget is the total project budget in USD
	TotalBudget float64 `json:"total_budget"`

	// SpentAmount is the current amount spent in USD
	SpentAmount float64 `json:"spent_amount"`

	// MonthlyLimit is the optional monthly spending limit in USD
	MonthlyLimit *float64 `json:"monthly_limit,omitempty"`

	// DailyLimit is the optional daily spending limit in USD
	DailyLimit *float64 `json:"daily_limit,omitempty"`

	// AlertThresholds define when to send budget alerts
	AlertThresholds []BudgetAlert `json:"alert_thresholds"`

	// AutoActions define automatic actions when thresholds are reached
	AutoActions []BudgetAutoAction `json:"auto_actions"`

	// BudgetPeriod defines the budget period (project lifetime, monthly, etc.)
	BudgetPeriod BudgetPeriod `json:"budget_period"`

	// StartDate is when budget tracking began
	StartDate time.Time `json:"start_date"`

	// EndDate is when the budget period ends (optional)
	EndDate *time.Time `json:"end_date,omitempty"`

	// LastUpdated is when spending was last calculated
	LastUpdated time.Time `json:"last_updated"`
}

ProjectBudget represents project budget configuration and tracking

type ProjectCostBreakdown

type ProjectCostBreakdown struct {
	// ProjectID is the project identifier
	ProjectID string `json:"project_id"`

	// TotalCost is the total project cost in USD
	TotalCost float64 `json:"total_cost"`

	// InstanceCosts breaks down costs by instance
	InstanceCosts []InstanceCost `json:"instance_costs"`

	// StorageCosts breaks down storage costs
	StorageCosts []StorageCost `json:"storage_costs"`

	// PeriodStart is the start of the cost reporting period
	PeriodStart time.Time `json:"period_start"`

	// PeriodEnd is the end of the cost reporting period
	PeriodEnd time.Time `json:"period_end"`

	// GeneratedAt is when this breakdown was generated
	GeneratedAt time.Time `json:"generated_at"`
}

ProjectCostBreakdown provides detailed cost analysis for a project

type ProjectMember

type ProjectMember struct {
	// UserID is the member's user identifier
	UserID string `json:"user_id"`

	// Role defines the member's permissions within the project
	Role ProjectRole `json:"role"`

	// AddedAt is when the member was added to the project
	AddedAt time.Time `json:"added_at"`

	// AddedBy is who added the member to the project
	AddedBy string `json:"added_by"`
}

ProjectMember represents a project member with specific permissions

type ProjectResourceUsage

type ProjectResourceUsage struct {
	// ProjectID is the project identifier
	ProjectID string `json:"project_id"`

	// ActiveInstances is the number of currently active instances
	ActiveInstances int `json:"active_instances"`

	// TotalInstances is the total number of instances ever launched
	TotalInstances int `json:"total_instances"`

	// TotalStorage is the total storage in GB across all volumes
	TotalStorage float64 `json:"total_storage"`

	// ComputeHours is the total compute hours used
	ComputeHours float64 `json:"compute_hours"`

	// IdleSavings is the estimated cost savings from idle policies
	IdleSavings float64 `json:"idle_savings"`

	// MeasurementPeriod defines the period for these metrics
	MeasurementPeriod time.Duration `json:"measurement_period"`

	// LastUpdated is when these metrics were last calculated
	LastUpdated time.Time `json:"last_updated"`
}

ProjectResourceUsage provides resource utilization metrics for a project

type ProjectRole

type ProjectRole string

ProjectRole defines member permissions within a project

const (
	// ProjectRoleOwner has full project control including budget and members
	ProjectRoleOwner ProjectRole = "owner"

	// ProjectRoleAdmin can manage resources and members but not budget
	ProjectRoleAdmin ProjectRole = "admin"

	// ProjectRoleMember can launch and manage their own instances
	ProjectRoleMember ProjectRole = "member"

	// ProjectRoleViewer can view project resources but not modify
	ProjectRoleViewer ProjectRole = "viewer"
)

type ProjectStatus

type ProjectStatus string

ProjectStatus represents the current status of a project

const (
	// ProjectStatusActive indicates an active project
	ProjectStatusActive ProjectStatus = "active"

	// ProjectStatusPaused indicates a temporarily paused project
	ProjectStatusPaused ProjectStatus = "paused"

	// ProjectStatusCompleted indicates a completed project
	ProjectStatusCompleted ProjectStatus = "completed"

	// ProjectStatusArchived indicates an archived project
	ProjectStatusArchived ProjectStatus = "archived"
)

type RecommendationsSummary

type RecommendationsSummary struct {
	TotalRecommendations    int `json:"total_recommendations"`
	DownsizeRecommendations int `json:"downsize_recommendations"`
	UpsizeRecommendations   int `json:"upsize_recommendations"`
	OptimizeRecommendations int `json:"optimize_recommendations"`
	HighConfidenceCount     int `json:"high_confidence_count"`
	MediumConfidenceCount   int `json:"medium_confidence_count"`
	LowConfidenceCount      int `json:"low_confidence_count"`
}

RecommendationsSummary represents summary of recommendations

type RegionAMIResult

type RegionAMIResult struct {
	Region   string            `json:"region"`
	AMIID    string            `json:"ami_id"`
	Status   AMICreationStatus `json:"status"`
	Error    string            `json:"error,omitempty"`
	CopyTime time.Duration     `json:"copy_time,omitempty"`
	CopyCost float64           `json:"copy_cost,omitempty"`
}

RegionAMIResult represents AMI deployment result in a specific region

type RegionTestResult

type RegionTestResult struct {
	Region           string              `json:"region"`
	Status           AMITestStatus       `json:"status"`
	AMI              *AMIInfo            `json:"ami,omitempty"`
	ResolutionMethod AMIResolutionMethod `json:"resolution_method,omitempty"`
	LaunchTest       *LaunchTestResult   `json:"launch_test,omitempty"`
	Error            string              `json:"error,omitempty"`
	TestDuration     time.Duration       `json:"test_duration"`
}

RegionTestResult represents AMI test result for a specific region

type RepositoryStatus

type RepositoryStatus struct {
	Repositories []TemplateRepository `json:"repositories"`
	DefaultRepo  string               `json:"default_repo"`
	SyncEnabled  bool                 `json:"sync_enabled"`
	LastSyncTime time.Time            `json:"last_sync_time"`
}

RepositoryStatus represents the current status of template repositories

type ResearchUserTemplate

type ResearchUserTemplate = research.ResearchUserTemplate

Type aliases pointing to canonical definitions in research package

type ResizeRequest

type ResizeRequest struct {
	InstanceName       string `json:"instance_name"`
	TargetInstanceType string `json:"target_instance_type"`
	Force              bool   `json:"force,omitempty"`
	Wait               bool   `json:"wait,omitempty"`
}

ResizeRequest represents a request to resize an instance

type ResizeResponse

type ResizeResponse struct {
	Success    bool   `json:"success"`
	Message    string `json:"message"`
	InstanceID string `json:"instance_id,omitempty"`
	OldType    string `json:"old_type,omitempty"`
	NewType    string `json:"new_type,omitempty"`
	Status     string `json:"status,omitempty"`
}

ResizeResponse represents the response to a resize request

type ResourceAnalysis

type ResourceAnalysis struct {
	CPUAnalysis     CPUAnalysis     `json:"cpu_analysis"`
	MemoryAnalysis  MemoryAnalysis  `json:"memory_analysis"`
	StorageAnalysis StorageAnalysis `json:"storage_analysis"`
	NetworkAnalysis NetworkAnalysis `json:"network_analysis"`
	GPUAnalysis     *GPUAnalysis    `json:"gpu_analysis,omitempty"`
	WorkloadPattern WorkloadPattern `json:"workload_pattern"`
}

ResourceAnalysis represents detailed resource utilization analysis

type ResourceSummary

type ResourceSummary struct {
	Average           float64 `json:"average"`
	Peak              float64 `json:"peak"`
	P95               float64 `json:"p95"`
	P99               float64 `json:"p99"`
	Minimum           float64 `json:"minimum"`
	StandardDeviation float64 `json:"standard_deviation"`
	TrendDirection    string  `json:"trend_direction"` // "increasing", "decreasing", "stable"
	Bottleneck        bool    `json:"bottleneck"`
	Underutilized     bool    `json:"underutilized"`
}

ResourceSummary represents summary statistics for a resource

type ResourceUtilizationSummary

type ResourceUtilizationSummary struct {
	AverageCPUUtilization     float64 `json:"average_cpu_utilization"`
	AverageMemoryUtilization  float64 `json:"average_memory_utilization"`
	AverageStorageUtilization float64 `json:"average_storage_utilization"`
	InstancesWithLowCPU       int     `json:"instances_with_low_cpu"`
	InstancesWithHighCPU      int     `json:"instances_with_high_cpu"`
	InstancesWithLowMemory    int     `json:"instances_with_low_memory"`
	InstancesWithHighMemory   int     `json:"instances_with_high_memory"`
}

ResourceUtilizationSummary represents fleet-wide resource utilization

type RestoreRequest

type RestoreRequest struct {
	BackupName      string   `json:"backup_name" binding:"required"`
	TargetInstance  string   `json:"target_instance" binding:"required"`
	RestorePath     string   `json:"restore_path"`
	SelectivePaths  []string `json:"selective_paths"`
	Overwrite       bool     `json:"overwrite"`
	Merge           bool     `json:"merge"`
	DryRun          bool     `json:"dry_run"`
	PreservePerms   bool     `json:"preserve_permissions"`
	PreserveOwner   bool     `json:"preserve_owner"`
	VerifyIntegrity bool     `json:"verify_integrity"`
	Wait            bool     `json:"wait"`
}

RestoreRequest represents a request to restore data from backup

type RestoreResult

type RestoreResult struct {
	RestoreID           string                 `json:"restore_id"`
	BackupName          string                 `json:"backup_name"`
	TargetInstance      string                 `json:"target_instance"`
	RestorePath         string                 `json:"restore_path"`
	SelectivePaths      []string               `json:"selective_paths"`
	State               string                 `json:"state"` // "running", "completed", "error"
	RestoredFileCount   int                    `json:"restored_file_count"`
	RestoredBytes       int64                  `json:"restored_bytes"`
	SkippedFileCount    int                    `json:"skipped_file_count"`
	ErrorCount          int                    `json:"error_count"`
	StartedAt           time.Time              `json:"started_at"`
	CompletedAt         *time.Time             `json:"completed_at,omitempty"`
	EstimatedCompletion int                    `json:"estimated_completion_minutes"`
	Message             string                 `json:"message"`
	Errors              []string               `json:"errors,omitempty"`
	Summary             map[string]interface{} `json:"summary,omitempty"`
	IntegrityVerified   bool                   `json:"integrity_verified"`
}

RestoreResult represents the result of a restore operation

type RightsizingAnalysisRequest

type RightsizingAnalysisRequest struct {
	InstanceName        string  `json:"instance_name"`
	AnalysisPeriodHours float64 `json:"analysis_period_hours,omitempty"`
	IncludeDetails      bool    `json:"include_details,omitempty"`
	ForceRefresh        bool    `json:"force_refresh,omitempty"`
}

RightsizingAnalysisRequest represents a request for rightsizing analysis

type RightsizingAnalysisResponse

type RightsizingAnalysisResponse struct {
	Recommendation      *RightsizingRecommendation `json:"recommendation"`
	MetricsAvailable    bool                       `json:"metrics_available"`
	DataPointsCount     int                        `json:"data_points_count"`
	AnalysisPeriodHours float64                    `json:"analysis_period_hours"`
	LastUpdated         time.Time                  `json:"last_updated"`
	Message             string                     `json:"message,omitempty"`
}

RightsizingAnalysisResponse represents the response from rightsizing analysis

type RightsizingRecommendation

type RightsizingRecommendation struct {
	InstanceID              string           `json:"instance_id"`
	InstanceName            string           `json:"instance_name"`
	CurrentInstanceType     string           `json:"current_instance_type"`
	CurrentSize             string           `json:"current_size"`
	RecommendedInstanceType string           `json:"recommended_instance_type"`
	RecommendedSize         string           `json:"recommended_size"`
	RecommendationType      RightsizingType  `json:"recommendation_type"`
	Confidence              ConfidenceLevel  `json:"confidence"`
	Reasoning               string           `json:"reasoning"`
	CostImpact              CostImpact       `json:"cost_impact"`
	ResourceAnalysis        ResourceAnalysis `json:"resource_analysis"`
	CreatedAt               time.Time        `json:"created_at"`
	DataPointsAnalyzed      int              `json:"data_points_analyzed"`
	AnalysisPeriodHours     float64          `json:"analysis_period_hours"`
}

RightsizingRecommendation represents a rightsizing recommendation

type RightsizingRecommendationsResponse

type RightsizingRecommendationsResponse struct {
	Recommendations  []RightsizingRecommendation `json:"recommendations"`
	TotalInstances   int                         `json:"total_instances"`
	ActiveInstances  int                         `json:"active_instances"`
	PotentialSavings float64                     `json:"potential_savings"`
	GeneratedAt      time.Time                   `json:"generated_at"`
}

RightsizingRecommendationsResponse represents multiple recommendations

type RightsizingStatsResponse

type RightsizingStatsResponse struct {
	InstanceName         string                     `json:"instance_name"`
	CurrentConfiguration InstanceConfiguration      `json:"current_configuration"`
	MetricsSummary       MetricsSummary             `json:"metrics_summary"`
	RecentMetrics        []InstanceMetrics          `json:"recent_metrics"`
	Recommendation       *RightsizingRecommendation `json:"recommendation,omitempty"`
	CollectionStatus     MetricsCollectionStatus    `json:"collection_status"`
}

RightsizingStatsResponse represents detailed statistics for an instance

type RightsizingSummaryResponse

type RightsizingSummaryResponse struct {
	FleetOverview       FleetOverview              `json:"fleet_overview"`
	CostOptimization    CostOptimizationSummary    `json:"cost_optimization"`
	ResourceUtilization ResourceUtilizationSummary `json:"resource_utilization"`
	Recommendations     RecommendationsSummary     `json:"recommendations"`
	GeneratedAt         time.Time                  `json:"generated_at"`
}

RightsizingSummaryResponse represents fleet-wide rightsizing summary

type RightsizingType

type RightsizingType string

RightsizingType represents the type of rightsizing recommendation

const (
	RightsizingDownsize         RightsizingType = "downsize"
	RightsizingUpsize           RightsizingType = "upsize"
	RightsizingOptimal          RightsizingType = "optimal"
	RightsizingMemoryOptimized  RightsizingType = "memory_optimized"
	RightsizingComputeOptimized RightsizingType = "compute_optimized"
	RightsizingGPUOptimized     RightsizingType = "gpu_optimized"
)

type RollbackRequest

type RollbackRequest struct {
	InstanceName string `json:"instance_name"`
	CheckpointID string `json:"checkpoint_id"`
}

RollbackRequest represents a request to rollback an instance

type RuntimeTemplate

type RuntimeTemplate struct {
	Name                 string
	Slug                 string // CLI identifier for template (e.g., "python-ml")
	Description          string
	LongDescription      string                       // Detailed description for GUI
	AMI                  map[string]map[string]string // region -> arch -> AMI ID
	InstanceType         map[string]string            // arch -> instance type
	UserData             string                       // Generated installation script
	Ports                []int
	RootVolumeGB         int                            `json:"root_volume_gb"` // Root volume size in GB (default: 20)
	EstimatedCostPerHour map[string]float64             // arch -> cost per hour
	IdleDetection        *IdleDetectionConfig           // Idle detection configuration
	ResearchUser         *research.ResearchUserTemplate `json:"research_user,omitempty"`

	// Complexity and categorization for GUI
	Complexity TemplateComplexity `json:"complexity,omitempty"`
	Category   string             `json:"category,omitempty"`
	Domain     string             `json:"domain,omitempty"`

	// Visual presentation for GUI
	Icon     string `json:"icon,omitempty"`
	Color    string `json:"color,omitempty"`
	Popular  bool   `json:"popular,omitempty"`
	Featured bool   `json:"featured,omitempty"`

	// User guidance for GUI
	EstimatedLaunchTime int      `json:"estimated_launch_time,omitempty"`
	Prerequisites       []string `json:"prerequisites,omitempty"`
	LearningResources   []string `json:"learning_resources,omitempty"`

	// Template metadata for GUI
	ValidationStatus ValidationStatus  `json:"validation_status,omitempty"`
	Tags             map[string]string `json:"tags,omitempty"`
	Maintainer       string            `json:"maintainer,omitempty"`

	// Connection configuration
	ConnectionType ConnectionType `json:"connection_type,omitempty"`

	// Additional metadata from unified template
	Source    interface{} `json:"-"` // Reference to source template (avoid circular import)
	Generated time.Time   // When this runtime template was generated
}

RuntimeTemplate defines a cloud workstation template for launching instances This is the CANONICAL definition - pkg/templates/types.go uses a type alias to this

type Service

type Service struct {
	Name        string `json:"name"`                  // Service name (e.g., "jupyter", "rstudio-server")
	Port        int    `json:"port"`                  // Remote port on instance
	LocalPort   int    `json:"local_port"`            // Local tunnel port (0 = not tunneled)
	Type        string `json:"type,omitempty"`        // Service type: "web", "api", etc.
	URL         string `json:"url,omitempty"`         // Local access URL (e.g., "http://localhost:8787")
	AuthToken   string `json:"auth_token,omitempty"`  // Authentication token if needed
	Status      string `json:"status,omitempty"`      // "running", "stopped", "unknown"
	Description string `json:"description,omitempty"` // Human-readable description
}

Service represents a web service running on an instance

type SimpleAPIError

type SimpleAPIError struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
	Details string `json:"details,omitempty"`
}

SimpleAPIError represents a simple API error response (legacy)

func (SimpleAPIError) Error

func (e SimpleAPIError) Error() string

type SnapshotCreationResult

type SnapshotCreationResult struct {
	SnapshotID                 string    `json:"snapshot_id"`
	VolumeID                   string    `json:"volume_id"`
	VolumeSize                 int       `json:"volume_size"`
	Description                string    `json:"description"`
	EstimatedCompletionMinutes int       `json:"estimated_completion_minutes"`
	StorageCostMonthly         float64   `json:"storage_cost_monthly"`
	CreationInitiatedAt        time.Time `json:"creation_initiated_at"`
}

SnapshotCreationResult represents the result of snapshot creation

type SnapshotDeletionResult

type SnapshotDeletionResult struct {
	SnapshotID            string    `json:"snapshot_id"`
	VolumeSize            int       `json:"volume_size"`
	StorageSavingsMonthly float64   `json:"storage_savings_monthly"`
	CompletedAt           time.Time `json:"completed_at"`
}

SnapshotDeletionResult represents the result of snapshot deletion

type SnapshotInfo

type SnapshotInfo struct {
	SnapshotID         string    `json:"snapshot_id"`
	VolumeID           string    `json:"volume_id"`
	VolumeSize         int       `json:"volume_size"`
	Description        string    `json:"description"`
	StartTime          time.Time `json:"start_time"`
	State              string    `json:"state"`
	Progress           string    `json:"progress"`
	StorageCostMonthly float64   `json:"storage_cost_monthly"`
}

SnapshotInfo represents information about an EBS snapshot

type State

type State struct {
	Instances      map[string]Instance      `json:"instances"`
	StorageVolumes map[string]StorageVolume `json:"storage_volumes"`
	Config         Config                   `json:"config"`
}

State manages the application state

type StateTransition

type StateTransition struct {
	FromState string    `json:"from_state"`          // Previous state (or empty for launch)
	ToState   string    `json:"to_state"`            // New state
	Timestamp time.Time `json:"timestamp"`           // When transition occurred
	Reason    string    `json:"reason,omitempty"`    // Why transition happened (user action, idle detection, etc.)
	Initiator string    `json:"initiator,omitempty"` // Who/what initiated (user, system, policy)
}

StateTransition records when an instance changes state for cost tracking This enables accurate billing calculations based on actual runtime vs stopped time

type StorageAnalysis

type StorageAnalysis struct {
	AverageIOPS       float64 `json:"average_iops"`
	PeakIOPS          float64 `json:"peak_iops"`
	AverageThroughput float64 `json:"average_throughput"`
	PeakThroughput    float64 `json:"peak_throughput"`
	SpaceUtilization  float64 `json:"space_utilization"`
	IsBottleneck      bool    `json:"is_bottleneck"`
	Recommendation    string  `json:"recommendation"`
}

StorageAnalysis represents storage utilization analysis

type StorageCost

type StorageCost struct {
	// VolumeName is the storage volume identifier
	VolumeName string `json:"volume_name"`

	// VolumeType is the storage type (EFS, EBS, etc.)
	VolumeType string `json:"volume_type"`

	// SizeGB is the storage size in gigabytes
	SizeGB float64 `json:"size_gb"`

	// Cost is the storage cost in USD
	Cost float64 `json:"cost"`

	// CostPerGB is the cost per gigabyte
	CostPerGB float64 `json:"cost_per_gb"`
}

StorageCost represents the cost breakdown for storage

type StorageCreateRequest

type StorageCreateRequest struct {
	Name       string `json:"name"`
	Size       string `json:"size"`        // XS, S, M, L, XL or specific GB
	VolumeType string `json:"volume_type"` // gp3, io2
	Region     string `json:"region,omitempty"`
}

StorageCreateRequest represents a request to create an EBS volume

type StorageMetrics

type StorageMetrics struct {
	TotalGB             float64 `json:"total_gb"`
	UsedGB              float64 `json:"used_gb"`
	AvailableGB         float64 `json:"available_gb"`
	UtilizationPercent  float64 `json:"utilization_percent"`
	ReadIOPS            float64 `json:"read_iops"`
	WriteIOPS           float64 `json:"write_iops"`
	ReadThroughputMBps  float64 `json:"read_throughput_mbps"`
	WriteThroughputMBps float64 `json:"write_throughput_mbps"`
}

StorageMetrics represents storage performance metrics

type StorageType

type StorageType string

StorageType represents user-friendly storage types

const (
	StorageTypeWorkspace StorageType = "workspace" // Workspace Storage (EBS)
	StorageTypeShared    StorageType = "shared"    // Shared Storage (EFS)
	StorageTypeCloud     StorageType = "cloud"     // Cloud Storage (S3)
)

type StorageVolume

type StorageVolume struct {
	Name         string      `json:"name"`          // User-friendly name
	Type         StorageType `json:"type"`          // User-facing type (local/shared/cloud)
	AWSService   AWSService  `json:"aws_service"`   // Technical AWS service
	Region       string      `json:"region"`        // AWS region
	State        string      `json:"state"`         // available, creating, in-use, deleting
	CreationTime time.Time   `json:"creation_time"` // When created

	// Size/capacity (varies by type)
	SizeGB    *int32 `json:"size_gb,omitempty"`    // Size in GB (EBS)
	SizeBytes *int64 `json:"size_bytes,omitempty"` // Size in bytes (EFS)

	// EBS-specific fields
	VolumeID   string `json:"volume_id,omitempty"`   // AWS EBS volume ID
	VolumeType string `json:"volume_type,omitempty"` // gp3, io2, etc.
	IOPS       *int32 `json:"iops,omitempty"`        // Provisioned IOPS
	Throughput *int32 `json:"throughput,omitempty"`  // MB/s throughput
	AttachedTo string `json:"attached_to,omitempty"` // Instance name if attached

	// EFS-specific fields
	FileSystemID    string   `json:"filesystem_id,omitempty"`    // AWS EFS ID
	MountTargets    []string `json:"mount_targets,omitempty"`    // Mount target IDs
	PerformanceMode string   `json:"performance_mode,omitempty"` // generalPurpose, maxIO
	ThroughputMode  string   `json:"throughput_mode,omitempty"`  // bursting, provisioned

	// S3-specific fields
	BucketName string `json:"bucket_name,omitempty"` // S3 bucket name

	// Cost estimation
	EstimatedCostGB float64 `json:"estimated_cost_gb"` // $/GB/month
}

StorageVolume represents a unified storage volume (any type)

func (*StorageVolume) GetDisplayType

func (sv *StorageVolume) GetDisplayType() string

GetDisplayType returns the user-friendly type name

func (*StorageVolume) GetTechnicalType

func (sv *StorageVolume) GetTechnicalType() string

GetTechnicalType returns the AWS service name (for verbose mode)

func (*StorageVolume) IsCloud

func (sv *StorageVolume) IsCloud() bool

IsCloud returns true if this is cloud storage (S3)

func (*StorageVolume) IsShared

func (sv *StorageVolume) IsShared() bool

IsShared returns true if this is shared storage (EFS)

func (*StorageVolume) IsWorkspace

func (sv *StorageVolume) IsWorkspace() bool

IsWorkspace returns true if this is workspace storage (EBS)

type SystemMetrics

type SystemMetrics struct {
	ProcessCount    int       `json:"process_count"`
	LoggedInUsers   int       `json:"logged_in_users"`
	UptimeSeconds   float64   `json:"uptime_seconds"`
	LastActivity    time.Time `json:"last_activity"`
	LoadAverage1Min float64   `json:"load_average_1min"`
}

SystemMetrics represents system-level metrics

type Template

type Template = RuntimeTemplate

Backward compatibility aliases Template is aliased to RuntimeTemplate to distinguish from AMI build templates

type TemplateComplexity

type TemplateComplexity string

TemplateComplexity represents template complexity level

const (
	TemplateComplexitySimple   TemplateComplexity = "simple"   // Ready to use, perfect for getting started
	TemplateComplexityModerate TemplateComplexity = "moderate" // Some customization available, good for regular users
	TemplateComplexityAdvanced TemplateComplexity = "advanced" // Highly configurable, for experienced users
	TemplateComplexityComplex  TemplateComplexity = "complex"  // Maximum flexibility, requires technical knowledge
)

func (TemplateComplexity) Badge

func (c TemplateComplexity) Badge() string

Badge returns the badge text for GUI display

func (TemplateComplexity) Color

func (c TemplateComplexity) Color() string

Color returns the hex color for the complexity level

func (TemplateComplexity) Icon

func (c TemplateComplexity) Icon() string

Icon returns the emoji icon for the complexity level

func (TemplateComplexity) Label

func (c TemplateComplexity) Label() string

Label returns the human-readable label for the complexity level

func (TemplateComplexity) Level

func (c TemplateComplexity) Level() int

Level returns the numeric level for sorting (1=simple, 4=complex)

type TemplateRepository

type TemplateRepository struct {
	Name          string    `json:"name"`
	URL           string    `json:"url"`
	Priority      int       `json:"priority"`
	Enabled       bool      `json:"enabled"`
	LastSync      time.Time `json:"last_sync"`
	TemplateCount int       `json:"template_count"`
	Description   string    `json:"description"`
	Owner         string    `json:"owner,omitempty"`
	AuthType      string    `json:"auth_type,omitempty"` // none, token, ssh
}

TemplateRepository represents a template repository configuration

type TemplateRepositoryUpdate

type TemplateRepositoryUpdate struct {
	Name     string `json:"name"`
	URL      string `json:"url"`
	Priority int    `json:"priority"`
	Enabled  bool   `json:"enabled"`
}

TemplateRepositoryUpdate represents a request to update repository settings

type ValidationStatus

type ValidationStatus string

ValidationStatus represents template validation status

const (
	ValidationStatusValid   ValidationStatus = "valid"
	ValidationStatusInvalid ValidationStatus = "invalid"
	ValidationStatusUnknown ValidationStatus = "unknown"
)

type VolumeCreateRequest

type VolumeCreateRequest struct {
	Name            string `json:"name"`
	PerformanceMode string `json:"performance_mode,omitempty"` // generalPurpose, maxIO
	ThroughputMode  string `json:"throughput_mode,omitempty"`  // bursting, provisioned
	Region          string `json:"region,omitempty"`
}

VolumeCreateRequest represents a request to create an EFS volume

type WorkloadPattern

type WorkloadPattern struct {
	Type                WorkloadPatternType `json:"type"`
	ConsistencyScore    float64             `json:"consistency_score"`
	PeakHours           []int               `json:"peak_hours"`
	SeasonalityDetected bool                `json:"seasonality_detected"`
	GrowthTrend         float64             `json:"growth_trend"`
	BurstFrequency      float64             `json:"burst_frequency"`
	Description         string              `json:"description"`
}

WorkloadPattern represents workload pattern analysis

type WorkloadPatternType

type WorkloadPatternType string

WorkloadPatternType represents different types of workload patterns

const (
	WorkloadPatternSteady        WorkloadPatternType = "steady"
	WorkloadPatternBursty        WorkloadPatternType = "bursty"
	WorkloadPatternSeasonal      WorkloadPatternType = "seasonal"
	WorkloadPatternGrowing       WorkloadPatternType = "growing"
	WorkloadPatternDeclining     WorkloadPatternType = "declining"
	WorkloadPatternUnpredictable WorkloadPatternType = "unpredictable"
)

Jump to

Keyboard shortcuts

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