chore: enable godot

This commit is contained in:
Julian Sommer
2026-07-15 16:08:30 +10:00
parent 03d981779b
commit ac5bd613b4
129 changed files with 508 additions and 507 deletions
+1
View File
@@ -25,6 +25,7 @@ linters:
- fatcontext # detects nested contexts in loops
- forcetypeassert # flags unchecked type assertions that can panic
- gocheckcompilerdirectives # validates go compiler directive comments (//go:)
- godot # checks that declaration comments end in a period
- goprintffuncname # checks that printf-like functions are named with f at the end
- gosec # inspects source code for security problems
- govet # reports suspicious constructs (Printf alignment, shadow, etc.)
+4 -4
View File
@@ -66,7 +66,7 @@ var supportedArchs = map[string]bool{
"arm64": true,
}
// TODO: Confirm suppported platform types
// TODO: Confirm suppported platform types.
var supportedPlatforms = map[string]bool{
"Linux/UNIX": true,
"Windows": true,
@@ -937,7 +937,7 @@ func runimagesPromoteCmd(cmd *cobra.Command, args []string) {
fmt.Printf("✅ Promoted %s to system image (owner: %s).\n", imageID, admin.SystemOwnerAlias)
}
// List remote images available
// List remote images available.
func runimagesListCmd(cmd *cobra.Command, args []string) {
//fmt.Println(availableImages)
@@ -964,7 +964,7 @@ func runimagesListCmd(cmd *cobra.Command, args []string) {
pterm.Println("spx admin images import --name <image-name>")
}
// TODO: Move all logic to a module, use minimal application logic in viper commands
// TODO: Move all logic to a module, use minimal application logic in viper commands.
func runAdminInit(cmd *cobra.Command, args []string) {
if os.Getuid() != 0 {
fmt.Fprintln(os.Stderr, "⚠️ Warning: 'spx admin init' is not running as root.")
@@ -2908,7 +2908,7 @@ func detectDNSServers(iface string) []string {
}
// parseDNSFromResolvectl extracts IP addresses from resolvectl dns output.
// Format: "Link 2 (enp0s3): 192.168.1.1 8.8.8.8 1.1.1.1"
// Format: "Link 2 (enp0s3): 192.168.1.1 8.8.8.8 1.1.1.1".
func parseDNSFromResolvectl(output string) []string {
var servers []string
for line := range strings.SplitSeq(output, "\n") {
+3 -3
View File
@@ -8,7 +8,7 @@ import (
// DefaultConfigDir returns the default configuration directory.
// Production: /etc/spinifex (when /etc/spinifex exists)
// Development: ~/spinifex/config
// Development: ~/spinifex/config.
func DefaultConfigDir() string {
if isProductionLayout() {
return "/etc/spinifex"
@@ -18,7 +18,7 @@ func DefaultConfigDir() string {
// DefaultDataDir returns the default data directory.
// Production: /var/lib/spinifex
// Development: ~/spinifex
// Development: ~/spinifex.
func DefaultDataDir() string {
if isProductionLayout() {
return "/var/lib/spinifex"
@@ -28,7 +28,7 @@ func DefaultDataDir() string {
// LogDirFor returns the log directory for a given data directory.
// Production: /var/log/spinifex (matches systemd ReadWritePaths)
// Development: <dataDir>/logs (supports custom per-node data dirs)
// Development: <dataDir>/logs (supports custom per-node data dirs).
func LogDirFor(dataDir string) string {
if isProductionLayout() {
return "/var/log/spinifex"
+1 -1
View File
@@ -15,7 +15,7 @@ var (
appConfig *config.ClusterConfig
)
// rootCmd represents the base command when called without any subcommands
// rootCmd represents the base command when called without any subcommands.
var rootCmd = &cobra.Command{
Use: "spx",
Short: "Spinifex - Open source AWS-compatible platform for secure edge deployments",
+3 -3
View File
@@ -201,7 +201,7 @@ var predastoreStatusCmd = &cobra.Command{
},
}
// Repeat for viperblock
// Repeat for viperblock.
var viperblockStartCmd = &cobra.Command{
Use: "start",
Short: "Start the viperblock service",
@@ -365,7 +365,7 @@ var viperblockStatusCmd = &cobra.Command{
},
}
// Repeat for nats
// Repeat for nats.
var natsStartCmd = &cobra.Command{
Use: "start",
Short: "Start the nats service",
@@ -434,7 +434,7 @@ var natsStatusCmd = &cobra.Command{
},
}
// Repeat for spinifex
// Repeat for spinifex.
var spinifexStartCmd = &cobra.Command{
Use: "start",
Short: "Start the spinifex service",
+1 -1
View File
@@ -8,7 +8,7 @@ import (
)
// Version variables set via ldflags at build time.
// Example: go build -ldflags "-X github.com/mulgadc/spinifex/cmd/spinifex/cmd.Version=v1.0.0"
// Example: go build -ldflags "-X github.com/mulgadc/spinifex/cmd/spinifex/cmd.Version=v1.0.0".
var (
Version = "dev"
Commit = "unknown"
+1 -1
View File
@@ -504,7 +504,7 @@ func DefaultAccountName() string {
return "spinifex"
}
// GenerateNATSToken generates a secure random token for NATS
// GenerateNATSToken generates a secure random token for NATS.
func GenerateNATSToken() (string, error) {
bytes := make([]byte, 32)
if _, err := rand.Read(bytes); err != nil {
+4 -4
View File
@@ -449,7 +449,7 @@ var (
ErrorVpnGatewayLimitExceeded = "VpnGatewayLimitExceeded"
ErrorZonesMismatched = "ZonesMismatched"
// IAM-specific error codes
// IAM-specific error codes.
ErrorIAMNoSuchEntity = "NoSuchEntity"
ErrorIAMEntityAlreadyExists = "EntityAlreadyExists"
ErrorIAMDeleteConflict = "DeleteConflict"
@@ -458,7 +458,7 @@ var (
ErrorIAMMalformedPolicyDocument = "MalformedPolicyDocument"
ErrorAccessDenied = "AccessDenied"
// ECR-specific error codes
// ECR-specific error codes.
ErrorRepositoryNotFound = "RepositoryNotFoundException"
ErrorRepositoryPolicyNotFound = "RepositoryPolicyNotFoundException"
ErrorLifecyclePolicyNotFound = "LifecyclePolicyNotFoundException"
@@ -473,7 +473,7 @@ var (
ErrorTooManyTags = "TooManyTagsException"
ErrorOperationNotSupported = "OperationNotSupportedException"
// ELBv2-specific error codes
// ELBv2-specific error codes.
ErrorELBv2LoadBalancerNotFound = "LoadBalancerNotFound"
ErrorELBv2TargetGroupNotFound = "TargetGroupNotFound"
ErrorELBv2ListenerNotFound = "ListenerNotFound"
@@ -500,7 +500,7 @@ var (
ErrorELBv2CertificateNotFound = "CertificateNotFound"
ErrorELBv2SSLPolicyNotFound = "SSLPolicyNotFound"
// Bedrock/bedrock-runtime error codes
// Bedrock/bedrock-runtime error codes.
ErrorValidationException = "ValidationException"
// ErrorResourceNotFoundException aliases ErrorEKSResourceNotFound: both
// services use the same wire code, so it is not a second ErrorLookup entry.
+6 -6
View File
@@ -84,7 +84,7 @@ type BootstrapConfig struct {
SubnetCidr string `mapstructure:"subnet_cidr"`
}
// Config holds all configuration for the application
// Config holds all configuration for the application.
type Config struct {
// Node config
Node string `json:"Node" mapstructure:"node"`
@@ -174,7 +174,7 @@ type GPUModelOverride struct {
MIGProfile string `json:"MIGProfile" mapstructure:"mig_profile"`
}
// DaemonConfig holds the daemon configuration
// DaemonConfig holds the daemon configuration.
type DaemonConfig struct {
Host string `json:"Host" mapstructure:"host"`
TLSKey string `json:"TLSKey" mapstructure:"tlskey"`
@@ -187,7 +187,7 @@ type DaemonConfig struct {
MIGProfile string `json:"MIGProfile" mapstructure:"mig_profile"`
}
// NATSConfig holds the NATS configuration
// NATSConfig holds the NATS configuration.
type NATSConfig struct {
Host string `json:"Host" mapstructure:"host"`
CACert string `json:"CACert" mapstructure:"cacert"`
@@ -195,12 +195,12 @@ type NATSConfig struct {
Sub NATSSub `json:"Sub" mapstructure:"sub"`
}
// NATSACL holds the NATS ACL configuration
// NATSACL holds the NATS ACL configuration.
type NATSACL struct {
Token string `json:"Token" mapstructure:"token"`
}
// NATSSub holds the NATS subscription configuration
// NATSSub holds the NATS subscription configuration.
type NATSSub struct {
Subject string `json:"Subject" mapstructure:"subject"`
}
@@ -242,7 +242,7 @@ func (c Config) GetServices() []string {
return c.Services
}
// LoadConfig loads the configuration from file and environment variables
// LoadConfig loads the configuration from file and environment variables.
func LoadConfig(configPath string) (*ClusterConfig, error) {
// Set environment variable prefix
viper.SetEnvPrefix("SPINIFEX")
+6 -6
View File
@@ -116,7 +116,7 @@ type ResourceManager struct {
// handler's GatePublisher hook — the two services are wired together below.
var _ handlers_ec2_igw.GatePublisher = (*handlers_ec2_routetable.RouteTableServiceImpl)(nil)
// Daemon represents the main daemon service
// Daemon represents the main daemon service.
type Daemon struct {
node string
clusterConfig *config.ClusterConfig
@@ -343,7 +343,7 @@ func (d *Daemon) onNATSReconnect(_ *nats.Conn) {
// execCommand wraps exec.Command so tests can substitute a fake implementation.
var execCommand = exec.Command
// getSystemMemory returns the total system memory in GB
// getSystemMemory returns the total system memory in GB.
func getSystemMemory() (float64, error) {
switch runtime.GOOS {
case "darwin":
@@ -523,7 +523,7 @@ func (rm *ResourceManager) instanceMemChargeMiB(it *ec2.InstanceTypeInfo) int64
nbdkitChargeMiB(defaultMainVolumes, defaultAuxVolumes, rm.nbdkitMainMiB, rm.nbdkitAuxMiB)
}
// GetInstanceTypeInfos returns all instance types as ec2.InstanceTypeInfo for AWS API compatibility
// GetInstanceTypeInfos returns all instance types as ec2.InstanceTypeInfo for AWS API compatibility.
func (rm *ResourceManager) GetInstanceTypeInfos() []*ec2.InstanceTypeInfo {
rm.mu.RLock()
defer rm.mu.RUnlock()
@@ -666,12 +666,12 @@ func (rm *ResourceManager) GetResourceStats() (totalVCPU int, totalMemGB float64
return totalVCPU, totalMemGB, reservedVCPU, reservedMemGB, allocVCPU, allocMemGB, caps
}
// SetConfigPath sets the configuration file path for cluster management
// SetConfigPath sets the configuration file path for cluster management.
func (d *Daemon) SetConfigPath(path string) {
d.configPath = path
}
// NewDaemon creates a new daemon instance
// NewDaemon creates a new daemon instance.
func NewDaemon(cfg *config.ClusterConfig) (*Daemon, error) {
ctx, cancel := context.WithCancel(context.Background())
@@ -2340,7 +2340,7 @@ func (rm *ResourceManager) allocate(instanceType *ec2.InstanceTypeInfo) error {
return nil
}
// deallocate releases resources for an instance and updates NATS subscriptions
// deallocate releases resources for an instance and updates NATS subscriptions.
func (rm *ResourceManager) deallocate(instanceType *ec2.InstanceTypeInfo) {
rm.mu.Lock()
vCPUs := instanceTypeVCPUs(instanceType)
+3 -3
View File
@@ -122,7 +122,7 @@ func handleNATSRequestWithPrincipal[I any, O any](msg *nats.Msg, serviceFn func(
respondWithJSON(msg, output)
}
// handleEC2Events processes incoming EC2 instance events (start, stop, terminate, attach-volume)
// handleEC2Events processes incoming EC2 instance events (start, stop, terminate, attach-volume).
func (d *Daemon) handleEC2Events(msg *nats.Msg) {
ctx, span := utils.StartConsumerSpan(msg)
defer span.End()
@@ -213,7 +213,7 @@ func (d *Daemon) handleEC2Events(msg *nats.Msg) {
// --- Admin / node management handlers ---
// handleHealthCheck processes NATS health check requests
// handleHealthCheck processes NATS health check requests.
func (d *Daemon) handleHealthCheck(msg *nats.Msg) {
configHash, err := d.computeConfigHash()
if err != nil {
@@ -239,7 +239,7 @@ func (d *Daemon) handleHealthCheck(msg *nats.Msg) {
}
// handleNodeDiscover responds to node discovery requests with this node's ID
// Used by the gateway to dynamically discover active spinifex nodes in the cluster
// Used by the gateway to dynamically discover active spinifex nodes in the cluster.
func (d *Daemon) handleNodeDiscover(msg *nats.Msg) {
response := types.NodeDiscoverResponse{
Node: d.node,
+1 -1
View File
@@ -176,7 +176,7 @@ func (d *Daemon) handleEC2DescribeVolumesModifications(msg *nats.Msg) {
handleNATSRequest(msg, d.volumeService.DescribeVolumesModifications)
}
// handleEC2ModifyVolume processes incoming EC2 ModifyVolume requests
// handleEC2ModifyVolume processes incoming EC2 ModifyVolume requests.
func (d *Daemon) handleEC2ModifyVolume(msg *nats.Msg) {
ctx, span := utils.StartConsumerSpan(msg)
defer span.End()
+1 -1
View File
@@ -189,7 +189,7 @@ func (d *Daemon) ensureDefaultVPCInfrastructureFor(ctx context.Context, accountI
}
}
// ensureDefaultIGWRoute adds 0.0.0.0/0 → igw-xxx to the main route table if not present
// ensureDefaultIGWRoute adds 0.0.0.0/0 → igw-xxx to the main route table if not present.
func (d *Daemon) ensureDefaultIGWRoute(ctx context.Context, accountID, vpcID string) {
// Find the main route table for this VPC
vpcFilter := "vpc-id"
+15 -15
View File
@@ -78,7 +78,7 @@ func drainAndClose(t *testing.T, nc *nats.Conn) {
}
}
// createTestDaemon creates a test daemon instance with minimal configuration
// createTestDaemon creates a test daemon instance with minimal configuration.
func createTestDaemon(t *testing.T, natsURL string) *Daemon {
// Create a temporary directory for test data
tmpDir := t.TempDir()
@@ -150,7 +150,7 @@ func createTestDaemon(t *testing.T, natsURL string) *Daemon {
return daemon
}
// getTestInstanceType returns a valid instance type for testing based on the system's CPU
// getTestInstanceType returns a valid instance type for testing based on the system's CPU.
func getTestInstanceType(t *testing.T) string {
t.Helper()
rm, err := NewResourceManager(nil, nil, nil)
@@ -182,7 +182,7 @@ func seedTestAMI(t *testing.T, store *objectstore.MemoryObjectStore, bucket, ima
require.NoError(t, err)
}
// TestResourceManager tests resource manager functionality
// TestResourceManager tests resource manager functionality.
func TestResourceManager(t *testing.T) {
rm, err := NewResourceManager(nil, nil, nil)
require.NoError(t, err)
@@ -267,7 +267,7 @@ func TestResourceManager(t *testing.T) {
})
}
// TestGetInstanceTypeInfos tests the GetInstanceTypeInfos method
// TestGetInstanceTypeInfos tests the GetInstanceTypeInfos method.
func TestGetInstanceTypeInfos(t *testing.T) {
rm, err := NewResourceManager(nil, nil, nil)
require.NoError(t, err)
@@ -295,7 +295,7 @@ func TestGetInstanceTypeInfos(t *testing.T) {
}
}
// TestGetAvailableInstanceTypeInfos_ResourceFiltering tests that instance types are filtered by available resources
// TestGetAvailableInstanceTypeInfos_ResourceFiltering tests that instance types are filtered by available resources.
func TestGetAvailableInstanceTypeInfos_ResourceFiltering(t *testing.T) {
rm, err := NewResourceManager(nil, nil, nil)
require.NoError(t, err)
@@ -377,7 +377,7 @@ func TestGetAvailableInstanceTypeInfos_ResourceFiltering(t *testing.T) {
"Should have same available types after deallocation")
}
// TestHandleEC2DescribeInstanceTypes tests the DescribeInstanceTypes handler
// TestHandleEC2DescribeInstanceTypes tests the DescribeInstanceTypes handler.
func TestHandleEC2DescribeInstanceTypes(t *testing.T) {
natsURL := sharedNATSURL
@@ -694,7 +694,7 @@ func TestHandleEC2DescribeInstanceTypes(t *testing.T) {
})
}
// TestDaemon_BootAllocation verifies that resources are correctly reconstructed on startup
// TestDaemon_BootAllocation verifies that resources are correctly reconstructed on startup.
func TestDaemon_BootAllocation(t *testing.T) {
natsURL := sharedJSNATSURL
@@ -774,7 +774,7 @@ func TestDaemon_BootAllocation(t *testing.T) {
assert.Equal(t, expectedMem, daemon.resourceMgr.allocatedMem)
}
// TestCanAllocate_CountEdgeCases tests edge cases for canAllocate with count parameter
// TestCanAllocate_CountEdgeCases tests edge cases for canAllocate with count parameter.
func TestCanAllocate_CountEdgeCases(t *testing.T) {
t.Run("MinCount_equals_MaxCount", func(t *testing.T) {
rm, err := NewResourceManager(nil, nil, nil)
@@ -1018,7 +1018,7 @@ func TestAllocate_NoOvercommitUnderContention(t *testing.T) {
assert.InDelta(t, memGB*float64(capacityFor), finalMem, 0.001, "allocated memory must not exceed schedulable pool")
}
// TestDescribeInstances_ReservationGrouping tests that instances are grouped by reservation ID
// TestDescribeInstances_ReservationGrouping tests that instances are grouped by reservation ID.
func TestDescribeInstances_ReservationGrouping(t *testing.T) {
natsURL := sharedNATSURL
@@ -1209,7 +1209,7 @@ func TestDescribeInstances_ReservationGrouping(t *testing.T) {
})
}
// TestRunInstances_CountValidation tests MinCount/MaxCount validation scenarios
// TestRunInstances_CountValidation tests MinCount/MaxCount validation scenarios.
func TestRunInstances_CountValidation(t *testing.T) {
natsURL := sharedNATSURL
instanceType := getTestInstanceType(t)
@@ -1557,7 +1557,7 @@ func TestInstanceTypeSubscriptions(t *testing.T) {
})
}
// TestResourceManager_ConcurrentAccess tests thread safety of resource manager
// TestResourceManager_ConcurrentAccess tests thread safety of resource manager.
func TestResourceManager_ConcurrentAccess(t *testing.T) {
rm, err := NewResourceManager(nil, nil, nil)
require.NoError(t, err)
@@ -1738,7 +1738,7 @@ func TestInstanceCleanerAdapter_DeleteVolumes_DeleteOnTermination_False(t *testi
assert.False(t, ebsDeletedVolumes["vol-keep"], "Root volume with DeleteOnTermination=false should NOT be deleted")
}
// TestHandleEC2Events_AttachVolume tests the attach-volume handler in handleEC2Events
// TestHandleEC2Events_AttachVolume tests the attach-volume handler in handleEC2Events.
func TestHandleEC2Events_AttachVolume(t *testing.T) {
natsURL := sharedNATSURL
@@ -1840,7 +1840,7 @@ func TestHandleEC2Events_AttachVolume(t *testing.T) {
})
}
// TestHandleEC2Events_DetachVolume tests the detach-volume handler in handleEC2Events
// TestHandleEC2Events_DetachVolume tests the detach-volume handler in handleEC2Events.
func TestHandleEC2Events_DetachVolume(t *testing.T) {
natsURL := sharedNATSURL
@@ -2267,7 +2267,7 @@ func TestDetachVolume_SuccessPath(t *testing.T) {
assert.Equal(t, "vol-root", *instance.Instance.BlockDeviceMappings[0].Ebs.VolumeId)
}
// TestDetachVolume_ForceFlag tests that force=true continues past device_del failure
// TestDetachVolume_ForceFlag tests that force=true continues past device_del failure.
func TestDetachVolume_ForceFlag(t *testing.T) {
natsURL := sharedNATSURL
@@ -2493,7 +2493,7 @@ func TestDetachVolume_BlockdevDelFailure(t *testing.T) {
assert.True(t, bdmFound, "Volume must remain in BlockDeviceMappings when blockdev-del fails")
}
// TestDetachVolume_SuccessWithDeviceMatch tests detach with correct --device cross-check
// TestDetachVolume_SuccessWithDeviceMatch tests detach with correct --device cross-check.
func TestDetachVolume_SuccessWithDeviceMatch(t *testing.T) {
natsURL := sharedNATSURL
+10 -10
View File
@@ -16,20 +16,20 @@ import (
)
const (
// InstanceStateBucket is the name of the KV bucket for storing instance state
// InstanceStateBucket is the name of the KV bucket for storing instance state.
InstanceStateBucket = "spinifex-instance-state"
// ClusterStateBucket is the name of the KV bucket for cluster state (heartbeats, shutdown markers, service maps)
// ClusterStateBucket is the name of the KV bucket for cluster state (heartbeats, shutdown markers, service maps).
ClusterStateBucket = "spinifex-cluster-state"
// InstanceStatePrefix is the key prefix for per-node instance state entries
// InstanceStatePrefix is the key prefix for per-node instance state entries.
InstanceStatePrefix = "node."
// StoppedInstancePrefix is the key prefix for stopped instances in shared KV
// StoppedInstancePrefix is the key prefix for stopped instances in shared KV.
StoppedInstancePrefix = "instance."
// TerminatedInstanceBucket is the name of the KV bucket for terminated instances (auto-expiry via TTL)
// TerminatedInstanceBucket is the name of the KV bucket for terminated instances (auto-expiry via TTL).
TerminatedInstanceBucket = "spinifex-terminated-instances"
// TerminatedInstancePrefix is the key prefix for terminated instances
// TerminatedInstancePrefix is the key prefix for terminated instances.
TerminatedInstancePrefix = "terminated."
// Schema versions for daemon KV buckets
// Schema versions for daemon KV buckets.
InstanceStateBucketVersion = 1
ClusterStateBucketVersion = 1
TerminatedInstanceBucketVersion = 1
@@ -44,7 +44,7 @@ type KVSyncObserver interface {
RecordKVSyncFailure(bucket string, err error)
}
// JetStreamManager manages JetStream KV store operations for instance state
// JetStreamManager manages JetStream KV store operations for instance state.
type JetStreamManager struct {
js nats.JetStreamContext
kv nats.KeyValue // spinifex-instance-state
@@ -86,7 +86,7 @@ func NewJetStreamManager(nc *nats.Conn, replicas int) (*JetStreamManager, error)
}, nil
}
// InitKVBucket initializes the KV bucket, creating it if it doesn't exist
// InitKVBucket initializes the KV bucket, creating it if it doesn't exist.
func (m *JetStreamManager) InitKVBucket() error {
// Try to get the existing bucket first
kv, err := m.js.KeyValue(InstanceStateBucket)
@@ -705,7 +705,7 @@ func (m *JetStreamManager) LoadState(nodeID string) (map[string]*vm.VM, error) {
return state.VMS, nil
}
// DeleteState removes the instance state from the KV store for the given node
// DeleteState removes the instance state from the KV store for the given node.
func (m *JetStreamManager) DeleteState(nodeID string) error {
if m.kv == nil {
return errors.New("KV bucket not initialized")
+17 -17
View File
@@ -14,7 +14,7 @@ import (
"github.com/stretchr/testify/require"
)
// TestJetStreamManager_WriteAndLoadState tests round-trip write and load of instance state
// TestJetStreamManager_WriteAndLoadState tests round-trip write and load of instance state.
func TestJetStreamManager_WriteAndLoadState(t *testing.T) {
natsURL := sharedJSNATSURL
@@ -65,7 +65,7 @@ func TestJetStreamManager_WriteAndLoadState(t *testing.T) {
assert.Equal(t, "t3.small", loadedInstances["i-test-002"].InstanceType)
}
// TestJetStreamManager_LoadState_KeyNotFound tests that LoadState returns empty state when key doesn't exist
// TestJetStreamManager_LoadState_KeyNotFound tests that LoadState returns empty state when key doesn't exist.
func TestJetStreamManager_LoadState_KeyNotFound(t *testing.T) {
natsURL := sharedJSNATSURL
@@ -86,7 +86,7 @@ func TestJetStreamManager_LoadState_KeyNotFound(t *testing.T) {
assert.Empty(t, instances, "Should return empty VMS map")
}
// TestJetStreamManager_BucketCreation tests that InitKVBucket creates the bucket when it doesn't exist
// TestJetStreamManager_BucketCreation tests that InitKVBucket creates the bucket when it doesn't exist.
func TestJetStreamManager_BucketCreation(t *testing.T) {
natsURL := sharedJSNATSURL
@@ -105,7 +105,7 @@ func TestJetStreamManager_BucketCreation(t *testing.T) {
assert.NotNil(t, jsm.kv, "KV bucket should be initialized")
}
// TestJetStreamManager_BucketReconnection tests that InitKVBucket connects to existing bucket
// TestJetStreamManager_BucketReconnection tests that InitKVBucket connects to existing bucket.
func TestJetStreamManager_BucketReconnection(t *testing.T) {
natsURL := sharedJSNATSURL
@@ -150,7 +150,7 @@ func TestJetStreamManager_BucketReconnection(t *testing.T) {
assert.Equal(t, vm.StateRunning, loadedInstances["i-persist"].Status)
}
// TestJetStreamManager_DeleteState tests deleting state from the KV store
// TestJetStreamManager_DeleteState tests deleting state from the KV store.
func TestJetStreamManager_DeleteState(t *testing.T) {
natsURL := sharedJSNATSURL
@@ -190,7 +190,7 @@ func TestJetStreamManager_DeleteState(t *testing.T) {
assert.Empty(t, loadedInstances, "Should return empty state after deletion")
}
// TestJetStreamManager_DeleteState_NonExistent tests deleting state that doesn't exist
// TestJetStreamManager_DeleteState_NonExistent tests deleting state that doesn't exist.
func TestJetStreamManager_DeleteState_NonExistent(t *testing.T) {
natsURL := sharedJSNATSURL
@@ -209,7 +209,7 @@ func TestJetStreamManager_DeleteState_NonExistent(t *testing.T) {
require.NoError(t, err, "Deleting non-existent state should not error")
}
// TestJetStreamManager_WriteState_UpdateExisting tests that writing state updates existing entry
// TestJetStreamManager_WriteState_UpdateExisting tests that writing state updates existing entry.
func TestJetStreamManager_WriteState_UpdateExisting(t *testing.T) {
natsURL := sharedJSNATSURL
@@ -257,7 +257,7 @@ func TestJetStreamManager_WriteState_UpdateExisting(t *testing.T) {
assert.NotNil(t, loadedInstances["i-new"], "Should have new instance")
}
// TestJetStreamManager_MultipleNodes tests storing state for multiple nodes
// TestJetStreamManager_MultipleNodes tests storing state for multiple nodes.
func TestJetStreamManager_MultipleNodes(t *testing.T) {
natsURL := sharedJSNATSURL
@@ -304,7 +304,7 @@ func TestJetStreamManager_MultipleNodes(t *testing.T) {
assert.False(t, exists, "Node-1 should not have node-2's instances")
}
// TestJetStreamManager_KVNotInitialized tests error handling when KV is not initialized
// TestJetStreamManager_KVNotInitialized tests error handling when KV is not initialized.
func TestJetStreamManager_KVNotInitialized(t *testing.T) {
natsURL := sharedJSNATSURL
@@ -327,7 +327,7 @@ func TestJetStreamManager_KVNotInitialized(t *testing.T) {
assert.Error(t, err, "DeleteState should error when KV not initialized")
}
// TestJetStreamManager_UpdateReplicas tests updating replica count for the KV bucket
// TestJetStreamManager_UpdateReplicas tests updating replica count for the KV bucket.
func TestJetStreamManager_UpdateReplicas(t *testing.T) {
natsURL := sharedJSNATSURL
@@ -358,7 +358,7 @@ func TestJetStreamManager_UpdateReplicas(t *testing.T) {
// This test verifies the basic functionality works.
}
// TestJetStreamManager_UpdateReplicas_NoInit tests UpdateReplicas when JS not initialized
// TestJetStreamManager_UpdateReplicas_NoInit tests UpdateReplicas when JS not initialized.
func TestJetStreamManager_UpdateReplicas_NoInit(t *testing.T) {
// Test with nil JetStream context
jsm := &JetStreamManager{
@@ -372,7 +372,7 @@ func TestJetStreamManager_UpdateReplicas_NoInit(t *testing.T) {
// --- Stopped instance KV tests ---
// TestJetStreamManager_WriteAndLoadStoppedInstance tests round-trip write and load of a stopped instance
// TestJetStreamManager_WriteAndLoadStoppedInstance tests round-trip write and load of a stopped instance.
func TestJetStreamManager_WriteAndLoadStoppedInstance(t *testing.T) {
nc, err := nats.Connect(sharedJSNATSURL)
require.NoError(t, err)
@@ -407,7 +407,7 @@ func TestJetStreamManager_WriteAndLoadStoppedInstance(t *testing.T) {
_ = jsm.DeleteStoppedInstance(testVM.ID)
}
// TestJetStreamManager_LoadStoppedInstance_NotFound tests that LoadStoppedInstance returns nil for missing key
// TestJetStreamManager_LoadStoppedInstance_NotFound tests that LoadStoppedInstance returns nil for missing key.
func TestJetStreamManager_LoadStoppedInstance_NotFound(t *testing.T) {
nc, err := nats.Connect(sharedJSNATSURL)
require.NoError(t, err)
@@ -423,7 +423,7 @@ func TestJetStreamManager_LoadStoppedInstance_NotFound(t *testing.T) {
assert.Nil(t, loaded)
}
// TestJetStreamManager_DeleteStoppedInstance tests deleting a stopped instance (including non-existent)
// TestJetStreamManager_DeleteStoppedInstance tests deleting a stopped instance (including non-existent).
func TestJetStreamManager_DeleteStoppedInstance(t *testing.T) {
nc, err := nats.Connect(sharedJSNATSURL)
require.NoError(t, err)
@@ -653,7 +653,7 @@ func TestJetStreamManager_UpdateStoppedInstance_NoResurrectAfterClaim(t *testing
assert.Nil(t, stillGone, "the stopped record must stay deleted after the losing update")
}
// TestJetStreamManager_ListStoppedInstances tests listing multiple stopped instances
// TestJetStreamManager_ListStoppedInstances tests listing multiple stopped instances.
func TestJetStreamManager_ListStoppedInstances(t *testing.T) {
nc, err := nats.Connect(sharedJSNATSURL)
require.NoError(t, err)
@@ -695,7 +695,7 @@ func TestJetStreamManager_ListStoppedInstances(t *testing.T) {
}
}
// TestJetStreamManager_StoppedInstances_NoInterference tests that stopped instances don't interfere with per-node state
// TestJetStreamManager_StoppedInstances_NoInterference tests that stopped instances don't interfere with per-node state.
func TestJetStreamManager_StoppedInstances_NoInterference(t *testing.T) {
nc, err := nats.Connect(sharedJSNATSURL)
require.NoError(t, err)
@@ -735,7 +735,7 @@ func TestJetStreamManager_StoppedInstances_NoInterference(t *testing.T) {
_ = jsm.DeleteState("interference-test-node")
}
// TestJetStreamManager_StoppedInstance_KVNotInitialized tests error handling when KV is not initialized
// TestJetStreamManager_StoppedInstance_KVNotInitialized tests error handling when KV is not initialized.
func TestJetStreamManager_StoppedInstance_KVNotInitialized(t *testing.T) {
nc, err := nats.Connect(sharedJSNATSURL)
require.NoError(t, err)
+7 -7
View File
@@ -10,7 +10,7 @@ import (
"github.com/nats-io/nats.go"
)
// ImportCertificate — CertificateManager.ImportCertificate
// ImportCertificate — CertificateManager.ImportCertificate.
func ImportCertificate(ctx context.Context, natsConn *nats.Conn, accountID string, body []byte) (*acm.ImportCertificateOutput, error) {
input := new(acm.ImportCertificateInput)
if err := unmarshalIfBody(body, input); err != nil {
@@ -19,7 +19,7 @@ func ImportCertificate(ctx context.Context, natsConn *nats.Conn, accountID strin
return handlers_acm.NewNATSACMService(natsConn).ImportCertificate(ctx, input, accountID)
}
// DescribeCertificate — CertificateManager.DescribeCertificate
// DescribeCertificate — CertificateManager.DescribeCertificate.
func DescribeCertificate(ctx context.Context, natsConn *nats.Conn, accountID string, body []byte) (*acm.DescribeCertificateOutput, error) {
input := new(acm.DescribeCertificateInput)
if err := unmarshalIfBody(body, input); err != nil {
@@ -28,7 +28,7 @@ func DescribeCertificate(ctx context.Context, natsConn *nats.Conn, accountID str
return handlers_acm.NewNATSACMService(natsConn).DescribeCertificate(ctx, input, accountID)
}
// ListCertificates — CertificateManager.ListCertificates
// ListCertificates — CertificateManager.ListCertificates.
func ListCertificates(ctx context.Context, natsConn *nats.Conn, accountID string, body []byte) (*acm.ListCertificatesOutput, error) {
input := new(acm.ListCertificatesInput)
if err := unmarshalIfBody(body, input); err != nil {
@@ -37,7 +37,7 @@ func ListCertificates(ctx context.Context, natsConn *nats.Conn, accountID string
return handlers_acm.NewNATSACMService(natsConn).ListCertificates(ctx, input, accountID)
}
// DeleteCertificate — CertificateManager.DeleteCertificate
// DeleteCertificate — CertificateManager.DeleteCertificate.
func DeleteCertificate(ctx context.Context, natsConn *nats.Conn, accountID string, body []byte) (*acm.DeleteCertificateOutput, error) {
input := new(acm.DeleteCertificateInput)
if err := unmarshalIfBody(body, input); err != nil {
@@ -46,7 +46,7 @@ func DeleteCertificate(ctx context.Context, natsConn *nats.Conn, accountID strin
return handlers_acm.NewNATSACMService(natsConn).DeleteCertificate(ctx, input, accountID)
}
// ListTagsForCertificate — CertificateManager.ListTagsForCertificate
// ListTagsForCertificate — CertificateManager.ListTagsForCertificate.
func ListTagsForCertificate(ctx context.Context, natsConn *nats.Conn, accountID string, body []byte) (*acm.ListTagsForCertificateOutput, error) {
input := new(acm.ListTagsForCertificateInput)
if err := unmarshalIfBody(body, input); err != nil {
@@ -55,7 +55,7 @@ func ListTagsForCertificate(ctx context.Context, natsConn *nats.Conn, accountID
return handlers_acm.NewNATSACMService(natsConn).ListTagsForCertificate(ctx, input, accountID)
}
// AddTagsToCertificate — CertificateManager.AddTagsToCertificate
// AddTagsToCertificate — CertificateManager.AddTagsToCertificate.
func AddTagsToCertificate(ctx context.Context, natsConn *nats.Conn, accountID string, body []byte) (*acm.AddTagsToCertificateOutput, error) {
input := new(acm.AddTagsToCertificateInput)
if err := unmarshalIfBody(body, input); err != nil {
@@ -64,7 +64,7 @@ func AddTagsToCertificate(ctx context.Context, natsConn *nats.Conn, accountID st
return handlers_acm.NewNATSACMService(natsConn).AddTagsToCertificate(ctx, input, accountID)
}
// RemoveTagsFromCertificate — CertificateManager.RemoveTagsFromCertificate
// RemoveTagsFromCertificate — CertificateManager.RemoveTagsFromCertificate.
func RemoveTagsFromCertificate(ctx context.Context, natsConn *nats.Conn, accountID string, body []byte) (*acm.RemoveTagsFromCertificateOutput, error) {
input := new(acm.RemoveTagsFromCertificateInput)
if err := unmarshalIfBody(body, input); err != nil {
@@ -7,7 +7,7 @@ import (
"github.com/aws/aws-sdk-go/service/ec2"
)
// DescribeAccountAttributes returns static account attributes for the Spinifex platform
// DescribeAccountAttributes returns static account attributes for the Spinifex platform.
func DescribeAccountAttributes(input *ec2.DescribeAccountAttributesInput) (*ec2.DescribeAccountAttributesOutput, error) {
requestedAttrs := make(map[string]bool)
for _, name := range input.AttributeNames {
@@ -22,7 +22,7 @@ func ValidateCreateEgressOnlyInternetGatewayInput(input *ec2.CreateEgressOnlyInt
return nil
}
// CreateEgressOnlyInternetGateway handles the EC2 CreateEgressOnlyInternetGateway API call
// CreateEgressOnlyInternetGateway handles the EC2 CreateEgressOnlyInternetGateway API call.
func CreateEgressOnlyInternetGateway(ctx context.Context, input *ec2.CreateEgressOnlyInternetGatewayInput, natsConn *nats.Conn, accountID string) (ec2.CreateEgressOnlyInternetGatewayOutput, error) {
var output ec2.CreateEgressOnlyInternetGatewayOutput
@@ -22,7 +22,7 @@ func ValidateDeleteEgressOnlyInternetGatewayInput(input *ec2.DeleteEgressOnlyInt
return nil
}
// DeleteEgressOnlyInternetGateway handles the EC2 DeleteEgressOnlyInternetGateway API call
// DeleteEgressOnlyInternetGateway handles the EC2 DeleteEgressOnlyInternetGateway API call.
func DeleteEgressOnlyInternetGateway(ctx context.Context, input *ec2.DeleteEgressOnlyInternetGatewayInput, natsConn *nats.Conn, accountID string) (ec2.DeleteEgressOnlyInternetGatewayOutput, error) {
var output ec2.DeleteEgressOnlyInternetGatewayOutput
@@ -18,7 +18,7 @@ func ValidateDescribeEgressOnlyInternetGatewaysInput(input *ec2.DescribeEgressOn
return nil
}
// DescribeEgressOnlyInternetGateways handles the EC2 DescribeEgressOnlyInternetGateways API call
// DescribeEgressOnlyInternetGateways handles the EC2 DescribeEgressOnlyInternetGateways API call.
func DescribeEgressOnlyInternetGateways(ctx context.Context, input *ec2.DescribeEgressOnlyInternetGatewaysInput, natsConn *nats.Conn, accountID string) (ec2.DescribeEgressOnlyInternetGatewaysOutput, error) {
var output ec2.DescribeEgressOnlyInternetGatewaysOutput
@@ -23,7 +23,7 @@ func ValidateAttachInternetGatewayInput(input *ec2.AttachInternetGatewayInput) e
return nil
}
// AttachInternetGateway handles the EC2 AttachInternetGateway API call
// AttachInternetGateway handles the EC2 AttachInternetGateway API call.
func AttachInternetGateway(ctx context.Context, input *ec2.AttachInternetGatewayInput, natsConn *nats.Conn, accountID string) (ec2.AttachInternetGatewayOutput, error) {
var output ec2.AttachInternetGatewayOutput
@@ -10,7 +10,7 @@ import (
"github.com/nats-io/nats.go"
)
// CreateInternetGateway handles the EC2 CreateInternetGateway API call
// CreateInternetGateway handles the EC2 CreateInternetGateway API call.
func CreateInternetGateway(ctx context.Context, input *ec2.CreateInternetGatewayInput, natsConn *nats.Conn, accountID string) (ec2.CreateInternetGatewayOutput, error) {
var output ec2.CreateInternetGatewayOutput
@@ -20,7 +20,7 @@ func ValidateDeleteInternetGatewayInput(input *ec2.DeleteInternetGatewayInput) e
return nil
}
// DeleteInternetGateway handles the EC2 DeleteInternetGateway API call
// DeleteInternetGateway handles the EC2 DeleteInternetGateway API call.
func DeleteInternetGateway(ctx context.Context, input *ec2.DeleteInternetGatewayInput, natsConn *nats.Conn, accountID string) (ec2.DeleteInternetGatewayOutput, error) {
var output ec2.DeleteInternetGatewayOutput
@@ -10,7 +10,7 @@ import (
"github.com/nats-io/nats.go"
)
// DescribeInternetGateways handles the EC2 DescribeInternetGateways API call
// DescribeInternetGateways handles the EC2 DescribeInternetGateways API call.
func DescribeInternetGateways(ctx context.Context, input *ec2.DescribeInternetGatewaysInput, natsConn *nats.Conn, accountID string) (ec2.DescribeInternetGatewaysOutput, error) {
var output ec2.DescribeInternetGatewaysOutput
@@ -23,7 +23,7 @@ func ValidateDetachInternetGatewayInput(input *ec2.DetachInternetGatewayInput) e
return nil
}
// DetachInternetGateway handles the EC2 DetachInternetGateway API call
// DetachInternetGateway handles the EC2 DetachInternetGateway API call.
func DetachInternetGateway(ctx context.Context, input *ec2.DetachInternetGatewayInput, natsConn *nats.Conn, accountID string) (ec2.DetachInternetGatewayOutput, error) {
var output ec2.DetachInternetGatewayOutput
+2 -2
View File
@@ -11,7 +11,7 @@ import (
"github.com/nats-io/nats.go"
)
// ValidateCreateImageInput validates the input parameters for CreateImage
// ValidateCreateImageInput validates the input parameters for CreateImage.
func ValidateCreateImageInput(input *ec2.CreateImageInput) error {
if input == nil {
return errors.New(awserrors.ErrorInvalidParameterValue)
@@ -32,7 +32,7 @@ func ValidateCreateImageInput(input *ec2.CreateImageInput) error {
return nil
}
// CreateImage handles the EC2 CreateImage API call
// CreateImage handles the EC2 CreateImage API call.
func CreateImage(ctx context.Context, input *ec2.CreateImageInput, natsConn *nats.Conn, expectedNodes int, accountID string) (ec2.CreateImageOutput, error) {
var output ec2.CreateImageOutput
@@ -15,7 +15,7 @@ import (
"github.com/nats-io/nats.go"
)
// startStoppedInstanceRequest is the payload sent to the ec2.start topic
// startStoppedInstanceRequest is the payload sent to the ec2.start topic.
type startStoppedInstanceRequest struct {
InstanceID string `json:"instance_id"`
}
@@ -15,7 +15,7 @@ import (
"github.com/nats-io/nats.go"
)
// terminateStoppedInstanceRequest is the payload sent to the ec2.terminate topic
// terminateStoppedInstanceRequest is the payload sent to the ec2.terminate topic.
type terminateStoppedInstanceRequest struct {
InstanceID string `json:"instance_id"`
}
@@ -9,7 +9,7 @@ import (
"github.com/nats-io/nats.go"
)
// startTestNATSServer starts an embedded NATS server for testing
// startTestNATSServer starts an embedded NATS server for testing.
func startTestNATSServer(t *testing.T) (*server.Server, *nats.Conn) {
t.Helper()
return testutil.StartTestNATS(t)
+1 -1
View File
@@ -7,7 +7,7 @@ import (
"github.com/nats-io/nats.go"
)
// DescribeKeyPairs lists key pairs via NATS
// DescribeKeyPairs lists key pairs via NATS.
func DescribeKeyPairs(ctx context.Context, input *ec2.DescribeKeyPairsInput, natsConn *nats.Conn, accountID string) (output ec2.DescribeKeyPairsOutput, err error) {
keyService := handlers_ec2_key.NewNATSKeyService(natsConn)
result, err := keyService.DescribeKeyPairs(ctx, input, accountID)
@@ -11,7 +11,7 @@ import (
"github.com/nats-io/nats.go"
)
// ValidateCopySnapshotInput validates the input parameters for CopySnapshot
// ValidateCopySnapshotInput validates the input parameters for CopySnapshot.
func ValidateCopySnapshotInput(input *ec2.CopySnapshotInput) error {
if input == nil {
return errors.New(awserrors.ErrorInvalidParameterValue)
@@ -32,7 +32,7 @@ func ValidateCopySnapshotInput(input *ec2.CopySnapshotInput) error {
return nil
}
// CopySnapshot handles the EC2 CopySnapshot API call
// CopySnapshot handles the EC2 CopySnapshot API call.
func CopySnapshot(ctx context.Context, input *ec2.CopySnapshotInput, natsConn *nats.Conn, accountID string) (ec2.CopySnapshotOutput, error) {
var output ec2.CopySnapshotOutput
@@ -11,7 +11,7 @@ import (
"github.com/nats-io/nats.go"
)
// ValidateCreateSnapshotInput validates the input parameters for CreateSnapshot
// ValidateCreateSnapshotInput validates the input parameters for CreateSnapshot.
func ValidateCreateSnapshotInput(input *ec2.CreateSnapshotInput) error {
if input == nil {
return errors.New(awserrors.ErrorInvalidParameterValue)
@@ -28,7 +28,7 @@ func ValidateCreateSnapshotInput(input *ec2.CreateSnapshotInput) error {
return nil
}
// CreateSnapshot handles the EC2 CreateSnapshot API call
// CreateSnapshot handles the EC2 CreateSnapshot API call.
func CreateSnapshot(ctx context.Context, input *ec2.CreateSnapshotInput, natsConn *nats.Conn, accountID string) (ec2.Snapshot, error) {
var output ec2.Snapshot
@@ -11,7 +11,7 @@ import (
"github.com/nats-io/nats.go"
)
// ValidateDeleteSnapshotInput validates the input parameters for DeleteSnapshot
// ValidateDeleteSnapshotInput validates the input parameters for DeleteSnapshot.
func ValidateDeleteSnapshotInput(input *ec2.DeleteSnapshotInput) error {
if input == nil {
return errors.New(awserrors.ErrorInvalidParameterValue)
@@ -28,7 +28,7 @@ func ValidateDeleteSnapshotInput(input *ec2.DeleteSnapshotInput) error {
return nil
}
// DeleteSnapshot handles the EC2 DeleteSnapshot API call
// DeleteSnapshot handles the EC2 DeleteSnapshot API call.
func DeleteSnapshot(ctx context.Context, input *ec2.DeleteSnapshotInput, natsConn *nats.Conn, accountID string) (ec2.DeleteSnapshotOutput, error) {
var output ec2.DeleteSnapshotOutput
@@ -11,7 +11,7 @@ import (
"github.com/nats-io/nats.go"
)
// ValidateDescribeSnapshotsInput validates the input parameters for DescribeSnapshots
// ValidateDescribeSnapshotsInput validates the input parameters for DescribeSnapshots.
func ValidateDescribeSnapshotsInput(input *ec2.DescribeSnapshotsInput) error {
if input == nil {
return nil
@@ -26,7 +26,7 @@ func ValidateDescribeSnapshotsInput(input *ec2.DescribeSnapshotsInput) error {
return nil
}
// DescribeSnapshots handles the EC2 DescribeSnapshots API call
// DescribeSnapshots handles the EC2 DescribeSnapshots API call.
func DescribeSnapshots(ctx context.Context, input *ec2.DescribeSnapshotsInput, natsConn *nats.Conn, accountID string) (ec2.DescribeSnapshotsOutput, error) {
var output ec2.DescribeSnapshotsOutput
+2 -2
View File
@@ -10,7 +10,7 @@ import (
"github.com/nats-io/nats.go"
)
// ValidateCreateTagsInput validates the input parameters for CreateTags
// ValidateCreateTagsInput validates the input parameters for CreateTags.
func ValidateCreateTagsInput(input *ec2.CreateTagsInput) error {
if input == nil {
return errors.New(awserrors.ErrorInvalidParameterValue)
@@ -33,7 +33,7 @@ func ValidateCreateTagsInput(input *ec2.CreateTagsInput) error {
return nil
}
// CreateTags handles the EC2 CreateTags API call
// CreateTags handles the EC2 CreateTags API call.
func CreateTags(ctx context.Context, input *ec2.CreateTagsInput, natsConn *nats.Conn, accountID string) (ec2.CreateTagsOutput, error) {
var output ec2.CreateTagsOutput
+2 -2
View File
@@ -10,7 +10,7 @@ import (
"github.com/nats-io/nats.go"
)
// ValidateDeleteTagsInput validates the input parameters for DeleteTags
// ValidateDeleteTagsInput validates the input parameters for DeleteTags.
func ValidateDeleteTagsInput(input *ec2.DeleteTagsInput) error {
if input == nil {
return errors.New(awserrors.ErrorInvalidParameterValue)
@@ -23,7 +23,7 @@ func ValidateDeleteTagsInput(input *ec2.DeleteTagsInput) error {
return nil
}
// DeleteTags handles the EC2 DeleteTags API call
// DeleteTags handles the EC2 DeleteTags API call.
func DeleteTags(ctx context.Context, input *ec2.DeleteTagsInput, natsConn *nats.Conn, accountID string) (ec2.DeleteTagsOutput, error) {
var output ec2.DeleteTagsOutput
+1 -1
View File
@@ -7,7 +7,7 @@ import (
"github.com/nats-io/nats.go"
)
// DescribeTags handles the EC2 DescribeTags API call
// DescribeTags handles the EC2 DescribeTags API call.
func DescribeTags(ctx context.Context, input *ec2.DescribeTagsInput, natsConn *nats.Conn, accountID string) (ec2.DescribeTagsOutput, error) {
var output ec2.DescribeTagsOutput
+2 -2
View File
@@ -16,7 +16,7 @@ import (
"github.com/nats-io/nats.go"
)
// ValidateAttachVolumeInput validates the input parameters for AttachVolume
// ValidateAttachVolumeInput validates the input parameters for AttachVolume.
func ValidateAttachVolumeInput(input *ec2.AttachVolumeInput) error {
if input == nil {
return errors.New(awserrors.ErrorInvalidParameterValue)
@@ -33,7 +33,7 @@ func ValidateAttachVolumeInput(input *ec2.AttachVolumeInput) error {
return nil
}
// AttachVolume sends an attach-volume command to the daemon owning the instance
// AttachVolume sends an attach-volume command to the daemon owning the instance.
func AttachVolume(ctx context.Context, input *ec2.AttachVolumeInput, natsConn *nats.Conn, accountID string) (ec2.VolumeAttachment, error) {
var output ec2.VolumeAttachment
+1 -1
View File
@@ -36,7 +36,7 @@ func ValidateCreateVolumeInput(input *ec2.CreateVolumeInput) error {
return nil
}
// CreateVolume handles the CreateVolume API call
// CreateVolume handles the CreateVolume API call.
func CreateVolume(ctx context.Context, input *ec2.CreateVolumeInput, natsConn *nats.Conn, accountID string) (ec2.Volume, error) {
var output ec2.Volume
@@ -25,7 +25,7 @@ func ValidateDescribeVolumeStatusInput(input *ec2.DescribeVolumeStatusInput) err
return nil
}
// DescribeVolumeStatus handles the DescribeVolumeStatus API call
// DescribeVolumeStatus handles the DescribeVolumeStatus API call.
func DescribeVolumeStatus(ctx context.Context, input *ec2.DescribeVolumeStatusInput, natsConn *nats.Conn, accountID string) (ec2.DescribeVolumeStatusOutput, error) {
var output ec2.DescribeVolumeStatusOutput
@@ -27,7 +27,7 @@ func ValidateDescribeVolumesInput(input *ec2.DescribeVolumesInput) error {
return nil
}
// DescribeVolumes handles the DescribeVolumes API call
// DescribeVolumes handles the DescribeVolumes API call.
func DescribeVolumes(ctx context.Context, input *ec2.DescribeVolumesInput, natsConn *nats.Conn, accountID string) (ec2.DescribeVolumesOutput, error) {
var output ec2.DescribeVolumesOutput
@@ -25,7 +25,7 @@ func ValidateDescribeVolumesModificationsInput(input *ec2.DescribeVolumesModific
return nil
}
// DescribeVolumesModifications handles the DescribeVolumesModifications API call
// DescribeVolumesModifications handles the DescribeVolumesModifications API call.
func DescribeVolumesModifications(ctx context.Context, input *ec2.DescribeVolumesModificationsInput, natsConn *nats.Conn, accountID string) (ec2.DescribeVolumesModificationsOutput, error) {
var output ec2.DescribeVolumesModificationsOutput
+2 -2
View File
@@ -16,7 +16,7 @@ import (
"github.com/nats-io/nats.go"
)
// ValidateDetachVolumeInput validates the input parameters for DetachVolume
// ValidateDetachVolumeInput validates the input parameters for DetachVolume.
func ValidateDetachVolumeInput(input *ec2.DetachVolumeInput) error {
if input == nil {
return errors.New(awserrors.ErrorInvalidParameterValue)
@@ -29,7 +29,7 @@ func ValidateDetachVolumeInput(input *ec2.DetachVolumeInput) error {
return nil
}
// DetachVolume sends a detach-volume command to the daemon owning the instance
// DetachVolume sends a detach-volume command to the daemon owning the instance.
func DetachVolume(ctx context.Context, input *ec2.DetachVolumeInput, natsConn *nats.Conn, accountID string) (ec2.VolumeAttachment, error) {
var output ec2.VolumeAttachment
+1 -1
View File
@@ -27,7 +27,7 @@ func ValidateModifyVolumeInput(input *ec2.ModifyVolumeInput) error {
return nil
}
// ModifyVolume handles the ModifyVolume API call
// ModifyVolume handles the ModifyVolume API call.
func ModifyVolume(ctx context.Context, input *ec2.ModifyVolumeInput, natsConn *nats.Conn, accountID string) (ec2.ModifyVolumeOutput, error) {
var output ec2.ModifyVolumeOutput
@@ -20,7 +20,7 @@ func ValidateCreateNetworkInterfaceInput(input *ec2.CreateNetworkInterfaceInput)
return nil
}
// CreateNetworkInterface handles the EC2 CreateNetworkInterface API call
// CreateNetworkInterface handles the EC2 CreateNetworkInterface API call.
func CreateNetworkInterface(ctx context.Context, input *ec2.CreateNetworkInterfaceInput, natsConn *nats.Conn, accountID string) (ec2.CreateNetworkInterfaceOutput, error) {
var output ec2.CreateNetworkInterfaceOutput
+1 -1
View File
@@ -23,7 +23,7 @@ func ValidateCreateSubnetInput(input *ec2.CreateSubnetInput) error {
return nil
}
// CreateSubnet handles the EC2 CreateSubnet API call
// CreateSubnet handles the EC2 CreateSubnet API call.
func CreateSubnet(ctx context.Context, input *ec2.CreateSubnetInput, natsConn *nats.Conn, accountID string) (ec2.CreateSubnetOutput, error) {
var output ec2.CreateSubnetOutput
+1 -1
View File
@@ -20,7 +20,7 @@ func ValidateCreateVpcInput(input *ec2.CreateVpcInput) error {
return nil
}
// CreateVpc handles the EC2 CreateVpc API call
// CreateVpc handles the EC2 CreateVpc API call.
func CreateVpc(ctx context.Context, input *ec2.CreateVpcInput, natsConn *nats.Conn, accountID string) (ec2.CreateVpcOutput, error) {
var output ec2.CreateVpcOutput
@@ -20,7 +20,7 @@ func ValidateDeleteNetworkInterfaceInput(input *ec2.DeleteNetworkInterfaceInput)
return nil
}
// DeleteNetworkInterface handles the EC2 DeleteNetworkInterface API call
// DeleteNetworkInterface handles the EC2 DeleteNetworkInterface API call.
func DeleteNetworkInterface(ctx context.Context, input *ec2.DeleteNetworkInterfaceInput, natsConn *nats.Conn, accountID string) (ec2.DeleteNetworkInterfaceOutput, error) {
var output ec2.DeleteNetworkInterfaceOutput
+1 -1
View File
@@ -20,7 +20,7 @@ func ValidateDeleteSubnetInput(input *ec2.DeleteSubnetInput) error {
return nil
}
// DeleteSubnet handles the EC2 DeleteSubnet API call
// DeleteSubnet handles the EC2 DeleteSubnet API call.
func DeleteSubnet(ctx context.Context, input *ec2.DeleteSubnetInput, natsConn *nats.Conn, accountID string) (ec2.DeleteSubnetOutput, error) {
var output ec2.DeleteSubnetOutput
+1 -1
View File
@@ -20,7 +20,7 @@ func ValidateDeleteVpcInput(input *ec2.DeleteVpcInput) error {
return nil
}
// DeleteVpc handles the EC2 DeleteVpc API call
// DeleteVpc handles the EC2 DeleteVpc API call.
func DeleteVpc(ctx context.Context, input *ec2.DeleteVpcInput, natsConn *nats.Conn, accountID string) (ec2.DeleteVpcOutput, error) {
var output ec2.DeleteVpcOutput
@@ -7,7 +7,7 @@ import (
"github.com/nats-io/nats.go"
)
// DescribeNetworkInterfaces handles the EC2 DescribeNetworkInterfaces API call
// DescribeNetworkInterfaces handles the EC2 DescribeNetworkInterfaces API call.
func DescribeNetworkInterfaces(ctx context.Context, input *ec2.DescribeNetworkInterfacesInput, natsConn *nats.Conn, accountID string) (ec2.DescribeNetworkInterfacesOutput, error) {
svc := handlers_ec2_vpc.NewNATSVPCService(natsConn)
result, err := svc.DescribeNetworkInterfaces(ctx, input, accountID)
+1 -1
View File
@@ -7,7 +7,7 @@ import (
"github.com/nats-io/nats.go"
)
// DescribeSubnets handles the EC2 DescribeSubnets API call
// DescribeSubnets handles the EC2 DescribeSubnets API call.
func DescribeSubnets(ctx context.Context, input *ec2.DescribeSubnetsInput, natsConn *nats.Conn, accountID string) (ec2.DescribeSubnetsOutput, error) {
var output ec2.DescribeSubnetsOutput
@@ -23,7 +23,7 @@ func ValidateDescribeVpcAttributeInput(input *ec2.DescribeVpcAttributeInput) err
return nil
}
// DescribeVpcAttribute handles the EC2 DescribeVpcAttribute API call
// DescribeVpcAttribute handles the EC2 DescribeVpcAttribute API call.
func DescribeVpcAttribute(ctx context.Context, input *ec2.DescribeVpcAttributeInput, natsConn *nats.Conn, accountID string) (ec2.DescribeVpcAttributeOutput, error) {
var output ec2.DescribeVpcAttributeOutput
+1 -1
View File
@@ -7,7 +7,7 @@ import (
"github.com/nats-io/nats.go"
)
// DescribeVpcs handles the EC2 DescribeVpcs API call
// DescribeVpcs handles the EC2 DescribeVpcs API call.
func DescribeVpcs(ctx context.Context, input *ec2.DescribeVpcsInput, natsConn *nats.Conn, accountID string) (ec2.DescribeVpcsOutput, error) {
var output ec2.DescribeVpcsOutput
@@ -27,7 +27,7 @@ func ValidateModifyNetworkInterfaceAttributeInput(input *ec2.ModifyNetworkInterf
return nil
}
// ModifyNetworkInterfaceAttribute handles the EC2 ModifyNetworkInterfaceAttribute API call
// ModifyNetworkInterfaceAttribute handles the EC2 ModifyNetworkInterfaceAttribute API call.
func ModifyNetworkInterfaceAttribute(ctx context.Context, input *ec2.ModifyNetworkInterfaceAttributeInput, natsConn *nats.Conn, accountID string) (ec2.ModifyNetworkInterfaceAttributeOutput, error) {
var output ec2.ModifyNetworkInterfaceAttributeOutput
@@ -20,7 +20,7 @@ func ValidateModifySubnetAttributeInput(input *ec2.ModifySubnetAttributeInput) e
return nil
}
// ModifySubnetAttribute handles the EC2 ModifySubnetAttribute API call
// ModifySubnetAttribute handles the EC2 ModifySubnetAttribute API call.
func ModifySubnetAttribute(ctx context.Context, input *ec2.ModifySubnetAttributeInput, natsConn *nats.Conn, accountID string) (ec2.ModifySubnetAttributeOutput, error) {
var output ec2.ModifySubnetAttributeOutput
@@ -20,7 +20,7 @@ func ValidateModifyVpcAttributeInput(input *ec2.ModifyVpcAttributeInput) error {
return nil
}
// ModifyVpcAttribute handles the EC2 ModifyVpcAttribute API call
// ModifyVpcAttribute handles the EC2 ModifyVpcAttribute API call.
func ModifyVpcAttribute(ctx context.Context, input *ec2.ModifyVpcAttributeInput, natsConn *nats.Conn, accountID string) (ec2.ModifyVpcAttributeOutput, error) {
var output ec2.ModifyVpcAttributeOutput
+9 -9
View File
@@ -8,7 +8,7 @@ import (
"github.com/nats-io/nats.go"
)
// CreateAccessEntry — POST /clusters/{name}/access-entries
// CreateAccessEntry — POST /clusters/{name}/access-entries.
func CreateAccessEntry(ctx context.Context, natsConn *nats.Conn, accountID, cluster string, body []byte) (*eks.CreateAccessEntryOutput, error) {
input := new(eks.CreateAccessEntryInput)
if err := unmarshalIfBody(body, input); err != nil {
@@ -18,7 +18,7 @@ func CreateAccessEntry(ctx context.Context, natsConn *nats.Conn, accountID, clus
return handlers_eks.NewNATSEKSService(natsConn).CreateAccessEntry(ctx, input, accountID)
}
// DescribeAccessEntry — GET /clusters/{name}/access-entries/{arn}
// DescribeAccessEntry — GET /clusters/{name}/access-entries/{arn}.
func DescribeAccessEntry(ctx context.Context, natsConn *nats.Conn, accountID, cluster, principalARN string) (*eks.DescribeAccessEntryOutput, error) {
input := &eks.DescribeAccessEntryInput{
ClusterName: aws.String(cluster),
@@ -27,13 +27,13 @@ func DescribeAccessEntry(ctx context.Context, natsConn *nats.Conn, accountID, cl
return handlers_eks.NewNATSEKSService(natsConn).DescribeAccessEntry(ctx, input, accountID)
}
// ListAccessEntries — GET /clusters/{name}/access-entries
// ListAccessEntries — GET /clusters/{name}/access-entries.
func ListAccessEntries(ctx context.Context, natsConn *nats.Conn, accountID, cluster string) (*eks.ListAccessEntriesOutput, error) {
input := &eks.ListAccessEntriesInput{ClusterName: aws.String(cluster)}
return handlers_eks.NewNATSEKSService(natsConn).ListAccessEntries(ctx, input, accountID)
}
// UpdateAccessEntry — POST /clusters/{name}/access-entries/{arn}
// UpdateAccessEntry — POST /clusters/{name}/access-entries/{arn}.
func UpdateAccessEntry(ctx context.Context, natsConn *nats.Conn, accountID, cluster, principalARN string, body []byte) (*eks.UpdateAccessEntryOutput, error) {
input := new(eks.UpdateAccessEntryInput)
if err := unmarshalIfBody(body, input); err != nil {
@@ -44,7 +44,7 @@ func UpdateAccessEntry(ctx context.Context, natsConn *nats.Conn, accountID, clus
return handlers_eks.NewNATSEKSService(natsConn).UpdateAccessEntry(ctx, input, accountID)
}
// DeleteAccessEntry — DELETE /clusters/{name}/access-entries/{arn}
// DeleteAccessEntry — DELETE /clusters/{name}/access-entries/{arn}.
func DeleteAccessEntry(ctx context.Context, natsConn *nats.Conn, accountID, cluster, principalARN string) (*eks.DeleteAccessEntryOutput, error) {
input := &eks.DeleteAccessEntryInput{
ClusterName: aws.String(cluster),
@@ -53,7 +53,7 @@ func DeleteAccessEntry(ctx context.Context, natsConn *nats.Conn, accountID, clus
return handlers_eks.NewNATSEKSService(natsConn).DeleteAccessEntry(ctx, input, accountID)
}
// AssociateAccessPolicy — POST /clusters/{name}/access-entries/{arn}/access-policies
// AssociateAccessPolicy — POST /clusters/{name}/access-entries/{arn}/access-policies.
func AssociateAccessPolicy(ctx context.Context, natsConn *nats.Conn, accountID, cluster, principalARN string, body []byte) (*eks.AssociateAccessPolicyOutput, error) {
input := new(eks.AssociateAccessPolicyInput)
if err := unmarshalIfBody(body, input); err != nil {
@@ -64,7 +64,7 @@ func AssociateAccessPolicy(ctx context.Context, natsConn *nats.Conn, accountID,
return handlers_eks.NewNATSEKSService(natsConn).AssociateAccessPolicy(ctx, input, accountID)
}
// DisassociateAccessPolicy — DELETE /clusters/{name}/access-entries/{arn}/access-policies/{policyArn}
// DisassociateAccessPolicy — DELETE /clusters/{name}/access-entries/{arn}/access-policies/{policyArn}.
func DisassociateAccessPolicy(ctx context.Context, natsConn *nats.Conn, accountID, cluster, principalARN, policyARN string) (*eks.DisassociateAccessPolicyOutput, error) {
input := &eks.DisassociateAccessPolicyInput{
ClusterName: aws.String(cluster),
@@ -74,7 +74,7 @@ func DisassociateAccessPolicy(ctx context.Context, natsConn *nats.Conn, accountI
return handlers_eks.NewNATSEKSService(natsConn).DisassociateAccessPolicy(ctx, input, accountID)
}
// ListAssociatedAccessPolicies — GET /clusters/{name}/access-entries/{arn}/access-policies
// ListAssociatedAccessPolicies — GET /clusters/{name}/access-entries/{arn}/access-policies.
func ListAssociatedAccessPolicies(ctx context.Context, natsConn *nats.Conn, accountID, cluster, principalARN string) (*eks.ListAssociatedAccessPoliciesOutput, error) {
input := &eks.ListAssociatedAccessPoliciesInput{
ClusterName: aws.String(cluster),
@@ -83,7 +83,7 @@ func ListAssociatedAccessPolicies(ctx context.Context, natsConn *nats.Conn, acco
return handlers_eks.NewNATSEKSService(natsConn).ListAssociatedAccessPolicies(ctx, input, accountID)
}
// ListAccessPolicies — GET /access-policies
// ListAccessPolicies — GET /access-policies.
func ListAccessPolicies(ctx context.Context, natsConn *nats.Conn, accountID string) (*eks.ListAccessPoliciesOutput, error) {
return handlers_eks.NewNATSEKSService(natsConn).ListAccessPolicies(ctx, &eks.ListAccessPoliciesInput{}, accountID)
}
+6 -6
View File
@@ -8,19 +8,19 @@ import (
"github.com/nats-io/nats.go"
)
// ListAddons — GET /clusters/{name}/addons
// ListAddons — GET /clusters/{name}/addons.
func ListAddons(ctx context.Context, natsConn *nats.Conn, accountID, cluster string) (*eks.ListAddonsOutput, error) {
return handlers_eks.NewNATSEKSService(natsConn).ListAddons(ctx, &eks.ListAddonsInput{
ClusterName: aws.String(cluster),
}, accountID)
}
// DescribeAddonVersions — GET /addons/supported-versions
// DescribeAddonVersions — GET /addons/supported-versions.
func DescribeAddonVersions(ctx context.Context, natsConn *nats.Conn, accountID string) (*eks.DescribeAddonVersionsOutput, error) {
return handlers_eks.NewNATSEKSService(natsConn).DescribeAddonVersions(ctx, &eks.DescribeAddonVersionsInput{}, accountID)
}
// CreateAddon — POST /clusters/{name}/addons
// CreateAddon — POST /clusters/{name}/addons.
func CreateAddon(ctx context.Context, natsConn *nats.Conn, accountID, cluster string, body []byte) (*eks.CreateAddonOutput, error) {
input := new(eks.CreateAddonInput)
if err := unmarshalIfBody(body, input); err != nil {
@@ -30,7 +30,7 @@ func CreateAddon(ctx context.Context, natsConn *nats.Conn, accountID, cluster st
return handlers_eks.NewNATSEKSService(natsConn).CreateAddon(ctx, input, accountID)
}
// DeleteAddon — DELETE /clusters/{name}/addons/{addon}
// DeleteAddon — DELETE /clusters/{name}/addons/{addon}.
func DeleteAddon(ctx context.Context, natsConn *nats.Conn, accountID, cluster, addon string) (*eks.DeleteAddonOutput, error) {
input := &eks.DeleteAddonInput{
ClusterName: aws.String(cluster),
@@ -39,7 +39,7 @@ func DeleteAddon(ctx context.Context, natsConn *nats.Conn, accountID, cluster, a
return handlers_eks.NewNATSEKSService(natsConn).DeleteAddon(ctx, input, accountID)
}
// DescribeAddon — GET /clusters/{name}/addons/{addon}
// DescribeAddon — GET /clusters/{name}/addons/{addon}.
func DescribeAddon(ctx context.Context, natsConn *nats.Conn, accountID, cluster, addon string) (*eks.DescribeAddonOutput, error) {
input := &eks.DescribeAddonInput{
ClusterName: aws.String(cluster),
@@ -48,7 +48,7 @@ func DescribeAddon(ctx context.Context, natsConn *nats.Conn, accountID, cluster,
return handlers_eks.NewNATSEKSService(natsConn).DescribeAddon(ctx, input, accountID)
}
// UpdateAddon — POST /clusters/{name}/addons/{addon}/update
// UpdateAddon — POST /clusters/{name}/addons/{addon}/update.
func UpdateAddon(ctx context.Context, natsConn *nats.Conn, accountID, cluster, addon string, body []byte) (*eks.UpdateAddonOutput, error) {
input := new(eks.UpdateAddonInput)
if err := unmarshalIfBody(body, input); err != nil {
+5 -5
View File
@@ -20,18 +20,18 @@ func CreateCluster(ctx context.Context, natsConn *nats.Conn, accountID, callerPr
return handlers_eks.NewNATSEKSService(natsConn).CreateCluster(ctx, input, accountID, callerPrincipalARN)
}
// DescribeCluster — GET /clusters/{name}
// DescribeCluster — GET /clusters/{name}.
func DescribeCluster(ctx context.Context, natsConn *nats.Conn, accountID, name string) (*eks.DescribeClusterOutput, error) {
input := &eks.DescribeClusterInput{Name: aws.String(name)}
return handlers_eks.NewNATSEKSService(natsConn).DescribeCluster(ctx, input, accountID)
}
// ListClusters — GET /clusters
// ListClusters — GET /clusters.
func ListClusters(ctx context.Context, natsConn *nats.Conn, accountID string) (*eks.ListClustersOutput, error) {
return handlers_eks.NewNATSEKSService(natsConn).ListClusters(ctx, &eks.ListClustersInput{}, accountID)
}
// UpdateClusterConfig — POST /clusters/{name}/update-config
// UpdateClusterConfig — POST /clusters/{name}/update-config.
func UpdateClusterConfig(ctx context.Context, natsConn *nats.Conn, accountID, name string, body []byte) (*eks.UpdateClusterConfigOutput, error) {
input := new(eks.UpdateClusterConfigInput)
if err := unmarshalIfBody(body, input); err != nil {
@@ -41,7 +41,7 @@ func UpdateClusterConfig(ctx context.Context, natsConn *nats.Conn, accountID, na
return handlers_eks.NewNATSEKSService(natsConn).UpdateClusterConfig(ctx, input, accountID)
}
// UpdateClusterVersion — POST /clusters/{name}/update-version
// UpdateClusterVersion — POST /clusters/{name}/update-version.
func UpdateClusterVersion(ctx context.Context, natsConn *nats.Conn, accountID, name string, body []byte) (*eks.UpdateClusterVersionOutput, error) {
input := new(eks.UpdateClusterVersionInput)
if err := unmarshalIfBody(body, input); err != nil {
@@ -51,7 +51,7 @@ func UpdateClusterVersion(ctx context.Context, natsConn *nats.Conn, accountID, n
return handlers_eks.NewNATSEKSService(natsConn).UpdateClusterVersion(ctx, input, accountID)
}
// DeleteCluster — DELETE /clusters/{name}
// DeleteCluster — DELETE /clusters/{name}.
func DeleteCluster(ctx context.Context, natsConn *nats.Conn, accountID, name string) (*eks.DeleteClusterOutput, error) {
input := &eks.DeleteClusterInput{Name: aws.String(name)}
return handlers_eks.NewNATSEKSService(natsConn).DeleteCluster(ctx, input, accountID)
+6 -6
View File
@@ -8,7 +8,7 @@ import (
"github.com/nats-io/nats.go"
)
// CreateNodegroup — POST /clusters/{name}/node-groups
// CreateNodegroup — POST /clusters/{name}/node-groups.
func CreateNodegroup(ctx context.Context, natsConn *nats.Conn, accountID, cluster string, body []byte) (*eks.CreateNodegroupOutput, error) {
input := new(eks.CreateNodegroupInput)
if err := unmarshalIfBody(body, input); err != nil {
@@ -18,7 +18,7 @@ func CreateNodegroup(ctx context.Context, natsConn *nats.Conn, accountID, cluste
return handlers_eks.NewNATSEKSService(natsConn).CreateNodegroup(ctx, input, accountID)
}
// DescribeNodegroup — GET /clusters/{name}/node-groups/{ng}
// DescribeNodegroup — GET /clusters/{name}/node-groups/{ng}.
func DescribeNodegroup(ctx context.Context, natsConn *nats.Conn, accountID, cluster, ng string) (*eks.DescribeNodegroupOutput, error) {
input := &eks.DescribeNodegroupInput{
ClusterName: aws.String(cluster),
@@ -27,13 +27,13 @@ func DescribeNodegroup(ctx context.Context, natsConn *nats.Conn, accountID, clus
return handlers_eks.NewNATSEKSService(natsConn).DescribeNodegroup(ctx, input, accountID)
}
// ListNodegroups — GET /clusters/{name}/node-groups
// ListNodegroups — GET /clusters/{name}/node-groups.
func ListNodegroups(ctx context.Context, natsConn *nats.Conn, accountID, cluster string) (*eks.ListNodegroupsOutput, error) {
input := &eks.ListNodegroupsInput{ClusterName: aws.String(cluster)}
return handlers_eks.NewNATSEKSService(natsConn).ListNodegroups(ctx, input, accountID)
}
// UpdateNodegroupConfig — POST /clusters/{name}/node-groups/{ng}/update-config
// UpdateNodegroupConfig — POST /clusters/{name}/node-groups/{ng}/update-config.
func UpdateNodegroupConfig(ctx context.Context, natsConn *nats.Conn, accountID, cluster, ng string, body []byte) (*eks.UpdateNodegroupConfigOutput, error) {
input := new(eks.UpdateNodegroupConfigInput)
if err := unmarshalIfBody(body, input); err != nil {
@@ -44,7 +44,7 @@ func UpdateNodegroupConfig(ctx context.Context, natsConn *nats.Conn, accountID,
return handlers_eks.NewNATSEKSService(natsConn).UpdateNodegroupConfig(ctx, input, accountID)
}
// UpdateNodegroupVersion — POST /clusters/{name}/node-groups/{ng}/update-version
// UpdateNodegroupVersion — POST /clusters/{name}/node-groups/{ng}/update-version.
func UpdateNodegroupVersion(ctx context.Context, natsConn *nats.Conn, accountID, cluster, ng string, body []byte) (*eks.UpdateNodegroupVersionOutput, error) {
input := new(eks.UpdateNodegroupVersionInput)
if err := unmarshalIfBody(body, input); err != nil {
@@ -55,7 +55,7 @@ func UpdateNodegroupVersion(ctx context.Context, natsConn *nats.Conn, accountID,
return handlers_eks.NewNATSEKSService(natsConn).UpdateNodegroupVersion(ctx, input, accountID)
}
// DeleteNodegroup — DELETE /clusters/{name}/node-groups/{ng}
// DeleteNodegroup — DELETE /clusters/{name}/node-groups/{ng}.
func DeleteNodegroup(ctx context.Context, natsConn *nats.Conn, accountID, cluster, ng string) (*eks.DeleteNodegroupOutput, error) {
input := &eks.DeleteNodegroupInput{
ClusterName: aws.String(cluster),
+4 -4
View File
@@ -8,7 +8,7 @@ import (
"github.com/nats-io/nats.go"
)
// AssociateIdentityProviderConfig — POST /clusters/{name}/identity-provider-configs/associate
// AssociateIdentityProviderConfig — POST /clusters/{name}/identity-provider-configs/associate.
func AssociateIdentityProviderConfig(ctx context.Context, natsConn *nats.Conn, accountID, cluster string, body []byte) (*eks.AssociateIdentityProviderConfigOutput, error) {
input := new(eks.AssociateIdentityProviderConfigInput)
if err := unmarshalIfBody(body, input); err != nil {
@@ -18,7 +18,7 @@ func AssociateIdentityProviderConfig(ctx context.Context, natsConn *nats.Conn, a
return handlers_eks.NewNATSEKSService(natsConn).AssociateIdentityProviderConfig(ctx, input, accountID)
}
// DescribeIdentityProviderConfig — POST /clusters/{name}/identity-provider-configs/describe
// DescribeIdentityProviderConfig — POST /clusters/{name}/identity-provider-configs/describe.
func DescribeIdentityProviderConfig(ctx context.Context, natsConn *nats.Conn, accountID, cluster string, body []byte) (*eks.DescribeIdentityProviderConfigOutput, error) {
input := new(eks.DescribeIdentityProviderConfigInput)
if err := unmarshalIfBody(body, input); err != nil {
@@ -28,13 +28,13 @@ func DescribeIdentityProviderConfig(ctx context.Context, natsConn *nats.Conn, ac
return handlers_eks.NewNATSEKSService(natsConn).DescribeIdentityProviderConfig(ctx, input, accountID)
}
// ListIdentityProviderConfigs — GET /clusters/{name}/identity-provider-configs
// ListIdentityProviderConfigs — GET /clusters/{name}/identity-provider-configs.
func ListIdentityProviderConfigs(ctx context.Context, natsConn *nats.Conn, accountID, cluster string) (*eks.ListIdentityProviderConfigsOutput, error) {
input := &eks.ListIdentityProviderConfigsInput{ClusterName: aws.String(cluster)}
return handlers_eks.NewNATSEKSService(natsConn).ListIdentityProviderConfigs(ctx, input, accountID)
}
// DisassociateIdentityProviderConfig — POST /clusters/{name}/identity-provider-configs/disassociate
// DisassociateIdentityProviderConfig — POST /clusters/{name}/identity-provider-configs/disassociate.
func DisassociateIdentityProviderConfig(ctx context.Context, natsConn *nats.Conn, accountID, cluster string, body []byte) (*eks.DisassociateIdentityProviderConfigOutput, error) {
input := new(eks.DisassociateIdentityProviderConfigInput)
if err := unmarshalIfBody(body, input); err != nil {
+3 -3
View File
@@ -8,7 +8,7 @@ import (
"github.com/nats-io/nats.go"
)
// TagResource — POST /tags/{arn}
// TagResource — POST /tags/{arn}.
func TagResource(ctx context.Context, natsConn *nats.Conn, accountID, resourceARN string, body []byte) (*eks.TagResourceOutput, error) {
input := new(eks.TagResourceInput)
if err := unmarshalIfBody(body, input); err != nil {
@@ -18,7 +18,7 @@ func TagResource(ctx context.Context, natsConn *nats.Conn, accountID, resourceAR
return handlers_eks.NewNATSEKSService(natsConn).TagResource(ctx, input, accountID)
}
// UntagResource — DELETE /tags/{arn}
// UntagResource — DELETE /tags/{arn}.
func UntagResource(ctx context.Context, natsConn *nats.Conn, accountID, resourceARN string, body []byte) (*eks.UntagResourceOutput, error) {
input := new(eks.UntagResourceInput)
if err := unmarshalIfBody(body, input); err != nil {
@@ -28,7 +28,7 @@ func UntagResource(ctx context.Context, natsConn *nats.Conn, accountID, resource
return handlers_eks.NewNATSEKSService(natsConn).UntagResource(ctx, input, accountID)
}
// ListTagsForResource — GET /tags/{arn}
// ListTagsForResource — GET /tags/{arn}.
func ListTagsForResource(ctx context.Context, natsConn *nats.Conn, accountID, resourceARN string) (*eks.ListTagsForResourceOutput, error) {
input := &eks.ListTagsForResourceInput{ResourceArn: aws.String(resourceARN)}
return handlers_eks.NewNATSEKSService(natsConn).ListTagsForResource(ctx, input, accountID)
+1 -1
View File
@@ -19,7 +19,7 @@ type ELBv2Handler func(ctx context.Context, action string, q map[string]string,
// elbv2Handler creates a type-safe ELBv2Handler that allocates the typed input struct,
// parses query params into it, calls the handler, and marshals the output to XML.
// ELBv2 uses the IAM-style XML envelope: <ActionResponse><ActionResult>...</ActionResult></ActionResponse>
// ELBv2 uses the IAM-style XML envelope: <ActionResponse><ActionResult>...</ActionResult></ActionResponse>.
func elbv2Handler[In any](handler func(context.Context, *In, *GatewayConfig, string) (any, error)) ELBv2Handler {
return func(ctx context.Context, action string, q map[string]string, gw *GatewayConfig, accountID string) ([]byte, error) {
input := new(In)
+2 -2
View File
@@ -343,7 +343,7 @@ func parseMIGMemory(name string) int64 {
}
// parseCreatedGIID extracts the newly created GPU instance ID from nvidia-smi output.
// Example: "Successfully created GPU instance ID 2 on GPU 0 ..."
// Example: "Successfully created GPU instance ID 2 on GPU 0 ...".
func parseCreatedGIID(output string) (int, error) {
for line := range strings.SplitSeq(output, "\n") {
if strings.Contains(line, "Successfully created GPU instance") {
@@ -359,7 +359,7 @@ func parseCreatedGIID(output string) (int, error) {
}
// parseCreatedCIID extracts the newly created compute instance ID from nvidia-smi output.
// Example: "Successfully created compute instance ID 0 on GPU 0 GPU instance ID 2 ..."
// Example: "Successfully created compute instance ID 0 on GPU 0 GPU instance ID 2 ...".
func parseCreatedCIID(output string) (int, error) {
for line := range strings.SplitSeq(output, "\n") {
if strings.Contains(line, "Successfully created compute instance") {
+1 -1
View File
@@ -6,7 +6,7 @@ import (
"github.com/aws/aws-sdk-go/service/ec2"
)
// AccountSettingsService defines the interface for EC2 account-level settings
// AccountSettingsService defines the interface for EC2 account-level settings.
type AccountSettingsService interface {
EnableEbsEncryptionByDefault(ctx context.Context, input *ec2.EnableEbsEncryptionByDefaultInput, accountID string) (*ec2.EnableEbsEncryptionByDefaultOutput, error)
DisableEbsEncryptionByDefault(ctx context.Context, input *ec2.DisableEbsEncryptionByDefaultInput, accountID string) (*ec2.DisableEbsEncryptionByDefaultOutput, error)
+11 -11
View File
@@ -22,13 +22,13 @@ const (
KeySerialConsoleAccess = "serial-console-access"
)
// AccountSettingsRecord represents stored account settings
// AccountSettingsRecord represents stored account settings.
type AccountSettingsRecord struct {
EbsEncryptionByDefault bool `json:"ebs_encryption_by_default"`
SerialConsoleAccess bool `json:"serial_console_access"`
}
// AccountSettingsServiceImpl implements account settings operations with NATS JetStream persistence
// AccountSettingsServiceImpl implements account settings operations with NATS JetStream persistence.
type AccountSettingsServiceImpl struct {
config *config.Config
js nats.JetStreamContext
@@ -37,7 +37,7 @@ type AccountSettingsServiceImpl struct {
var _ AccountSettingsService = (*AccountSettingsServiceImpl)(nil)
// NewAccountSettingsServiceImplWithNATS creates an account settings service with NATS JetStream for persistence
// NewAccountSettingsServiceImplWithNATS creates an account settings service with NATS JetStream for persistence.
func NewAccountSettingsServiceImplWithNATS(cfg *config.Config, natsConn *nats.Conn) (*AccountSettingsServiceImpl, error) {
js, err := natsConn.JetStream()
if err != nil {
@@ -70,7 +70,7 @@ func settingsKey(accountID string) string {
return accountID
}
// getSettings retrieves current account settings
// getSettings retrieves current account settings.
func (s *AccountSettingsServiceImpl) getSettings(accountID string) (*AccountSettingsRecord, error) {
entry, err := s.settingsKV.Get(settingsKey(accountID))
if err != nil {
@@ -91,7 +91,7 @@ func (s *AccountSettingsServiceImpl) getSettings(accountID string) (*AccountSett
return &settings, nil
}
// saveSettings saves current account settings
// saveSettings saves current account settings.
func (s *AccountSettingsServiceImpl) saveSettings(settings *AccountSettingsRecord, accountID string) error {
data, err := json.Marshal(settings)
if err != nil {
@@ -102,7 +102,7 @@ func (s *AccountSettingsServiceImpl) saveSettings(settings *AccountSettingsRecor
return err
}
// EnableEbsEncryptionByDefault enables EBS encryption by default for the account
// EnableEbsEncryptionByDefault enables EBS encryption by default for the account.
func (s *AccountSettingsServiceImpl) EnableEbsEncryptionByDefault(ctx context.Context, input *ec2.EnableEbsEncryptionByDefaultInput, accountID string) (*ec2.EnableEbsEncryptionByDefaultOutput, error) {
slog.InfoContext(ctx, "EnableEbsEncryptionByDefault called", "accountID", accountID)
@@ -122,7 +122,7 @@ func (s *AccountSettingsServiceImpl) EnableEbsEncryptionByDefault(ctx context.Co
}, nil
}
// DisableEbsEncryptionByDefault disables EBS encryption by default for the account
// DisableEbsEncryptionByDefault disables EBS encryption by default for the account.
func (s *AccountSettingsServiceImpl) DisableEbsEncryptionByDefault(ctx context.Context, input *ec2.DisableEbsEncryptionByDefaultInput, accountID string) (*ec2.DisableEbsEncryptionByDefaultOutput, error) {
slog.InfoContext(ctx, "DisableEbsEncryptionByDefault called", "accountID", accountID)
@@ -142,7 +142,7 @@ func (s *AccountSettingsServiceImpl) DisableEbsEncryptionByDefault(ctx context.C
}, nil
}
// GetEbsEncryptionByDefault gets the current EBS encryption by default setting
// GetEbsEncryptionByDefault gets the current EBS encryption by default setting.
func (s *AccountSettingsServiceImpl) GetEbsEncryptionByDefault(ctx context.Context, input *ec2.GetEbsEncryptionByDefaultInput, accountID string) (*ec2.GetEbsEncryptionByDefaultOutput, error) {
slog.InfoContext(ctx, "GetEbsEncryptionByDefault called", "accountID", accountID)
@@ -156,7 +156,7 @@ func (s *AccountSettingsServiceImpl) GetEbsEncryptionByDefault(ctx context.Conte
}, nil
}
// GetSerialConsoleAccessStatus gets the current serial console access status
// GetSerialConsoleAccessStatus gets the current serial console access status.
func (s *AccountSettingsServiceImpl) GetSerialConsoleAccessStatus(ctx context.Context, input *ec2.GetSerialConsoleAccessStatusInput, accountID string) (*ec2.GetSerialConsoleAccessStatusOutput, error) {
slog.InfoContext(ctx, "GetSerialConsoleAccessStatus called", "accountID", accountID)
@@ -170,7 +170,7 @@ func (s *AccountSettingsServiceImpl) GetSerialConsoleAccessStatus(ctx context.Co
}, nil
}
// EnableSerialConsoleAccess enables serial console access for the account
// EnableSerialConsoleAccess enables serial console access for the account.
func (s *AccountSettingsServiceImpl) EnableSerialConsoleAccess(ctx context.Context, input *ec2.EnableSerialConsoleAccessInput, accountID string) (*ec2.EnableSerialConsoleAccessOutput, error) {
slog.InfoContext(ctx, "EnableSerialConsoleAccess called", "accountID", accountID)
@@ -190,7 +190,7 @@ func (s *AccountSettingsServiceImpl) EnableSerialConsoleAccess(ctx context.Conte
}, nil
}
// DisableSerialConsoleAccess disables serial console access for the account
// DisableSerialConsoleAccess disables serial console access for the account.
func (s *AccountSettingsServiceImpl) DisableSerialConsoleAccess(ctx context.Context, input *ec2.DisableSerialConsoleAccessInput, accountID string) (*ec2.DisableSerialConsoleAccessOutput, error) {
slog.InfoContext(ctx, "DisableSerialConsoleAccess called", "accountID", accountID)
@@ -11,12 +11,12 @@ import (
var _ AccountSettingsService = (*NATSAccountSettingsService)(nil)
// NATSAccountSettingsService implements AccountSettingsService via NATS messaging
// NATSAccountSettingsService implements AccountSettingsService via NATS messaging.
type NATSAccountSettingsService struct {
natsConn *nats.Conn
}
// NewNATSAccountSettingsService creates a new NATS-based account settings service
// NewNATSAccountSettingsService creates a new NATS-based account settings service.
func NewNATSAccountSettingsService(natsConn *nats.Conn) AccountSettingsService {
return &NATSAccountSettingsService{natsConn: natsConn}
}
+1 -1
View File
@@ -6,7 +6,7 @@ import (
"github.com/aws/aws-sdk-go/service/ec2"
)
// EgressOnlyIGWService defines the interface for Egress-only Internet Gateway operations
// EgressOnlyIGWService defines the interface for Egress-only Internet Gateway operations.
type EgressOnlyIGWService interface {
CreateEgressOnlyInternetGateway(ctx context.Context, input *ec2.CreateEgressOnlyInternetGatewayInput, accountID string) (*ec2.CreateEgressOnlyInternetGatewayOutput, error)
DeleteEgressOnlyInternetGateway(ctx context.Context, input *ec2.DeleteEgressOnlyInternetGatewayInput, accountID string) (*ec2.DeleteEgressOnlyInternetGatewayOutput, error)
+7 -7
View File
@@ -20,7 +20,7 @@ import (
"github.com/nats-io/nats.go"
)
// Ensure EgressOnlyIGWServiceImpl implements EgressOnlyIGWService
// Ensure EgressOnlyIGWServiceImpl implements EgressOnlyIGWService.
var _ EgressOnlyIGWService = (*EgressOnlyIGWServiceImpl)(nil)
const (
@@ -28,7 +28,7 @@ const (
KVBucketEgressOnlyIGWVersion = 1
)
// EgressOnlyIGWRecord represents a stored Egress-only Internet Gateway
// EgressOnlyIGWRecord represents a stored Egress-only Internet Gateway.
type EgressOnlyIGWRecord struct {
EgressOnlyInternetGatewayId string `json:"egress_only_internet_gateway_id"`
VpcId string `json:"vpc_id"`
@@ -37,14 +37,14 @@ type EgressOnlyIGWRecord struct {
CreatedAt time.Time `json:"created_at"`
}
// EgressOnlyIGWServiceImpl implements Egress-only Internet Gateway operations with NATS JetStream persistence
// EgressOnlyIGWServiceImpl implements Egress-only Internet Gateway operations with NATS JetStream persistence.
type EgressOnlyIGWServiceImpl struct {
config *config.Config
eigwKV nats.KeyValue
vpcKV nats.KeyValue
}
// NewEgressOnlyIGWServiceImplWithNATS creates an Egress-only Internet Gateway service with NATS JetStream for persistence
// NewEgressOnlyIGWServiceImplWithNATS creates an Egress-only Internet Gateway service with NATS JetStream for persistence.
func NewEgressOnlyIGWServiceImplWithNATS(cfg *config.Config, natsConn *nats.Conn) (*EgressOnlyIGWServiceImpl, error) {
js, err := natsConn.JetStream()
if err != nil {
@@ -74,7 +74,7 @@ func NewEgressOnlyIGWServiceImplWithNATS(cfg *config.Config, natsConn *nats.Conn
}, nil
}
// CreateEgressOnlyInternetGateway creates a new Egress-only Internet Gateway
// CreateEgressOnlyInternetGateway creates a new Egress-only Internet Gateway.
func (s *EgressOnlyIGWServiceImpl) CreateEgressOnlyInternetGateway(ctx context.Context, input *ec2.CreateEgressOnlyInternetGatewayInput, accountID string) (*ec2.CreateEgressOnlyInternetGatewayOutput, error) {
if input.VpcId == nil || *input.VpcId == "" {
return nil, errors.New(awserrors.ErrorMissingParameter)
@@ -115,7 +115,7 @@ func (s *EgressOnlyIGWServiceImpl) CreateEgressOnlyInternetGateway(ctx context.C
}, nil
}
// DeleteEgressOnlyInternetGateway deletes an Egress-only Internet Gateway
// DeleteEgressOnlyInternetGateway deletes an Egress-only Internet Gateway.
func (s *EgressOnlyIGWServiceImpl) DeleteEgressOnlyInternetGateway(ctx context.Context, input *ec2.DeleteEgressOnlyInternetGatewayInput, accountID string) (*ec2.DeleteEgressOnlyInternetGatewayOutput, error) {
if input.EgressOnlyInternetGatewayId == nil || *input.EgressOnlyInternetGatewayId == "" {
return nil, errors.New(awserrors.ErrorMissingParameter)
@@ -147,7 +147,7 @@ var describeEIGWValidFilters = map[string]bool{
"egress-only-internet-gateway-id": true,
}
// DescribeEgressOnlyInternetGateways describes Egress-only Internet Gateways
// DescribeEgressOnlyInternetGateways describes Egress-only Internet Gateways.
func (s *EgressOnlyIGWServiceImpl) DescribeEgressOnlyInternetGateways(ctx context.Context, input *ec2.DescribeEgressOnlyInternetGatewaysInput, accountID string) (*ec2.DescribeEgressOnlyInternetGatewaysOutput, error) {
var egressOnlyIGWs []*ec2.EgressOnlyInternetGateway
+3 -3
View File
@@ -9,15 +9,15 @@ import (
"github.com/nats-io/nats.go"
)
// Ensure NATSEgressOnlyIGWService implements EgressOnlyIGWService
// Ensure NATSEgressOnlyIGWService implements EgressOnlyIGWService.
var _ EgressOnlyIGWService = (*NATSEgressOnlyIGWService)(nil)
// NATSEgressOnlyIGWService handles Egress-only Internet Gateway operations via NATS messaging
// NATSEgressOnlyIGWService handles Egress-only Internet Gateway operations via NATS messaging.
type NATSEgressOnlyIGWService struct {
natsConn *nats.Conn
}
// NewNATSEgressOnlyIGWService creates a new NATS-based Egress-only Internet Gateway service
// NewNATSEgressOnlyIGWService creates a new NATS-based Egress-only Internet Gateway service.
func NewNATSEgressOnlyIGWService(conn *nats.Conn) EgressOnlyIGWService {
return &NATSEgressOnlyIGWService{natsConn: conn}
}
+1 -1
View File
@@ -6,7 +6,7 @@ import (
"github.com/aws/aws-sdk-go/service/ec2"
)
// IGWService defines the interface for Internet Gateway operations
// IGWService defines the interface for Internet Gateway operations.
type IGWService interface {
CreateInternetGateway(ctx context.Context, input *ec2.CreateInternetGatewayInput, accountID string) (*ec2.CreateInternetGatewayOutput, error)
DeleteInternetGateway(ctx context.Context, input *ec2.DeleteInternetGatewayInput, accountID string) (*ec2.DeleteInternetGatewayOutput, error)
+6 -6
View File
@@ -21,7 +21,7 @@ import (
"github.com/nats-io/nats.go"
)
// Ensure IGWServiceImpl implements IGWService
// Ensure IGWServiceImpl implements IGWService.
var _ IGWService = (*IGWServiceImpl)(nil)
const (
@@ -29,7 +29,7 @@ const (
KVBucketIGWVersion = 1
)
// IGWRecord represents a stored Internet Gateway
// IGWRecord represents a stored Internet Gateway.
type IGWRecord struct {
InternetGatewayId string `json:"internet_gateway_id"`
VpcId string `json:"vpc_id,omitempty"` // empty when detached
@@ -45,7 +45,7 @@ type GatePublisher interface {
PublishGateDecisionsForVPC(accountID, vpcID, destCidr string)
}
// IGWServiceImpl implements Internet Gateway operations with NATS JetStream persistence
// IGWServiceImpl implements Internet Gateway operations with NATS JetStream persistence.
type IGWServiceImpl struct {
config *config.Config
igwKV nats.KeyValue
@@ -60,7 +60,7 @@ func (s *IGWServiceImpl) SetGatePublisher(p GatePublisher) {
s.gatePublisher = p
}
// NewIGWServiceImplWithNATS creates an Internet Gateway service with NATS JetStream for persistence
// NewIGWServiceImplWithNATS creates an Internet Gateway service with NATS JetStream for persistence.
func NewIGWServiceImplWithNATS(cfg *config.Config, natsConn *nats.Conn) (*IGWServiceImpl, error) {
js, err := natsConn.JetStream()
if err != nil {
@@ -126,7 +126,7 @@ func (s *IGWServiceImpl) createIGW(ctx context.Context, input *ec2.CreateInterne
}, nil
}
// DeleteInternetGateway deletes an Internet Gateway (must be detached first)
// DeleteInternetGateway deletes an Internet Gateway (must be detached first).
func (s *IGWServiceImpl) DeleteInternetGateway(ctx context.Context, input *ec2.DeleteInternetGatewayInput, accountID string) (*ec2.DeleteInternetGatewayOutput, error) {
if input.InternetGatewayId == nil || *input.InternetGatewayId == "" {
return nil, errors.New(awserrors.ErrorMissingParameter)
@@ -172,7 +172,7 @@ var describeIGWValidFilters = map[string]bool{
"attachment.state": true,
}
// DescribeInternetGateways lists Internet Gateways, optionally filtered by ID
// DescribeInternetGateways lists Internet Gateways, optionally filtered by ID.
func (s *IGWServiceImpl) DescribeInternetGateways(ctx context.Context, input *ec2.DescribeInternetGatewaysInput, accountID string) (*ec2.DescribeInternetGatewaysOutput, error) {
var igws []*ec2.InternetGateway
+3 -3
View File
@@ -9,15 +9,15 @@ import (
"github.com/nats-io/nats.go"
)
// Ensure NATSIGWService implements IGWService
// Ensure NATSIGWService implements IGWService.
var _ IGWService = (*NATSIGWService)(nil)
// NATSIGWService handles Internet Gateway operations via NATS messaging
// NATSIGWService handles Internet Gateway operations via NATS messaging.
type NATSIGWService struct {
natsConn *nats.Conn
}
// NewNATSIGWService creates a new NATS-based Internet Gateway service
// NewNATSIGWService creates a new NATS-based Internet Gateway service.
func NewNATSIGWService(conn *nats.Conn) IGWService {
return &NATSIGWService{natsConn: conn}
}
+1 -1
View File
@@ -6,7 +6,7 @@ import (
"github.com/aws/aws-sdk-go/service/ec2"
)
// ImageService defines the interface for EC2 image operations business logic
// ImageService defines the interface for EC2 image operations business logic.
type ImageService interface {
CreateImage(ctx context.Context, input *ec2.CreateImageInput, accountID string) (*ec2.CreateImageOutput, error)
CopyImage(ctx context.Context, input *ec2.CopyImageInput, accountID string) (*ec2.CopyImageOutput, error)
+8 -8
View File
@@ -26,7 +26,7 @@ import (
vbs3 "github.com/mulgadc/viperblock/viperblock/backends/s3"
)
// Ensure ImageServiceImpl implements ImageService
// Ensure ImageServiceImpl implements ImageService.
var _ ImageService = (*ImageServiceImpl)(nil)
// CreateImageParams holds parameters for creating an AMI from an instance.
@@ -38,14 +38,14 @@ type CreateImageParams struct {
IsRunning bool // true = use live checkpoint (instance still running), false = use numbered checkpoint from Close
}
// ImageServiceImpl handles AMI image operations with S3 storage
// ImageServiceImpl handles AMI image operations with S3 storage.
type ImageServiceImpl struct {
config *config.Config
store objectstore.ObjectStore
bucketName string
}
// NewImageServiceImpl creates a new daemon-side image service
// NewImageServiceImpl creates a new daemon-side image service.
func NewImageServiceImpl(cfg *config.Config) *ImageServiceImpl {
store := objectstore.NewS3ObjectStoreFromConfig(
cfg.Predastore.Host,
@@ -61,7 +61,7 @@ func NewImageServiceImpl(cfg *config.Config) *ImageServiceImpl {
}
}
// NewImageServiceImplWithStore creates an image service with a custom object store (for testing)
// NewImageServiceImplWithStore creates an image service with a custom object store (for testing).
func NewImageServiceImplWithStore(store objectstore.ObjectStore, bucketName string) *ImageServiceImpl {
return &ImageServiceImpl{
store: store,
@@ -83,7 +83,7 @@ var describeImagesValidFilters = map[string]bool{
"root-device-type": true,
}
// DescribeImages lists available AMI images by reading config.json files from S3
// DescribeImages lists available AMI images by reading config.json files from S3.
func (s *ImageServiceImpl) DescribeImages(ctx context.Context, input *ec2.DescribeImagesInput, accountID string) (*ec2.DescribeImagesOutput, error) {
if input == nil {
input = &ec2.DescribeImagesInput{}
@@ -539,7 +539,7 @@ func (s *ImageServiceImpl) snapshotRunningVolume(volumeID, snapshotID string) er
return nil
}
// snapshotStoppedVolume creates a snapshot offline by loading viperblock state from S3
// snapshotStoppedVolume creates a snapshot offline by loading viperblock state from S3.
func (s *ImageServiceImpl) snapshotStoppedVolume(volumeID, snapshotID string) error {
if s.config == nil {
return errors.New(awserrors.ErrorServerInternal)
@@ -619,7 +619,7 @@ func (s *ImageServiceImpl) snapshotStoppedVolume(volumeID, snapshotID string) er
return nil
}
// getVolumeConfig reads a volume's VBState config from S3
// getVolumeConfig reads a volume's VBState config from S3.
func (s *ImageServiceImpl) getVolumeConfig(ctx context.Context, volumeID string) (*viperblock.VolumeConfig, error) {
configKey := fmt.Sprintf("%s/config.json", volumeID)
result, err := s.store.GetObject(ctx, &s3.GetObjectInput{
@@ -856,7 +856,7 @@ func (s *ImageServiceImpl) loadAMIForMutation(ctx context.Context, imageID, acco
return meta, nil
}
// putSnapshotMetadata stores snapshot metadata in S3 using the canonical SnapshotConfig type
// putSnapshotMetadata stores snapshot metadata in S3 using the canonical SnapshotConfig type.
func (s *ImageServiceImpl) putSnapshotMetadata(ctx context.Context, snapshotID, volumeID string, volumeSizeGiB uint64, accountID string) error {
cfg := handlers_ec2_snapshot.SnapshotConfig{
SnapshotID: snapshotID,
@@ -25,14 +25,14 @@ import (
const testBucket = "test-bucket"
const testAccountID = "000000000001"
// setupTestImageService creates an image service with in-memory storage for testing
// setupTestImageService creates an image service with in-memory storage for testing.
func setupTestImageService(t *testing.T) (*ImageServiceImpl, *objectstore.MemoryObjectStore) {
store := objectstore.NewMemoryObjectStore()
svc := NewImageServiceImplWithStore(store, testBucket)
return svc, store
}
// createTestVolumeConfig creates a test volume config in the mock store
// createTestVolumeConfig creates a test volume config in the mock store.
func createTestVolumeConfig(t *testing.T, store *objectstore.MemoryObjectStore, volumeID string, sizeGiB int) {
volumeState := viperblock.VBState{
VolumeConfig: viperblock.VolumeConfig{
@@ -53,7 +53,7 @@ func createTestVolumeConfig(t *testing.T, store *objectstore.MemoryObjectStore,
require.NoError(t, err)
}
// createTestAMIConfig creates a test AMI config in the mock store
// createTestAMIConfig creates a test AMI config in the mock store.
func createTestAMIConfig(t *testing.T, store *objectstore.MemoryObjectStore, imageID string) {
amiState := viperblock.VBState{
VolumeConfig: viperblock.VolumeConfig{
@@ -110,7 +110,7 @@ func createTestAMIConfigWithName(t *testing.T, store *objectstore.MemoryObjectSt
require.NoError(t, err)
}
// createTestAMIConfigWithOwner creates a test AMI config with a specified name and owner
// createTestAMIConfigWithOwner creates a test AMI config with a specified name and owner.
func createTestAMIConfigWithOwner(t *testing.T, store *objectstore.MemoryObjectStore, imageID, name, owner string) {
amiState := viperblock.VBState{
VolumeConfig: viperblock.VolumeConfig{
+1 -1
View File
@@ -15,7 +15,7 @@ import (
var _ ImageService = (*NATSImageService)(nil)
// NATSImageService handles image operations via NATS messaging
// NATSImageService handles image operations via NATS messaging.
type NATSImageService struct {
natsConn *nats.Conn
expectedNodes int
+1 -1
View File
@@ -9,7 +9,7 @@ import (
"github.com/mulgadc/viperblock/viperblock"
)
// InstanceService defines the interface for EC2 instance operations business logic
// InstanceService defines the interface for EC2 instance operations business logic.
type InstanceService interface {
RunInstances(ctx context.Context, input *ec2.RunInstancesInput, accountID string) (*ec2.Reservation, error)
DescribeInstances(ctx context.Context, input *ec2.DescribeInstancesInput, accountID string) (*ec2.DescribeInstancesOutput, error)
@@ -34,7 +34,7 @@ import (
)
// VolumeInfo holds volume information returned from GenerateVolumes
// for populating BlockDeviceMappings in the EC2 API response
// for populating BlockDeviceMappings in the EC2 API response.
type VolumeInfo struct {
VolumeId string
DeviceName string
@@ -118,7 +118,7 @@ func parseVolumeParams(input *ec2.RunInstancesInput) volumeParams {
var _ InstanceService = (*InstanceServiceImpl)(nil)
// InstanceServiceImpl handles daemon-side EC2 instance operations
// InstanceServiceImpl handles daemon-side EC2 instance operations.
type InstanceServiceImpl struct {
config *config.Config
instanceTypes map[string]*ec2.InstanceTypeInfo
@@ -138,7 +138,7 @@ type InstanceServiceImpl struct {
ipAllocator PublicIPAllocator
}
// NewInstanceServiceImpl creates a new instance service implementation for daemon use
// NewInstanceServiceImpl creates a new instance service implementation for daemon use.
func NewInstanceServiceImpl(
cfg *config.Config,
instanceTypes map[string]*ec2.InstanceTypeInfo,
@@ -186,7 +186,7 @@ func (s *InstanceServiceImpl) SetRunInstancesDeps(ami AMIMetaLoader, key KeyPair
}
// RunInstance creates a single EC2 instance (called per-instance by daemon)
// Returns the VM struct and EC2 instance metadata
// Returns the VM struct and EC2 instance metadata.
func (s *InstanceServiceImpl) RunInstance(input *ec2.RunInstancesInput) (*vm.VM, *ec2.Instance, error) {
// Validate instance type exists
_, exists := s.instanceTypes[*input.InstanceType]
@@ -1388,7 +1388,7 @@ func (s *InstanceServiceImpl) newViperblock(volumeName string, size int, volumeC
return vb, err
}
// prepareRootVolume handles creation/cloning of the root volume
// prepareRootVolume handles creation/cloning of the root volume.
func (s *InstanceServiceImpl) prepareRootVolume(ctx context.Context, input *ec2.RunInstancesInput, imageId string, size int, volumeConfig viperblock.VolumeConfig, instance *vm.VM, deleteOnTermination bool) error {
vb, err := s.newViperblock(imageId, size, volumeConfig)
if err != nil {
@@ -20,7 +20,7 @@ type NATSInstanceService struct {
var _ InstanceService = (*NATSInstanceService)(nil)
// NewNATSInstanceService creates a new NATS-based instance service
// NewNATSInstanceService creates a new NATS-based instance service.
func NewNATSInstanceService(conn *nats.Conn) InstanceService {
return &NATSInstanceService{natsConn: conn}
}
@@ -18,7 +18,7 @@ import (
"github.com/stretchr/testify/require"
)
// startTestNATSServer starts an embedded NATS server for testing
// startTestNATSServer starts an embedded NATS server for testing.
func startTestNATSServer(t *testing.T) (*server.Server, string) {
t.Helper()
ns, nc := testutil.StartTestNATS(t)
@@ -26,7 +26,7 @@ func startTestNATSServer(t *testing.T) (*server.Server, string) {
return ns, ns.ClientURL()
}
// createValidRunInstancesInput creates a valid RunInstancesInput for testing
// createValidRunInstancesInput creates a valid RunInstancesInput for testing.
func createValidRunInstancesInput() *ec2.RunInstancesInput {
return &ec2.RunInstancesInput{
ImageId: aws.String("ami-0abcdef1234567890"),
@@ -42,7 +42,7 @@ func createValidRunInstancesInput() *ec2.RunInstancesInput {
}
}
// createValidReservation creates a valid ec2.Reservation response for testing
// createValidReservation creates a valid ec2.Reservation response for testing.
func createValidReservation() *ec2.Reservation {
return &ec2.Reservation{
ReservationId: aws.String("r-0123456789abcdef0"),
@@ -63,7 +63,7 @@ func createValidReservation() *ec2.Reservation {
}
}
// TestNATSInstanceService_RunInstances_Success tests successful RunInstances operation
// TestNATSInstanceService_RunInstances_Success tests successful RunInstances operation.
func TestNATSInstanceService_RunInstances_Success(t *testing.T) {
// Skip if LOG_IGNORE is set
if os.Getenv("LOG_IGNORE") != "" {
@@ -123,7 +123,7 @@ func TestNATSInstanceService_RunInstances_Success(t *testing.T) {
assert.Equal(t, "pending", *instance.State.Name)
}
// TestNATSInstanceService_RunInstances_DaemonError tests error handling when daemon returns error
// TestNATSInstanceService_RunInstances_DaemonError tests error handling when daemon returns error.
func TestNATSInstanceService_RunInstances_DaemonError(t *testing.T) {
if os.Getenv("LOG_IGNORE") != "" {
t.Setenv("LOG_IGNORE", "1")
@@ -163,7 +163,7 @@ func TestNATSInstanceService_RunInstances_DaemonError(t *testing.T) {
assert.Equal(t, "InvalidInstanceType", err.Error(), "Error should be the AWS error code")
}
// TestNATSInstanceService_RunInstances_NoSubscriber tests behavior when no daemon is subscribed
// TestNATSInstanceService_RunInstances_NoSubscriber tests behavior when no daemon is subscribed.
func TestNATSInstanceService_RunInstances_NoSubscriber(t *testing.T) {
if os.Getenv("LOG_IGNORE") != "" {
t.Setenv("LOG_IGNORE", "1")
@@ -196,7 +196,7 @@ func TestNATSInstanceService_RunInstances_NoSubscriber(t *testing.T) {
assert.Less(t, duration.Seconds(), 1.0, "Should fail immediately when no responders")
}
// TestNATSInstanceService_RunInstances_InvalidResponse tests handling of malformed responses
// TestNATSInstanceService_RunInstances_InvalidResponse tests handling of malformed responses.
func TestNATSInstanceService_RunInstances_InvalidResponse(t *testing.T) {
if os.Getenv("LOG_IGNORE") != "" {
t.Setenv("LOG_IGNORE", "1")
@@ -228,7 +228,7 @@ func TestNATSInstanceService_RunInstances_InvalidResponse(t *testing.T) {
assert.Contains(t, err.Error(), "failed to unmarshal", "Error should indicate unmarshal failure")
}
// TestNATSInstanceService_RunInstances_MarshalError tests handling when input marshaling fails
// TestNATSInstanceService_RunInstances_MarshalError tests handling when input marshaling fails.
func TestNATSInstanceService_RunInstances_MarshalError(t *testing.T) {
if os.Getenv("LOG_IGNORE") != "" {
t.Setenv("LOG_IGNORE", "1")
@@ -250,7 +250,7 @@ func TestNATSInstanceService_RunInstances_MarshalError(t *testing.T) {
assert.Contains(t, err.Error(), "instance type is required")
}
// TestNATSInstanceService_RunInstances_MultipleInstances tests launching multiple instances
// TestNATSInstanceService_RunInstances_MultipleInstances tests launching multiple instances.
func TestNATSInstanceService_RunInstances_MultipleInstances(t *testing.T) {
if os.Getenv("LOG_IGNORE") != "" {
t.Setenv("LOG_IGNORE", "1")
@@ -309,7 +309,7 @@ func TestNATSInstanceService_RunInstances_MultipleInstances(t *testing.T) {
assert.Len(t, reservation.Instances, 3, "Should have 3 instances")
}
// TestNATSInstanceService_RunInstances_QueueGroup tests load balancing with queue groups
// TestNATSInstanceService_RunInstances_QueueGroup tests load balancing with queue groups.
func TestNATSInstanceService_RunInstances_QueueGroup(t *testing.T) {
if os.Getenv("LOG_IGNORE") != "" {
t.Setenv("LOG_IGNORE", "1")
+1 -1
View File
@@ -6,7 +6,7 @@ import (
"github.com/aws/aws-sdk-go/service/ec2"
)
// KeyService defines the interface for EC2 key pair operations business logic
// KeyService defines the interface for EC2 key pair operations business logic.
type KeyService interface {
CreateKeyPair(ctx context.Context, input *ec2.CreateKeyPairInput, accountID string) (*ec2.CreateKeyPairOutput, error)
DeleteKeyPair(ctx context.Context, input *ec2.DeleteKeyPairInput, accountID string) (*ec2.DeleteKeyPairOutput, error)
+12 -12
View File
@@ -27,17 +27,17 @@ import (
"github.com/mulgadc/spinifex/spinifex/utils"
)
// Ensure KeyServiceImpl implements KeyService
// Ensure KeyServiceImpl implements KeyService.
var _ KeyService = (*KeyServiceImpl)(nil)
// KeyServiceImpl handles key pair operations with ssh-keygen and S3 storage
// KeyServiceImpl handles key pair operations with ssh-keygen and S3 storage.
type KeyServiceImpl struct {
config *config.Config
store objectstore.ObjectStore
bucketName string
}
// NewKeyServiceImpl creates a new daemon-side key service
// NewKeyServiceImpl creates a new daemon-side key service.
func NewKeyServiceImpl(cfg *config.Config) *KeyServiceImpl {
store := objectstore.NewS3ObjectStoreFromConfig(
cfg.Predastore.Host,
@@ -53,7 +53,7 @@ func NewKeyServiceImpl(cfg *config.Config) *KeyServiceImpl {
}
}
// NewKeyServiceImplWithStore creates a key service with a custom object store (for testing)
// NewKeyServiceImplWithStore creates a key service with a custom object store (for testing).
func NewKeyServiceImplWithStore(store objectstore.ObjectStore, bucketName string) *KeyServiceImpl {
return &KeyServiceImpl{
store: store,
@@ -61,7 +61,7 @@ func NewKeyServiceImplWithStore(store objectstore.ObjectStore, bucketName string
}
}
// CreateKeyPair generates a new SSH key pair using ssh-keygen
// CreateKeyPair generates a new SSH key pair using ssh-keygen.
func (s *KeyServiceImpl) CreateKeyPair(ctx context.Context, input *ec2.CreateKeyPairInput, accountID string) (*ec2.CreateKeyPairOutput, error) {
if input == nil || input.KeyName == nil {
return nil, errors.New(awserrors.ErrorMissingParameter)
@@ -200,7 +200,7 @@ func (s *KeyServiceImpl) CreateKeyPair(ctx context.Context, input *ec2.CreateKey
// calculateFingerprint computes the SSH key fingerprint
// - For RSA: SHA-1 hash of public key (MD5 for older format)
// - For ED25519: SHA-256 hash of public key
// - For ED25519: SHA-256 hash of public key.
func (s *KeyServiceImpl) calculateFingerprint(publicKeyData []byte, keyType string) (string, error) {
// Parse the public key to extract the key data
// Format: "ssh-ed25519 AAAAC3Nza... comment"
@@ -227,7 +227,7 @@ func (s *KeyServiceImpl) calculateFingerprint(publicKeyData []byte, keyType stri
}
}
// formatFingerprint formats the hash as a colon-separated hex string
// formatFingerprint formats the hash as a colon-separated hex string.
func formatFingerprint(hash []byte, algorithm string) string {
if algorithm == "MD5" {
// MD5 format: aa:bb:cc:dd:...
@@ -238,7 +238,7 @@ func formatFingerprint(hash []byte, algorithm string) string {
}
}
// storeKeyPairMetadata stores key pair metadata (without private key) to S3 for keyPairId lookups
// storeKeyPairMetadata stores key pair metadata (without private key) to S3 for keyPairId lookups.
func (s *KeyServiceImpl) storeKeyPairMetadata(ctx context.Context, accountID, keyPairID string, metadata *ec2.CreateKeyPairOutput) error {
// Store metadata with keyPairId as filename for efficient lookup when keyPairId is provided
metadataPath := fmt.Sprintf("keys/%s/%s.json", accountID, keyPairID)
@@ -262,7 +262,7 @@ func (s *KeyServiceImpl) storeKeyPairMetadata(ctx context.Context, accountID, ke
return nil
}
// getKeyNameFromKeyPairId retrieves the key name by directly reading the metadata file for a given keyPairId
// getKeyNameFromKeyPairId retrieves the key name by directly reading the metadata file for a given keyPairId.
func (s *KeyServiceImpl) getKeyNameFromKeyPairId(ctx context.Context, accountID, keyPairID string) (string, error) {
metadataPath := fmt.Sprintf("keys/%s/%s.json", accountID, keyPairID)
@@ -301,7 +301,7 @@ func (s *KeyServiceImpl) getKeyNameFromKeyPairId(ctx context.Context, accountID,
return *metadata.KeyName, nil
}
// findKeyPairIdFromKeyName finds the keyPairId by searching metadata files for a given keyName
// findKeyPairIdFromKeyName finds the keyPairId by searching metadata files for a given keyName.
func (s *KeyServiceImpl) findKeyPairIdFromKeyName(ctx context.Context, accountID, keyName string) (string, error) {
prefix := fmt.Sprintf("keys/%s/", accountID)
@@ -404,7 +404,7 @@ func (s *KeyServiceImpl) GetPublicKeyMaterial(accountID, keyName string) (string
return material, nil
}
// DeleteKeyPair removes a key pair (both public key and metadata from S3)
// DeleteKeyPair removes a key pair (both public key and metadata from S3).
func (s *KeyServiceImpl) DeleteKeyPair(ctx context.Context, input *ec2.DeleteKeyPairInput, accountID string) (*ec2.DeleteKeyPairOutput, error) {
if input == nil {
return nil, errors.New(awserrors.ErrorMissingParameter)
@@ -678,7 +678,7 @@ func keyPairMatchesFilters(kp *ec2.KeyPairInfo, filters map[string][]string) boo
return filterutil.MatchesTags(filters, tags)
}
// ImportKeyPair imports an existing public key
// ImportKeyPair imports an existing public key.
func (s *KeyServiceImpl) ImportKeyPair(ctx context.Context, input *ec2.ImportKeyPairInput, accountID string) (*ec2.ImportKeyPairOutput, error) {
if input == nil || input.KeyName == nil {
return nil, errors.New(awserrors.ErrorMissingParameter)
@@ -21,10 +21,10 @@ const (
testAccountID = "123456789"
)
// Valid ed25519 public key for import tests
// Valid ed25519 public key for import tests.
const testED25519PubKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOMqqnkVzrm0SdG6UOoqKLsabgH5C9okWi0dh2l9GKJl"
// Valid RSA public key for import tests (generated locally, 2048-bit)
// Valid RSA public key for import tests (generated locally, 2048-bit).
const testRSAPubKey = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDP9LrByKWpgbX+prxBwnlf7lrmI5AfDwuiCofuvOAzt9/PwIDMMIAhlvlpm09jjOuuH/MRQApJB5A714Auv+hBKVK0lCq9KcTrnKZOpRj2aGgIZgaoO6P/POoZc+kBf9Y/GP18DCKc4y/XyBsp69dPP6XRdYBlEdeIeVZdgCPYrM7s5FjT7aML2ba2Y2EvH116hPxv+nJZGwM6yqWxWRyTOoNMMTAfNYmoKkNy2zC1FARUyqDwumJ2z5Fvo4ZdN1qoFPOsfPc3iB0NUtSZbLU1awScvHb0rwR5PRnelTZ3Nbkw8I8A0IAhBTE5veW9D38hDIJhRd4nW73BUhgmzDL7"
func newTestKeyService() (*KeyServiceImpl, *objectstore.MemoryObjectStore) {
+2 -2
View File
@@ -11,12 +11,12 @@ import (
var _ KeyService = (*NATSKeyService)(nil)
// NATSKeyService handles key operations via NATS messaging
// NATSKeyService handles key operations via NATS messaging.
type NATSKeyService struct {
natsConn *nats.Conn
}
// NewNATSKeyService creates a new NATS-based key service
// NewNATSKeyService creates a new NATS-based key service.
func NewNATSKeyService(conn *nats.Conn) KeyService {
return &NATSKeyService{natsConn: conn}
}
+1 -1
View File
@@ -6,7 +6,7 @@ import (
"github.com/aws/aws-sdk-go/service/ec2"
)
// NatGatewayService defines the interface for NAT Gateway operations
// NatGatewayService defines the interface for NAT Gateway operations.
type NatGatewayService interface {
CreateNatGateway(ctx context.Context, input *ec2.CreateNatGatewayInput, accountID string) (*ec2.CreateNatGatewayOutput, error)
DeleteNatGateway(ctx context.Context, input *ec2.DeleteNatGatewayInput, accountID string) (*ec2.DeleteNatGatewayOutput, error)
+6 -6
View File
@@ -22,7 +22,7 @@ import (
var _ NatGatewayService = (*NatGatewayServiceImpl)(nil)
// NatGatewayServiceImpl implements NAT Gateway operations with NATS JetStream persistence
// NatGatewayServiceImpl implements NAT Gateway operations with NATS JetStream persistence.
type NatGatewayServiceImpl struct {
natgwKV nats.KeyValue
deletedNatgwKV nats.KeyValue
@@ -32,7 +32,7 @@ type NatGatewayServiceImpl struct {
natsConn *nats.Conn
}
// NewNatGatewayServiceImplWithNATS creates a NAT Gateway service
// NewNatGatewayServiceImplWithNATS creates a NAT Gateway service.
func NewNatGatewayServiceImplWithNATS(natsConn *nats.Conn) (*NatGatewayServiceImpl, error) {
js, err := natsConn.JetStream()
if err != nil {
@@ -100,7 +100,7 @@ type natGatewayEvent struct {
SubnetCidr string `json:"subnet_cidr"` // private subnet CIDR for SNAT rule
}
// CreateNatGateway creates a NAT Gateway in a public subnet with an EIP
// CreateNatGateway creates a NAT Gateway in a public subnet with an EIP.
func (s *NatGatewayServiceImpl) CreateNatGateway(ctx context.Context, input *ec2.CreateNatGatewayInput, accountID string) (*ec2.CreateNatGatewayOutput, error) {
if input.SubnetId == nil || *input.SubnetId == "" {
return nil, errors.New(awserrors.ErrorMissingParameter)
@@ -178,7 +178,7 @@ func (s *NatGatewayServiceImpl) CreateNatGateway(ctx context.Context, input *ec2
}, nil
}
// DeleteNatGateway deletes a NAT Gateway and removes OVN SNAT rules
// DeleteNatGateway deletes a NAT Gateway and removes OVN SNAT rules.
func (s *NatGatewayServiceImpl) DeleteNatGateway(ctx context.Context, input *ec2.DeleteNatGatewayInput, accountID string) (*ec2.DeleteNatGatewayOutput, error) {
if input.NatGatewayId == nil || *input.NatGatewayId == "" {
return nil, errors.New(awserrors.ErrorMissingParameter)
@@ -360,7 +360,7 @@ var describeNatGatewaysValidFilters = map[string]bool{
"state": true,
}
// DescribeNatGateways lists NAT Gateways, optionally filtered
// DescribeNatGateways lists NAT Gateways, optionally filtered.
func (s *NatGatewayServiceImpl) DescribeNatGateways(ctx context.Context, input *ec2.DescribeNatGatewaysInput, accountID string) (*ec2.DescribeNatGatewaysOutput, error) {
parsedFilters, err := filterutil.ParseFilters(input.Filter, describeNatGatewaysValidFilters)
if err != nil {
@@ -491,7 +491,7 @@ func (s *NatGatewayServiceImpl) PublishDeleteEvent(vpcId, natGatewayId, publicIp
})
}
// GetNatGateway retrieves a NAT Gateway record by ID
// GetNatGateway retrieves a NAT Gateway record by ID.
func (s *NatGatewayServiceImpl) GetNatGateway(accountID, natgwID string) (*NatGatewayRecord, error) {
entry, err := s.natgwKV.Get(utils.AccountKey(accountID, natgwID))
if err != nil {
+2 -2
View File
@@ -11,12 +11,12 @@ import (
var _ NatGatewayService = (*NATSNatGatewayService)(nil)
// NATSNatGatewayService handles NAT Gateway operations via NATS messaging
// NATSNatGatewayService handles NAT Gateway operations via NATS messaging.
type NATSNatGatewayService struct {
natsConn *nats.Conn
}
// NewNATSNatGatewayService creates a new NATS-based NAT Gateway service
// NewNATSNatGatewayService creates a new NATS-based NAT Gateway service.
func NewNATSNatGatewayService(conn *nats.Conn) NatGatewayService {
return &NATSNatGatewayService{natsConn: conn}
}
+1 -1
View File
@@ -10,7 +10,7 @@ const (
KVBucketDeletedNatGatewaysVersion = 1
)
// NatGatewayRecord represents a stored NAT Gateway
// NatGatewayRecord represents a stored NAT Gateway.
type NatGatewayRecord struct {
NatGatewayId string `json:"nat_gateway_id"`
VpcId string `json:"vpc_id"`
@@ -19,7 +19,7 @@ import (
"github.com/nats-io/nats.go"
)
// Ensure PlacementGroupServiceImpl implements PlacementGroupService
// Ensure PlacementGroupServiceImpl implements PlacementGroupService.
var _ PlacementGroupService = (*PlacementGroupServiceImpl)(nil)
const (
+1 -1
View File
@@ -6,7 +6,7 @@ import (
"github.com/aws/aws-sdk-go/service/ec2"
)
// RouteTableService defines the interface for Route Table operations
// RouteTableService defines the interface for Route Table operations.
type RouteTableService interface {
CreateRouteTable(ctx context.Context, input *ec2.CreateRouteTableInput, accountID string) (*ec2.CreateRouteTableOutput, error)
DeleteRouteTable(ctx context.Context, input *ec2.DeleteRouteTableInput, accountID string) (*ec2.DeleteRouteTableOutput, error)
@@ -22,10 +22,10 @@ import (
"github.com/nats-io/nats.go"
)
// Ensure RouteTableServiceImpl implements RouteTableService
// Ensure RouteTableServiceImpl implements RouteTableService.
var _ RouteTableService = (*RouteTableServiceImpl)(nil)
// RouteTableServiceImpl implements Route Table operations with NATS JetStream persistence
// RouteTableServiceImpl implements Route Table operations with NATS JetStream persistence.
type RouteTableServiceImpl struct {
config *config.Config
rtbKV nats.KeyValue
@@ -36,7 +36,7 @@ type RouteTableServiceImpl struct {
natsConn *nats.Conn
}
// NewRouteTableServiceImplWithNATS creates a Route Table service with NATS JetStream for persistence
// NewRouteTableServiceImplWithNATS creates a Route Table service with NATS JetStream for persistence.
func NewRouteTableServiceImplWithNATS(cfg *config.Config, natsConn *nats.Conn) (*RouteTableServiceImpl, error) {
js, err := natsConn.JetStream()
if err != nil {
@@ -84,7 +84,7 @@ func NewRouteTableServiceImplWithNATS(cfg *config.Config, natsConn *nats.Conn) (
}, nil
}
// getRouteTable retrieves a route table record from KV
// getRouteTable retrieves a route table record from KV.
func (s *RouteTableServiceImpl) getRouteTable(ctx context.Context, accountID, rtbID string) (*RouteTableRecord, error) {
entry, err := s.rtbKV.Get(utils.AccountKey(accountID, rtbID))
if err != nil {
@@ -102,7 +102,7 @@ func (s *RouteTableServiceImpl) getRouteTable(ctx context.Context, accountID, rt
return &record, nil
}
// putRouteTable stores a route table record to KV
// putRouteTable stores a route table record to KV.
func (s *RouteTableServiceImpl) putRouteTable(ctx context.Context, accountID string, record *RouteTableRecord) error {
data, err := json.Marshal(record)
if err != nil {
@@ -170,7 +170,7 @@ func (s *RouteTableServiceImpl) mutateRouteTableCAS(ctx context.Context, account
return errors.New(awserrors.ErrorServerInternal)
}
// getVPCCidr looks up a VPC's CIDR block from the VPC KV bucket
// getVPCCidr looks up a VPC's CIDR block from the VPC KV bucket.
func (s *RouteTableServiceImpl) getVPCCidr(ctx context.Context, accountID, vpcID string) (string, error) {
entry, err := s.vpcKV.Get(utils.AccountKey(accountID, vpcID))
if err != nil {
@@ -447,7 +447,7 @@ func (s *RouteTableServiceImpl) publishSubnetEgressGateDecisionForRT(ctx context
}
}
// allRouteTablesForVPC returns all route tables belonging to a VPC
// allRouteTablesForVPC returns all route tables belonging to a VPC.
func (s *RouteTableServiceImpl) allRouteTablesForVPC(ctx context.Context, accountID, vpcID string) ([]RouteTableRecord, error) {
prefix := accountID + "."
keys, err := s.rtbKV.Keys()
@@ -524,7 +524,7 @@ func (s *RouteTableServiceImpl) CreateRouteTableForVPC(vpcID, vpcCidr, accountID
return &record, nil
}
// CreateRouteTable creates a new custom (non-main) route table for a VPC
// CreateRouteTable creates a new custom (non-main) route table for a VPC.
func (s *RouteTableServiceImpl) CreateRouteTable(ctx context.Context, input *ec2.CreateRouteTableInput, accountID string) (*ec2.CreateRouteTableOutput, error) {
if input.VpcId == nil || *input.VpcId == "" {
return nil, errors.New(awserrors.ErrorMissingParameter)
@@ -556,7 +556,7 @@ func (s *RouteTableServiceImpl) CreateRouteTable(ctx context.Context, input *ec2
}, nil
}
// DeleteRouteTable deletes a route table (must not be main, must have no subnet associations)
// DeleteRouteTable deletes a route table (must not be main, must have no subnet associations).
func (s *RouteTableServiceImpl) DeleteRouteTable(ctx context.Context, input *ec2.DeleteRouteTableInput, accountID string) (*ec2.DeleteRouteTableOutput, error) {
if input.RouteTableId == nil || *input.RouteTableId == "" {
return nil, errors.New(awserrors.ErrorMissingParameter)
@@ -603,7 +603,7 @@ var describeRouteTablesValidFilters = map[string]bool{
"owner-id": true,
}
// DescribeRouteTables lists route tables, optionally filtered
// DescribeRouteTables lists route tables, optionally filtered.
func (s *RouteTableServiceImpl) DescribeRouteTables(ctx context.Context, input *ec2.DescribeRouteTablesInput, accountID string) (*ec2.DescribeRouteTablesOutput, error) {
rtbIDs := make(map[string]bool)
for _, id := range input.RouteTableIds {
@@ -671,7 +671,7 @@ func (s *RouteTableServiceImpl) DescribeRouteTables(ctx context.Context, input *
}, nil
}
// CreateRoute adds a route to a route table
// CreateRoute adds a route to a route table.
func (s *RouteTableServiceImpl) CreateRoute(ctx context.Context, input *ec2.CreateRouteInput, accountID string) (*ec2.CreateRouteOutput, error) {
if input.RouteTableId == nil || *input.RouteTableId == "" {
return nil, errors.New(awserrors.ErrorMissingParameter)
@@ -777,7 +777,7 @@ func (s *RouteTableServiceImpl) CreateRoute(ctx context.Context, input *ec2.Crea
}, nil
}
// DeleteRoute removes a route from a route table (cannot delete local route)
// DeleteRoute removes a route from a route table (cannot delete local route).
func (s *RouteTableServiceImpl) DeleteRoute(ctx context.Context, input *ec2.DeleteRouteInput, accountID string) (*ec2.DeleteRouteOutput, error) {
if input.RouteTableId == nil || *input.RouteTableId == "" {
return nil, errors.New(awserrors.ErrorMissingParameter)
@@ -838,7 +838,7 @@ func (s *RouteTableServiceImpl) DeleteRoute(ctx context.Context, input *ec2.Dele
return &ec2.DeleteRouteOutput{}, nil
}
// ReplaceRoute atomically replaces the target of an existing route
// ReplaceRoute atomically replaces the target of an existing route.
func (s *RouteTableServiceImpl) ReplaceRoute(ctx context.Context, input *ec2.ReplaceRouteInput, accountID string) (*ec2.ReplaceRouteOutput, error) {
if input.RouteTableId == nil || *input.RouteTableId == "" {
return nil, errors.New(awserrors.ErrorMissingParameter)
@@ -903,7 +903,7 @@ func (s *RouteTableServiceImpl) ReplaceRoute(ctx context.Context, input *ec2.Rep
return &ec2.ReplaceRouteOutput{}, nil
}
// AssociateRouteTable associates a subnet with a route table
// AssociateRouteTable associates a subnet with a route table.
func (s *RouteTableServiceImpl) AssociateRouteTable(ctx context.Context, input *ec2.AssociateRouteTableInput, accountID string) (*ec2.AssociateRouteTableOutput, error) {
if input.RouteTableId == nil || *input.RouteTableId == "" {
return nil, errors.New(awserrors.ErrorMissingParameter)
@@ -995,7 +995,7 @@ func (s *RouteTableServiceImpl) AssociateRouteTable(ctx context.Context, input *
}, nil
}
// DisassociateRouteTable removes a subnet association (cannot disassociate main)
// DisassociateRouteTable removes a subnet association (cannot disassociate main).
func (s *RouteTableServiceImpl) DisassociateRouteTable(ctx context.Context, input *ec2.DisassociateRouteTableInput, accountID string) (*ec2.DisassociateRouteTableOutput, error) {
if input.AssociationId == nil || *input.AssociationId == "" {
return nil, errors.New(awserrors.ErrorMissingParameter)
@@ -1076,7 +1076,7 @@ func (s *RouteTableServiceImpl) DisassociateRouteTable(ctx context.Context, inpu
return nil, errors.New(awserrors.ErrorInvalidAssociationIDNotFound)
}
// ReplaceRouteTableAssociation atomically moves a subnet from one route table to another
// ReplaceRouteTableAssociation atomically moves a subnet from one route table to another.
func (s *RouteTableServiceImpl) ReplaceRouteTableAssociation(ctx context.Context, input *ec2.ReplaceRouteTableAssociationInput, accountID string) (*ec2.ReplaceRouteTableAssociationOutput, error) {
if input.AssociationId == nil || *input.AssociationId == "" {
return nil, errors.New(awserrors.ErrorMissingParameter)
@@ -1525,7 +1525,7 @@ func (s *RouteTableServiceImpl) publishIGWRouteEventForSubnet(ctx context.Contex
slog.InfoContext(ctx, "IGW route event published", "topic", topic, "subnetId", subnetID, "destinationCidr", destCidr, "igwId", igwID)
}
// recordToEC2 converts an internal record to an AWS SDK RouteTable struct
// recordToEC2 converts an internal record to an AWS SDK RouteTable struct.
func recordToEC2(record *RouteTableRecord) *ec2.RouteTable {
rtb := &ec2.RouteTable{
RouteTableId: aws.String(record.RouteTableId),
@@ -9,15 +9,15 @@ import (
"github.com/nats-io/nats.go"
)
// Ensure NATSRouteTableService implements RouteTableService
// Ensure NATSRouteTableService implements RouteTableService.
var _ RouteTableService = (*NATSRouteTableService)(nil)
// NATSRouteTableService handles Route Table operations via NATS messaging
// NATSRouteTableService handles Route Table operations via NATS messaging.
type NATSRouteTableService struct {
natsConn *nats.Conn
}
// NewNATSRouteTableService creates a new NATS-based Route Table service
// NewNATSRouteTableService creates a new NATS-based Route Table service.
func NewNATSRouteTableService(conn *nats.Conn) RouteTableService {
return &NATSRouteTableService{natsConn: conn}
}
+3 -3
View File
@@ -7,7 +7,7 @@ const (
KVBucketRouteTablesVersion = 1
)
// RouteTableRecord represents a stored Route Table
// RouteTableRecord represents a stored Route Table.
type RouteTableRecord struct {
RouteTableId string `json:"route_table_id"`
VpcId string `json:"vpc_id"`
@@ -19,7 +19,7 @@ type RouteTableRecord struct {
CreatedAt time.Time `json:"created_at"`
}
// RouteRecord represents a single route in a route table
// RouteRecord represents a single route in a route table.
type RouteRecord struct {
DestinationCidrBlock string `json:"destination_cidr_block"`
GatewayId string `json:"gateway_id,omitempty"` // "local" or "igw-xxx"
@@ -28,7 +28,7 @@ type RouteRecord struct {
Origin string `json:"origin"` // "CreateRouteTable", "CreateRoute"
}
// AssociationRecord represents a route table ↔ subnet association
// AssociationRecord represents a route table ↔ subnet association.
type AssociationRecord struct {
AssociationId string `json:"association_id"`
SubnetId string `json:"subnet_id,omitempty"` // empty for main table VPC association
+1 -1
View File
@@ -6,7 +6,7 @@ import (
"github.com/aws/aws-sdk-go/service/ec2"
)
// SnapshotService defines the interface for EC2 snapshot operations
// SnapshotService defines the interface for EC2 snapshot operations.
type SnapshotService interface {
CreateSnapshot(ctx context.Context, input *ec2.CreateSnapshotInput, accountID string) (*ec2.Snapshot, error)
DescribeSnapshots(ctx context.Context, input *ec2.DescribeSnapshotsInput, accountID string) (*ec2.DescribeSnapshotsOutput, error)
@@ -30,7 +30,7 @@ import (
"github.com/nats-io/nats.go"
)
// Ensure SnapshotServiceImpl implements SnapshotService
// Ensure SnapshotServiceImpl implements SnapshotService.
var _ SnapshotService = (*SnapshotServiceImpl)(nil)
const (
@@ -38,7 +38,7 @@ const (
KVBucketVolumeSnapshotsVersion = 1
)
// SnapshotServiceImpl implements SnapshotService with S3-backed storage
// SnapshotServiceImpl implements SnapshotService with S3-backed storage.
type SnapshotServiceImpl struct {
config *config.Config
store objectstore.ObjectStore
@@ -47,7 +47,7 @@ type SnapshotServiceImpl struct {
mutex sync.RWMutex
}
// SnapshotConfig represents snapshot metadata stored in S3
// SnapshotConfig represents snapshot metadata stored in S3.
type SnapshotConfig struct {
SnapshotID string `json:"snapshot_id"`
VolumeID string `json:"volume_id"`
@@ -62,7 +62,7 @@ type SnapshotConfig struct {
Tags map[string]string `json:"tags"`
}
// NewSnapshotServiceImplWithNATS creates a snapshot service with JetStream KV for volume-snapshot tracking
// NewSnapshotServiceImplWithNATS creates a snapshot service with JetStream KV for volume-snapshot tracking.
func NewSnapshotServiceImplWithNATS(cfg *config.Config, natsConn *nats.Conn) (*SnapshotServiceImpl, nats.KeyValue, error) {
store := objectstore.NewS3ObjectStoreFromConfig(
cfg.Predastore.Host,
@@ -166,12 +166,12 @@ func (s *SnapshotServiceImpl) getSnapshotConfig(snapshotID string) (*SnapshotCon
return cfg, nil
}
// putSnapshotConfig stores snapshot config to S3
// putSnapshotConfig stores snapshot config to S3.
func (s *SnapshotServiceImpl) putSnapshotConfig(snapshotID string, cfg *SnapshotConfig) error {
return WriteSnapshotConfig(s.store, s.config.Predastore.Bucket, snapshotID, cfg)
}
// snapshotConfigToEC2 converts a SnapshotConfig to an EC2 Snapshot response object
// snapshotConfigToEC2 converts a SnapshotConfig to an EC2 Snapshot response object.
func snapshotConfigToEC2(cfg *SnapshotConfig) *ec2.Snapshot {
snapshot := &ec2.Snapshot{
SnapshotId: aws.String(cfg.SnapshotID),
@@ -190,7 +190,7 @@ func snapshotConfigToEC2(cfg *SnapshotConfig) *ec2.Snapshot {
return snapshot
}
// CreateSnapshot creates a new snapshot from a volume
// CreateSnapshot creates a new snapshot from a volume.
func (s *SnapshotServiceImpl) CreateSnapshot(ctx context.Context, input *ec2.CreateSnapshotInput, accountID string) (*ec2.Snapshot, error) {
if input == nil || input.VolumeId == nil {
return nil, errors.New(awserrors.ErrorInvalidParameterValue)
@@ -26,7 +26,7 @@ import (
const testAccountID = "111122223333"
const otherAccountID = "444455556666"
// setupTestSnapshotService creates a snapshot service with in-memory storage for testing
// setupTestSnapshotService creates a snapshot service with in-memory storage for testing.
func setupTestSnapshotService(t *testing.T) (*SnapshotServiceImpl, *objectstore.MemoryObjectStore) {
store := objectstore.NewMemoryObjectStore()
cfg := &config.Config{
@@ -63,7 +63,7 @@ func createTestVolume(t *testing.T, store *objectstore.MemoryObjectStore, volume
require.NoError(t, err)
}
// TestCreateSnapshot tests creating a snapshot from a volume
// TestCreateSnapshot tests creating a snapshot from a volume.
func TestCreateSnapshot(t *testing.T) {
svc, store := setupTestSnapshotService(t)
@@ -101,7 +101,7 @@ func TestCreateSnapshot(t *testing.T) {
assert.Equal(t, "test-snap", *result.Tags[0].Value)
}
// TestCreateSnapshot_MissingVolumeId tests creating a snapshot without volume ID
// TestCreateSnapshot_MissingVolumeId tests creating a snapshot without volume ID.
func TestCreateSnapshot_MissingVolumeId(t *testing.T) {
svc, _ := setupTestSnapshotService(t)
@@ -110,7 +110,7 @@ func TestCreateSnapshot_MissingVolumeId(t *testing.T) {
assert.Contains(t, err.Error(), awserrors.ErrorInvalidParameterValue)
}
// TestCreateSnapshot_VolumeZeroSize tests that creating a snapshot from a volume with zero SizeGiB fails
// TestCreateSnapshot_VolumeZeroSize tests that creating a snapshot from a volume with zero SizeGiB fails.
func TestCreateSnapshot_VolumeZeroSize(t *testing.T) {
svc, store := setupTestSnapshotService(t)
@@ -218,7 +218,7 @@ func TestSnapshotInUseByVolumes_EncryptedVolume(t *testing.T) {
assert.True(t, inUse, "encrypted volume's SnapshotID must be visible through the envelope")
}
// TestCreateSnapshot_VolumeNotFound tests creating a snapshot from non-existent volume
// TestCreateSnapshot_VolumeNotFound tests creating a snapshot from non-existent volume.
func TestCreateSnapshot_VolumeNotFound(t *testing.T) {
svc, _ := setupTestSnapshotService(t)
@@ -229,7 +229,7 @@ func TestCreateSnapshot_VolumeNotFound(t *testing.T) {
assert.Contains(t, err.Error(), awserrors.ErrorInvalidVolumeNotFound)
}
// TestDescribeSnapshots tests listing all snapshots
// TestDescribeSnapshots tests listing all snapshots.
func TestDescribeSnapshots(t *testing.T) {
svc, store := setupTestSnapshotService(t)
@@ -265,7 +265,7 @@ func TestDescribeSnapshots(t *testing.T) {
assert.True(t, snapshotIDs[*snap2.SnapshotId])
}
// TestDescribeSnapshots_ByID tests listing specific snapshots by ID
// TestDescribeSnapshots_ByID tests listing specific snapshots by ID.
func TestDescribeSnapshots_ByID(t *testing.T) {
svc, store := setupTestSnapshotService(t)
@@ -293,7 +293,7 @@ func TestDescribeSnapshots_ByID(t *testing.T) {
assert.Equal(t, *snap1.SnapshotId, *result.Snapshots[0].SnapshotId)
}
// TestDescribeSnapshots_Empty tests listing snapshots when none exist
// TestDescribeSnapshots_Empty tests listing snapshots when none exist.
func TestDescribeSnapshots_Empty(t *testing.T) {
svc, _ := setupTestSnapshotService(t)
@@ -303,7 +303,7 @@ func TestDescribeSnapshots_Empty(t *testing.T) {
assert.Empty(t, result.Snapshots)
}
// TestDescribeSnapshots_AccountScoping tests that account A cannot see account B's snapshots
// TestDescribeSnapshots_AccountScoping tests that account A cannot see account B's snapshots.
func TestDescribeSnapshots_AccountScoping(t *testing.T) {
svc, store := setupTestSnapshotService(t)
@@ -334,7 +334,7 @@ func TestDescribeSnapshots_AccountScoping(t *testing.T) {
assert.Equal(t, *snapB.SnapshotId, *resultB.Snapshots[0].SnapshotId)
}
// TestDeleteSnapshot tests deleting a snapshot
// TestDeleteSnapshot tests deleting a snapshot.
func TestDeleteSnapshot(t *testing.T) {
svc, store := setupTestSnapshotService(t)
@@ -366,7 +366,7 @@ func TestDeleteSnapshot(t *testing.T) {
assert.Empty(t, result.Snapshots)
}
// TestDeleteSnapshot_WrongAccount tests that account B cannot delete account A's snapshot
// TestDeleteSnapshot_WrongAccount tests that account B cannot delete account A's snapshot.
func TestDeleteSnapshot_WrongAccount(t *testing.T) {
svc, store := setupTestSnapshotService(t)
@@ -391,7 +391,7 @@ func TestDeleteSnapshot_WrongAccount(t *testing.T) {
assert.Len(t, result.Snapshots, 1)
}
// TestDeleteSnapshot_InUseByVolume tests that deleting a snapshot fails when a volume was created from it
// TestDeleteSnapshot_InUseByVolume tests that deleting a snapshot fails when a volume was created from it.
func TestDeleteSnapshot_InUseByVolume(t *testing.T) {
svc, store := setupTestSnapshotService(t)
@@ -435,7 +435,7 @@ func TestDeleteSnapshot_InUseByVolume(t *testing.T) {
assert.Len(t, result.Snapshots, 1)
}
// TestDeleteSnapshot_NotFound tests deleting a non-existent snapshot
// TestDeleteSnapshot_NotFound tests deleting a non-existent snapshot.
func TestDeleteSnapshot_NotFound(t *testing.T) {
svc, _ := setupTestSnapshotService(t)
@@ -446,7 +446,7 @@ func TestDeleteSnapshot_NotFound(t *testing.T) {
assert.Contains(t, err.Error(), awserrors.ErrorInvalidSnapshotNotFound)
}
// TestDeleteSnapshot_MissingID tests deleting without snapshot ID
// TestDeleteSnapshot_MissingID tests deleting without snapshot ID.
func TestDeleteSnapshot_MissingID(t *testing.T) {
svc, _ := setupTestSnapshotService(t)
@@ -455,7 +455,7 @@ func TestDeleteSnapshot_MissingID(t *testing.T) {
assert.Contains(t, err.Error(), awserrors.ErrorInvalidParameterValue)
}
// TestCopySnapshot tests copying a snapshot
// TestCopySnapshot tests copying a snapshot.
func TestCopySnapshot(t *testing.T) {
svc, store := setupTestSnapshotService(t)
@@ -483,7 +483,7 @@ func TestCopySnapshot(t *testing.T) {
assert.Len(t, result.Snapshots, 2)
}
// TestCopySnapshot_SetsCallerAsOwner tests that copied snapshot is owned by the caller
// TestCopySnapshot_SetsCallerAsOwner tests that copied snapshot is owned by the caller.
func TestCopySnapshot_SetsCallerAsOwner(t *testing.T) {
svc, store := setupTestSnapshotService(t)
@@ -508,7 +508,7 @@ func TestCopySnapshot_SetsCallerAsOwner(t *testing.T) {
assert.Equal(t, testAccountID, *result.Snapshots[0].OwnerId)
}
// TestCopySnapshot_WrongAccount tests that account B cannot copy account A's snapshot
// TestCopySnapshot_WrongAccount tests that account B cannot copy account A's snapshot.
func TestCopySnapshot_WrongAccount(t *testing.T) {
svc, store := setupTestSnapshotService(t)
@@ -531,7 +531,7 @@ func TestCopySnapshot_WrongAccount(t *testing.T) {
assert.Contains(t, err.Error(), awserrors.ErrorUnauthorizedOperation)
}
// TestCopySnapshot_NotFound tests copying a non-existent snapshot
// TestCopySnapshot_NotFound tests copying a non-existent snapshot.
func TestCopySnapshot_NotFound(t *testing.T) {
svc, _ := setupTestSnapshotService(t)
@@ -542,7 +542,7 @@ func TestCopySnapshot_NotFound(t *testing.T) {
assert.Contains(t, err.Error(), awserrors.ErrorInvalidSnapshotNotFound)
}
// TestCopySnapshot_MissingSourceID tests copying without source snapshot ID
// TestCopySnapshot_MissingSourceID tests copying without source snapshot ID.
func TestCopySnapshot_MissingSourceID(t *testing.T) {
svc, _ := setupTestSnapshotService(t)
@@ -551,7 +551,7 @@ func TestCopySnapshot_MissingSourceID(t *testing.T) {
assert.Contains(t, err.Error(), awserrors.ErrorInvalidParameterValue)
}
// TestCopySnapshot_PreservesTags tests that tags are copied
// TestCopySnapshot_PreservesTags tests that tags are copied.
func TestCopySnapshot_PreservesTags(t *testing.T) {
svc, store := setupTestSnapshotService(t)
@@ -11,12 +11,12 @@ import (
var _ SnapshotService = (*NATSSnapshotService)(nil)
// NATSSnapshotService handles snapshot operations via NATS messaging
// NATSSnapshotService handles snapshot operations via NATS messaging.
type NATSSnapshotService struct {
natsConn *nats.Conn
}
// NewNATSSnapshotService creates a new NATS-based snapshot service
// NewNATSSnapshotService creates a new NATS-based snapshot service.
func NewNATSSnapshotService(conn *nats.Conn) SnapshotService {
return &NATSSnapshotService{natsConn: conn}
}

Some files were not shown because too many files have changed in this diff Show More