Skip to content

Commit

Permalink
Update modules and satisfy new linter warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
majst01 committed Nov 14, 2024
1 parent 7a43db2 commit f807f61
Show file tree
Hide file tree
Showing 4 changed files with 165 additions and 161 deletions.
18 changes: 9 additions & 9 deletions cmd/output/order.go
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ func (s ProjectTablePrinter) Order(data []*models.V1ProjectResponse) {
}

// Order clusterUsage
func (s *ClusterBillingTablePrinter) Order(data []*models.V1ClusterUsage) {
func (s ClusterBillingTablePrinter) Order(data []*models.V1ClusterUsage) {
cols := strings.Split(s.order, ",")
if len(cols) > 0 {
sort.SliceStable(data, func(i, j int) bool {
Expand Down Expand Up @@ -394,7 +394,7 @@ func (s *ClusterBillingTablePrinter) Order(data []*models.V1ClusterUsage) {
}

// Order machineUsage
func (s *MachineBillingTablePrinter) Order(data []*models.V1MachineUsage) {
func (s MachineBillingTablePrinter) Order(data []*models.V1MachineUsage) {
cols := strings.Split(s.order, ",")
if len(cols) > 0 {
sort.SliceStable(data, func(i, j int) bool {
Expand Down Expand Up @@ -492,7 +492,7 @@ func (s *MachineBillingTablePrinter) Order(data []*models.V1MachineUsage) {
}

// Order productOptionUsage
func (s *ProductOptionBillingTablePrinter) Order(data []*models.V1ProductOptionUsage) {
func (s ProductOptionBillingTablePrinter) Order(data []*models.V1ProductOptionUsage) {
cols := strings.Split(s.order, ",")
if len(cols) > 0 {
sort.SliceStable(data, func(i, j int) bool {
Expand Down Expand Up @@ -564,7 +564,7 @@ func (s *ProductOptionBillingTablePrinter) Order(data []*models.V1ProductOptionU
}

// Order s3Usage
func (s *S3BillingTablePrinter) Order(data []*models.V1S3Usage) {
func (s S3BillingTablePrinter) Order(data []*models.V1S3Usage) {
cols := strings.Split(s.order, ",")
if len(cols) > 0 {
sort.SliceStable(data, func(i, j int) bool {
Expand Down Expand Up @@ -675,7 +675,7 @@ func (s *S3BillingTablePrinter) Order(data []*models.V1S3Usage) {
}

// Order containerUsage
func (s *ContainerBillingTablePrinter) Order(data []*models.V1ContainerUsage) {
func (s ContainerBillingTablePrinter) Order(data []*models.V1ContainerUsage) {
cols := strings.Split(s.order, ",")
if len(cols) > 0 {
sort.SliceStable(data, func(i, j int) bool {
Expand Down Expand Up @@ -826,7 +826,7 @@ func (s *ContainerBillingTablePrinter) Order(data []*models.V1ContainerUsage) {
}

// Order ipUsage
func (s *IPBillingTablePrinter) Order(data []*models.V1IPUsage) {
func (s IPBillingTablePrinter) Order(data []*models.V1IPUsage) {
cols := strings.Split(s.order, ",")
if len(cols) > 0 {
sort.SliceStable(data, func(i, j int) bool {
Expand Down Expand Up @@ -906,7 +906,7 @@ func (s *IPBillingTablePrinter) Order(data []*models.V1IPUsage) {
}

// Order volumeUsage
func (s *NetworkTrafficBillingTablePrinter) Order(data []*models.V1NetworkUsage) {
func (s NetworkTrafficBillingTablePrinter) Order(data []*models.V1NetworkUsage) {
cols := strings.Split(s.order, ",")
if len(cols) > 0 {
sort.SliceStable(data, func(i, j int) bool {
Expand Down Expand Up @@ -1004,7 +1004,7 @@ func (s *NetworkTrafficBillingTablePrinter) Order(data []*models.V1NetworkUsage)
}

// Order volumeUsage
func (s *VolumeBillingTablePrinter) Order(data []*models.V1VolumeUsage) {
func (s VolumeBillingTablePrinter) Order(data []*models.V1VolumeUsage) {
cols := strings.Split(s.order, ",")
if len(cols) > 0 {
sort.SliceStable(data, func(i, j int) bool {
Expand Down Expand Up @@ -1102,7 +1102,7 @@ func (s *VolumeBillingTablePrinter) Order(data []*models.V1VolumeUsage) {
}

// Order ipUsage
func (s *PostgresBillingTablePrinter) Order(data []*models.V1PostgresUsage) {
func (s PostgresBillingTablePrinter) Order(data []*models.V1PostgresUsage) {
cols := strings.Split(s.order, ",")
if len(cols) > 0 {
sort.SliceStable(data, func(i, j int) bool {
Expand Down
99 changes: 50 additions & 49 deletions cmd/output/printer.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ func newPrinter(format, order, tpl string, noHeaders bool, writer io.Writer) (Pr
return printer, nil
}

func newTablePrinter(format, order string, noHeaders bool, template *template.Template, writer io.Writer) tablePrinter {
func newTablePrinter(format, order string, noHeaders bool, template *template.Template, writer io.Writer) *tablePrinter {
tp := tablePrinter{
format: format,
wide: false,
Expand Down Expand Up @@ -204,106 +204,107 @@ func newTablePrinter(format, order string, noHeaders bool, template *template.Te
}

tp.table = table
return tp
return &tp
}

func (t tablePrinter) Type() string {
func (t *tablePrinter) Type() string {
return "table"
}

// Print a model in a human readable table
func (t tablePrinter) Print(data interface{}) error {
func (t *tablePrinter) Print(data interface{}) error {
tp := *t
switch d := data.(type) {
case *models.V1AuditResponse:
AuditTablePrinter{t}.Print([]*models.V1AuditResponse{d})
AuditTablePrinter{tp}.Print([]*models.V1AuditResponse{d})
case []*models.V1AuditResponse:
AuditTablePrinter{t}.Print(d)
AuditTablePrinter{tp}.Print(d)
case *models.V1ClusterResponse:
ShootTablePrinter{t}.Print([]*models.V1ClusterResponse{d})
ShootTablePrinter{tp}.Print([]*models.V1ClusterResponse{d})
case []*models.V1ClusterResponse:
ShootTablePrinter{t}.Print(d)
ShootTablePrinter{tp}.Print(d)
case ShootIssuesResponse:
ShootIssuesTablePrinter{t}.Print([]*models.V1ClusterResponse{d})
ShootIssuesTablePrinter{tp}.Print([]*models.V1ClusterResponse{d})
case ShootIssuesResponses:
ShootIssuesTablePrinter{t}.Print(d)
ShootIssuesTablePrinter{tp}.Print(d)
case []*models.V1beta1Condition:
ShootConditionsTablePrinter{t}.Print(d)
ShootConditionsTablePrinter{tp}.Print(d)
case []*models.V1beta1LastError:
ShootLastErrorsTablePrinter{t}.Print(d)
ShootLastErrorsTablePrinter{tp}.Print(d)
case *models.V1beta1LastOperation:
ShootLastOperationTablePrinter{t}.Print(d)
ShootLastOperationTablePrinter{tp}.Print(d)
case *models.V1ProjectResponse:
ProjectTableDetailPrinter{t}.Print(d)
ProjectTableDetailPrinter{tp}.Print(d)
case []*models.V1ProjectResponse:
ProjectTablePrinter{t}.Print(d)
ProjectTablePrinter{tp}.Print(d)
case []*models.V1TenantResponse:
TenantTablePrinter{t}.Print(d)
TenantTablePrinter{tp}.Print(d)
case *models.V1TenantResponse:
TenantTablePrinter{t}.Print([]*models.V1TenantResponse{d})
TenantTablePrinter{tp}.Print([]*models.V1TenantResponse{d})
case *models.RestHealthResponse:
HealthTablePrinter{t}.Print(d)
HealthTablePrinter{tp}.Print(d)
case map[string]models.RestHealthResponse:
HealthTablePrinter{t}.PrintServices(d)
HealthTablePrinter{tp}.PrintServices(d)
case []*models.ModelsV1IPResponse:
IPTablePrinter{t}.Print(d)
IPTablePrinter{tp}.Print(d)
case *models.ModelsV1IPResponse:
IPTablePrinter{t}.Print([]*models.ModelsV1IPResponse{d})
IPTablePrinter{tp}.Print([]*models.ModelsV1IPResponse{d})
case []*models.V1ProjectInfoResponse:
ProjectBillingTablePrinter{t}.Print(d)
ProjectBillingTablePrinter{tp}.Print(d)
case *models.V1ContainerUsageResponse:
ContainerBillingTablePrinter{t}.Print(d)
ContainerBillingTablePrinter{tp}.Print(d)
case *models.V1ClusterUsageResponse:
ClusterBillingTablePrinter{t}.Print(d)
ClusterBillingTablePrinter{tp}.Print(d)
case *models.V1MachineUsageResponse:
MachineBillingTablePrinter{t}.Print(d)
MachineBillingTablePrinter{tp}.Print(d)
case *models.V1ProductOptionUsageResponse:
ProductOptionBillingTablePrinter{t}.Print(d)
ProductOptionBillingTablePrinter{tp}.Print(d)
case *models.V1IPUsageResponse:
IPBillingTablePrinter{t}.Print(d)
IPBillingTablePrinter{tp}.Print(d)
case *models.V1NetworkUsageResponse:
NetworkTrafficBillingTablePrinter{t}.Print(d)
NetworkTrafficBillingTablePrinter{tp}.Print(d)
case *models.V1S3UsageResponse:
S3BillingTablePrinter{t}.Print(d)
S3BillingTablePrinter{tp}.Print(d)
case *models.V1VolumeUsageResponse:
VolumeBillingTablePrinter{t}.Print(d)
VolumeBillingTablePrinter{tp}.Print(d)
case *models.V1PostgresUsageResponse:
PostgresBillingTablePrinter{t}.Print(d)
PostgresBillingTablePrinter{tp}.Print(d)
case []*models.ModelsV1MachineResponse:
MachineTablePrinter{t}.Print(d)
MachineTablePrinter{tp}.Print(d)
case []*models.V1S3Response:
S3TablePrinter{t}.Print(d)
S3TablePrinter{tp}.Print(d)
case *models.V1VolumeResponse:
VolumeTablePrinter{t}.Print([]*models.V1VolumeResponse{d})
VolumeTablePrinter{tp}.Print([]*models.V1VolumeResponse{d})
case []*models.V1VolumeResponse:
VolumeTablePrinter{t}.Print(d)
VolumeTablePrinter{tp}.Print(d)
case []*models.V1SnapshotResponse:
SnapshotTablePrinter{t}.Print(d)
SnapshotTablePrinter{tp}.Print(d)
case *models.V1SnapshotResponse:
SnapshotTablePrinter{t}.Print(pointer.WrapInSlice(d))
SnapshotTablePrinter{tp}.Print(pointer.WrapInSlice(d))
case []*models.V1QoSPolicyResponse:
QoSPolicyTablePrinter{t}.Print(d)
QoSPolicyTablePrinter{tp}.Print(d)
case *models.V1QoSPolicyResponse:
QoSPolicyTablePrinter{t}.Print(pointer.WrapInSlice(d))
QoSPolicyTablePrinter{tp}.Print(pointer.WrapInSlice(d))
case []*models.V1StorageClusterInfo:
VolumeClusterInfoTablePrinter{t}.Print(d)
VolumeClusterInfoTablePrinter{tp}.Print(d)
case models.V1PostgresPartitionsResponse:
PostgresPartitionsTablePrinter{t}.Print(d)
PostgresPartitionsTablePrinter{tp}.Print(d)
case []*models.V1PostgresVersion:
PostgresVersionsTablePrinter{t}.Print(d)
PostgresVersionsTablePrinter{tp}.Print(d)
case *models.V1PostgresResponse:
PostgresTablePrinter{t}.Print([]*models.V1PostgresResponse{d})
PostgresTablePrinter{tp}.Print([]*models.V1PostgresResponse{d})
case []*models.V1PostgresResponse:
PostgresTablePrinter{t}.Print(d)
PostgresTablePrinter{tp}.Print(d)
case []*models.V1PostgresBackupConfigResponse:
PostgresBackupsTablePrinter{t}.Print(d)
PostgresBackupsTablePrinter{tp}.Print(d)
case *models.V1PostgresBackupConfigResponse:
PostgresBackupsTablePrinter{t}.Print([]*models.V1PostgresBackupConfigResponse{d})
PostgresBackupsTablePrinter{tp}.Print([]*models.V1PostgresBackupConfigResponse{d})
case []*models.V1PostgresBackupEntry:
PostgresBackupEntryTablePrinter{t}.Print(d)
PostgresBackupEntryTablePrinter{tp}.Print(d)
case []*models.V1S3PartitionResponse:
S3PartitionTablePrinter{t}.Print(d)
S3PartitionTablePrinter{tp}.Print(d)
case *api.Contexts:
ContextPrinter{t}.Print(d)
ContextPrinter{tp}.Print(d)
default:
return fmt.Errorf("unknown table printer for type: %T", d)
}
Expand Down
67 changes: 34 additions & 33 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
module github.com/fi-ts/cloudctl

go 1.23.0
go 1.23.1

toolchain go1.23.3

require (
github.com/Masterminds/semver/v3 v3.3.0
github.com/dcorbe/termui-dpc v0.0.0-20211125210512-9d2673a82dd6
github.com/dustin/go-humanize v1.0.1
github.com/fatih/color v1.17.0
github.com/fatih/color v1.18.0
github.com/fi-ts/accounting-go v0.11.0
github.com/fi-ts/cloud-go v0.29.4
github.com/gardener/gardener v1.91.0
Expand All @@ -18,9 +20,9 @@ require (
github.com/google/go-cmp v0.6.0
github.com/gosimple/slug v1.14.0
github.com/jinzhu/now v1.1.5
github.com/metal-stack/duros-go v0.5.1
github.com/metal-stack/metal-go v0.37.2
github.com/metal-stack/metal-lib v0.18.4
github.com/metal-stack/duros-go v0.5.2
github.com/metal-stack/metal-go v0.39.4
github.com/metal-stack/metal-lib v0.19.0
github.com/metal-stack/updater v1.2.2
github.com/metal-stack/v v1.0.3
github.com/olekukonko/tablewriter v0.0.5
Expand All @@ -30,10 +32,10 @@ require (
github.com/spf13/viper v1.19.0
github.com/stretchr/testify v1.9.0
github.com/undefinedlabs/go-mpatch v1.0.7
golang.org/x/sync v0.8.0
golang.org/x/sync v0.9.0
gopkg.in/yaml.v3 v3.0.1
k8s.io/api v0.30.3
k8s.io/apimachinery v0.31.0
k8s.io/api v0.31.2
k8s.io/apimachinery v0.31.2
sigs.k8s.io/yaml v1.4.0
)

Expand Down Expand Up @@ -91,7 +93,7 @@ require (
github.com/goccy/go-yaml v1.12.0 // indirect
github.com/godbus/dbus/v5 v5.1.1-0.20230522191255-76236955d466 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang-jwt/jwt/v4 v4.5.0 // indirect
github.com/golang-jwt/jwt/v5 v5.2.1 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/btree v1.1.2 // indirect
Expand All @@ -108,7 +110,7 @@ require (
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/hdevalence/ed25519consensus v0.2.0 // indirect
github.com/icza/dyno v0.0.0-20230330125955-09f820a8d9c0 // indirect
github.com/illarion/gonotify v1.0.1 // indirect
github.com/illarion/gonotify/v2 v2.0.3 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/insomniacslk/dhcp v0.0.0-20240204152450-ca2dc33955c1 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
Expand All @@ -123,7 +125,7 @@ require (
github.com/lestrrat-go/httpcc v1.0.1 // indirect
github.com/lestrrat-go/httprc v1.0.6 // indirect
github.com/lestrrat-go/iter v1.0.2 // indirect
github.com/lestrrat-go/jwx/v2 v2.1.1 // indirect
github.com/lestrrat-go/jwx/v2 v2.1.2 // indirect
github.com/lestrrat-go/option v1.0.1 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
Expand All @@ -134,7 +136,7 @@ require (
github.com/mdlayher/netlink v1.7.2 // indirect
github.com/mdlayher/sdnotify v1.0.0 // indirect
github.com/mdlayher/socket v0.5.0 // indirect
github.com/metal-stack/security v0.8.1 // indirect
github.com/metal-stack/security v0.9.0 // indirect
github.com/miekg/dns v1.1.58 // indirect
github.com/mitchellh/go-ps v1.0.0 // indirect
github.com/mitchellh/go-wordwrap v1.0.1 // indirect
Expand Down Expand Up @@ -162,38 +164,37 @@ require (
github.com/tailscale/golang-x-crypto v0.0.0-20240604161659-3fde5e568aa4 // indirect
github.com/tailscale/goupnp v1.0.1-0.20210804011211-c64d0f06ea05 // indirect
github.com/tailscale/hujson v0.0.0-20221223112325-20486734a56a // indirect
github.com/tailscale/netlink v1.1.1-0.20211101221916-cabfb018fe85 // indirect
github.com/tailscale/netlink v1.1.1-0.20240822203006-4d49adab4de7 // indirect
github.com/tailscale/peercred v0.0.0-20240214030740-b535050b2aa4 // indirect
github.com/tailscale/web-client-prebuilt v0.0.0-20240226180453-5db17b287bf1 // indirect
github.com/tailscale/wireguard-go v0.0.0-20240731203015-71393c576b98 // indirect
github.com/tailscale/wireguard-go v0.0.0-20240905161824-799c1978fafc // indirect
github.com/tcnksm/go-httpstat v0.2.0 // indirect
github.com/u-root/uio v0.0.0-20240209044354-b3d14b93376a // indirect
github.com/vishvananda/netlink v1.2.1-beta.2 // indirect
github.com/vishvananda/netns v0.0.4 // indirect
github.com/x448/float16 v0.8.4 // indirect
go.mongodb.org/mongo-driver v1.16.1 // indirect
go.opentelemetry.io/otel v1.30.0 // indirect
go.opentelemetry.io/otel/metric v1.30.0 // indirect
go.opentelemetry.io/otel/trace v1.30.0 // indirect
go.mongodb.org/mongo-driver v1.17.1 // indirect
go.opentelemetry.io/otel v1.32.0 // indirect
go.opentelemetry.io/otel/metric v1.32.0 // indirect
go.opentelemetry.io/otel/trace v1.32.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
go4.org/mem v0.0.0-20220726221520-4f986261bf13 // indirect
go4.org/netipx v0.0.0-20231129151722-fdeea329fbba // indirect
golang.org/x/crypto v0.28.0 // indirect
golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 // indirect
golang.org/x/mod v0.21.0 // indirect
golang.org/x/net v0.30.0 // indirect
golang.org/x/oauth2 v0.23.0 // indirect
golang.org/x/sys v0.26.0 // indirect
golang.org/x/term v0.25.0 // indirect
golang.org/x/text v0.19.0 // indirect
golang.org/x/time v0.7.0 // indirect
golang.org/x/tools v0.26.0 // indirect
golang.org/x/crypto v0.29.0 // indirect
golang.org/x/exp v0.0.0-20241108190413-2d47ceb2692f // indirect
golang.org/x/mod v0.22.0 // indirect
golang.org/x/net v0.31.0 // indirect
golang.org/x/oauth2 v0.24.0 // indirect
golang.org/x/sys v0.27.0 // indirect
golang.org/x/term v0.26.0 // indirect
golang.org/x/text v0.20.0 // indirect
golang.org/x/time v0.8.0 // indirect
golang.org/x/tools v0.27.0 // indirect
golang.org/x/xerrors v0.0.0-20240903120638-7835f813f4da // indirect
golang.zx2c4.com/wintun v0.0.0-20230126152724-0fa3db229ce2 // indirect
golang.zx2c4.com/wireguard/windows v0.5.3 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 // indirect
google.golang.org/grpc v1.67.1 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20241113202542-65e8d215514f // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20241113202542-65e8d215514f // indirect
google.golang.org/grpc v1.68.0 // indirect
google.golang.org/protobuf v1.35.1 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
Expand All @@ -203,5 +204,5 @@ require (
k8s.io/utils v0.0.0-20240902221715-702e33fdd3c3 // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
tailscale.com v1.72.1 // indirect
tailscale.com v1.76.6 // indirect
)
Loading

0 comments on commit f807f61

Please sign in to comment.