diff --git a/cmd/generate.go b/cmd/generate.go index 87f1ed2..94b8d34 100644 --- a/cmd/generate.go +++ b/cmd/generate.go @@ -1,3 +1,18 @@ +// Copyright (c) 2024 Parseable, Inc +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + package cmd import ( @@ -7,6 +22,7 @@ import ( "io" "net/http" "os" + "pb/pkg/common" internalHTTP "pb/pkg/http" @@ -157,5 +173,4 @@ func init() { GenerateSchemaCmd.Flags().StringP("file", "f", "", "Path to the JSON file to generate schema") CreateSchemaCmd.Flags().StringP("stream", "s", "", "Name of the stream to associate with the schema") CreateSchemaCmd.Flags().StringP("file", "f", "", "Path to the JSON file to create schema") - } diff --git a/cmd/installer.go b/cmd/installer.go index 24dbe49..a8c9116 100644 --- a/cmd/installer.go +++ b/cmd/installer.go @@ -1,3 +1,18 @@ +// Copyright (c) 2024 Parseable, Inc +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + package cmd import ( diff --git a/cmd/uninstaller.go b/cmd/uninstaller.go index e07db54..66b51e6 100644 --- a/cmd/uninstaller.go +++ b/cmd/uninstaller.go @@ -1,7 +1,23 @@ +// Copyright (c) 2024 Parseable, Inc +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + package cmd import ( "fmt" + "pb/pkg/common" "pb/pkg/installer" diff --git a/pkg/analytics/analytics.go b/pkg/analytics/analytics.go index 420147d..6c84712 100644 --- a/pkg/analytics/analytics.go +++ b/pkg/analytics/analytics.go @@ -1,3 +1,18 @@ +// Copyright (c) 2024 Parseable, Inc +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + package analytics import ( @@ -92,7 +107,7 @@ func CheckAndCreateULID(_ *cobra.Command, _ []string) error { // Check if config path exists if _, err := os.Stat(configPath); os.IsNotExist(err) { // Create the directory if needed - if err := os.MkdirAll(filepath.Dir(configPath), 0755); err != nil { + if err := os.MkdirAll(filepath.Dir(configPath), 0o755); err != nil { fmt.Printf("could not create config directory: %v\n", err) return err } @@ -123,7 +138,7 @@ func CheckAndCreateULID(_ *cobra.Command, _ []string) error { } // Write updated config with ULID back to the file - if err := os.WriteFile(configPath, newData, 0644); err != nil { + if err := os.WriteFile(configPath, newData, 0o644); err != nil { fmt.Printf("could not write to config file: %v\n", err) return err } @@ -152,7 +167,6 @@ func PostRunAnalytics(cmd *cobra.Command, name string, args []string) { if err != nil { fmt.Println("Error sending analytics event:", err) } - } // sendEvent is a placeholder function to simulate sending an event after command execution. @@ -223,7 +237,6 @@ func sendEvent(commandName string, arguments []string, errors *string, execution return fmt.Errorf("received non-2xx response: %v", resp.Status) } - //fmt.Println("Event sent successfully:", string(eventJSON)) return nil } @@ -383,5 +396,4 @@ func GetProfile() (config.Profile, error) { } return conf.Profiles[conf.DefaultProfile], nil - } diff --git a/pkg/common/common.go b/pkg/common/common.go index 6c396a5..56271d2 100644 --- a/pkg/common/common.go +++ b/pkg/common/common.go @@ -1,3 +1,18 @@ +// Copyright (c) 2024 Parseable, Inc +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + package common // ANSI escape codes for colors diff --git a/pkg/helm/helm.go b/pkg/helm/helm.go index a69d9df..91928fa 100644 --- a/pkg/helm/helm.go +++ b/pkg/helm/helm.go @@ -1,3 +1,18 @@ +// Copyright (c) 2024 Parseable, Inc +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + package helm import ( @@ -40,7 +55,7 @@ func ListReleases(namespace string) ([]*release.Release, error) { } client := action.NewList(actionConfig) - //client.Deployed = true + // client.Deployed = true return client.Run() } @@ -48,7 +63,6 @@ func ListReleases(namespace string) ([]*release.Release, error) { // Apply applies a Helm chart using the provided Helm struct configuration. // It returns an error if any operation fails, otherwise, it returns nil. func Apply(h Helm, verbose bool) error { - // Create a logger that does nothing by default silentLogger := func(_ string, _ ...interface{}) {} @@ -82,7 +96,7 @@ func Apply(h Helm, verbose bool) error { // Add repository repoAdd(h) - //RepoUpdate() + // RepoUpdate() // Locate chart path cp, err := client.ChartPathOptions.LocateChart(fmt.Sprintf("%s/%s", h.RepoName, h.ChartName), settings) @@ -104,7 +118,7 @@ func Apply(h Helm, verbose bool) error { client.Wait = true client.Timeout = 300 * time.Second client.WaitForJobs = true - //client.IncludeCRDs = true + // client.IncludeCRDs = true // Merge values values := values.Options{ @@ -132,7 +146,7 @@ func repoAdd(h Helm) error { // Get the repository file path repoFile := settings.RepositoryConfig - //Ensure the file directory exists as it is required for file locking + // Ensure the file directory exists as it is required for file locking err := os.MkdirAll(filepath.Dir(repoFile), os.ModePerm) if err != nil && !os.IsExist(err) { return err @@ -200,7 +214,7 @@ func repoAdd(h Helm) error { f.Update(&c) // Write the updated repository file - if err := f.WriteFile(repoFile, 0644); err != nil { + if err := f.WriteFile(repoFile, 0o644); err != nil { return err } return nil @@ -294,7 +308,6 @@ func DeleteRelease(chartName, namespace string) error { } func Upgrade(h Helm) error { - settings := cli.New() // Initialize action configuration @@ -311,7 +324,7 @@ func Upgrade(h Helm) error { // Add repository repoAdd(h) - //RepoUpdate() + // RepoUpdate() // Locate chart path cp, err := client.ChartPathOptions.LocateChart(fmt.Sprintf("%s/%s", h.RepoName, h.ChartName), settings) @@ -332,7 +345,7 @@ func Upgrade(h Helm) error { client.Wait = true client.Timeout = 300 * time.Second client.WaitForJobs = true - //client.IncludeCRDs = true + // client.IncludeCRDs = true // Merge values values := values.Options{ @@ -352,7 +365,6 @@ func Upgrade(h Helm) error { } func Uninstall(h Helm, verbose bool) (*release.UninstallReleaseResponse, error) { - // Create a logger that does nothing by default silentLogger := func(_ string, _ ...interface{}) {} diff --git a/pkg/installer/installer.go b/pkg/installer/installer.go index cc83a07..dfc01d4 100644 --- a/pkg/installer/installer.go +++ b/pkg/installer/installer.go @@ -1,3 +1,18 @@ +// Copyright (c) 2024 Parseable, Inc +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + package installer import ( diff --git a/pkg/installer/model.go b/pkg/installer/model.go index 31d3cd2..7710e9f 100644 --- a/pkg/installer/model.go +++ b/pkg/installer/model.go @@ -1,3 +1,18 @@ +// Copyright (c) 2024 Parseable, Inc +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + package installer // deploymentType represents the type of deployment for the application. diff --git a/pkg/installer/plans.go b/pkg/installer/plans.go index e8c6dd6..d37481e 100644 --- a/pkg/installer/plans.go +++ b/pkg/installer/plans.go @@ -1,3 +1,18 @@ +// Copyright (c) 2024 Parseable, Inc +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + package installer import ( diff --git a/pkg/installer/spinner.go b/pkg/installer/spinner.go index 38dfb72..6d51d01 100644 --- a/pkg/installer/spinner.go +++ b/pkg/installer/spinner.go @@ -1,10 +1,26 @@ +// Copyright (c) 2024 Parseable, Inc +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + package installer import ( "fmt" - "pb/pkg/common" "time" + "pb/pkg/common" + "github.com/briandowns/spinner" ) diff --git a/pkg/installer/uninstaller.go b/pkg/installer/uninstaller.go index 36dc7f7..5f0cb8c 100644 --- a/pkg/installer/uninstaller.go +++ b/pkg/installer/uninstaller.go @@ -1,3 +1,18 @@ +// Copyright (c) 2024 Parseable, Inc +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + package installer import ( @@ -6,11 +21,12 @@ import ( "fmt" "os" "path/filepath" - "pb/pkg/common" - "pb/pkg/helm" "strings" "time" + "pb/pkg/common" + "pb/pkg/helm" + "gopkg.in/yaml.v2" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/kubernetes" @@ -41,7 +57,7 @@ func Uninstaller(verbose bool) error { return fmt.Errorf("failed to get user confirmation: %v", err) } if !confirm { - return fmt.Errorf("Uninstall cancelled.") + return fmt.Errorf("Uninstall canceled.") } // Helm application configuration @@ -91,7 +107,6 @@ func Uninstaller(verbose bool) error { fmt.Printf(common.Green+"Successfully uninstalled Parseable from namespace '%s'.\n"+common.Reset, namespace) return nil - } // promptUserConfirmation prompts the user for a yes/no confirmation diff --git a/pkg/model/datetime/datetime.go b/pkg/model/datetime/datetime.go index 2860ad3..6692323 100644 --- a/pkg/model/datetime/datetime.go +++ b/pkg/model/datetime/datetime.go @@ -1,3 +1,18 @@ +// Copyright (c) 2024 Parseable, Inc +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + package datetime import ( diff --git a/pkg/model/tablekeymap.go b/pkg/model/tablekeymap.go index 8b76807..665aa0b 100644 --- a/pkg/model/tablekeymap.go +++ b/pkg/model/tablekeymap.go @@ -1,3 +1,18 @@ +// Copyright (c) 2024 Parseable, Inc +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + package model import ( diff --git a/pkg/model/textareakeymap.go b/pkg/model/textareakeymap.go index 2d43691..7ad4df4 100644 --- a/pkg/model/textareakeymap.go +++ b/pkg/model/textareakeymap.go @@ -1,3 +1,18 @@ +// Copyright (c) 2024 Parseable, Inc +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + package model import (