-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprofiles.go
More file actions
58 lines (49 loc) · 1.9 KB
/
profiles.go
File metadata and controls
58 lines (49 loc) · 1.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
package main
import (
"context"
)
// ================================================================================
// PROFILE SERVICE - Manages connection profiles (Enterprise Feature)
// Follows Single Responsibility Principle: handles only profile CRUD operations
// ================================================================================
// ConnectionProfile represents a saved connection configuration
type ConnectionProfile struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description,omitempty"`
Address string `json:"address"`
Port string `json:"port"`
Protocol string `json:"protocol"`
FramingMethod string `json:"framingMethod"`
UseTLS bool `json:"useTls"`
TLSVerify bool `json:"tlsVerify"`
CACertPath string `json:"caCertPath,omitempty"`
ClientCertPath string `json:"clientCertPath,omitempty"`
ClientKeyPath string `json:"clientKeyPath,omitempty"`
CreatedAt int64 `json:"createdAt"`
UpdatedAt int64 `json:"updatedAt"`
}
// ProfileService handles connection profile operations
type ProfileService struct {
ctx context.Context
}
// NewProfileService creates a new ProfileService instance
func NewProfileService() *ProfileService {
return &ProfileService{}
}
// SetContext sets the Wails runtime context
func (p *ProfileService) SetContext(ctx context.Context) {
p.ctx = ctx
}
// GetProfiles returns all saved connection profiles
func (p *ProfileService) GetProfiles() ([]ConnectionProfile, error) {
return getProfilesFromStorage()
}
// SaveProfile saves a new or updates an existing connection profile
func (p *ProfileService) SaveProfile(profile ConnectionProfile) (ConnectionProfile, error) {
return saveProfileToStorage(profile)
}
// DeleteProfile deletes a connection profile by ID
func (p *ProfileService) DeleteProfile(id string) error {
return deleteProfileFromStorage(id)
}