Skip to content

Commit

Permalink
Merge pull request #49 from inexio/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
Lostboi authored Jun 11, 2021
2 parents 1c6f073 + caacf25 commit c867864
Show file tree
Hide file tree
Showing 130 changed files with 249 additions and 187 deletions.
2 changes: 1 addition & 1 deletion api/rate_limiter.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package api

import (
"github.com/inexio/thola/core/tholaerr"
"github.com/inexio/thola/internal/tholaerr"
"github.com/labstack/echo/v4"
"github.com/rs/zerolog/log"
"github.com/spf13/viper"
Expand Down
6 changes: 3 additions & 3 deletions api/request_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import (
"crypto/subtle"
"fmt"
"github.com/inexio/thola/api/statistics"
"github.com/inexio/thola/core/database"
"github.com/inexio/thola/core/request"
"github.com/inexio/thola/core/tholaerr"
"github.com/inexio/thola/internal/database"
"github.com/inexio/thola/internal/request"
"github.com/inexio/thola/internal/tholaerr"
"github.com/labstack/echo/v4"
"github.com/labstack/echo/v4/middleware"
"github.com/rs/zerolog/log"
Expand Down
2 changes: 1 addition & 1 deletion cmd/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package cmd
import (
"fmt"
"github.com/inexio/go-monitoringplugin"
"github.com/inexio/thola/core/request"
"github.com/inexio/thola/internal/request"
"github.com/rs/zerolog"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
Expand Down
2 changes: 1 addition & 1 deletion cmd/check_cpu_load.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package cmd

import (
"github.com/inexio/thola/core/request"
"github.com/inexio/thola/internal/request"
"github.com/spf13/cobra"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/check_disk.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package cmd

import (
"github.com/inexio/thola/core/request"
"github.com/inexio/thola/internal/request"
"github.com/spf13/cobra"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/check_hardware_health.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package cmd

import (
"github.com/inexio/thola/core/request"
"github.com/inexio/thola/internal/request"
"github.com/spf13/cobra"
)

Expand Down
6 changes: 3 additions & 3 deletions cmd/check_identify.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package cmd

import (
"github.com/inexio/thola/core/device"
"github.com/inexio/thola/core/request"
"github.com/inexio/thola/core/utility"
"github.com/inexio/thola/internal/device"
"github.com/inexio/thola/internal/request"
"github.com/inexio/thola/internal/utility"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"log"
Expand Down
2 changes: 1 addition & 1 deletion cmd/check_interface_metrics.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package cmd

import (
"github.com/inexio/thola/core/request"
"github.com/inexio/thola/internal/request"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
)
Expand Down
2 changes: 1 addition & 1 deletion cmd/check_memory_usage.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package cmd

import (
"github.com/inexio/thola/core/request"
"github.com/inexio/thola/internal/request"
"github.com/spf13/cobra"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/check_sbc.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package cmd

import (
"github.com/inexio/thola/core/request"
"github.com/inexio/thola/internal/request"
"github.com/spf13/cobra"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/check_server.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package cmd

import (
"github.com/inexio/thola/core/request"
"github.com/inexio/thola/internal/request"
"github.com/spf13/cobra"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/check_snmp.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package cmd

import (
"github.com/inexio/thola/core/request"
"github.com/inexio/thola/internal/request"
"github.com/spf13/cobra"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/check_thola_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
package cmd

import (
"github.com/inexio/thola/core/request"
"github.com/inexio/thola/internal/request"
"github.com/spf13/cobra"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/check_ups.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package cmd

import (
"github.com/inexio/thola/core/request"
"github.com/inexio/thola/internal/request"
"github.com/spf13/cobra"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/identify.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package cmd

import (
"github.com/inexio/thola/core/request"
"github.com/inexio/thola/internal/request"
"github.com/spf13/cobra"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/read.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package cmd

import (
"fmt"
"github.com/inexio/thola/core/request"
"github.com/inexio/thola/internal/request"
"github.com/spf13/cobra"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/read_available_components.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package cmd

import (
"github.com/inexio/thola/core/request"
"github.com/inexio/thola/internal/request"
"github.com/spf13/cobra"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/read_count_interfaces.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package cmd

import (
"github.com/inexio/thola/core/request"
"github.com/inexio/thola/internal/request"
"github.com/spf13/cobra"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/read_cpu_load.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package cmd

import (
"github.com/inexio/thola/core/request"
"github.com/inexio/thola/internal/request"
"github.com/spf13/cobra"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/read_disk.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package cmd

import (
"github.com/inexio/thola/core/request"
"github.com/inexio/thola/internal/request"
"github.com/spf13/cobra"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/read_hardware_health.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package cmd

import (
"github.com/inexio/thola/core/request"
"github.com/inexio/thola/internal/request"
"github.com/spf13/cobra"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/read_interfaces.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package cmd

import (
"github.com/inexio/thola/core/request"
"github.com/inexio/thola/internal/request"
"github.com/spf13/cobra"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/read_memory_usage.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package cmd

import (
"github.com/inexio/thola/core/request"
"github.com/inexio/thola/internal/request"
"github.com/spf13/cobra"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/read_sbc.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package cmd

import (
"github.com/inexio/thola/core/request"
"github.com/inexio/thola/internal/request"
"github.com/spf13/cobra"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/read_server.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package cmd

import (
"github.com/inexio/thola/core/request"
"github.com/inexio/thola/internal/request"
"github.com/spf13/cobra"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/read_ups.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package cmd

import (
"github.com/inexio/thola/core/request"
"github.com/inexio/thola/internal/request"
"github.com/spf13/cobra"
)

Expand Down
14 changes: 7 additions & 7 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ package cmd
import (
"context"
"fmt"
"github.com/inexio/thola/core/database"
"github.com/inexio/thola/core/parser"
"github.com/inexio/thola/core/request"
"github.com/inexio/thola/doc"
"github.com/inexio/thola/internal/database"
"github.com/inexio/thola/internal/parser"
"github.com/inexio/thola/internal/request"
"github.com/pkg/errors"
"github.com/rs/xid"
"github.com/rs/zerolog"
Expand All @@ -26,9 +26,9 @@ func init() {

cobra.OnInitialize(initConfig)

rootCMD.PersistentFlags().StringVar(&cfgFile, "config", "", "The location of the config file")
rootCMD.PersistentFlags().String("loglevel", "error", "The loglevel")
rootCMD.PersistentFlags().String("format", "pretty", "Output format ('json', 'xml' or 'pretty')")
rootCMD.PersistentFlags().StringVarP(&cfgFile, "config", "c", "", "The location of the config file")
rootCMD.PersistentFlags().StringP("loglevel", "l", "error", "The loglevel")
rootCMD.PersistentFlags().StringP("format", "f", "pretty", "Output format ('json', 'xml' or 'pretty')")
rootCMD.PersistentFlags().String("db-drivername", "built-in", "Database type for caching ('built-in', 'mysql' or 'redis' supported)")
rootCMD.PersistentFlags().String("db-duration", "60m", "Duration in which the cache stays valid")
rootCMD.PersistentFlags().String("sql-datasourcename", "", "Data sourcename if using a sql driver")
Expand All @@ -40,7 +40,7 @@ func init() {
rootCMD.PersistentFlags().Bool("db-rebuild", false, "Rebuild the cache DB")
rootCMD.PersistentFlags().Bool("no-cache", false, "Don't use a database cache")
rootCMD.PersistentFlags().Bool("ignore-db-failure", false, "Ignore the cache if the database fails")
rootCMD.Flags().Bool("version", false, "Prints the version of Thola")
rootCMD.Flags().BoolP("version", "v", false, "Prints the version of Thola")

err := viper.BindPFlag("config", rootCMD.PersistentFlags().Lookup("config"))
if err != nil {
Expand Down
12 changes: 6 additions & 6 deletions cmd/root_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ package cmd
import (
"context"
"fmt"
"github.com/inexio/thola/core/parser"
"github.com/inexio/thola/core/request"
"github.com/inexio/thola/doc"
"github.com/inexio/thola/internal/parser"
"github.com/inexio/thola/internal/request"
"github.com/pkg/errors"
"github.com/rs/xid"
"github.com/rs/zerolog"
Expand All @@ -20,16 +20,16 @@ import (
func init() {
log.Logger = zerolog.New(zerolog.ConsoleWriter{Out: os.Stderr}).With().Timestamp().Logger()

rootCMD.PersistentFlags().String("loglevel", "error", "The loglevel")
rootCMD.PersistentFlags().String("format", "pretty", "Output format ('json', 'xml' or 'pretty')")
rootCMD.PersistentFlags().String("target-api", "", "The URL of the target API")
rootCMD.PersistentFlags().StringP("loglevel", "l", "error", "The loglevel")
rootCMD.PersistentFlags().StringP("format", "f", "pretty", "Output format ('json', 'xml' or 'pretty')")
rootCMD.PersistentFlags().StringP("target-api", "t", "", "The URL of the target API")
rootCMD.PersistentFlags().String("target-api-username", "", "The username for authorization on the target API")
rootCMD.PersistentFlags().String("target-api-password", "", "The password for authorization on the target API")
rootCMD.PersistentFlags().String("target-api-format", "json", "The format of the target API ('json' or 'xml')")

rootCMD.PersistentFlags().Bool("insecure-ssl-cert", false, "Allow insecure SSL certificate of the target API")

rootCMD.Flags().Bool("version", false, "Prints the version of Thola")
rootCMD.Flags().BoolP("version", "v", false, "Prints the version of Thola")

err := rootCMD.MarkPersistentFlagRequired("target-api")
if err != nil {
Expand Down
8 changes: 4 additions & 4 deletions cmd/shared.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ package cmd
import (
"context"
"fmt"
"github.com/inexio/thola/core/network"
"github.com/inexio/thola/core/parser"
"github.com/inexio/thola/core/request"
"github.com/inexio/thola/core/utility"
"github.com/inexio/thola/internal/network"
"github.com/inexio/thola/internal/parser"
"github.com/inexio/thola/internal/request"
"github.com/inexio/thola/internal/utility"
"github.com/rs/zerolog/log"
"github.com/spf13/viper"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package codecommunicator
import (
"context"
"fmt"
"github.com/inexio/thola/core/device"
"github.com/inexio/thola/core/network"
"github.com/inexio/thola/internal/device"
"github.com/inexio/thola/internal/network"
"github.com/pkg/errors"
"github.com/rs/zerolog/log"
"github.com/shopspring/decimal"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package codecommunicator

import (
"context"
"github.com/inexio/thola/core/device"
"github.com/inexio/thola/internal/device"
"github.com/pkg/errors"
"regexp"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package codecommunicator
import (
"context"
"fmt"
"github.com/inexio/thola/core/communicator/communicator"
"github.com/inexio/thola/core/device"
"github.com/inexio/thola/core/tholaerr"
"github.com/inexio/thola/internal/communicator/communicator"
"github.com/inexio/thola/internal/device"
"github.com/inexio/thola/internal/tholaerr"
"github.com/pkg/errors"
)

Expand All @@ -17,7 +17,7 @@ type codeCommunicator struct {
// GetCodeCommunicator returns the code communicator for the given device class
func GetCodeCommunicator(deviceClass communicator.Communicator, parentNetworkDeviceCommunicator communicator.Communicator) (communicator.Functions, error) {
if deviceClass == nil {
return nil, errors.New("device class is nil")
return nil, errors.New("device class is empty")
}
var base = codeCommunicator{
deviceClass: deviceClass,
Expand All @@ -44,7 +44,7 @@ func GetCodeCommunicator(deviceClass communicator.Communicator, parentNetworkDev
case "timos":
return &timosCommunicator{base}, nil
}
return nil, tholaerr.NewNotFoundError(fmt.Sprintf("no communicator found for device class identifier '%s'", classIdentifier))
return nil, tholaerr.NewNotFoundError(fmt.Sprintf("no code communicator found for device class identifier '%s'", classIdentifier))
}

func (c *codeCommunicator) GetVendor(_ context.Context) (string, error) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package codecommunicator
import (
"context"
"fmt"
"github.com/inexio/thola/core/device"
"github.com/inexio/thola/core/network"
"github.com/inexio/thola/internal/device"
"github.com/inexio/thola/internal/network"
"github.com/pkg/errors"
"github.com/rs/zerolog/log"
"strings"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package codecommunicator

import (
"context"
"github.com/inexio/thola/core/device"
"github.com/inexio/thola/core/network"
"github.com/inexio/thola/internal/device"
"github.com/inexio/thola/internal/network"
"github.com/pkg/errors"
"math"
)
Expand Down
Loading

0 comments on commit c867864

Please sign in to comment.