From 86f486ef25e7a411c9644fe8d99abacc1ba0d0c2 Mon Sep 17 00:00:00 2001 From: Alexandru Claudius Virtopeanu Date: Thu, 9 Jan 2025 12:05:16 +0200 Subject: [PATCH] fix: merge conflicts --- commands/cloudapi-v6/completer/ids.go | 2 +- commands/vpn/ipsec/completer/completer.go | 11 ----------- commands/vpn/wireguard/completer/completer.go | 11 ----------- go.mod | 1 + internal/core/command.go | 1 - 5 files changed, 2 insertions(+), 24 deletions(-) diff --git a/commands/cloudapi-v6/completer/ids.go b/commands/cloudapi-v6/completer/ids.go index 5e97781d6..5dd7c8664 100644 --- a/commands/cloudapi-v6/completer/ids.go +++ b/commands/cloudapi-v6/completer/ids.go @@ -83,7 +83,7 @@ func DatacenterIdsFilterLocation(loc string) []string { return dcIds } -func DataCentersIds() []string { +func DataCentersIds(filters ...func(datacenter ionoscloud.Datacenter) bool) []string { datacenterSvc := resources.NewDataCenterService(client.Must(), context.Background()) datacenters, _, err := datacenterSvc.List(resources.ListQueryParams{}) if err != nil { diff --git a/commands/vpn/ipsec/completer/completer.go b/commands/vpn/ipsec/completer/completer.go index 1c636bd74..d5bdfccec 100644 --- a/commands/vpn/ipsec/completer/completer.go +++ b/commands/vpn/ipsec/completer/completer.go @@ -4,11 +4,8 @@ import ( "context" "github.com/ionos-cloud/ionosctl/v6/internal/client" - "github.com/ionos-cloud/ionosctl/v6/internal/config" - "github.com/ionos-cloud/ionosctl/v6/internal/constants" "github.com/ionos-cloud/ionosctl/v6/pkg/functional" vpn "github.com/ionos-cloud/sdk-go-vpn" - "github.com/spf13/viper" ) // -- GATEWAYS @@ -24,10 +21,6 @@ func GatewaysProperty[V any](f func(gateway vpn.IPSecGatewayRead) V, fs ...Gatew // Gateways returns all distributions matching the given filters func Gateways(fs ...GatewayFilter) (vpn.IPSecGatewayReadList, error) { - if url := config.GetServerUrl(); url == constants.DefaultApiURL || url == "" { - viper.Set(constants.ArgServerUrl, constants.DefaultVPNApiURL) - } - req := client.Must().VPNClient.IPSecGatewaysApi.IpsecgatewaysGet(context.Background()) for _, f := range fs { var err error @@ -57,10 +50,6 @@ func TunnelsProperty[V any](gatewayID string, f func(tunnel vpn.IPSecTunnelRead) // Tunnels returns all distributions matching the given filters func Tunnels(gatewayID string, fs ...TunnelFilter) (vpn.IPSecTunnelReadList, error) { - if url := config.GetServerUrl(); url == constants.DefaultApiURL || url == "" { - viper.Set(constants.ArgServerUrl, constants.DefaultVPNApiURL) - } - req := client.Must().VPNClient.IPSecTunnelsApi.IpsecgatewaysTunnelsGet(context.Background(), gatewayID) for _, f := range fs { var err error diff --git a/commands/vpn/wireguard/completer/completer.go b/commands/vpn/wireguard/completer/completer.go index 29e732d0b..09c279dd1 100644 --- a/commands/vpn/wireguard/completer/completer.go +++ b/commands/vpn/wireguard/completer/completer.go @@ -4,11 +4,8 @@ import ( "context" "github.com/ionos-cloud/ionosctl/v6/internal/client" - "github.com/ionos-cloud/ionosctl/v6/internal/config" - "github.com/ionos-cloud/ionosctl/v6/internal/constants" "github.com/ionos-cloud/ionosctl/v6/pkg/functional" vpn "github.com/ionos-cloud/sdk-go-vpn" - "github.com/spf13/viper" ) // -- GATEWAYS @@ -24,10 +21,6 @@ func GatewaysProperty[V any](f func(gateway vpn.WireguardGatewayRead) V, fs ...G // Gateways returns all distributions matching the given filters func Gateways(fs ...GatewayFilter) (vpn.WireguardGatewayReadList, error) { - if url := config.GetServerUrl(); url == constants.DefaultApiURL || url == "" { - viper.Set(constants.ArgServerUrl, constants.DefaultVPNApiURL) - } - req := client.Must().VPNClient.WireguardGatewaysApi.WireguardgatewaysGet(context.Background()) for _, f := range fs { var err error @@ -59,10 +52,6 @@ func PeersProperty[V any](gatewayID string, f func(peer vpn.WireguardPeerRead) V // Peers returns all distributions matching the given filters func Peers(gatewayID string, fs ...PeerFilter) (vpn.WireguardPeerReadList, error) { - if url := config.GetServerUrl(); url == constants.DefaultApiURL || url == "" { - viper.Set(constants.ArgServerUrl, constants.DefaultVPNApiURL) - } - req := client.Must().VPNClient.WireguardPeersApi.WireguardgatewaysPeersGet(context.Background(), gatewayID) for _, f := range fs { var err error diff --git a/go.mod b/go.mod index 85b43aa48..a30d63365 100644 --- a/go.mod +++ b/go.mod @@ -42,6 +42,7 @@ require ( github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4 github.com/ionos-cloud/sdk-go-cdn v1.1.0 github.com/ionos-cloud/sdk-go-dbaas-mariadb v1.1.1 + github.com/ionos-cloud/sdk-go-kafka v1.1.0 github.com/ionos-cloud/sdk-go-vpn v1.0.1 ) diff --git a/internal/core/command.go b/internal/core/command.go index 224929c0e..2d1da4ad9 100644 --- a/internal/core/command.go +++ b/internal/core/command.go @@ -3,7 +3,6 @@ package core import ( "fmt" "net" - "os" "strings" "time"