From ac5bd613b417bcf7ad23f138067219f3dd57fa9c Mon Sep 17 00:00:00 2001 From: Julian Sommer <115516918+juliansommer@users.noreply.github.com> Date: Wed, 15 Jul 2026 16:08:30 +1000 Subject: [PATCH] chore: enable godot --- .golangci.yml | 1 + cmd/spinifex/cmd/admin.go | 8 ++-- cmd/spinifex/cmd/paths.go | 6 +-- cmd/spinifex/cmd/root.go | 2 +- cmd/spinifex/cmd/service.go | 6 +-- cmd/spinifex/cmd/version.go | 2 +- spinifex/admin/admin.go | 2 +- spinifex/awserrors/awserrors.go | 8 ++-- spinifex/config/config.go | 12 ++--- spinifex/daemon/daemon.go | 12 ++--- spinifex/daemon/daemon_handlers.go | 6 +-- spinifex/daemon/daemon_handlers_volume.go | 2 +- spinifex/daemon/daemon_handlers_vpc.go | 2 +- spinifex/daemon/daemon_test.go | 30 ++++++------ spinifex/daemon/jetstream.go | 20 ++++---- spinifex/daemon/jetstream_test.go | 34 ++++++------- spinifex/gateway/acm/certificates.go | 14 +++--- .../ec2/account/DescribeAccountAttributes.go | 2 +- .../eigw/CreateEgressOnlyInternetGateway.go | 2 +- .../eigw/DeleteEgressOnlyInternetGateway.go | 2 +- .../DescribeEgressOnlyInternetGateways.go | 2 +- .../gateway/ec2/igw/AttachInternetGateway.go | 2 +- .../gateway/ec2/igw/CreateInternetGateway.go | 2 +- .../gateway/ec2/igw/DeleteInternetGateway.go | 2 +- .../ec2/igw/DescribeInternetGateways.go | 2 +- .../gateway/ec2/igw/DetachInternetGateway.go | 2 +- spinifex/gateway/ec2/image/CreateImage.go | 4 +- .../gateway/ec2/instance/StartInstances.go | 2 +- .../ec2/instance/TerminateInstances.go | 2 +- spinifex/gateway/ec2/instance/helpers_test.go | 2 +- spinifex/gateway/ec2/key/DescribeKeyPairs.go | 2 +- spinifex/gateway/ec2/snapshot/CopySnapshot.go | 4 +- .../gateway/ec2/snapshot/CreateSnapshot.go | 4 +- .../gateway/ec2/snapshot/DeleteSnapshot.go | 4 +- .../gateway/ec2/snapshot/DescribeSnapshots.go | 4 +- spinifex/gateway/ec2/tags/CreateTags.go | 4 +- spinifex/gateway/ec2/tags/DeleteTags.go | 4 +- spinifex/gateway/ec2/tags/DescribeTags.go | 2 +- spinifex/gateway/ec2/volume/AttachVolume.go | 4 +- spinifex/gateway/ec2/volume/CreateVolume.go | 2 +- .../ec2/volume/DescribeVolumeStatus.go | 2 +- .../gateway/ec2/volume/DescribeVolumes.go | 2 +- .../volume/DescribeVolumesModifications.go | 2 +- spinifex/gateway/ec2/volume/DetachVolume.go | 4 +- spinifex/gateway/ec2/volume/ModifyVolume.go | 2 +- .../gateway/ec2/vpc/CreateNetworkInterface.go | 2 +- spinifex/gateway/ec2/vpc/CreateSubnet.go | 2 +- spinifex/gateway/ec2/vpc/CreateVpc.go | 2 +- .../gateway/ec2/vpc/DeleteNetworkInterface.go | 2 +- spinifex/gateway/ec2/vpc/DeleteSubnet.go | 2 +- spinifex/gateway/ec2/vpc/DeleteVpc.go | 2 +- .../ec2/vpc/DescribeNetworkInterfaces.go | 2 +- spinifex/gateway/ec2/vpc/DescribeSubnets.go | 2 +- .../gateway/ec2/vpc/DescribeVpcAttribute.go | 2 +- spinifex/gateway/ec2/vpc/DescribeVpcs.go | 2 +- .../vpc/ModifyNetworkInterfaceAttribute.go | 2 +- .../gateway/ec2/vpc/ModifySubnetAttribute.go | 2 +- .../gateway/ec2/vpc/ModifyVpcAttribute.go | 2 +- spinifex/gateway/eks/access.go | 18 +++---- spinifex/gateway/eks/addons.go | 12 ++--- spinifex/gateway/eks/cluster.go | 10 ++-- spinifex/gateway/eks/nodegroup.go | 12 ++--- spinifex/gateway/eks/oidc.go | 8 ++-- spinifex/gateway/eks/tags.go | 6 +-- spinifex/gateway/elbv2.go | 2 +- spinifex/gpu/mig.go | 4 +- spinifex/handlers/ec2/account/service.go | 2 +- spinifex/handlers/ec2/account/service_impl.go | 22 ++++----- spinifex/handlers/ec2/account/service_nats.go | 4 +- spinifex/handlers/ec2/eigw/service.go | 2 +- spinifex/handlers/ec2/eigw/service_impl.go | 14 +++--- spinifex/handlers/ec2/eigw/service_nats.go | 6 +-- spinifex/handlers/ec2/igw/service.go | 2 +- spinifex/handlers/ec2/igw/service_impl.go | 12 ++--- spinifex/handlers/ec2/igw/service_nats.go | 6 +-- spinifex/handlers/ec2/image/service.go | 2 +- spinifex/handlers/ec2/image/service_impl.go | 16 +++---- .../handlers/ec2/image/service_impl_test.go | 8 ++-- spinifex/handlers/ec2/image/service_nats.go | 2 +- spinifex/handlers/ec2/instance/service.go | 2 +- .../handlers/ec2/instance/service_impl.go | 10 ++-- .../handlers/ec2/instance/service_nats.go | 2 +- .../ec2/instance/service_nats_test.go | 20 ++++---- spinifex/handlers/ec2/key/service.go | 2 +- spinifex/handlers/ec2/key/service_impl.go | 24 +++++----- .../handlers/ec2/key/service_impl_test.go | 4 +- spinifex/handlers/ec2/key/service_nats.go | 4 +- spinifex/handlers/ec2/natgw/service.go | 2 +- spinifex/handlers/ec2/natgw/service_impl.go | 12 ++--- spinifex/handlers/ec2/natgw/service_nats.go | 4 +- spinifex/handlers/ec2/natgw/types.go | 2 +- .../ec2/placementgroup/service_impl.go | 2 +- spinifex/handlers/ec2/routetable/service.go | 2 +- .../handlers/ec2/routetable/service_impl.go | 34 ++++++------- .../handlers/ec2/routetable/service_nats.go | 6 +-- spinifex/handlers/ec2/routetable/types.go | 6 +-- spinifex/handlers/ec2/snapshot/service.go | 2 +- .../handlers/ec2/snapshot/service_impl.go | 14 +++--- .../ec2/snapshot/service_impl_test.go | 40 ++++++++-------- .../handlers/ec2/snapshot/service_nats.go | 4 +- spinifex/handlers/ec2/tags/service.go | 2 +- spinifex/handlers/ec2/tags/service_impl.go | 24 +++++----- .../handlers/ec2/tags/service_impl_test.go | 48 +++++++++---------- spinifex/handlers/ec2/tags/service_nats.go | 4 +- spinifex/handlers/ec2/volume/service.go | 2 +- spinifex/handlers/ec2/volume/service_impl.go | 18 +++---- .../handlers/ec2/volume/service_impl_test.go | 2 +- spinifex/handlers/ec2/volume/service_nats.go | 4 +- spinifex/handlers/ec2/vpc/eni.go | 8 ++-- spinifex/handlers/ec2/vpc/service.go | 2 +- spinifex/handlers/ec2/vpc/service_impl.go | 22 ++++----- spinifex/handlers/ec2/vpc/service_nats.go | 4 +- spinifex/handlers/elbv2/store.go | 2 +- spinifex/handlers/elbv2/types.go | 24 +++++----- spinifex/handlers/iam/service_impl_test.go | 2 +- spinifex/instancetypes/definitions.go | 12 ++--- spinifex/objectstore/objectstore.go | 14 +++--- spinifex/objectstore/objectstore_test.go | 2 +- spinifex/qmp/qmp.go | 2 +- spinifex/services/predastore/predastore.go | 16 +++---- .../predastore/predastore_integration_test.go | 26 +++++----- .../services/predastore/predastore_test.go | 34 ++++++------- spinifex/services/spinifexui/spinifexui.go | 18 +++---- .../viperblockd_integration_test.go | 24 +++++----- .../services/viperblockd/viperblockd_test.go | 42 ++++++++-------- spinifex/types/cluster.go | 2 +- spinifex/types/ebs.go | 6 +-- spinifex/utils/conversion.go | 8 ++-- spinifex/vm/device_map.go | 6 +-- 129 files changed, 508 insertions(+), 507 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index acc680629..ed080aa6e 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -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.) diff --git a/cmd/spinifex/cmd/admin.go b/cmd/spinifex/cmd/admin.go index ac36d91ec..7c8648521 100644 --- a/cmd/spinifex/cmd/admin.go +++ b/cmd/spinifex/cmd/admin.go @@ -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 ") } -// 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") { diff --git a/cmd/spinifex/cmd/paths.go b/cmd/spinifex/cmd/paths.go index bebdf720d..1364f2f38 100644 --- a/cmd/spinifex/cmd/paths.go +++ b/cmd/spinifex/cmd/paths.go @@ -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: /logs (supports custom per-node data dirs) +// Development: /logs (supports custom per-node data dirs). func LogDirFor(dataDir string) string { if isProductionLayout() { return "/var/log/spinifex" diff --git a/cmd/spinifex/cmd/root.go b/cmd/spinifex/cmd/root.go index a45a2641a..ade7c2b3e 100644 --- a/cmd/spinifex/cmd/root.go +++ b/cmd/spinifex/cmd/root.go @@ -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", diff --git a/cmd/spinifex/cmd/service.go b/cmd/spinifex/cmd/service.go index 4806bac93..791644b2d 100644 --- a/cmd/spinifex/cmd/service.go +++ b/cmd/spinifex/cmd/service.go @@ -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", diff --git a/cmd/spinifex/cmd/version.go b/cmd/spinifex/cmd/version.go index 101d2cfe6..ca1cd5495 100644 --- a/cmd/spinifex/cmd/version.go +++ b/cmd/spinifex/cmd/version.go @@ -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" diff --git a/spinifex/admin/admin.go b/spinifex/admin/admin.go index 48f1d79f7..1d9d78553 100644 --- a/spinifex/admin/admin.go +++ b/spinifex/admin/admin.go @@ -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 { diff --git a/spinifex/awserrors/awserrors.go b/spinifex/awserrors/awserrors.go index 08b8faab4..aa188812a 100644 --- a/spinifex/awserrors/awserrors.go +++ b/spinifex/awserrors/awserrors.go @@ -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. diff --git a/spinifex/config/config.go b/spinifex/config/config.go index 8f8a1c9c9..29cbeed57 100644 --- a/spinifex/config/config.go +++ b/spinifex/config/config.go @@ -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") diff --git a/spinifex/daemon/daemon.go b/spinifex/daemon/daemon.go index 59fcd22e9..d602c2cf7 100644 --- a/spinifex/daemon/daemon.go +++ b/spinifex/daemon/daemon.go @@ -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) diff --git a/spinifex/daemon/daemon_handlers.go b/spinifex/daemon/daemon_handlers.go index 85119f8c3..f6d509841 100644 --- a/spinifex/daemon/daemon_handlers.go +++ b/spinifex/daemon/daemon_handlers.go @@ -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, diff --git a/spinifex/daemon/daemon_handlers_volume.go b/spinifex/daemon/daemon_handlers_volume.go index bb98f0b18..f81fe8ed3 100644 --- a/spinifex/daemon/daemon_handlers_volume.go +++ b/spinifex/daemon/daemon_handlers_volume.go @@ -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() diff --git a/spinifex/daemon/daemon_handlers_vpc.go b/spinifex/daemon/daemon_handlers_vpc.go index 7281c05c3..7548fcbe2 100644 --- a/spinifex/daemon/daemon_handlers_vpc.go +++ b/spinifex/daemon/daemon_handlers_vpc.go @@ -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" diff --git a/spinifex/daemon/daemon_test.go b/spinifex/daemon/daemon_test.go index df00259c4..b6d6eff18 100644 --- a/spinifex/daemon/daemon_test.go +++ b/spinifex/daemon/daemon_test.go @@ -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 diff --git a/spinifex/daemon/jetstream.go b/spinifex/daemon/jetstream.go index abdb1ecf2..8dcad7e36 100644 --- a/spinifex/daemon/jetstream.go +++ b/spinifex/daemon/jetstream.go @@ -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") diff --git a/spinifex/daemon/jetstream_test.go b/spinifex/daemon/jetstream_test.go index e5a6f8280..8398f7c46 100644 --- a/spinifex/daemon/jetstream_test.go +++ b/spinifex/daemon/jetstream_test.go @@ -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) diff --git a/spinifex/gateway/acm/certificates.go b/spinifex/gateway/acm/certificates.go index 155e7bb62..f050386b8 100644 --- a/spinifex/gateway/acm/certificates.go +++ b/spinifex/gateway/acm/certificates.go @@ -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 { diff --git a/spinifex/gateway/ec2/account/DescribeAccountAttributes.go b/spinifex/gateway/ec2/account/DescribeAccountAttributes.go index 53d0bd7a6..697d9ff08 100644 --- a/spinifex/gateway/ec2/account/DescribeAccountAttributes.go +++ b/spinifex/gateway/ec2/account/DescribeAccountAttributes.go @@ -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 { diff --git a/spinifex/gateway/ec2/eigw/CreateEgressOnlyInternetGateway.go b/spinifex/gateway/ec2/eigw/CreateEgressOnlyInternetGateway.go index 71eec09ec..b35a93c69 100644 --- a/spinifex/gateway/ec2/eigw/CreateEgressOnlyInternetGateway.go +++ b/spinifex/gateway/ec2/eigw/CreateEgressOnlyInternetGateway.go @@ -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 diff --git a/spinifex/gateway/ec2/eigw/DeleteEgressOnlyInternetGateway.go b/spinifex/gateway/ec2/eigw/DeleteEgressOnlyInternetGateway.go index 1de07acb4..02f3ef853 100644 --- a/spinifex/gateway/ec2/eigw/DeleteEgressOnlyInternetGateway.go +++ b/spinifex/gateway/ec2/eigw/DeleteEgressOnlyInternetGateway.go @@ -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 diff --git a/spinifex/gateway/ec2/eigw/DescribeEgressOnlyInternetGateways.go b/spinifex/gateway/ec2/eigw/DescribeEgressOnlyInternetGateways.go index c2808926c..f6278f1f2 100644 --- a/spinifex/gateway/ec2/eigw/DescribeEgressOnlyInternetGateways.go +++ b/spinifex/gateway/ec2/eigw/DescribeEgressOnlyInternetGateways.go @@ -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 diff --git a/spinifex/gateway/ec2/igw/AttachInternetGateway.go b/spinifex/gateway/ec2/igw/AttachInternetGateway.go index ecb3ebabd..685173d99 100644 --- a/spinifex/gateway/ec2/igw/AttachInternetGateway.go +++ b/spinifex/gateway/ec2/igw/AttachInternetGateway.go @@ -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 diff --git a/spinifex/gateway/ec2/igw/CreateInternetGateway.go b/spinifex/gateway/ec2/igw/CreateInternetGateway.go index 540d21020..7a0070cd9 100644 --- a/spinifex/gateway/ec2/igw/CreateInternetGateway.go +++ b/spinifex/gateway/ec2/igw/CreateInternetGateway.go @@ -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 diff --git a/spinifex/gateway/ec2/igw/DeleteInternetGateway.go b/spinifex/gateway/ec2/igw/DeleteInternetGateway.go index a4b00d788..53f226d6c 100644 --- a/spinifex/gateway/ec2/igw/DeleteInternetGateway.go +++ b/spinifex/gateway/ec2/igw/DeleteInternetGateway.go @@ -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 diff --git a/spinifex/gateway/ec2/igw/DescribeInternetGateways.go b/spinifex/gateway/ec2/igw/DescribeInternetGateways.go index 5e967061f..0c50db5c7 100644 --- a/spinifex/gateway/ec2/igw/DescribeInternetGateways.go +++ b/spinifex/gateway/ec2/igw/DescribeInternetGateways.go @@ -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 diff --git a/spinifex/gateway/ec2/igw/DetachInternetGateway.go b/spinifex/gateway/ec2/igw/DetachInternetGateway.go index 106dabe56..728233703 100644 --- a/spinifex/gateway/ec2/igw/DetachInternetGateway.go +++ b/spinifex/gateway/ec2/igw/DetachInternetGateway.go @@ -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 diff --git a/spinifex/gateway/ec2/image/CreateImage.go b/spinifex/gateway/ec2/image/CreateImage.go index 53023a0d3..768670c46 100644 --- a/spinifex/gateway/ec2/image/CreateImage.go +++ b/spinifex/gateway/ec2/image/CreateImage.go @@ -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 diff --git a/spinifex/gateway/ec2/instance/StartInstances.go b/spinifex/gateway/ec2/instance/StartInstances.go index da6c62aed..432a0b8e0 100644 --- a/spinifex/gateway/ec2/instance/StartInstances.go +++ b/spinifex/gateway/ec2/instance/StartInstances.go @@ -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"` } diff --git a/spinifex/gateway/ec2/instance/TerminateInstances.go b/spinifex/gateway/ec2/instance/TerminateInstances.go index 3020d6d2f..5e091638a 100644 --- a/spinifex/gateway/ec2/instance/TerminateInstances.go +++ b/spinifex/gateway/ec2/instance/TerminateInstances.go @@ -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"` } diff --git a/spinifex/gateway/ec2/instance/helpers_test.go b/spinifex/gateway/ec2/instance/helpers_test.go index 606e0fdeb..43d91a4e4 100644 --- a/spinifex/gateway/ec2/instance/helpers_test.go +++ b/spinifex/gateway/ec2/instance/helpers_test.go @@ -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) diff --git a/spinifex/gateway/ec2/key/DescribeKeyPairs.go b/spinifex/gateway/ec2/key/DescribeKeyPairs.go index ca8ef5698..e8f0a485e 100644 --- a/spinifex/gateway/ec2/key/DescribeKeyPairs.go +++ b/spinifex/gateway/ec2/key/DescribeKeyPairs.go @@ -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) diff --git a/spinifex/gateway/ec2/snapshot/CopySnapshot.go b/spinifex/gateway/ec2/snapshot/CopySnapshot.go index cd79f98d9..8d0312b8d 100644 --- a/spinifex/gateway/ec2/snapshot/CopySnapshot.go +++ b/spinifex/gateway/ec2/snapshot/CopySnapshot.go @@ -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 diff --git a/spinifex/gateway/ec2/snapshot/CreateSnapshot.go b/spinifex/gateway/ec2/snapshot/CreateSnapshot.go index fa780f650..0eaeed2dd 100644 --- a/spinifex/gateway/ec2/snapshot/CreateSnapshot.go +++ b/spinifex/gateway/ec2/snapshot/CreateSnapshot.go @@ -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 diff --git a/spinifex/gateway/ec2/snapshot/DeleteSnapshot.go b/spinifex/gateway/ec2/snapshot/DeleteSnapshot.go index 79476e31c..1f6edf546 100644 --- a/spinifex/gateway/ec2/snapshot/DeleteSnapshot.go +++ b/spinifex/gateway/ec2/snapshot/DeleteSnapshot.go @@ -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 diff --git a/spinifex/gateway/ec2/snapshot/DescribeSnapshots.go b/spinifex/gateway/ec2/snapshot/DescribeSnapshots.go index b6a0baf72..c16f8440d 100644 --- a/spinifex/gateway/ec2/snapshot/DescribeSnapshots.go +++ b/spinifex/gateway/ec2/snapshot/DescribeSnapshots.go @@ -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 diff --git a/spinifex/gateway/ec2/tags/CreateTags.go b/spinifex/gateway/ec2/tags/CreateTags.go index 243047b71..254f69da1 100644 --- a/spinifex/gateway/ec2/tags/CreateTags.go +++ b/spinifex/gateway/ec2/tags/CreateTags.go @@ -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 diff --git a/spinifex/gateway/ec2/tags/DeleteTags.go b/spinifex/gateway/ec2/tags/DeleteTags.go index c96d3efee..d1b87cddc 100644 --- a/spinifex/gateway/ec2/tags/DeleteTags.go +++ b/spinifex/gateway/ec2/tags/DeleteTags.go @@ -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 diff --git a/spinifex/gateway/ec2/tags/DescribeTags.go b/spinifex/gateway/ec2/tags/DescribeTags.go index 260c7bbab..6b0b6cd01 100644 --- a/spinifex/gateway/ec2/tags/DescribeTags.go +++ b/spinifex/gateway/ec2/tags/DescribeTags.go @@ -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 diff --git a/spinifex/gateway/ec2/volume/AttachVolume.go b/spinifex/gateway/ec2/volume/AttachVolume.go index fba57db67..d8d5e4ab7 100644 --- a/spinifex/gateway/ec2/volume/AttachVolume.go +++ b/spinifex/gateway/ec2/volume/AttachVolume.go @@ -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 diff --git a/spinifex/gateway/ec2/volume/CreateVolume.go b/spinifex/gateway/ec2/volume/CreateVolume.go index 8ebb9668c..81797e292 100644 --- a/spinifex/gateway/ec2/volume/CreateVolume.go +++ b/spinifex/gateway/ec2/volume/CreateVolume.go @@ -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 diff --git a/spinifex/gateway/ec2/volume/DescribeVolumeStatus.go b/spinifex/gateway/ec2/volume/DescribeVolumeStatus.go index 9cfbbb7a9..40e2afa54 100644 --- a/spinifex/gateway/ec2/volume/DescribeVolumeStatus.go +++ b/spinifex/gateway/ec2/volume/DescribeVolumeStatus.go @@ -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 diff --git a/spinifex/gateway/ec2/volume/DescribeVolumes.go b/spinifex/gateway/ec2/volume/DescribeVolumes.go index 11c65288f..45138e603 100644 --- a/spinifex/gateway/ec2/volume/DescribeVolumes.go +++ b/spinifex/gateway/ec2/volume/DescribeVolumes.go @@ -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 diff --git a/spinifex/gateway/ec2/volume/DescribeVolumesModifications.go b/spinifex/gateway/ec2/volume/DescribeVolumesModifications.go index 845d7b2b1..a495a3d37 100644 --- a/spinifex/gateway/ec2/volume/DescribeVolumesModifications.go +++ b/spinifex/gateway/ec2/volume/DescribeVolumesModifications.go @@ -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 diff --git a/spinifex/gateway/ec2/volume/DetachVolume.go b/spinifex/gateway/ec2/volume/DetachVolume.go index 34c18d6e3..5075f4854 100644 --- a/spinifex/gateway/ec2/volume/DetachVolume.go +++ b/spinifex/gateway/ec2/volume/DetachVolume.go @@ -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 diff --git a/spinifex/gateway/ec2/volume/ModifyVolume.go b/spinifex/gateway/ec2/volume/ModifyVolume.go index 5d8669422..425dad01f 100644 --- a/spinifex/gateway/ec2/volume/ModifyVolume.go +++ b/spinifex/gateway/ec2/volume/ModifyVolume.go @@ -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 diff --git a/spinifex/gateway/ec2/vpc/CreateNetworkInterface.go b/spinifex/gateway/ec2/vpc/CreateNetworkInterface.go index 4fe93483e..263aee1e9 100644 --- a/spinifex/gateway/ec2/vpc/CreateNetworkInterface.go +++ b/spinifex/gateway/ec2/vpc/CreateNetworkInterface.go @@ -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 diff --git a/spinifex/gateway/ec2/vpc/CreateSubnet.go b/spinifex/gateway/ec2/vpc/CreateSubnet.go index f376c3a10..33a8a2ff1 100644 --- a/spinifex/gateway/ec2/vpc/CreateSubnet.go +++ b/spinifex/gateway/ec2/vpc/CreateSubnet.go @@ -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 diff --git a/spinifex/gateway/ec2/vpc/CreateVpc.go b/spinifex/gateway/ec2/vpc/CreateVpc.go index e54c41ff4..f1ded22a1 100644 --- a/spinifex/gateway/ec2/vpc/CreateVpc.go +++ b/spinifex/gateway/ec2/vpc/CreateVpc.go @@ -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 diff --git a/spinifex/gateway/ec2/vpc/DeleteNetworkInterface.go b/spinifex/gateway/ec2/vpc/DeleteNetworkInterface.go index 2fbd5187b..cd34d769a 100644 --- a/spinifex/gateway/ec2/vpc/DeleteNetworkInterface.go +++ b/spinifex/gateway/ec2/vpc/DeleteNetworkInterface.go @@ -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 diff --git a/spinifex/gateway/ec2/vpc/DeleteSubnet.go b/spinifex/gateway/ec2/vpc/DeleteSubnet.go index f5e15e116..64d40287a 100644 --- a/spinifex/gateway/ec2/vpc/DeleteSubnet.go +++ b/spinifex/gateway/ec2/vpc/DeleteSubnet.go @@ -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 diff --git a/spinifex/gateway/ec2/vpc/DeleteVpc.go b/spinifex/gateway/ec2/vpc/DeleteVpc.go index 366bbf25e..ddc7e23df 100644 --- a/spinifex/gateway/ec2/vpc/DeleteVpc.go +++ b/spinifex/gateway/ec2/vpc/DeleteVpc.go @@ -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 diff --git a/spinifex/gateway/ec2/vpc/DescribeNetworkInterfaces.go b/spinifex/gateway/ec2/vpc/DescribeNetworkInterfaces.go index f1f70ac02..20bf0029f 100644 --- a/spinifex/gateway/ec2/vpc/DescribeNetworkInterfaces.go +++ b/spinifex/gateway/ec2/vpc/DescribeNetworkInterfaces.go @@ -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) diff --git a/spinifex/gateway/ec2/vpc/DescribeSubnets.go b/spinifex/gateway/ec2/vpc/DescribeSubnets.go index 4595e5759..852ac21d6 100644 --- a/spinifex/gateway/ec2/vpc/DescribeSubnets.go +++ b/spinifex/gateway/ec2/vpc/DescribeSubnets.go @@ -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 diff --git a/spinifex/gateway/ec2/vpc/DescribeVpcAttribute.go b/spinifex/gateway/ec2/vpc/DescribeVpcAttribute.go index afd357c5a..126efb6b9 100644 --- a/spinifex/gateway/ec2/vpc/DescribeVpcAttribute.go +++ b/spinifex/gateway/ec2/vpc/DescribeVpcAttribute.go @@ -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 diff --git a/spinifex/gateway/ec2/vpc/DescribeVpcs.go b/spinifex/gateway/ec2/vpc/DescribeVpcs.go index dee1f87d9..bbc0d5e8d 100644 --- a/spinifex/gateway/ec2/vpc/DescribeVpcs.go +++ b/spinifex/gateway/ec2/vpc/DescribeVpcs.go @@ -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 diff --git a/spinifex/gateway/ec2/vpc/ModifyNetworkInterfaceAttribute.go b/spinifex/gateway/ec2/vpc/ModifyNetworkInterfaceAttribute.go index d1d1e66c3..1ecbbfda4 100644 --- a/spinifex/gateway/ec2/vpc/ModifyNetworkInterfaceAttribute.go +++ b/spinifex/gateway/ec2/vpc/ModifyNetworkInterfaceAttribute.go @@ -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 diff --git a/spinifex/gateway/ec2/vpc/ModifySubnetAttribute.go b/spinifex/gateway/ec2/vpc/ModifySubnetAttribute.go index 794379b16..b0e0d8411 100644 --- a/spinifex/gateway/ec2/vpc/ModifySubnetAttribute.go +++ b/spinifex/gateway/ec2/vpc/ModifySubnetAttribute.go @@ -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 diff --git a/spinifex/gateway/ec2/vpc/ModifyVpcAttribute.go b/spinifex/gateway/ec2/vpc/ModifyVpcAttribute.go index fc74c7560..2515b6d8d 100644 --- a/spinifex/gateway/ec2/vpc/ModifyVpcAttribute.go +++ b/spinifex/gateway/ec2/vpc/ModifyVpcAttribute.go @@ -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 diff --git a/spinifex/gateway/eks/access.go b/spinifex/gateway/eks/access.go index fc78b3945..9e2128575 100644 --- a/spinifex/gateway/eks/access.go +++ b/spinifex/gateway/eks/access.go @@ -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) } diff --git a/spinifex/gateway/eks/addons.go b/spinifex/gateway/eks/addons.go index 9d2e5e3c5..c5541f662 100644 --- a/spinifex/gateway/eks/addons.go +++ b/spinifex/gateway/eks/addons.go @@ -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 { diff --git a/spinifex/gateway/eks/cluster.go b/spinifex/gateway/eks/cluster.go index b568eb481..c3dd287d8 100644 --- a/spinifex/gateway/eks/cluster.go +++ b/spinifex/gateway/eks/cluster.go @@ -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) diff --git a/spinifex/gateway/eks/nodegroup.go b/spinifex/gateway/eks/nodegroup.go index dd3d98907..1d5dd17ad 100644 --- a/spinifex/gateway/eks/nodegroup.go +++ b/spinifex/gateway/eks/nodegroup.go @@ -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), diff --git a/spinifex/gateway/eks/oidc.go b/spinifex/gateway/eks/oidc.go index 8c8e3c8fb..c92951324 100644 --- a/spinifex/gateway/eks/oidc.go +++ b/spinifex/gateway/eks/oidc.go @@ -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 { diff --git a/spinifex/gateway/eks/tags.go b/spinifex/gateway/eks/tags.go index 8590f44e8..cc71d012a 100644 --- a/spinifex/gateway/eks/tags.go +++ b/spinifex/gateway/eks/tags.go @@ -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) diff --git a/spinifex/gateway/elbv2.go b/spinifex/gateway/elbv2.go index 61e68a0f9..d46eca715 100644 --- a/spinifex/gateway/elbv2.go +++ b/spinifex/gateway/elbv2.go @@ -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: ... +// ELBv2 uses the IAM-style XML envelope: .... 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) diff --git a/spinifex/gpu/mig.go b/spinifex/gpu/mig.go index 13f4f1591..adf84fc41 100644 --- a/spinifex/gpu/mig.go +++ b/spinifex/gpu/mig.go @@ -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") { diff --git a/spinifex/handlers/ec2/account/service.go b/spinifex/handlers/ec2/account/service.go index 7ea31ef9a..fb40853ae 100644 --- a/spinifex/handlers/ec2/account/service.go +++ b/spinifex/handlers/ec2/account/service.go @@ -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) diff --git a/spinifex/handlers/ec2/account/service_impl.go b/spinifex/handlers/ec2/account/service_impl.go index 5fbe8d145..80261b452 100644 --- a/spinifex/handlers/ec2/account/service_impl.go +++ b/spinifex/handlers/ec2/account/service_impl.go @@ -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) diff --git a/spinifex/handlers/ec2/account/service_nats.go b/spinifex/handlers/ec2/account/service_nats.go index e784e24a2..c2e0506e0 100644 --- a/spinifex/handlers/ec2/account/service_nats.go +++ b/spinifex/handlers/ec2/account/service_nats.go @@ -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} } diff --git a/spinifex/handlers/ec2/eigw/service.go b/spinifex/handlers/ec2/eigw/service.go index 82098d964..1e6742403 100644 --- a/spinifex/handlers/ec2/eigw/service.go +++ b/spinifex/handlers/ec2/eigw/service.go @@ -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) diff --git a/spinifex/handlers/ec2/eigw/service_impl.go b/spinifex/handlers/ec2/eigw/service_impl.go index 341915a10..93309e685 100644 --- a/spinifex/handlers/ec2/eigw/service_impl.go +++ b/spinifex/handlers/ec2/eigw/service_impl.go @@ -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 diff --git a/spinifex/handlers/ec2/eigw/service_nats.go b/spinifex/handlers/ec2/eigw/service_nats.go index e00c7c440..03be6ffaf 100644 --- a/spinifex/handlers/ec2/eigw/service_nats.go +++ b/spinifex/handlers/ec2/eigw/service_nats.go @@ -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} } diff --git a/spinifex/handlers/ec2/igw/service.go b/spinifex/handlers/ec2/igw/service.go index 55559c572..95186e1b2 100644 --- a/spinifex/handlers/ec2/igw/service.go +++ b/spinifex/handlers/ec2/igw/service.go @@ -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) diff --git a/spinifex/handlers/ec2/igw/service_impl.go b/spinifex/handlers/ec2/igw/service_impl.go index 3d9721bb5..b30295e95 100644 --- a/spinifex/handlers/ec2/igw/service_impl.go +++ b/spinifex/handlers/ec2/igw/service_impl.go @@ -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 diff --git a/spinifex/handlers/ec2/igw/service_nats.go b/spinifex/handlers/ec2/igw/service_nats.go index ed6938b4e..360635d95 100644 --- a/spinifex/handlers/ec2/igw/service_nats.go +++ b/spinifex/handlers/ec2/igw/service_nats.go @@ -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} } diff --git a/spinifex/handlers/ec2/image/service.go b/spinifex/handlers/ec2/image/service.go index e0cf530f6..774218f15 100644 --- a/spinifex/handlers/ec2/image/service.go +++ b/spinifex/handlers/ec2/image/service.go @@ -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) diff --git a/spinifex/handlers/ec2/image/service_impl.go b/spinifex/handlers/ec2/image/service_impl.go index b9ed083e3..608c0b339 100644 --- a/spinifex/handlers/ec2/image/service_impl.go +++ b/spinifex/handlers/ec2/image/service_impl.go @@ -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, diff --git a/spinifex/handlers/ec2/image/service_impl_test.go b/spinifex/handlers/ec2/image/service_impl_test.go index eff6f5e14..42cfbb91e 100644 --- a/spinifex/handlers/ec2/image/service_impl_test.go +++ b/spinifex/handlers/ec2/image/service_impl_test.go @@ -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{ diff --git a/spinifex/handlers/ec2/image/service_nats.go b/spinifex/handlers/ec2/image/service_nats.go index 90abaacbc..2ebbe383d 100644 --- a/spinifex/handlers/ec2/image/service_nats.go +++ b/spinifex/handlers/ec2/image/service_nats.go @@ -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 diff --git a/spinifex/handlers/ec2/instance/service.go b/spinifex/handlers/ec2/instance/service.go index 888c7ad0b..4c67257c1 100644 --- a/spinifex/handlers/ec2/instance/service.go +++ b/spinifex/handlers/ec2/instance/service.go @@ -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) diff --git a/spinifex/handlers/ec2/instance/service_impl.go b/spinifex/handlers/ec2/instance/service_impl.go index b51303688..ab699fb67 100644 --- a/spinifex/handlers/ec2/instance/service_impl.go +++ b/spinifex/handlers/ec2/instance/service_impl.go @@ -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 { diff --git a/spinifex/handlers/ec2/instance/service_nats.go b/spinifex/handlers/ec2/instance/service_nats.go index 1835902a4..5af64a2b4 100644 --- a/spinifex/handlers/ec2/instance/service_nats.go +++ b/spinifex/handlers/ec2/instance/service_nats.go @@ -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} } diff --git a/spinifex/handlers/ec2/instance/service_nats_test.go b/spinifex/handlers/ec2/instance/service_nats_test.go index 67121b1e5..10ed4fb4f 100644 --- a/spinifex/handlers/ec2/instance/service_nats_test.go +++ b/spinifex/handlers/ec2/instance/service_nats_test.go @@ -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") diff --git a/spinifex/handlers/ec2/key/service.go b/spinifex/handlers/ec2/key/service.go index e74869db3..f51e50cc7 100644 --- a/spinifex/handlers/ec2/key/service.go +++ b/spinifex/handlers/ec2/key/service.go @@ -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) diff --git a/spinifex/handlers/ec2/key/service_impl.go b/spinifex/handlers/ec2/key/service_impl.go index a313b031d..ad6f3f979 100644 --- a/spinifex/handlers/ec2/key/service_impl.go +++ b/spinifex/handlers/ec2/key/service_impl.go @@ -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) diff --git a/spinifex/handlers/ec2/key/service_impl_test.go b/spinifex/handlers/ec2/key/service_impl_test.go index bb61f370f..786c6386a 100644 --- a/spinifex/handlers/ec2/key/service_impl_test.go +++ b/spinifex/handlers/ec2/key/service_impl_test.go @@ -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) { diff --git a/spinifex/handlers/ec2/key/service_nats.go b/spinifex/handlers/ec2/key/service_nats.go index cee32dc44..47650c25f 100644 --- a/spinifex/handlers/ec2/key/service_nats.go +++ b/spinifex/handlers/ec2/key/service_nats.go @@ -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} } diff --git a/spinifex/handlers/ec2/natgw/service.go b/spinifex/handlers/ec2/natgw/service.go index 7e6a2dfa1..6e2aaeeb1 100644 --- a/spinifex/handlers/ec2/natgw/service.go +++ b/spinifex/handlers/ec2/natgw/service.go @@ -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) diff --git a/spinifex/handlers/ec2/natgw/service_impl.go b/spinifex/handlers/ec2/natgw/service_impl.go index 9b345c971..6b815e90f 100644 --- a/spinifex/handlers/ec2/natgw/service_impl.go +++ b/spinifex/handlers/ec2/natgw/service_impl.go @@ -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 { diff --git a/spinifex/handlers/ec2/natgw/service_nats.go b/spinifex/handlers/ec2/natgw/service_nats.go index f85a75486..0da064739 100644 --- a/spinifex/handlers/ec2/natgw/service_nats.go +++ b/spinifex/handlers/ec2/natgw/service_nats.go @@ -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} } diff --git a/spinifex/handlers/ec2/natgw/types.go b/spinifex/handlers/ec2/natgw/types.go index 29e5f6de6..20c79ce37 100644 --- a/spinifex/handlers/ec2/natgw/types.go +++ b/spinifex/handlers/ec2/natgw/types.go @@ -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"` diff --git a/spinifex/handlers/ec2/placementgroup/service_impl.go b/spinifex/handlers/ec2/placementgroup/service_impl.go index 6f2cbdaf7..c231c2085 100644 --- a/spinifex/handlers/ec2/placementgroup/service_impl.go +++ b/spinifex/handlers/ec2/placementgroup/service_impl.go @@ -19,7 +19,7 @@ import ( "github.com/nats-io/nats.go" ) -// Ensure PlacementGroupServiceImpl implements PlacementGroupService +// Ensure PlacementGroupServiceImpl implements PlacementGroupService. var _ PlacementGroupService = (*PlacementGroupServiceImpl)(nil) const ( diff --git a/spinifex/handlers/ec2/routetable/service.go b/spinifex/handlers/ec2/routetable/service.go index 5341213f4..c2f9faf97 100644 --- a/spinifex/handlers/ec2/routetable/service.go +++ b/spinifex/handlers/ec2/routetable/service.go @@ -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) diff --git a/spinifex/handlers/ec2/routetable/service_impl.go b/spinifex/handlers/ec2/routetable/service_impl.go index e1b5bbaea..370ce484e 100644 --- a/spinifex/handlers/ec2/routetable/service_impl.go +++ b/spinifex/handlers/ec2/routetable/service_impl.go @@ -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), diff --git a/spinifex/handlers/ec2/routetable/service_nats.go b/spinifex/handlers/ec2/routetable/service_nats.go index 81d08f8f6..387a45178 100644 --- a/spinifex/handlers/ec2/routetable/service_nats.go +++ b/spinifex/handlers/ec2/routetable/service_nats.go @@ -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} } diff --git a/spinifex/handlers/ec2/routetable/types.go b/spinifex/handlers/ec2/routetable/types.go index 32b0b3e6a..9151ca388 100644 --- a/spinifex/handlers/ec2/routetable/types.go +++ b/spinifex/handlers/ec2/routetable/types.go @@ -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 diff --git a/spinifex/handlers/ec2/snapshot/service.go b/spinifex/handlers/ec2/snapshot/service.go index b5fb0f82a..decfaf3a7 100644 --- a/spinifex/handlers/ec2/snapshot/service.go +++ b/spinifex/handlers/ec2/snapshot/service.go @@ -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) diff --git a/spinifex/handlers/ec2/snapshot/service_impl.go b/spinifex/handlers/ec2/snapshot/service_impl.go index 30cd85fb7..374580dc7 100644 --- a/spinifex/handlers/ec2/snapshot/service_impl.go +++ b/spinifex/handlers/ec2/snapshot/service_impl.go @@ -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) diff --git a/spinifex/handlers/ec2/snapshot/service_impl_test.go b/spinifex/handlers/ec2/snapshot/service_impl_test.go index 24b3cfe35..c05444486 100644 --- a/spinifex/handlers/ec2/snapshot/service_impl_test.go +++ b/spinifex/handlers/ec2/snapshot/service_impl_test.go @@ -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) diff --git a/spinifex/handlers/ec2/snapshot/service_nats.go b/spinifex/handlers/ec2/snapshot/service_nats.go index 59966a188..19103c846 100644 --- a/spinifex/handlers/ec2/snapshot/service_nats.go +++ b/spinifex/handlers/ec2/snapshot/service_nats.go @@ -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} } diff --git a/spinifex/handlers/ec2/tags/service.go b/spinifex/handlers/ec2/tags/service.go index b7aee0c71..5444ff13c 100644 --- a/spinifex/handlers/ec2/tags/service.go +++ b/spinifex/handlers/ec2/tags/service.go @@ -6,7 +6,7 @@ import ( "github.com/aws/aws-sdk-go/service/ec2" ) -// TagsService defines the interface for EC2 tag operations +// TagsService defines the interface for EC2 tag operations. type TagsService interface { CreateTags(ctx context.Context, input *ec2.CreateTagsInput, accountID string) (*ec2.CreateTagsOutput, error) DescribeTags(ctx context.Context, input *ec2.DescribeTagsInput, accountID string) (*ec2.DescribeTagsOutput, error) diff --git a/spinifex/handlers/ec2/tags/service_impl.go b/spinifex/handlers/ec2/tags/service_impl.go index 976512fd7..66b89b481 100644 --- a/spinifex/handlers/ec2/tags/service_impl.go +++ b/spinifex/handlers/ec2/tags/service_impl.go @@ -20,10 +20,10 @@ import ( "github.com/mulgadc/spinifex/spinifex/utils" ) -// Ensure TagsServiceImpl implements TagsService +// Ensure TagsServiceImpl implements TagsService. var _ TagsService = (*TagsServiceImpl)(nil) -// Ensure TagsServiceImpl can project instance record tags into the store +// Ensure TagsServiceImpl can project instance record tags into the store. var _ handlers_ec2_instance.InstanceTagWriter = (*TagsServiceImpl)(nil) // TagsServiceImpl implements TagsService with S3-backed storage. @@ -35,7 +35,7 @@ type TagsServiceImpl struct { mutex sync.RWMutex } -// NewTagsServiceImpl creates a new tags service implementation +// NewTagsServiceImpl creates a new tags service implementation. func NewTagsServiceImpl(cfg *config.Config) *TagsServiceImpl { store := objectstore.NewS3ObjectStoreFromConfig( cfg.Predastore.Host, @@ -50,7 +50,7 @@ func NewTagsServiceImpl(cfg *config.Config) *TagsServiceImpl { } } -// NewTagsServiceImplWithStore creates a tags service with a custom ObjectStore (for testing) +// NewTagsServiceImplWithStore creates a tags service with a custom ObjectStore (for testing). func NewTagsServiceImplWithStore(cfg *config.Config, store objectstore.ObjectStore) *TagsServiceImpl { return &TagsServiceImpl{ config: cfg, @@ -58,7 +58,7 @@ func NewTagsServiceImplWithStore(cfg *config.Config, store objectstore.ObjectSto } } -// getResourceType extracts resource type from resource ID prefix +// getResourceType extracts resource type from resource ID prefix. func getResourceType(resourceID string) string { if strings.HasPrefix(resourceID, "i-") { return "instance" @@ -108,17 +108,17 @@ func getResourceType(resourceID string) string { return "unknown" } -// getTagsKey returns the S3 key for storing tags for a resource, scoped by account +// getTagsKey returns the S3 key for storing tags for a resource, scoped by account. func getTagsKey(accountID, resourceID string) string { return "tags/" + accountID + "/" + resourceID + ".json" } -// getTagsPrefix returns the S3 prefix for listing all tags for an account +// getTagsPrefix returns the S3 prefix for listing all tags for an account. func getTagsPrefix(accountID string) string { return "tags/" + accountID + "/" } -// getResourceTags retrieves tags for a specific resource from S3 +// getResourceTags retrieves tags for a specific resource from S3. func (s *TagsServiceImpl) getResourceTags(ctx context.Context, accountID, resourceID string) (map[string]string, error) { key := getTagsKey(accountID, resourceID) @@ -142,7 +142,7 @@ func (s *TagsServiceImpl) getResourceTags(ctx context.Context, accountID, resour return tags, nil } -// putResourceTags stores tags for a specific resource in S3 +// putResourceTags stores tags for a specific resource in S3. func (s *TagsServiceImpl) putResourceTags(ctx context.Context, accountID, resourceID string, tags map[string]string) error { key := getTagsKey(accountID, resourceID) @@ -188,7 +188,7 @@ func (s *TagsServiceImpl) DeleteAllTags(ctx context.Context, accountID, resource return nil } -// CreateTags adds or overwrites tags for the specified resources +// CreateTags adds or overwrites tags for the specified resources. func (s *TagsServiceImpl) CreateTags(ctx context.Context, input *ec2.CreateTagsInput, accountID string) (*ec2.CreateTagsOutput, error) { if input == nil { return nil, errors.New(awserrors.ErrorInvalidParameterValue) @@ -245,7 +245,7 @@ var describeTagsValidFilters = map[string]bool{ "value": true, } -// DescribeTags returns tags matching the specified filters +// DescribeTags returns tags matching the specified filters. func (s *TagsServiceImpl) DescribeTags(ctx context.Context, input *ec2.DescribeTagsInput, accountID string) (*ec2.DescribeTagsOutput, error) { var filters map[string][]string if input != nil { @@ -323,7 +323,7 @@ func (s *TagsServiceImpl) DescribeTags(ctx context.Context, input *ec2.DescribeT }, nil } -// DeleteTags removes tags from the specified resources +// DeleteTags removes tags from the specified resources. func (s *TagsServiceImpl) DeleteTags(ctx context.Context, input *ec2.DeleteTagsInput, accountID string) (*ec2.DeleteTagsOutput, error) { if input == nil { return nil, errors.New(awserrors.ErrorInvalidParameterValue) diff --git a/spinifex/handlers/ec2/tags/service_impl_test.go b/spinifex/handlers/ec2/tags/service_impl_test.go index 5c1ed22a7..aaad8eb0b 100644 --- a/spinifex/handlers/ec2/tags/service_impl_test.go +++ b/spinifex/handlers/ec2/tags/service_impl_test.go @@ -16,7 +16,7 @@ import ( const testAccountID = "111111111111" -// setupTestTagsService creates a tags service with in-memory storage for testing +// setupTestTagsService creates a tags service with in-memory storage for testing. func setupTestTagsService(t *testing.T) (*TagsServiceImpl, *objectstore.MemoryObjectStore) { store := objectstore.NewMemoryObjectStore() cfg := &config.Config{ @@ -29,7 +29,7 @@ func setupTestTagsService(t *testing.T) (*TagsServiceImpl, *objectstore.MemoryOb return svc, store } -// TestCreateTags tests adding tags to resources +// TestCreateTags tests adding tags to resources. func TestCreateTags(t *testing.T) { svc, _ := setupTestTagsService(t) @@ -55,7 +55,7 @@ func TestCreateTags(t *testing.T) { assert.Len(t, describeResult.Tags, 2) } -// TestCreateTags_MultipleResources tests adding tags to multiple resources +// TestCreateTags_MultipleResources tests adding tags to multiple resources. func TestCreateTags_MultipleResources(t *testing.T) { svc, _ := setupTestTagsService(t) @@ -80,7 +80,7 @@ func TestCreateTags_MultipleResources(t *testing.T) { assert.Len(t, describeResult.Tags, 3) } -// TestCreateTags_UpdateExisting tests updating existing tags +// TestCreateTags_UpdateExisting tests updating existing tags. func TestCreateTags_UpdateExisting(t *testing.T) { svc, _ := setupTestTagsService(t) @@ -113,7 +113,7 @@ func TestCreateTags_UpdateExisting(t *testing.T) { assert.Equal(t, "updated", *describeResult.Tags[0].Value) } -// TestCreateTags_MissingResources tests creating tags without resources +// TestCreateTags_MissingResources tests creating tags without resources. func TestCreateTags_MissingResources(t *testing.T) { svc, _ := setupTestTagsService(t) @@ -126,7 +126,7 @@ func TestCreateTags_MissingResources(t *testing.T) { assert.Contains(t, err.Error(), awserrors.ErrorMissingParameter) } -// TestCreateTags_MissingTags tests creating tags without tags +// TestCreateTags_MissingTags tests creating tags without tags. func TestCreateTags_MissingTags(t *testing.T) { svc, _ := setupTestTagsService(t) @@ -137,7 +137,7 @@ func TestCreateTags_MissingTags(t *testing.T) { assert.Contains(t, err.Error(), awserrors.ErrorMissingParameter) } -// TestDescribeTags tests listing all tags +// TestDescribeTags tests listing all tags. func TestDescribeTags(t *testing.T) { svc, _ := setupTestTagsService(t) @@ -160,7 +160,7 @@ func TestDescribeTags(t *testing.T) { assert.Len(t, result.Tags, 2) } -// TestDescribeTags_FilterByResourceID tests filtering by resource ID +// TestDescribeTags_FilterByResourceID tests filtering by resource ID. func TestDescribeTags_FilterByResourceID(t *testing.T) { svc, _ := setupTestTagsService(t) @@ -188,7 +188,7 @@ func TestDescribeTags_FilterByResourceID(t *testing.T) { assert.Equal(t, "i-test1", *result.Tags[0].ResourceId) } -// TestDescribeTags_FilterByResourceType tests filtering by resource type +// TestDescribeTags_FilterByResourceType tests filtering by resource type. func TestDescribeTags_FilterByResourceType(t *testing.T) { svc, _ := setupTestTagsService(t) @@ -216,7 +216,7 @@ func TestDescribeTags_FilterByResourceType(t *testing.T) { assert.Equal(t, "instance", *result.Tags[0].ResourceType) } -// TestDescribeTags_FilterByKey tests filtering by tag key +// TestDescribeTags_FilterByKey tests filtering by tag key. func TestDescribeTags_FilterByKey(t *testing.T) { svc, _ := setupTestTagsService(t) @@ -241,7 +241,7 @@ func TestDescribeTags_FilterByKey(t *testing.T) { assert.Equal(t, "Name", *result.Tags[0].Key) } -// TestDescribeTags_FilterByValue tests filtering by tag value +// TestDescribeTags_FilterByValue tests filtering by tag value. func TestDescribeTags_FilterByValue(t *testing.T) { svc, _ := setupTestTagsService(t) @@ -273,7 +273,7 @@ func TestDescribeTags_FilterByValue(t *testing.T) { assert.Equal(t, "production", *result.Tags[0].Value) } -// TestDescribeTags_Empty tests listing tags when none exist +// TestDescribeTags_Empty tests listing tags when none exist. func TestDescribeTags_Empty(t *testing.T) { svc, _ := setupTestTagsService(t) @@ -282,7 +282,7 @@ func TestDescribeTags_Empty(t *testing.T) { assert.Empty(t, result.Tags) } -// TestDescribeTags_InvalidFilterName tests that unrecognized filter names return an error +// TestDescribeTags_InvalidFilterName tests that unrecognized filter names return an error. func TestDescribeTags_InvalidFilterName(t *testing.T) { svc, _ := setupTestTagsService(t) @@ -296,7 +296,7 @@ func TestDescribeTags_InvalidFilterName(t *testing.T) { assert.Contains(t, err.Error(), awserrors.ErrorInvalidParameterValue) } -// TestDeleteTags tests deleting specific tags +// TestDeleteTags tests deleting specific tags. func TestDeleteTags(t *testing.T) { svc, _ := setupTestTagsService(t) @@ -330,7 +330,7 @@ func TestDeleteTags(t *testing.T) { assert.Equal(t, "Environment", *result.Tags[0].Key) } -// TestDeleteTags_AllTags tests deleting all tags from a resource +// TestDeleteTags_AllTags tests deleting all tags from a resource. func TestDeleteTags_AllTags(t *testing.T) { svc, _ := setupTestTagsService(t) @@ -360,7 +360,7 @@ func TestDeleteTags_AllTags(t *testing.T) { assert.Empty(t, result.Tags) } -// TestDeleteTags_ValueConditional tests that DeleteTags only deletes when value matches +// TestDeleteTags_ValueConditional tests that DeleteTags only deletes when value matches. func TestDeleteTags_ValueConditional(t *testing.T) { svc, _ := setupTestTagsService(t) @@ -412,7 +412,7 @@ func TestDeleteTags_ValueConditional(t *testing.T) { assert.Equal(t, "Team", *result.Tags[0].Key) } -// TestDeleteTags_MissingResources tests deleting tags without resources +// TestDeleteTags_MissingResources tests deleting tags without resources. func TestDeleteTags_MissingResources(t *testing.T) { svc, _ := setupTestTagsService(t) @@ -425,7 +425,7 @@ func TestDeleteTags_MissingResources(t *testing.T) { assert.Contains(t, err.Error(), awserrors.ErrorMissingParameter) } -// TestGetResourceType tests the resource type detection helper +// TestGetResourceType tests the resource type detection helper. func TestGetResourceType(t *testing.T) { tests := []struct { resourceID string @@ -456,7 +456,7 @@ func TestGetResourceType(t *testing.T) { } } -// TestMemoryObjectStore tests the in-memory object store +// TestMemoryObjectStore tests the in-memory object store. func TestMemoryObjectStore(t *testing.T) { store := objectstore.NewMemoryObjectStore() @@ -469,7 +469,7 @@ func TestMemoryObjectStore(t *testing.T) { assert.True(t, objectstore.IsNoSuchKeyError(err)) } -// TestAccountIsolation_CreateAndDescribe tests that tags from one account are not visible to another +// TestAccountIsolation_CreateAndDescribe tests that tags from one account are not visible to another. func TestAccountIsolation_CreateAndDescribe(t *testing.T) { svc, _ := setupTestTagsService(t) accountA := "111111111111" @@ -504,7 +504,7 @@ func TestAccountIsolation_CreateAndDescribe(t *testing.T) { assert.Equal(t, "account-b-instance", *resultB.Tags[0].Value) } -// TestAccountIsolation_SameResourceID tests that two accounts can tag the same resource ID independently +// TestAccountIsolation_SameResourceID tests that two accounts can tag the same resource ID independently. func TestAccountIsolation_SameResourceID(t *testing.T) { svc, _ := setupTestTagsService(t) accountA := "111111111111" @@ -543,7 +543,7 @@ func TestAccountIsolation_SameResourceID(t *testing.T) { assert.Equal(t, "from-account-b", *resultB.Tags[0].Value) } -// TestAccountIsolation_DeleteDoesNotAffectOtherAccount tests that deleting tags in one account doesn't affect another +// TestAccountIsolation_DeleteDoesNotAffectOtherAccount tests that deleting tags in one account doesn't affect another. func TestAccountIsolation_DeleteDoesNotAffectOtherAccount(t *testing.T) { svc, _ := setupTestTagsService(t) accountA := "111111111111" @@ -582,7 +582,7 @@ func TestAccountIsolation_DeleteDoesNotAffectOtherAccount(t *testing.T) { } // TestDeleteAllTags tests that the resource's stored tag object is removed -// entirely and other accounts' entries for the same resource ID survive +// entirely and other accounts' entries for the same resource ID survive. func TestDeleteAllTags(t *testing.T) { svc, _ := setupTestTagsService(t) accountA := "111111111111" @@ -608,7 +608,7 @@ func TestDeleteAllTags(t *testing.T) { } // TestDeleteAllTags_MissingResourceIsNoError tests idempotency for a resource -// that never had tags +// that never had tags. func TestDeleteAllTags_MissingResourceIsNoError(t *testing.T) { svc, _ := setupTestTagsService(t) require.NoError(t, svc.DeleteAllTags(context.Background(), "111111111111", "i-never-tagged")) diff --git a/spinifex/handlers/ec2/tags/service_nats.go b/spinifex/handlers/ec2/tags/service_nats.go index 7fcd764be..654961e36 100644 --- a/spinifex/handlers/ec2/tags/service_nats.go +++ b/spinifex/handlers/ec2/tags/service_nats.go @@ -11,12 +11,12 @@ import ( var _ TagsService = (*NATSTagsService)(nil) -// NATSTagsService handles tag operations via NATS messaging +// NATSTagsService handles tag operations via NATS messaging. type NATSTagsService struct { natsConn *nats.Conn } -// NewNATSTagsService creates a new NATS-based tags service +// NewNATSTagsService creates a new NATS-based tags service. func NewNATSTagsService(conn *nats.Conn) TagsService { return &NATSTagsService{natsConn: conn} } diff --git a/spinifex/handlers/ec2/volume/service.go b/spinifex/handlers/ec2/volume/service.go index e7ea17f34..ab50ebbeb 100644 --- a/spinifex/handlers/ec2/volume/service.go +++ b/spinifex/handlers/ec2/volume/service.go @@ -6,7 +6,7 @@ import ( "github.com/aws/aws-sdk-go/service/ec2" ) -// VolumeService defines the interface for EBS volume operations +// VolumeService defines the interface for EBS volume operations. type VolumeService interface { CreateVolume(ctx context.Context, input *ec2.CreateVolumeInput, accountID string) (*ec2.Volume, error) DescribeVolumes(ctx context.Context, input *ec2.DescribeVolumesInput, accountID string) (*ec2.DescribeVolumesOutput, error) diff --git a/spinifex/handlers/ec2/volume/service_impl.go b/spinifex/handlers/ec2/volume/service_impl.go index d1b9a0295..f0667614d 100644 --- a/spinifex/handlers/ec2/volume/service_impl.go +++ b/spinifex/handlers/ec2/volume/service_impl.go @@ -37,14 +37,14 @@ const ( gp3IOPSPerGiB = 500 ) -// Ensure VolumeServiceImpl implements VolumeService +// Ensure VolumeServiceImpl implements VolumeService. var _ VolumeService = (*VolumeServiceImpl)(nil) // Ensure VolumeServiceImpl satisfies vm.VolumeStateUpdater so the manager // can call UpdateVolumeState directly without a daemon-side adapter. var _ vm.VolumeStateUpdater = (*VolumeServiceImpl)(nil) -// VolumeServiceImpl handles EBS volume operations with S3 storage +// VolumeServiceImpl handles EBS volume operations with S3 storage. type VolumeServiceImpl struct { config *config.Config store objectstore.ObjectStore @@ -73,7 +73,7 @@ func NewVolumeServiceImpl(cfg *config.Config, natsConn *nats.Conn, snapshotKV na } } -// NewVolumeServiceImplWithStore creates a volume service with a custom ObjectStore (for testing) +// NewVolumeServiceImplWithStore creates a volume service with a custom ObjectStore (for testing). func NewVolumeServiceImplWithStore(cfg *config.Config, store objectstore.ObjectStore, natsConn *nats.Conn, snapshotKV ...nats.KeyValue) *VolumeServiceImpl { bucketName := "" if cfg != nil { @@ -91,7 +91,7 @@ func NewVolumeServiceImplWithStore(cfg *config.Config, store objectstore.ObjectS return svc } -// CreateVolume creates a new EBS volume via viperblock and persists its config to S3 +// CreateVolume creates a new EBS volume via viperblock and persists its config to S3. func (s *VolumeServiceImpl) CreateVolume(ctx context.Context, input *ec2.CreateVolumeInput, accountID string) (*ec2.Volume, error) { if input == nil { return nil, errors.New(awserrors.ErrorInvalidParameterValue) @@ -276,7 +276,7 @@ var describeVolumesValidFilters = map[string]bool{ "availability-zone": true, } -// DescribeVolumes lists EBS volumes by reading config.json files from S3 +// DescribeVolumes lists EBS volumes by reading config.json files from S3. func (s *VolumeServiceImpl) DescribeVolumes(ctx context.Context, input *ec2.DescribeVolumesInput, accountID string) (*ec2.DescribeVolumesOutput, error) { if input == nil { input = &ec2.DescribeVolumesInput{} @@ -1002,7 +1002,7 @@ func (s *VolumeServiceImpl) getVolumeByID(ctx context.Context, volumeID string) return &volumeResult{volume: volume, tenantID: volMeta.TenantID}, nil } -// volumeConfigWrapper matches the JSON structure stored in S3 config.json files +// volumeConfigWrapper matches the JSON structure stored in S3 config.json files. type volumeConfigWrapper struct { VolumeConfig viperblock.VolumeConfig `json:"VolumeConfig"` } @@ -1310,7 +1310,7 @@ func (s *VolumeServiceImpl) UpdateVolumeState(volumeID, state, attachedInstance, return nil } -// ModifyVolume modifies an EBS volume (grow-only, requires stopped instance) +// ModifyVolume modifies an EBS volume (grow-only, requires stopped instance). func (s *VolumeServiceImpl) ModifyVolume(ctx context.Context, input *ec2.ModifyVolumeInput, accountID string) (*ec2.ModifyVolumeOutput, error) { if input.VolumeId == nil || *input.VolumeId == "" { return nil, errors.New(awserrors.ErrorInvalidVolumeIDMalformed) @@ -1402,7 +1402,7 @@ func (s *VolumeServiceImpl) ModifyVolume(ctx context.Context, input *ec2.ModifyV }, nil } -// DeleteVolume deletes an EBS volume: validates state, notifies viperblockd, and removes S3 data +// DeleteVolume deletes an EBS volume: validates state, notifies viperblockd, and removes S3 data. func (s *VolumeServiceImpl) DeleteVolume(ctx context.Context, input *ec2.DeleteVolumeInput, accountID string) (*ec2.DeleteVolumeOutput, error) { if input == nil || input.VolumeId == nil || *input.VolumeId == "" { return nil, errors.New(awserrors.ErrorInvalidParameterValue) @@ -1477,7 +1477,7 @@ func (s *VolumeServiceImpl) DeleteVolume(ctx context.Context, input *ec2.DeleteV return &ec2.DeleteVolumeOutput{}, nil } -// deleteS3Prefix deletes all S3 objects under the given prefix +// deleteS3Prefix deletes all S3 objects under the given prefix. func (s *VolumeServiceImpl) deleteS3Prefix(ctx context.Context, prefix string) error { bucket := s.bucketName diff --git a/spinifex/handlers/ec2/volume/service_impl_test.go b/spinifex/handlers/ec2/volume/service_impl_test.go index 81e8278c6..d803f5e0b 100644 --- a/spinifex/handlers/ec2/volume/service_impl_test.go +++ b/spinifex/handlers/ec2/volume/service_impl_test.go @@ -299,7 +299,7 @@ func TestDescribeVolumeStatus_WithVolumeIDs(t *testing.T) { assert.Equal(t, awserrors.ErrorInvalidVolumeNotFound, err.Error()) } -// newTestVolumeServiceWithStore creates a volume service with a specific memory store +// newTestVolumeServiceWithStore creates a volume service with a specific memory store. func newTestVolumeServiceWithStore(az string, store *objectstore.MemoryObjectStore) *VolumeServiceImpl { cfg := &config.Config{ AZ: az, diff --git a/spinifex/handlers/ec2/volume/service_nats.go b/spinifex/handlers/ec2/volume/service_nats.go index 47c6db656..f110c81ed 100644 --- a/spinifex/handlers/ec2/volume/service_nats.go +++ b/spinifex/handlers/ec2/volume/service_nats.go @@ -11,12 +11,12 @@ import ( var _ VolumeService = (*NATSVolumeService)(nil) -// NATSVolumeService handles volume operations via NATS messaging +// NATSVolumeService handles volume operations via NATS messaging. type NATSVolumeService struct { natsConn *nats.Conn } -// NewNATSVolumeService creates a new NATS-based volume service +// NewNATSVolumeService creates a new NATS-based volume service. func NewNATSVolumeService(conn *nats.Conn) VolumeService { return &NATSVolumeService{natsConn: conn} } diff --git a/spinifex/handlers/ec2/vpc/eni.go b/spinifex/handlers/ec2/vpc/eni.go index e2e371184..fab6b436e 100644 --- a/spinifex/handlers/ec2/vpc/eni.go +++ b/spinifex/handlers/ec2/vpc/eni.go @@ -23,7 +23,7 @@ const ( KVBucketENIsVersion = 1 ) -// ENIRecord represents a stored Elastic Network Interface +// ENIRecord represents a stored Elastic Network Interface. type ENIRecord struct { NetworkInterfaceId string `json:"network_interface_id"` SubnetId string `json:"subnet_id"` @@ -82,7 +82,7 @@ func eniIsLiveAttachment(r *ENIRecord) bool { return r.Status == "in-use" || r.InstanceId != "" || r.AttachmentId != "" } -// CreateNetworkInterface creates a new ENI in the specified subnet +// CreateNetworkInterface creates a new ENI in the specified subnet. func (s *VPCServiceImpl) CreateNetworkInterface(ctx context.Context, input *ec2.CreateNetworkInterfaceInput, accountID string) (*ec2.CreateNetworkInterfaceOutput, error) { if input.SubnetId == nil || *input.SubnetId == "" { return nil, errors.New(awserrors.ErrorMissingParameter) @@ -353,7 +353,7 @@ var describeNetworkInterfacesValidFilters = map[string]bool{ "attachment.status": true, } -// DescribeNetworkInterfaces lists ENIs with optional filters +// DescribeNetworkInterfaces lists ENIs with optional filters. func (s *VPCServiceImpl) DescribeNetworkInterfaces(ctx context.Context, input *ec2.DescribeNetworkInterfacesInput, accountID string) (*ec2.DescribeNetworkInterfacesOutput, error) { parsedFilters, err := filterutil.ParseFilters(input.Filters, describeNetworkInterfacesValidFilters) if err != nil { @@ -695,7 +695,7 @@ func (s *VPCServiceImpl) UpdateENIPublicIP(accountID, eniId, publicIP, poolName return nil } -// eniRecordToEC2 converts an ENI record to an EC2 NetworkInterface +// eniRecordToEC2 converts an ENI record to an EC2 NetworkInterface. func (s *VPCServiceImpl) eniRecordToEC2(record *ENIRecord, accountID string) *ec2.NetworkInterface { // ENIs with spinifex:managed-by tag are system-managed (e.g. by ELBv2) requesterManaged := record.Tags["spinifex:managed-by"] != "" diff --git a/spinifex/handlers/ec2/vpc/service.go b/spinifex/handlers/ec2/vpc/service.go index 508c05cb4..59477c4cf 100644 --- a/spinifex/handlers/ec2/vpc/service.go +++ b/spinifex/handlers/ec2/vpc/service.go @@ -6,7 +6,7 @@ import ( "github.com/aws/aws-sdk-go/service/ec2" ) -// VPCService defines the interface for VPC, Subnet, ENI, and Security Group operations +// VPCService defines the interface for VPC, Subnet, ENI, and Security Group operations. type VPCService interface { CreateVpc(ctx context.Context, input *ec2.CreateVpcInput, accountID string) (*ec2.CreateVpcOutput, error) DeleteVpc(ctx context.Context, input *ec2.DeleteVpcInput, accountID string) (*ec2.DeleteVpcOutput, error) diff --git a/spinifex/handlers/ec2/vpc/service_impl.go b/spinifex/handlers/ec2/vpc/service_impl.go index 5c9e88adb..b655b3b2a 100644 --- a/spinifex/handlers/ec2/vpc/service_impl.go +++ b/spinifex/handlers/ec2/vpc/service_impl.go @@ -21,7 +21,7 @@ import ( "github.com/nats-io/nats.go" ) -// Ensure VPCServiceImpl implements VPCService +// Ensure VPCServiceImpl implements VPCService. var _ VPCService = (*VPCServiceImpl)(nil) const ( @@ -57,7 +57,7 @@ type VPCRecord struct { CreatedAt time.Time `json:"created_at"` } -// SubnetRecord represents a stored Subnet +// SubnetRecord represents a stored Subnet. type SubnetRecord struct { SubnetId string `json:"subnet_id"` VpcId string `json:"vpc_id"` @@ -70,7 +70,7 @@ type SubnetRecord struct { CreatedAt time.Time `json:"created_at"` } -// VPCServiceImpl implements VPC, Subnet, and ENI operations with NATS JetStream persistence +// VPCServiceImpl implements VPC, Subnet, and ENI operations with NATS JetStream persistence. type VPCServiceImpl struct { config *config.Config natsConn *nats.Conn @@ -115,7 +115,7 @@ func (s *VPCServiceImpl) localAZ() string { return s.config.AZ } -// NewVPCServiceImplWithNATS creates a VPC service with NATS JetStream for persistence +// NewVPCServiceImplWithNATS creates a VPC service with NATS JetStream for persistence. func NewVPCServiceImplWithNATS(cfg *config.Config, natsConn *nats.Conn) (*VPCServiceImpl, error) { js, err := natsConn.JetStream() if err != nil { @@ -192,7 +192,7 @@ func NewVPCServiceImplWithNATS(cfg *config.Config, natsConn *nats.Conn) (*VPCSer }, nil } -// nextVNI allocates the next VNI using atomic increment on the NATS KV counter +// nextVNI allocates the next VNI using atomic increment on the NATS KV counter. func (s *VPCServiceImpl) nextVNI() (int64, error) { entry, err := s.vniKV.Get(vniCounterKey) if err != nil { @@ -228,7 +228,7 @@ func (s *VPCServiceImpl) nextVNI() (int64, error) { return current, nil } -// CreateVpc creates a new VPC +// CreateVpc creates a new VPC. func (s *VPCServiceImpl) CreateVpc(ctx context.Context, input *ec2.CreateVpcInput, accountID string) (*ec2.CreateVpcOutput, error) { if input.CidrBlock == nil || *input.CidrBlock == "" { return nil, errors.New(awserrors.ErrorMissingParameter) @@ -308,7 +308,7 @@ func (s *VPCServiceImpl) requireVPCExists(accountID, vpcId string) error { return nil } -// DeleteVpc deletes a VPC +// DeleteVpc deletes a VPC. func (s *VPCServiceImpl) DeleteVpc(ctx context.Context, input *ec2.DeleteVpcInput, accountID string) (*ec2.DeleteVpcOutput, error) { if input.VpcId == nil || *input.VpcId == "" { return nil, errors.New(awserrors.ErrorMissingParameter) @@ -445,7 +445,7 @@ var describeVpcsValidFilters = map[string]bool{ "owner-id": true, } -// DescribeVpcs describes VPCs +// DescribeVpcs describes VPCs. func (s *VPCServiceImpl) DescribeVpcs(ctx context.Context, input *ec2.DescribeVpcsInput, accountID string) (*ec2.DescribeVpcsOutput, error) { var vpcs []*ec2.Vpc @@ -521,7 +521,7 @@ func (s *VPCServiceImpl) DescribeVpcs(ctx context.Context, input *ec2.DescribeVp }, nil } -// CreateSubnet creates a new subnet within a VPC +// CreateSubnet creates a new subnet within a VPC. func (s *VPCServiceImpl) CreateSubnet(ctx context.Context, input *ec2.CreateSubnetInput, accountID string) (*ec2.CreateSubnetOutput, error) { if input.VpcId == nil || *input.VpcId == "" { return nil, errors.New(awserrors.ErrorMissingParameter) @@ -641,7 +641,7 @@ func (s *VPCServiceImpl) CreateSubnet(ctx context.Context, input *ec2.CreateSubn }, nil } -// DeleteSubnet deletes a subnet +// DeleteSubnet deletes a subnet. func (s *VPCServiceImpl) DeleteSubnet(ctx context.Context, input *ec2.DeleteSubnetInput, accountID string) (*ec2.DeleteSubnetOutput, error) { if input.SubnetId == nil || *input.SubnetId == "" { return nil, errors.New(awserrors.ErrorMissingParameter) @@ -718,7 +718,7 @@ func (s *VPCServiceImpl) checkSubnetResidents(ctx context.Context, accountID, su return nil } -// DescribeSubnets describes subnets +// DescribeSubnets describes subnets. func (s *VPCServiceImpl) DescribeSubnets(ctx context.Context, input *ec2.DescribeSubnetsInput, accountID string) (*ec2.DescribeSubnetsOutput, error) { var subnets []*ec2.Subnet diff --git a/spinifex/handlers/ec2/vpc/service_nats.go b/spinifex/handlers/ec2/vpc/service_nats.go index b3e65a58d..e5f864e9f 100644 --- a/spinifex/handlers/ec2/vpc/service_nats.go +++ b/spinifex/handlers/ec2/vpc/service_nats.go @@ -9,14 +9,14 @@ import ( "github.com/nats-io/nats.go" ) -// NATSVPCService handles VPC and Subnet operations via NATS messaging +// NATSVPCService handles VPC and Subnet operations via NATS messaging. type NATSVPCService struct { natsConn *nats.Conn } var _ VPCService = (*NATSVPCService)(nil) -// NewNATSVPCService creates a new NATS-based VPC service +// NewNATSVPCService creates a new NATS-based VPC service. func NewNATSVPCService(conn *nats.Conn) VPCService { return &NATSVPCService{natsConn: conn} } diff --git a/spinifex/handlers/elbv2/store.go b/spinifex/handlers/elbv2/store.go index 7277fd39e..adf7ea9d2 100644 --- a/spinifex/handlers/elbv2/store.go +++ b/spinifex/handlers/elbv2/store.go @@ -17,7 +17,7 @@ const ( KVBucketELBv2 = "spinifex-elbv2" KVBucketELBv2Version = 1 - // Key prefixes for different resource types within the single bucket + // Key prefixes for different resource types within the single bucket. KeyPrefixLB = "lb." KeyPrefixTG = "tg." KeyPrefixListener = "listener." diff --git a/spinifex/handlers/elbv2/types.go b/spinifex/handlers/elbv2/types.go index 44fc51abe..ab69d740e 100644 --- a/spinifex/handlers/elbv2/types.go +++ b/spinifex/handlers/elbv2/types.go @@ -6,38 +6,38 @@ import ( ) const ( - // LoadBalancer types + // LoadBalancer types. LoadBalancerTypeApplication = "application" LoadBalancerTypeNetwork = "network" // maxLBSecurityGroups is the AWS cap on security groups per load balancer. maxLBSecurityGroups = 5 - // LoadBalancer schemes + // LoadBalancer schemes. SchemeInternetFacing = "internet-facing" SchemeInternal = "internal" - // LoadBalancer states + // LoadBalancer states. StateProvisioning = "provisioning" StateActive = "active" StateFailed = "failed" - // Target group target types (v1 supports instance and ip) + // Target group target types (v1 supports instance and ip). TargetTypeInstance = "instance" TargetTypeIP = "ip" - // Target health states + // Target health states. TargetHealthInitial = "initial" TargetHealthHealthy = "healthy" TargetHealthUnhealthy = "unhealthy" TargetHealthDraining = "draining" TargetHealthUnused = "unused" - // Listener protocols (ALB) + // Listener protocols (ALB). ProtocolHTTP = "HTTP" ProtocolHTTPS = "HTTPS" - // Listener protocols (NLB) + // Listener protocols (NLB). ProtocolTCP = "TCP" ProtocolUDP = "UDP" ProtocolTLS = "TLS" @@ -60,12 +60,12 @@ const ( // not specify an SslPolicy. DefaultSslPolicy = "ELBSecurityPolicy-2016-08" - // Listener action types + // Listener action types. ActionTypeForward = "forward" ActionTypeFixedResponse = "fixed-response" ActionTypeRedirect = "redirect" - // Rule condition fields + // Rule condition fields. RuleFieldHostHeader = "host-header" RuleFieldPathPattern = "path-pattern" RuleFieldHTTPHeader = "http-header" @@ -85,7 +85,7 @@ const ( MaxConditionValueLen = 128 MaxHTTPHeaderNameLen = 40 - // Default health check values (ALB) + // Default health check values (ALB). DefaultHealthCheckInterval = 30 DefaultHealthCheckTimeout = 5 DefaultHealthyThreshold = 5 @@ -96,7 +96,7 @@ const ( DefaultHealthCheckMatcher = "200" DefaultTargetDeregistrationDelaySecs = 300 - // Default health check values (NLB) + // Default health check values (NLB). DefaultNLBHealthCheckInterval = 30 DefaultNLBHealthCheckTimeout = 10 DefaultNLBHealthyThreshold = 3 @@ -104,7 +104,7 @@ const ( DefaultNLBHealthCheckProtocol = ProtocolTCP DefaultNLBHealthCheckPort = "traffic-port" - // IP address type + // IP address type. IPAddressTypeIPv4 = "ipv4" ) diff --git a/spinifex/handlers/iam/service_impl_test.go b/spinifex/handlers/iam/service_impl_test.go index d7fc1c1e0..ca252e44b 100644 --- a/spinifex/handlers/iam/service_impl_test.go +++ b/spinifex/handlers/iam/service_impl_test.go @@ -17,7 +17,7 @@ import ( "github.com/stretchr/testify/require" ) -// Interface compliance check +// Interface compliance check. var _ IAMService = (*IAMServiceImpl)(nil) const testAccountID = utils.GlobalAccountID diff --git a/spinifex/instancetypes/definitions.go b/spinifex/instancetypes/definitions.go index 87d9a2a37..4d625c4f3 100644 --- a/spinifex/instancetypes/definitions.go +++ b/spinifex/instancetypes/definitions.go @@ -16,7 +16,7 @@ type GPUModel struct { } var ( - // NVIDIA GPU models + // NVIDIA GPU models. NVIDIAa10g = GPUModel{"10de", "2236", "g5", "NVIDIA", "A10G", 24576} NVIDIAt4 = GPUModel{"10de", "1eb8", "g4dn", "NVIDIA", "T4", 16384} NVIDIAl4 = GPUModel{"10de", "27b8", "g6", "NVIDIA", "L4", 24576} // gr6 uses identical hardware; requires operator config @@ -31,7 +31,7 @@ var ( NVIDIAh200sxm = GPUModel{"10de", "2335", "p5e", "NVIDIA", "H200", 144384} // SXM5 141 GiB NVIDIArtxPro6000BlackwellSE = GPUModel{"10de", "2bb5", "g7e", "NVIDIA", "RTX Pro 6000 Blackwell Server Edition", 98304} // 96 GiB GDDR7 - // AMD GPU models + // AMD GPU models. AMDradeonV520 = GPUModel{"1002", "7362", "g4ad", "AMD", "Radeon Pro V520", 8192} AMDmi350x = GPUModel{"1002", "75a0", "g7e", "AMD", "Instinct MI350X", 294896} ) @@ -110,25 +110,25 @@ var vendorSiblingFamily = map[string]string{ } var ( - // Intel generations + // Intel generations. genIntelBroadwell = cpuGeneration{"Intel Broadwell", []string{"t2", "c4", "m4", "r4"}} genIntelSkylake = cpuGeneration{"Intel Skylake/Cascade Lake", []string{"t3", "c5", "m5", "r5"}} genIntelIceLake = cpuGeneration{"Intel Ice Lake", []string{"t3", "c6i", "m6i", "r6i"}} genIntelSapphireRapids = cpuGeneration{"Intel Sapphire Rapids", []string{"t3", "c7i", "m7i", "r7i"}} genIntelGraniteRapids = cpuGeneration{"Intel Granite Rapids", []string{"t3", "c8i", "m8i", "r8i"}} - // AMD generations + // AMD generations. genAMDZen = cpuGeneration{"AMD Zen/Zen2 (Naples/Rome)", []string{"t3a", "c5a", "m5a", "r5a"}} genAMDZen3 = cpuGeneration{"AMD Zen 3 (Milan)", []string{"t3a", "c6a", "m6a", "r6a"}} genAMDZen4 = cpuGeneration{"AMD Zen 4 (Genoa)", []string{"t3a", "c7a", "m7a", "r7a"}} genAMDZen5 = cpuGeneration{"AMD Zen 5 (Turin)", []string{"t3a", "c8a", "m8a", "r8a"}} - // ARM generations + // ARM generations. genARMNeoverseN1 = cpuGeneration{"ARM Neoverse N1 (Graviton2)", []string{"t4g", "c6g", "m6g", "r6g"}} genARMNeoverseV1 = cpuGeneration{"ARM Neoverse V1 (Graviton3)", []string{"t4g", "c7g", "m7g", "r7g"}} genARMNeoverseV2 = cpuGeneration{"ARM Neoverse V2 (Graviton4)", []string{"t4g", "c8g", "m8g", "r8g"}} - // Unknown/fallback — expose only burstable family + // Unknown/fallback — expose only burstable family. genUnknownIntel = cpuGeneration{"Unknown Intel", []string{"t3"}} genUnknownAMD = cpuGeneration{"Unknown AMD", []string{"t3a"}} genUnknownARM = cpuGeneration{"Unknown ARM", []string{"t4g"}} diff --git a/spinifex/objectstore/objectstore.go b/spinifex/objectstore/objectstore.go index 6dc38ec9c..47b64ba20 100644 --- a/spinifex/objectstore/objectstore.go +++ b/spinifex/objectstore/objectstore.go @@ -21,7 +21,7 @@ import ( "go.opentelemetry.io/otel/trace" ) -// NoSuchKeyError represents a missing object error, compatible with AWS S3 errors +// NoSuchKeyError represents a missing object error, compatible with AWS S3 errors. type NoSuchKeyError struct { Key string } @@ -77,14 +77,14 @@ func NewS3ObjectStoreFromConfig(host, region, accessKey, secretKey string) *S3Ob return NewS3ObjectStore(s3.New(sess)) } -// S3ObjectStore wraps the AWS S3 client to implement ObjectStore +// S3ObjectStore wraps the AWS S3 client to implement ObjectStore. type S3ObjectStore struct { client *s3.S3 } var _ ObjectStore = (*S3ObjectStore)(nil) -// NewS3ObjectStore creates an ObjectStore backed by AWS S3 or S3-compatible storage +// NewS3ObjectStore creates an ObjectStore backed by AWS S3 or S3-compatible storage. func NewS3ObjectStore(client *s3.S3) *S3ObjectStore { return &S3ObjectStore{client: client} } @@ -156,14 +156,14 @@ type MemoryObjectStore struct { var _ ObjectStore = (*MemoryObjectStore)(nil) -// NewMemoryObjectStore creates an in-memory ObjectStore for testing +// NewMemoryObjectStore creates an in-memory ObjectStore for testing. func NewMemoryObjectStore() *MemoryObjectStore { return &MemoryObjectStore{ objects: make(map[string][]byte), } } -// makeKey creates a storage key from bucket and key +// makeKey creates a storage key from bucket and key. func makeKey(bucket, key string) string { return bucket + "/" + key } @@ -284,14 +284,14 @@ func (m *MemoryObjectStore) ListObjectsV2(_ context.Context, input *s3.ListObjec // prefixed with the bucket name on write. func (m *MemoryObjectStore) EnsureBucket(_ context.Context, bucket string) error { return nil } -// Clear removes all objects from the memory store (useful for test cleanup) +// Clear removes all objects from the memory store (useful for test cleanup). func (m *MemoryObjectStore) Clear() { m.mu.Lock() defer m.mu.Unlock() m.objects = make(map[string][]byte) } -// Count returns the number of objects in the memory store +// Count returns the number of objects in the memory store. func (m *MemoryObjectStore) Count() int { m.mu.RLock() defer m.mu.RUnlock() diff --git a/spinifex/objectstore/objectstore_test.go b/spinifex/objectstore/objectstore_test.go index d0ee2b5f2..2a3cbe24d 100644 --- a/spinifex/objectstore/objectstore_test.go +++ b/spinifex/objectstore/objectstore_test.go @@ -346,6 +346,6 @@ func TestIsNoSuchKeyError_WithWrappedError(t *testing.T) { assert.True(t, IsNoSuchKeyError(originalErr)) } -// Test that the interface is properly defined +// Test that the interface is properly defined. var _ ObjectStore = (*MemoryObjectStore)(nil) var _ ObjectStore = (*S3ObjectStore)(nil) diff --git a/spinifex/qmp/qmp.go b/spinifex/qmp/qmp.go index 08f53bee5..57daec50b 100644 --- a/spinifex/qmp/qmp.go +++ b/spinifex/qmp/qmp.go @@ -112,7 +112,7 @@ type QMPError struct { Desc string `json:"desc"` } -// QMP greeting on connect +// QMP greeting on connect. type QMPGreeting struct { QMP struct { Version struct { diff --git a/spinifex/services/predastore/predastore.go b/spinifex/services/predastore/predastore.go index b3f624b08..e350ac932 100644 --- a/spinifex/services/predastore/predastore.go +++ b/spinifex/services/predastore/predastore.go @@ -15,7 +15,7 @@ import ( var serviceName = "predastore" -// Config holds the configuration for the predastore service +// Config holds the configuration for the predastore service. type Config struct { ConfigPath string Port int @@ -37,13 +37,13 @@ type Config struct { PprofOutputPath string } -// Service wraps the predastore S3 server +// Service wraps the predastore S3 server. type Service struct { Config *Config server *s3.Server } -// New creates a new predastore service +// New creates a new predastore service. func New(config any) (svc *Service, err error) { cfg, ok := config.(*Config) if !ok { @@ -55,7 +55,7 @@ func New(config any) (svc *Service, err error) { return svc, nil } -// Start starts the predastore service +// Start starts the predastore service. func (svc *Service) Start() (int, error) { if svc.Config.EncryptionKeyFile == "" { return 0, fmt.Errorf("predastore encryption key file is required (set EncryptionKeyFile)") @@ -103,17 +103,17 @@ func (svc *Service) Start() (int, error) { return os.Getpid(), nil } -// Stop stops the predastore service +// Stop stops the predastore service. func (svc *Service) Stop() error { return utils.StopProcessAt(svc.Config.BasePath, serviceName) } -// Status returns the status of the predastore service +// Status returns the status of the predastore service. func (svc *Service) Status() (string, error) { return utils.ServiceStatus(svc.Config.BasePath, serviceName) } -// Shutdown gracefully shuts down the predastore service +// Shutdown gracefully shuts down the predastore service. func (svc *Service) Shutdown() error { if svc.server != nil { ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) @@ -123,7 +123,7 @@ func (svc *Service) Shutdown() error { return svc.Stop() } -// Reload reloads the predastore service configuration +// Reload reloads the predastore service configuration. func (svc *Service) Reload() error { return nil } diff --git a/spinifex/services/predastore/predastore_integration_test.go b/spinifex/services/predastore/predastore_integration_test.go index c64a224f1..02589f395 100644 --- a/spinifex/services/predastore/predastore_integration_test.go +++ b/spinifex/services/predastore/predastore_integration_test.go @@ -34,7 +34,7 @@ import ( "github.com/stretchr/testify/assert" ) -// Test credentials from config +// Test credentials from config. const ( validAccessKey = "AKIAIOSFODNN7EXAMPLE" validSecretKey = "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY" @@ -47,7 +47,7 @@ const ( testHost = "127.0.0.1" ) -// Global server instance for integration tests +// Global server instance for integration tests. var ( serverStarted bool serverStartMutex sync.Mutex @@ -124,7 +124,7 @@ func generateTestCertificate(certPath, keyPath string) (*x509.CertPool, error) { return pool, nil } -// startPredastoreServer starts the predastore server once for all tests +// startPredastoreServer starts the predastore server once for all tests. func startPredastoreServer(t *testing.T) *Config { serverStartMutex.Lock() defer serverStartMutex.Unlock() @@ -274,7 +274,7 @@ account_id = "123456789012" return cfg } -// waitForServer waits for the predastore server to be ready +// waitForServer waits for the predastore server to be ready. func waitForServer(timeout time.Duration) bool { client := &http.Client{ Transport: &http.Transport{ @@ -297,7 +297,7 @@ func waitForServer(timeout time.Duration) bool { return false } -// createS3Client creates an AWS S3 client for testing +// createS3Client creates an AWS S3 client for testing. func createS3Client(accessKey, secretKey string) *s3.S3 { tr := &http.Transport{ TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, @@ -316,7 +316,7 @@ func createS3Client(accessKey, secretKey string) *s3.S3 { return s3.New(sess) } -// TestIntegration_BucketListing tests that both buckets from config exist +// TestIntegration_BucketListing tests that both buckets from config exist. func TestIntegration_BucketListing(t *testing.T) { if testing.Short() { t.Skip("Skipping integration test in short mode") @@ -345,7 +345,7 @@ func TestIntegration_BucketListing(t *testing.T) { assert.Len(t, buckets, 2, "Should have exactly 2 buckets") } -// TestIntegration_Authentication_Valid tests authentication with valid credentials +// TestIntegration_Authentication_Valid tests authentication with valid credentials. func TestIntegration_Authentication_Valid(t *testing.T) { if testing.Short() { t.Skip("Skipping integration test in short mode") @@ -365,7 +365,7 @@ func TestIntegration_Authentication_Valid(t *testing.T) { } } -// TestIntegration_Authentication_Invalid tests authentication with invalid credentials +// TestIntegration_Authentication_Invalid tests authentication with invalid credentials. func TestIntegration_Authentication_Invalid(t *testing.T) { if testing.Short() { t.Skip("Skipping integration test in short mode") @@ -390,7 +390,7 @@ func TestIntegration_Authentication_Invalid(t *testing.T) { "Error should indicate authentication failure, got: %s", errStr) } -// TestIntegration_FileUpload_TestBucket tests file upload to test-bucket +// TestIntegration_FileUpload_TestBucket tests file upload to test-bucket. func TestIntegration_FileUpload_TestBucket(t *testing.T) { if testing.Short() { t.Skip("Skipping integration test in short mode") @@ -432,7 +432,7 @@ func TestIntegration_FileUpload_TestBucket(t *testing.T) { t.Logf("Successfully uploaded and verified file: s3://%s/%s", testBucket, key) } -// TestIntegration_FileUpload_PublicBucket tests file upload to public-bucket +// TestIntegration_FileUpload_PublicBucket tests file upload to public-bucket. func TestIntegration_FileUpload_PublicBucket(t *testing.T) { if testing.Short() { t.Skip("Skipping integration test in short mode") @@ -519,7 +519,7 @@ func TestIntegration_FileUpload_PublicBucket2(t *testing.T) { t.Logf("Successfully uploaded and verified file: s3://%s/%s", publicBucket, key) } -// TestIntegration_FileOperations_Complete tests full file lifecycle +// TestIntegration_FileOperations_Complete tests full file lifecycle. func TestIntegration_FileOperations_Complete(t *testing.T) { if testing.Short() { t.Skip("Skipping integration test in short mode") @@ -611,7 +611,7 @@ func TestIntegration_FileOperations_Complete(t *testing.T) { } } -// TestIntegration_MultipleFiles tests uploading multiple files +// TestIntegration_MultipleFiles tests uploading multiple files. func TestIntegration_MultipleFiles(t *testing.T) { if testing.Short() { t.Skip("Skipping integration test in short mode") @@ -660,7 +660,7 @@ func TestIntegration_MultipleFiles(t *testing.T) { } } -// TestIntegration_LargeFile tests uploading a larger file (1MB) +// TestIntegration_LargeFile tests uploading a larger file (1MB). func TestIntegration_LargeFile(t *testing.T) { if testing.Short() { t.Skip("Skipping integration test in short mode") diff --git a/spinifex/services/predastore/predastore_test.go b/spinifex/services/predastore/predastore_test.go index c8ea9bb62..02a2e1304 100644 --- a/spinifex/services/predastore/predastore_test.go +++ b/spinifex/services/predastore/predastore_test.go @@ -6,7 +6,7 @@ import ( "github.com/stretchr/testify/assert" ) -// TestNew tests the service constructor +// TestNew tests the service constructor. func TestNew(t *testing.T) { cfg := &Config{ ConfigPath: "/tmp/test-config.toml", @@ -34,7 +34,7 @@ func TestNew(t *testing.T) { assert.Equal(t, "/tmp/encryption.key", svc.Config.EncryptionKeyFile) } -// TestNewWithNilConfig tests that New handles nil config correctly +// TestNewWithNilConfig tests that New handles nil config correctly. func TestNewWithNilConfig(t *testing.T) { cfg := &Config{} svc, err := New(cfg) @@ -44,7 +44,7 @@ func TestNewWithNilConfig(t *testing.T) { assert.NotNil(t, svc.Config) } -// TestConfigDefaults tests Config struct default values +// TestConfigDefaults tests Config struct default values. func TestConfigDefaults(t *testing.T) { cfg := &Config{} @@ -58,7 +58,7 @@ func TestConfigDefaults(t *testing.T) { assert.Empty(t, cfg.EncryptionKeyFile) } -// TestConfigWithDebug tests Config with debug enabled +// TestConfigWithDebug tests Config with debug enabled. func TestConfigWithDebug(t *testing.T) { cfg := &Config{ Debug: true, @@ -71,7 +71,7 @@ func TestConfigWithDebug(t *testing.T) { assert.Equal(t, 8443, cfg.Port) } -// TestConfigFullyPopulated tests a fully populated config +// TestConfigFullyPopulated tests a fully populated config. func TestConfigFullyPopulated(t *testing.T) { cfg := &Config{ ConfigPath: "/etc/predastore/config.toml", @@ -94,7 +94,7 @@ func TestConfigFullyPopulated(t *testing.T) { assert.Equal(t, "/etc/spinifex/predastore/encryption.key", cfg.EncryptionKeyFile) } -// TestServiceMethods tests the service interface methods +// TestServiceMethods tests the service interface methods. func TestServiceMethods(t *testing.T) { cfg := &Config{ ConfigPath: "/tmp/test-config.toml", @@ -115,12 +115,12 @@ func TestServiceMethods(t *testing.T) { assert.NoError(t, err) } -// TestServiceNameConstant tests the serviceName constant +// TestServiceNameConstant tests the serviceName constant. func TestServiceNameConstant(t *testing.T) { assert.Equal(t, "predastore", serviceName) } -// TestConfigPortRange tests port validation +// TestConfigPortRange tests port validation. func TestConfigPortRange(t *testing.T) { testCases := []struct { name string @@ -150,7 +150,7 @@ func TestConfigPortRange(t *testing.T) { } } -// TestConfigHostnames tests host configuration +// TestConfigHostnames tests host configuration. func TestConfigHostnames(t *testing.T) { testCases := []struct { name string @@ -175,7 +175,7 @@ func TestConfigHostnames(t *testing.T) { } } -// TestConfigBasePath tests base path configuration +// TestConfigBasePath tests base path configuration. func TestConfigBasePath(t *testing.T) { testCases := []struct { name string @@ -198,7 +198,7 @@ func TestConfigBasePath(t *testing.T) { } } -// TestConfigTLSPaths tests TLS certificate and key paths +// TestConfigTLSPaths tests TLS certificate and key paths. func TestConfigTLSPaths(t *testing.T) { cfg := &Config{ TlsCert: "/etc/ssl/certs/server.crt", @@ -211,7 +211,7 @@ func TestConfigTLSPaths(t *testing.T) { assert.Contains(t, cfg.TlsKey, ".key") } -// TestConfigMinimal tests minimal required config +// TestConfigMinimal tests minimal required config. func TestConfigMinimal(t *testing.T) { cfg := &Config{ ConfigPath: "/tmp/config.toml", @@ -230,7 +230,7 @@ func TestConfigMinimal(t *testing.T) { } // TestServiceStartWithoutConfig tests Start method behavior -// Note: This will fail without proper config file, which is expected +// Note: This will fail without proper config file, which is expected. func TestServiceStartWithoutConfig(t *testing.T) { // Skip this test - it requires actual config file and will block/exit // This is covered by integration tests instead @@ -257,7 +257,7 @@ func TestServiceStartRejectsMissingEncryptionKey(t *testing.T) { assert.Contains(t, err.Error(), "encryption key file is required") } -// TestConfigDebugFlag tests debug flag behavior +// TestConfigDebugFlag tests debug flag behavior. func TestConfigDebugFlag(t *testing.T) { // Debug enabled cfg1 := &Config{ @@ -276,7 +276,7 @@ func TestConfigDebugFlag(t *testing.T) { assert.False(t, cfg3.Debug) } -// TestConfigValidation tests validation of required fields +// TestConfigValidation tests validation of required fields. func TestConfigValidation(t *testing.T) { // Empty config - fields should be empty/zero cfg := &Config{} @@ -295,7 +295,7 @@ func TestConfigValidation(t *testing.T) { assert.NotEmpty(t, cfg2.Host) } -// TestMultipleServiceInstances tests creating multiple service instances +// TestMultipleServiceInstances tests creating multiple service instances. func TestMultipleServiceInstances(t *testing.T) { cfg1 := &Config{ ConfigPath: "/tmp/config1.toml", @@ -322,7 +322,7 @@ func TestMultipleServiceInstances(t *testing.T) { assert.NotEqual(t, svc1.Config.ConfigPath, svc2.Config.ConfigPath) } -// TestConfigPointerPreservation tests that config pointer is preserved +// TestConfigPointerPreservation tests that config pointer is preserved. func TestConfigPointerPreservation(t *testing.T) { cfg := &Config{ Port: 8443, diff --git a/spinifex/services/spinifexui/spinifexui.go b/spinifex/services/spinifexui/spinifexui.go index 811dc73ca..837a3f665 100644 --- a/spinifex/services/spinifexui/spinifexui.go +++ b/spinifex/services/spinifexui/spinifexui.go @@ -28,7 +28,7 @@ var serviceName = "spinifex-ui" //go:embed all:frontend/dist var distFS embed.FS -// Config holds the configuration for the spinifex-ui service +// Config holds the configuration for the spinifex-ui service. type Config struct { Port int `json:"port"` Host string `json:"host"` @@ -36,14 +36,14 @@ type Config struct { TLSKey string `json:"tls_key"` } -// Service represents the spinifex-ui service +// Service represents the spinifex-ui service. type Service struct { Config *Config server *http.Server mu sync.Mutex } -// New creates a new spinifex-ui service +// New creates a new spinifex-ui service. func New(config any) (*Service, error) { cfg, ok := config.(*Config) if !ok { @@ -83,7 +83,7 @@ func New(config any) (*Service, error) { }, nil } -// Start starts the spinifex-ui service +// Start starts the spinifex-ui service. func (svc *Service) Start() (int, error) { if err := utils.WritePidFile(serviceName, os.Getpid()); err != nil { slog.Error("Failed to write pid file", "err", err) @@ -97,17 +97,17 @@ func (svc *Service) Start() (int, error) { return os.Getpid(), nil } -// Stop stops the spinifex-ui service +// Stop stops the spinifex-ui service. func (svc *Service) Stop() error { return utils.StopProcess(serviceName) } -// Status returns the status of the spinifex-ui service +// Status returns the status of the spinifex-ui service. func (svc *Service) Status() (string, error) { return utils.ServiceStatus("", serviceName) } -// Shutdown gracefully shuts down the spinifex-ui service +// Shutdown gracefully shuts down the spinifex-ui service. func (svc *Service) Shutdown() error { svc.mu.Lock() server := svc.server @@ -121,12 +121,12 @@ func (svc *Service) Shutdown() error { return svc.Stop() } -// Reload reloads the spinifex-ui service configuration +// Reload reloads the spinifex-ui service configuration. func (svc *Service) Reload() error { return nil } -// launchService starts the HTTP server +// launchService starts the HTTP server. func (svc *Service) launchService() error { // Strip the "frontend/dist" prefix from embedded filesystem contentFS, err := fs.Sub(distFS, "frontend/dist") diff --git a/spinifex/services/viperblockd/viperblockd_integration_test.go b/spinifex/services/viperblockd/viperblockd_integration_test.go index 7d20ee2d7..4139ae868 100644 --- a/spinifex/services/viperblockd/viperblockd_integration_test.go +++ b/spinifex/services/viperblockd/viperblockd_integration_test.go @@ -19,7 +19,7 @@ import ( "github.com/stretchr/testify/require" ) -// setupEmbeddedNATS starts an embedded NATS server for testing +// setupEmbeddedNATS starts an embedded NATS server for testing. func setupEmbeddedNATS(t *testing.T) (*server.Server, string) { opts := &server.Options{ Host: "127.0.0.1", @@ -34,7 +34,7 @@ func setupEmbeddedNATS(t *testing.T) (*server.Server, string) { return ns, ns.ClientURL() } -// setupTestConfig creates a test configuration with proper paths +// setupTestConfig creates a test configuration with proper paths. func setupTestConfig(t *testing.T, natsURL string) *Config { testDir := t.TempDir() @@ -55,7 +55,7 @@ func setupTestConfig(t *testing.T, natsURL string) *Config { return cfg } -// createMockVolumeState creates mock volume state files for testing +// createMockVolumeState creates mock volume state files for testing. func createMockVolumeState(t *testing.T, baseDir, volumeName string) { volumeDir := filepath.Join(baseDir, volumeName) err := os.MkdirAll(volumeDir, 0755) @@ -76,7 +76,7 @@ func createMockVolumeState(t *testing.T, baseDir, volumeName string) { assert.NoError(t, err) } -// TestIntegration_ServiceStartWithEmbeddedNATS tests service startup with embedded NATS +// TestIntegration_ServiceStartWithEmbeddedNATS tests service startup with embedded NATS. func TestIntegration_ServiceStartWithEmbeddedNATS(t *testing.T) { t.Parallel() if testing.Short() { @@ -110,7 +110,7 @@ func TestIntegration_ServiceStartWithEmbeddedNATS(t *testing.T) { // Test completes, launchService will be cleaned up when test ends } -// TestIntegration_EBSMountRequest tests EBS mount request handling +// TestIntegration_EBSMountRequest tests EBS mount request handling. func TestIntegration_EBSMountRequest(t *testing.T) { t.Parallel() if testing.Short() { @@ -173,7 +173,7 @@ func TestIntegration_EBSMountRequest(t *testing.T) { t.Logf("Received expected error response: %s", response.Error) } -// TestIntegration_EBSUnmountRequest tests EBS unmount request handling +// TestIntegration_EBSUnmountRequest tests EBS unmount request handling. func TestIntegration_EBSUnmountRequest(t *testing.T) { t.Parallel() if testing.Short() { @@ -243,7 +243,7 @@ func TestIntegration_EBSUnmountRequest(t *testing.T) { t.Logf("Unmount successful for volume: %s", response.Volume) } -// TestIntegration_EBSUnmountNonExistentVolume tests unmounting a volume that doesn't exist +// TestIntegration_EBSUnmountNonExistentVolume tests unmounting a volume that doesn't exist. func TestIntegration_EBSUnmountNonExistentVolume(t *testing.T) { t.Parallel() @@ -392,7 +392,7 @@ func TestIntegration_EBSUnmountSealFailureKeepsVolumeMounted(t *testing.T) { assert.Equal(t, "vol-seal-fail", cfg.MountedVolumes[0].Name) } -// TestIntegration_ConcurrentMountRequests tests multiple concurrent mount requests +// TestIntegration_ConcurrentMountRequests tests multiple concurrent mount requests. func TestIntegration_ConcurrentMountRequests(t *testing.T) { t.Parallel() if testing.Short() { @@ -459,7 +459,7 @@ func TestIntegration_ConcurrentMountRequests(t *testing.T) { assert.True(t, successCount > 0 || errorCount > 0, "Should have received some responses or timeouts") } -// TestIntegration_MessageSubscriptions tests that all expected subscriptions are active +// TestIntegration_MessageSubscriptions tests that all expected subscriptions are active. func TestIntegration_MessageSubscriptions(t *testing.T) { t.Parallel() if testing.Short() { @@ -513,7 +513,7 @@ func TestIntegration_MessageSubscriptions(t *testing.T) { t.Log("Successfully published to ebs.delete subscription") } -// TestIntegration_ServiceGracefulShutdown tests graceful shutdown behavior +// TestIntegration_ServiceGracefulShutdown tests graceful shutdown behavior. func TestIntegration_ServiceGracefulShutdown(t *testing.T) { t.Parallel() if testing.Short() { @@ -564,7 +564,7 @@ func TestIntegration_ServiceGracefulShutdown(t *testing.T) { t.Log("Service is running and responsive") } -// TestIntegration_GenericTopicRouting tests that NodeName="" uses generic ebs.unmount with queue group +// TestIntegration_GenericTopicRouting tests that NodeName="" uses generic ebs.unmount with queue group. func TestIntegration_GenericTopicRouting(t *testing.T) { t.Parallel() if testing.Short() { @@ -602,7 +602,7 @@ func TestIntegration_GenericTopicRouting(t *testing.T) { } // TestIntegration_MountAuxiliaryVolumeSuffix tests that volumes with -cloudinit suffix -// reach the mount handler and trigger the auxiliary volume code path +// reach the mount handler and trigger the auxiliary volume code path. func TestIntegration_MountAuxiliaryVolumeSuffix(t *testing.T) { t.Parallel() if testing.Short() { diff --git a/spinifex/services/viperblockd/viperblockd_test.go b/spinifex/services/viperblockd/viperblockd_test.go index d48847942..daf971332 100644 --- a/spinifex/services/viperblockd/viperblockd_test.go +++ b/spinifex/services/viperblockd/viperblockd_test.go @@ -13,7 +13,7 @@ import ( "github.com/stretchr/testify/require" ) -// TestNew tests the service constructor +// TestNew tests the service constructor. func TestNew(t *testing.T) { cfg := &Config{ NatsHost: "nats://localhost:4222", @@ -37,7 +37,7 @@ func TestNew(t *testing.T) { assert.Equal(t, "/tmp/viperblock", svc.Config.BaseDir) } -// TestNewWithNilConfig tests that New handles nil config correctly +// TestNewWithNilConfig tests that New handles nil config correctly. func TestNewWithNilConfig(t *testing.T) { // This will panic if not handled, but based on the code it type asserts // For now we test that it accepts a Config pointer @@ -49,7 +49,7 @@ func TestNewWithNilConfig(t *testing.T) { assert.NotNil(t, svc.Config) } -// TestConfigDefaults tests Config struct default values +// TestConfigDefaults tests Config struct default values. func TestConfigDefaults(t *testing.T) { cfg := &Config{} @@ -61,7 +61,7 @@ func TestConfigDefaults(t *testing.T) { assert.Empty(t, cfg.MountedVolumes) } -// TestConfigWithDebug tests Config with debug enabled +// TestConfigWithDebug tests Config with debug enabled. func TestConfigWithDebug(t *testing.T) { cfg := &Config{ Debug: true, @@ -74,7 +74,7 @@ func TestConfigWithDebug(t *testing.T) { assert.Equal(t, "/tmp/test", cfg.BaseDir) } -// TestMountedVolumeStruct tests the MountedVolume struct +// TestMountedVolumeStruct tests the MountedVolume struct. func TestMountedVolumeStruct(t *testing.T) { vol := MountedVolume{ Name: "vol-123", @@ -89,7 +89,7 @@ func TestMountedVolumeStruct(t *testing.T) { assert.Equal(t, 12345, vol.PID) } -// TestConfigMountedVolumesAppend tests adding volumes to the config +// TestConfigMountedVolumesAppend tests adding volumes to the config. func TestConfigMountedVolumesAppend(t *testing.T) { cfg := &Config{ MountedVolumes: []MountedVolume{}, @@ -118,7 +118,7 @@ func TestConfigMountedVolumesAppend(t *testing.T) { assert.Equal(t, "vol-2", cfg.MountedVolumes[1].Name) } -// TestConfigMutexThreadSafety tests that the mutex protects MountedVolumes +// TestConfigMutexThreadSafety tests that the mutex protects MountedVolumes. func TestConfigMutexThreadSafety(t *testing.T) { cfg := &Config{ MountedVolumes: []MountedVolume{}, @@ -149,7 +149,7 @@ func TestConfigMutexThreadSafety(t *testing.T) { cfg.mu.Unlock() } -// TestServiceMethods tests the service interface methods +// TestServiceMethods tests the service interface methods. func TestServiceMethods(t *testing.T) { cfg := &Config{ NatsHost: "nats://localhost:4222", @@ -169,7 +169,7 @@ func TestServiceMethods(t *testing.T) { assert.NoError(t, err) } -// TestServiceShutdown tests that Shutdown calls Stop +// TestServiceShutdown tests that Shutdown calls Stop. func TestServiceShutdown(t *testing.T) { cfg := &Config{ NatsHost: "nats://localhost:4222", @@ -187,7 +187,7 @@ func TestServiceShutdown(t *testing.T) { assert.Error(t, err) } -// TestServiceStop tests the Stop method +// TestServiceStop tests the Stop method. func TestServiceStop(t *testing.T) { cfg := &Config{ NatsHost: "nats://localhost:4222", @@ -203,7 +203,7 @@ func TestServiceStop(t *testing.T) { assert.Error(t, err) } -// TestConfigPluginPath tests PluginPath configuration +// TestConfigPluginPath tests PluginPath configuration. func TestConfigPluginPath(t *testing.T) { cfg := &Config{ PluginPath: "/usr/lib/nbdkit/plugins", @@ -214,7 +214,7 @@ func TestConfigPluginPath(t *testing.T) { assert.Equal(t, "/var/lib/viperblock", cfg.BaseDir) } -// TestConfigFullyPopulated tests a fully populated config +// TestConfigFullyPopulated tests a fully populated config. func TestConfigFullyPopulated(t *testing.T) { cfg := &Config{ ConfigPath: "/etc/viperblock/config.yml", @@ -251,7 +251,7 @@ func TestConfigFullyPopulated(t *testing.T) { assert.Equal(t, "vol-001", cfg.MountedVolumes[0].Name) } -// TestMountedVolumeFindByName tests finding a mounted volume by name +// TestMountedVolumeFindByName tests finding a mounted volume by name. func TestMountedVolumeFindByName(t *testing.T) { cfg := &Config{ MountedVolumes: []MountedVolume{ @@ -287,7 +287,7 @@ func TestMountedVolumeFindByName(t *testing.T) { assert.Nil(t, found) } -// TestMountedVolumeRemoval tests removing a mounted volume +// TestMountedVolumeRemoval tests removing a mounted volume. func TestMountedVolumeRemoval(t *testing.T) { cfg := &Config{ MountedVolumes: []MountedVolume{ @@ -314,12 +314,12 @@ func TestMountedVolumeRemoval(t *testing.T) { assert.Equal(t, "vol-3", cfg.MountedVolumes[1].Name) } -// TestServiceNameConstant tests the serviceName constant +// TestServiceNameConstant tests the serviceName constant. func TestServiceNameConstant(t *testing.T) { assert.Equal(t, "viperblock", serviceName) } -// TestConfigS3Credentials tests S3 credential fields +// TestConfigS3Credentials tests S3 credential fields. func TestConfigS3Credentials(t *testing.T) { cfg := &Config{ AccessKey: "test-key", @@ -332,7 +332,7 @@ func TestConfigS3Credentials(t *testing.T) { assert.Equal(t, "test-secret", cfg.SecretKey) } -// TestMountedVolumeWithSocket tests MountedVolume with socket path +// TestMountedVolumeWithSocket tests MountedVolume with socket path. func TestMountedVolumeWithSocket(t *testing.T) { vol := MountedVolume{ Name: "vol-ebs-123", @@ -345,7 +345,7 @@ func TestMountedVolumeWithSocket(t *testing.T) { assert.True(t, len(vol.Socket) > 0) } -// TestConfigConcurrentRead tests concurrent reads are safe +// TestConfigConcurrentRead tests concurrent reads are safe. func TestConfigConcurrentRead(t *testing.T) { cfg := &Config{ MountedVolumes: []MountedVolume{ @@ -377,7 +377,7 @@ func TestConfigConcurrentRead(t *testing.T) { } // TestServiceStartWithoutNATS tests Start method behavior -// Note: This will fail without a running NATS server, which is expected +// Note: This will fail without a running NATS server, which is expected. func TestServiceStartWithoutNATS(t *testing.T) { // Skip this test in CI environments or when NATS is not available if os.Getenv("SKIP_INTEGRATION_TESTS") == "true" { @@ -410,7 +410,7 @@ func TestServiceStartWithoutNATS(t *testing.T) { } } -// TestConfigValidation tests validation of required fields +// TestConfigValidation tests validation of required fields. func TestConfigValidation(t *testing.T) { // Test empty config - fields should be empty cfg := &Config{} @@ -429,7 +429,7 @@ func TestConfigValidation(t *testing.T) { assert.NotEmpty(t, cfg2.Region) } -// TestMountedVolumePortRange tests port assignment +// TestMountedVolumePortRange tests port assignment. func TestMountedVolumePortRange(t *testing.T) { volumes := []MountedVolume{ {Name: "vol-1", Port: 10809}, diff --git a/spinifex/types/cluster.go b/spinifex/types/cluster.go index 76f27210e..fb883aecc 100644 --- a/spinifex/types/cluster.go +++ b/spinifex/types/cluster.go @@ -2,7 +2,7 @@ package types import "github.com/mulgadc/spinifex/spinifex/config" -// SharedClusterData contains only the shared cluster information (no node-specific top-level fields) +// SharedClusterData contains only the shared cluster information (no node-specific top-level fields). type SharedClusterData struct { Epoch uint64 `json:"epoch" toml:"epoch"` Version string `json:"version" toml:"version"` diff --git a/spinifex/types/ebs.go b/spinifex/types/ebs.go index da8e9aa82..30c14404e 100644 --- a/spinifex/types/ebs.go +++ b/spinifex/types/ebs.go @@ -24,13 +24,13 @@ type EBSRequest struct { HotplugPort int `json:"HotplugPort,omitempty"` } -// NBDTransport defines the transport type for NBD connections +// NBDTransport defines the transport type for NBD connections. type NBDTransport string const ( - // NBDTransportSocket uses Unix domain sockets (faster, local only) + // NBDTransportSocket uses Unix domain sockets (faster, local only). NBDTransportSocket NBDTransport = "socket" - // NBDTransportTCP uses TCP connections (required for remote/DPU scenarios) + // NBDTransportTCP uses TCP connections (required for remote/DPU scenarios). NBDTransportTCP NBDTransport = "tcp" ) diff --git a/spinifex/utils/conversion.go b/spinifex/utils/conversion.go index 02f3f40e9..d488b7198 100644 --- a/spinifex/utils/conversion.go +++ b/spinifex/utils/conversion.go @@ -2,7 +2,7 @@ package utils import "math" -// SafeInt64ToUint64 converts int64 to uint64, returning 0 if negative +// SafeInt64ToUint64 converts int64 to uint64, returning 0 if negative. func SafeInt64ToUint64(v int64) uint64 { if v < 0 { return 0 @@ -10,7 +10,7 @@ func SafeInt64ToUint64(v int64) uint64 { return uint64(v) } -// SafeIntToUint8 converts int to uint8, clamping to [0, 255] +// SafeIntToUint8 converts int to uint8, clamping to [0, 255]. func SafeIntToUint8(v int) uint8 { if v < 0 { return 0 @@ -21,7 +21,7 @@ func SafeIntToUint8(v int) uint8 { return uint8(v) } -// SafeIntToUint64 converts int to uint64, returning 0 if negative +// SafeIntToUint64 converts int to uint64, returning 0 if negative. func SafeIntToUint64(v int) uint64 { if v < 0 { return 0 @@ -29,7 +29,7 @@ func SafeIntToUint64(v int) uint64 { return uint64(v) } -// SafeUint64ToInt64 converts uint64 to int64, capping at math.MaxInt64 +// SafeUint64ToInt64 converts uint64 to int64, capping at math.MaxInt64. func SafeUint64ToInt64(v uint64) int64 { if v > math.MaxInt64 { return math.MaxInt64 diff --git a/spinifex/vm/device_map.go b/spinifex/vm/device_map.go index e1e96cfbd..ac0907a42 100644 --- a/spinifex/vm/device_map.go +++ b/spinifex/vm/device_map.go @@ -16,7 +16,7 @@ import ( ) // pciAddrRegexp extracts the device index from a boot-time QDev path. -// Example: "/machine/peripheral-anon/device[0]/virtio-backend" → 0 +// Example: "/machine/peripheral-anon/device[0]/virtio-backend" → 0. var pciAddrRegexp = regexp.MustCompile(`device\[(\d+)\]`) // hotplugPortRegexp extracts the EBS hot-plug port number from a QDev path. @@ -189,7 +189,7 @@ func (m *Manager) UpdateGuestDeviceNames(instance *VM) { } // extractPCIIndex parses the device index from a QDev path. -// For example: "/machine/peripheral-anon/device[3]/virtio-backend" → 3 +// For example: "/machine/peripheral-anon/device[3]/virtio-backend" → 3. func extractPCIIndex(qdev string) int { matches := pciAddrRegexp.FindStringSubmatch(qdev) if len(matches) < 2 { @@ -203,7 +203,7 @@ func extractPCIIndex(qdev string) int { } // extractPeripheralName extracts the device ID from a hot-plugged QDev path. -// For example: "/machine/peripheral/vdisk-vol-abc123/virtio-backend" → "vdisk-vol-abc123" +// For example: "/machine/peripheral/vdisk-vol-abc123/virtio-backend" → "vdisk-vol-abc123". func extractPeripheralName(qdev string) string { const prefix = "/machine/peripheral/" if !strings.HasPrefix(qdev, prefix) {