diff --git a/commands/cdn/cdn.go b/commands/cdn/cdn.go index 8e7ed19be..0ac632a8b 100644 --- a/commands/cdn/cdn.go +++ b/commands/cdn/cdn.go @@ -2,6 +2,7 @@ package cdn import ( "github.com/ionos-cloud/ionosctl/v6/commands/cdn/distribution" + "github.com/ionos-cloud/ionosctl/v6/internal/constants" "github.com/ionos-cloud/ionosctl/v6/internal/core" "github.com/spf13/cobra" ) @@ -15,5 +16,6 @@ func Command() *core.Command { }, } cmd.AddCommand(distribution.Command()) - return cmd + + return core.WithRegionalFlags(cmd, constants.CDNApiRegionalURL, constants.CDNLocations) } diff --git a/commands/cdn/completer/completer.go b/commands/cdn/completer/completer.go index 98d7eab1e..66bbc5259 100644 --- a/commands/cdn/completer/completer.go +++ b/commands/cdn/completer/completer.go @@ -2,6 +2,7 @@ package completer import ( "context" + "github.com/ionos-cloud/ionosctl/v6/internal/client" "github.com/ionos-cloud/ionosctl/v6/pkg/functional" cdn "github.com/ionos-cloud/sdk-go-cdn" diff --git a/commands/cdn/distribution/create.go b/commands/cdn/distribution/create.go index 3be7b0618..c4c53b2c4 100644 --- a/commands/cdn/distribution/create.go +++ b/commands/cdn/distribution/create.go @@ -4,6 +4,8 @@ import ( "context" "encoding/json" "fmt" + "os" + "github.com/ionos-cloud/ionosctl/v6/internal/client" "github.com/ionos-cloud/ionosctl/v6/internal/constants" "github.com/ionos-cloud/ionosctl/v6/internal/core" @@ -11,7 +13,6 @@ import ( "github.com/ionos-cloud/ionosctl/v6/pkg/uuidgen" cdn "github.com/ionos-cloud/sdk-go-cdn" "github.com/spf13/viper" - "os" ) func Create() *core.Command { diff --git a/commands/cdn/distribution/delete.go b/commands/cdn/distribution/delete.go index 63e6ee920..b1e86a27a 100644 --- a/commands/cdn/distribution/delete.go +++ b/commands/cdn/distribution/delete.go @@ -3,13 +3,13 @@ package distribution import ( "context" "fmt" + "github.com/ionos-cloud/ionosctl/v6/commands/cdn/completer" "github.com/ionos-cloud/ionosctl/v6/internal/client" "github.com/ionos-cloud/ionosctl/v6/internal/constants" "github.com/ionos-cloud/ionosctl/v6/pkg/confirm" "github.com/ionos-cloud/ionosctl/v6/pkg/functional" cdn "github.com/ionos-cloud/sdk-go-cdn" - "github.com/spf13/cobra" "github.com/spf13/viper" "github.com/ionos-cloud/ionosctl/v6/internal/core" @@ -41,12 +41,14 @@ func Delete() *core.Command { InitClient: true, }) - cmd.AddStringFlag(constants.FlagCDNDistributionID, constants.FlagIdShort, "", "The ID of the distribution you want to retrieve", core.RequiredFlagOption()) - _ = cmd.Command.RegisterFlagCompletionFunc(constants.FlagCDNDistributionID, func(c *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - return completer.DistributionsProperty(func(r cdn.Distribution) string { - return *r.Id - }), cobra.ShellCompDirectiveNoFileComp - }) + cmd.AddStringFlag(constants.FlagCDNDistributionID, constants.FlagIdShort, "", "The ID of the distribution you want to delete", + core.RequiredFlagOption(), + core.WithCompletion(func() []string { + return completer.DistributionsProperty(func(r cdn.Distribution) string { + return *r.Id + }) + }, constants.CDNApiRegionalURL), + ) cmd.AddBoolFlag(constants.ArgAll, constants.ArgAllShort, false, "Delete all records if set", core.RequiredFlagOption()) cmd.Command.SilenceUsage = true diff --git a/commands/cdn/distribution/get.go b/commands/cdn/distribution/get.go index 47b29f7c3..38530416f 100644 --- a/commands/cdn/distribution/get.go +++ b/commands/cdn/distribution/get.go @@ -3,16 +3,15 @@ package distribution import ( "context" "fmt" - "github.com/ionos-cloud/ionosctl/v6/commands/cdn/completer" - cdn "github.com/ionos-cloud/sdk-go-cdn" - "github.com/spf13/cobra" + "github.com/ionos-cloud/ionosctl/v6/commands/cdn/completer" "github.com/ionos-cloud/ionosctl/v6/internal/client" "github.com/ionos-cloud/ionosctl/v6/internal/constants" "github.com/ionos-cloud/ionosctl/v6/internal/core" "github.com/ionos-cloud/ionosctl/v6/internal/printer/json2table/jsonpaths" "github.com/ionos-cloud/ionosctl/v6/internal/printer/jsontabwriter" "github.com/ionos-cloud/ionosctl/v6/internal/printer/tabheaders" + cdn "github.com/ionos-cloud/sdk-go-cdn" "github.com/spf13/viper" ) @@ -52,12 +51,15 @@ func FindByID() *core.Command { }, InitClient: true, }) - cmd.AddStringFlag(constants.FlagCDNDistributionID, constants.FlagIdShort, "", "The ID of the distribution you want to retrieve", core.RequiredFlagOption()) - _ = cmd.Command.RegisterFlagCompletionFunc(constants.FlagCDNDistributionID, func(c *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - return completer.DistributionsProperty(func(r cdn.Distribution) string { - return *r.Id - }), cobra.ShellCompDirectiveNoFileComp - }) + + cmd.AddStringFlag(constants.FlagCDNDistributionID, constants.FlagIdShort, "", "The ID of the distribution you want to retrieve", + core.RequiredFlagOption(), + core.WithCompletion(func() []string { + return completer.DistributionsProperty(func(r cdn.Distribution) string { + return *r.Id + }) + }, constants.CDNApiRegionalURL), + ) cmd.Command.SilenceUsage = true cmd.Command.Flags().SortFlags = false return cmd diff --git a/commands/cdn/distribution/list.go b/commands/cdn/distribution/list.go index e500797d9..8418f4eac 100644 --- a/commands/cdn/distribution/list.go +++ b/commands/cdn/distribution/list.go @@ -3,6 +3,7 @@ package distribution import ( "context" "fmt" + "github.com/ionos-cloud/ionosctl/v6/commands/cdn/completer" "github.com/ionos-cloud/ionosctl/v6/internal/constants" "github.com/ionos-cloud/ionosctl/v6/internal/core" diff --git a/commands/cdn/distribution/routingrules/routing_rules.go b/commands/cdn/distribution/routingrules/routing_rules.go index d2c09acf3..457696c70 100644 --- a/commands/cdn/distribution/routingrules/routing_rules.go +++ b/commands/cdn/distribution/routingrules/routing_rules.go @@ -3,6 +3,7 @@ package routingrules import ( "context" "fmt" + "github.com/ionos-cloud/ionosctl/v6/commands/cdn/completer" "github.com/ionos-cloud/ionosctl/v6/internal/client" "github.com/ionos-cloud/ionosctl/v6/internal/constants" @@ -78,12 +79,14 @@ func GetDistributionRoutingRules() *core.Command { }, InitClient: true, }) - cmd.AddStringFlag(constants.FlagCDNDistributionID, constants.FlagIdShort, "", "The ID of the distribution you want to retrieve", core.RequiredFlagOption()) - _ = cmd.Command.RegisterFlagCompletionFunc(constants.FlagCDNDistributionID, func(c *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - return completer.DistributionsProperty(func(r cdn.Distribution) string { - return *r.Id - }), cobra.ShellCompDirectiveNoFileComp - }) + cmd.AddStringFlag(constants.FlagCDNDistributionID, constants.FlagIdShort, "", "The ID of the distribution", + core.RequiredFlagOption(), + core.WithCompletion(func() []string { + return completer.DistributionsProperty(func(r cdn.Distribution) string { + return *r.Id + }) + }, constants.CDNApiRegionalURL), + ) cmd.Command.SilenceUsage = true cmd.Command.Flags().SortFlags = false return cmd diff --git a/commands/cdn/distribution/update.go b/commands/cdn/distribution/update.go index f2ff4305f..29d149b5e 100644 --- a/commands/cdn/distribution/update.go +++ b/commands/cdn/distribution/update.go @@ -3,9 +3,8 @@ package distribution import ( "context" "fmt" - "github.com/ionos-cloud/ionosctl/v6/commands/cdn/completer" - "github.com/spf13/cobra" + "github.com/ionos-cloud/ionosctl/v6/commands/cdn/completer" "github.com/ionos-cloud/ionosctl/v6/internal/client" "github.com/ionos-cloud/ionosctl/v6/internal/constants" "github.com/ionos-cloud/ionosctl/v6/internal/printer/json2table/jsonpaths" @@ -49,12 +48,14 @@ func Update() *core.Command { InitClient: true, }) - cmd.AddStringFlag(constants.FlagCDNDistributionID, constants.FlagIdShort, "", "The ID of the CDN distribution", core.RequiredFlagOption()) - _ = cmd.Command.RegisterFlagCompletionFunc(constants.FlagCDNDistributionID, func(c *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - return completer.DistributionsProperty(func(r cdn.Distribution) string { - return *r.Id - }), cobra.ShellCompDirectiveNoFileComp - }) + cmd.AddStringFlag(constants.FlagCDNDistributionID, constants.FlagIdShort, "", "The ID of the distribution you want to update", + core.RequiredFlagOption(), + core.WithCompletion(func() []string { + return completer.DistributionsProperty(func(r cdn.Distribution) string { + return *r.Id + }) + }, constants.CDNApiRegionalURL), + ) cmd.Command.SilenceUsage = true cmd.Command.Flags().SortFlags = false diff --git a/commands/dbaas/mariadb/backup/backup.go b/commands/dbaas/mariadb/backup/backup.go index 32af38ff9..843d4b83d 100644 --- a/commands/dbaas/mariadb/backup/backup.go +++ b/commands/dbaas/mariadb/backup/backup.go @@ -5,6 +5,7 @@ import ( "github.com/ionos-cloud/ionosctl/v6/commands/dbaas/mariadb/cluster" "github.com/ionos-cloud/ionosctl/v6/internal/printer/tabheaders" + "github.com/ionos-cloud/ionosctl/v6/pkg/functional" ionoscloud "github.com/ionos-cloud/sdk-go-dbaas-mariadb" "github.com/ionos-cloud/ionosctl/v6/internal/client" @@ -73,3 +74,11 @@ func FilterPaginationFlags(c *core.CommandConfig) Filter { return req } } + +func BackupsProperty[V any](f func(c ionoscloud.BackupResponse) V, fs ...Filter) []V { + recs, err := Backups(fs...) + if err != nil { + return nil + } + return functional.Map(*recs.Items, f) +} diff --git a/commands/dbaas/mariadb/backup/get.go b/commands/dbaas/mariadb/backup/get.go index a52f15cc1..bdd203ef1 100644 --- a/commands/dbaas/mariadb/backup/get.go +++ b/commands/dbaas/mariadb/backup/get.go @@ -4,6 +4,8 @@ import ( "context" "fmt" + ionoscloud "github.com/ionos-cloud/sdk-go-dbaas-mariadb" + "github.com/ionos-cloud/ionosctl/v6/internal/client" "github.com/ionos-cloud/ionosctl/v6/internal/constants" "github.com/ionos-cloud/ionosctl/v6/internal/core" @@ -46,7 +48,17 @@ func Get() *core.Command { InitClient: true, }) - cmd.AddStringFlag(constants.FlagBackupId, "", "", "The ID of the Backup to be retrieved") - + cmd.AddStringFlag(constants.FlagBackupId, "", "", "The ID of the Backup to be retrieved", + core.RequiredFlagOption(), + core.WithCompletion( + func() []string { + return BackupsProperty(func(c ionoscloud.BackupResponse) string { + if c.Id == nil { + return "" + } + return *c.Id + "\t" + fmt.Sprintf("(%d MiB)", *c.Properties.Size) + }) + }, constants.MariaDBApiRegionalURL), + ) return cmd } diff --git a/commands/dbaas/mariadb/backup/list.go b/commands/dbaas/mariadb/backup/list.go index c3d2f9dd7..67ad82c3b 100644 --- a/commands/dbaas/mariadb/backup/list.go +++ b/commands/dbaas/mariadb/backup/list.go @@ -12,7 +12,6 @@ import ( "github.com/ionos-cloud/ionosctl/v6/internal/printer/jsontabwriter" "github.com/ionos-cloud/ionosctl/v6/internal/printer/tabheaders" ionoscloud "github.com/ionos-cloud/sdk-go-dbaas-mariadb" - "github.com/spf13/cobra" "github.com/spf13/viper" ) @@ -58,15 +57,18 @@ func List() *core.Command { InitClient: true, }) - cmd.AddStringFlag(constants.FlagClusterId, constants.FlagIdShort, "", "Optionally limit shown backups to those of a certain cluster") - _ = cmd.Command.RegisterFlagCompletionFunc(constants.FlagClusterId, func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - return cluster.ClustersProperty(func(c ionoscloud.ClusterResponse) string { - if c.Id == nil { - return "" - } - return *c.Id - }), cobra.ShellCompDirectiveNoFileComp - }) + cmd.AddStringFlag(constants.FlagClusterId, constants.FlagIdShort, "", "Optionally limit shown backups to those of a certain cluster", + core.RequiredFlagOption(), + core.WithCompletion( + func() []string { + return cluster.ClustersProperty(func(c ionoscloud.ClusterResponse) string { + if c.Id == nil { + return "" + } + return *c.Id + }) + }, constants.MariaDBApiRegionalURL), + ) cmd.AddInt32Flag(constants.FlagMaxResults, constants.FlagMaxResultsShort, 0, constants.DescMaxResults) cmd.AddInt32Flag(constants.FlagOffset, "", 0, "Skip a certain number of results") diff --git a/commands/dbaas/mariadb/cluster/delete.go b/commands/dbaas/mariadb/cluster/delete.go index c71227caa..86d25ea85 100644 --- a/commands/dbaas/mariadb/cluster/delete.go +++ b/commands/dbaas/mariadb/cluster/delete.go @@ -72,15 +72,18 @@ ionosctl db mar c d --all --name `, InitClient: true, }) - cmd.AddStringFlag(constants.FlagClusterId, constants.FlagIdShort, "", "The unique ID of the cluster", core.RequiredFlagOption()) - _ = cmd.Command.RegisterFlagCompletionFunc(constants.FlagClusterId, func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - return ClustersProperty(func(c sdkgo.ClusterResponse) string { - if c.Id == nil { - return "" - } - return *c.Id - }), cobra.ShellCompDirectiveNoFileComp - }) + cmd.AddStringFlag(constants.FlagClusterId, constants.FlagIdShort, "", "The unique ID of the cluster", + core.RequiredFlagOption(), + core.WithCompletion( + func() []string { + return ClustersProperty(func(c sdkgo.ClusterResponse) string { + if c.Id == nil { + return "" + } + return *c.Id + }) + }, constants.MariaDBApiRegionalURL), + ) cmd.AddBoolFlag(constants.ArgAll, constants.ArgAllShort, false, "Delete all mariadb clusters") cmd.AddBoolFlag(constants.FlagName, "", false, "When deleting all clusters, filter the clusters by a name") cmd.AddStringSliceFlag(constants.ArgCols, "", nil, tabheaders.ColsMessage(allCols)) diff --git a/commands/dbaas/mariadb/cluster/get.go b/commands/dbaas/mariadb/cluster/get.go index 8fad18b0f..329c87dcc 100644 --- a/commands/dbaas/mariadb/cluster/get.go +++ b/commands/dbaas/mariadb/cluster/get.go @@ -11,7 +11,6 @@ import ( "github.com/ionos-cloud/ionosctl/v6/internal/printer/jsontabwriter" "github.com/ionos-cloud/ionosctl/v6/internal/printer/tabheaders" ionoscloud "github.com/ionos-cloud/sdk-go-dbaas-mariadb" - "github.com/spf13/cobra" "github.com/spf13/viper" ) @@ -50,15 +49,18 @@ func Get() *core.Command { InitClient: true, }) - cmd.AddStringFlag(constants.FlagClusterId, constants.FlagIdShort, "", "The unique ID of the cluster", core.RequiredFlagOption()) - _ = cmd.Command.RegisterFlagCompletionFunc(constants.FlagClusterId, func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - return ClustersProperty(func(c ionoscloud.ClusterResponse) string { - if c.Id == nil { - return "" - } - return *c.Id - }), cobra.ShellCompDirectiveNoFileComp - }) + cmd.AddStringFlag(constants.FlagClusterId, constants.FlagIdShort, "", "The unique ID of the cluster", + core.RequiredFlagOption(), + core.WithCompletion( + func() []string { + return ClustersProperty(func(c ionoscloud.ClusterResponse) string { + if c.Id == nil { + return "" + } + return *c.Id + }) + }, constants.MariaDBApiRegionalURL), + ) cmd.Command.SilenceUsage = true diff --git a/commands/dbaas/mariadb/mariadb.go b/commands/dbaas/mariadb/mariadb.go index 7114ec5b9..c2f6ee565 100644 --- a/commands/dbaas/mariadb/mariadb.go +++ b/commands/dbaas/mariadb/mariadb.go @@ -3,6 +3,7 @@ package mariadb import ( "github.com/ionos-cloud/ionosctl/v6/commands/dbaas/mariadb/backup" "github.com/ionos-cloud/ionosctl/v6/commands/dbaas/mariadb/cluster" + "github.com/ionos-cloud/ionosctl/v6/internal/constants" "github.com/ionos-cloud/ionosctl/v6/internal/core" "github.com/spf13/cobra" ) @@ -18,5 +19,6 @@ func Root() *core.Command { } cmd.AddCommand(cluster.Root()) cmd.AddCommand(backup.Root()) - return cmd + + return core.WithRegionalFlags(cmd, constants.MariaDBApiRegionalURL, constants.MariaDBLocations) } diff --git a/commands/dns/completer/completer.go b/commands/dns/completer/completer.go index 8c800f0f5..c68fe90d0 100644 --- a/commands/dns/completer/completer.go +++ b/commands/dns/completer/completer.go @@ -11,7 +11,7 @@ import ( "github.com/ionos-cloud/ionosctl/v6/internal/printer/json2table/jsonpaths" "github.com/ionos-cloud/ionosctl/v6/pkg/functional" - "github.com/ionos-cloud/sdk-go-dns" + ionoscloud "github.com/ionos-cloud/sdk-go-dns" "github.com/spf13/viper" ) diff --git a/commands/dns/dns.go b/commands/dns/dns.go index 39a6af049..cd5782912 100644 --- a/commands/dns/dns.go +++ b/commands/dns/dns.go @@ -7,11 +7,12 @@ import ( reverse_record "github.com/ionos-cloud/ionosctl/v6/commands/dns/reverse-record" secondary_zones "github.com/ionos-cloud/ionosctl/v6/commands/dns/secondary-zones" "github.com/ionos-cloud/ionosctl/v6/commands/dns/zone" + "github.com/ionos-cloud/ionosctl/v6/internal/constants" "github.com/ionos-cloud/ionosctl/v6/internal/core" "github.com/spf13/cobra" ) -func DNSCommand() *core.Command { +func Root() *core.Command { cmd := &core.Command{ Command: &cobra.Command{ Use: "dns", @@ -26,5 +27,5 @@ func DNSCommand() *core.Command { cmd.AddCommand(dnssec.Root()) cmd.AddCommand(secondary_zones.Root()) - return cmd + return core.WithRegionalFlags(cmd, constants.DNSApiRegionalURL, constants.DNSLocations) } diff --git a/commands/dns/dnssec/create.go b/commands/dns/dnssec/create.go index 283507ae8..8303eaea8 100644 --- a/commands/dns/dnssec/create.go +++ b/commands/dns/dnssec/create.go @@ -14,7 +14,6 @@ import ( "github.com/ionos-cloud/ionosctl/v6/internal/printer/tabheaders" "github.com/ionos-cloud/ionosctl/v6/pkg/pointer" dns "github.com/ionos-cloud/sdk-go-dns" - "github.com/spf13/cobra" "github.com/spf13/viper" ) @@ -83,28 +82,37 @@ func Create() *core.Command { InitClient: true, }) - cmd.AddStringFlag(constants.FlagZone, constants.FlagZoneShort, "", constants.DescZone) - _ = cmd.Command.RegisterFlagCompletionFunc(constants.FlagZone, func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - return completer.ZonesProperty(func(t dns.ZoneRead) string { - return *t.Properties.ZoneName - }), cobra.ShellCompDirectiveNoFileComp - }) - + cmd.AddStringFlag(constants.FlagZone, constants.FlagZoneShort, "", constants.DescZone, core.RequiredFlagOption(), + core.WithCompletion(func() []string { + return completer.ZonesProperty(func(t dns.ZoneRead) string { + return *t.Properties.ZoneName + }) + }, constants.DNSApiRegionalURL), + ) cmd.AddStringFlag(FlagAlgorithm, "", "RSASHA256", "Algorithm used to generate signing keys (both Key Signing Keys and Zone Signing Keys)") - cmd.AddIntFlag(FlagKskBits, "", 1024, "Key signing key length in bits. kskBits >= zskBits: [1024/2048/4096]") - _ = cmd.Command.RegisterFlagCompletionFunc(FlagKskBits, func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - return []string{"1024", "2048", "4096"}, cobra.ShellCompDirectiveNoFileComp - }) - cmd.AddIntFlag(FlagZskBits, "", 1024, "Zone signing key length in bits. zskBits <= kskBits: [1024/2048/4096]") - _ = cmd.Command.RegisterFlagCompletionFunc(FlagZskBits, func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - return []string{"1024", "2048", "4096"}, cobra.ShellCompDirectiveNoFileComp - }) + cmd.AddIntFlag(FlagKskBits, "", 1024, "Key signing key length in bits. kskBits >= zskBits: [1024/2048/4096]", + core.WithCompletion( + func() []string { + return []string{"1024", "2048", "4096"} + }, constants.DNSApiRegionalURL, + ), + ) + cmd.AddIntFlag(FlagZskBits, "", 1024, "Zone signing key length in bits. zskBits <= kskBits: [1024/2048/4096]", + core.WithCompletion( + func() []string { + return []string{"1024", "2048", "4096"} + }, constants.DNSApiRegionalURL, + ), + ) cmd.AddSetFlag(FlagNsecMode, "", "NSEC", []string{"NSEC", "NSEC3"}, "NSEC mode.") cmd.AddIntFlag(FlagNsec3Iterations, "", 0, "Number of iterations for NSEC3. [0..50]") - cmd.AddIntFlag(FlagNsec3SaltBits, "", 64, "Salt length in bits for NSEC3. [64..128], multiples of 8") - _ = cmd.Command.RegisterFlagCompletionFunc(FlagNsec3SaltBits, func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - return []string{"64", "72", "80", "88", "96", "104", "112", "120", "128"}, cobra.ShellCompDirectiveNoFileComp - }) + cmd.AddIntFlag(FlagNsec3SaltBits, "", 64, "Salt length in bits for NSEC3. [64..128], multiples of 8", + core.WithCompletion( + func() []string { + return []string{"64", "72", "80", "88", "96", "104", "112", "120", "128"} + }, constants.DNSApiRegionalURL, + ), + ) cmd.AddIntFlag(FlagValidity, "", 90, "Signature validity in days [90..365]") cmd.Command.SilenceUsage = true diff --git a/commands/dns/dnssec/delete.go b/commands/dns/dnssec/delete.go index 21fc41317..e6ad8ab0b 100644 --- a/commands/dns/dnssec/delete.go +++ b/commands/dns/dnssec/delete.go @@ -10,7 +10,6 @@ import ( "github.com/ionos-cloud/ionosctl/v6/internal/constants" "github.com/ionos-cloud/ionosctl/v6/internal/core" dns "github.com/ionos-cloud/sdk-go-dns" - "github.com/spf13/cobra" "github.com/spf13/viper" ) @@ -47,12 +46,13 @@ func Delete() *core.Command { InitClient: true, }) - cmd.AddStringFlag(constants.FlagZone, constants.FlagZoneShort, "", constants.DescZone) - _ = cmd.Command.RegisterFlagCompletionFunc(constants.FlagZone, func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - return completer.ZonesProperty(func(t dns.ZoneRead) string { - return *t.Properties.ZoneName - }), cobra.ShellCompDirectiveNoFileComp - }) + cmd.AddStringFlag(constants.FlagZone, constants.FlagZoneShort, "", constants.DescZone, core.RequiredFlagOption(), + core.WithCompletion(func() []string { + return completer.ZonesProperty(func(t dns.ZoneRead) string { + return *t.Properties.ZoneName + }) + }, constants.DNSApiRegionalURL), + ) cmd.Command.SilenceUsage = true cmd.Command.Flags().SortFlags = false diff --git a/commands/dns/dnssec/get.go b/commands/dns/dnssec/get.go index 32b82b42d..0528da728 100644 --- a/commands/dns/dnssec/get.go +++ b/commands/dns/dnssec/get.go @@ -13,7 +13,6 @@ import ( "github.com/ionos-cloud/ionosctl/v6/internal/printer/jsontabwriter" "github.com/ionos-cloud/ionosctl/v6/internal/printer/tabheaders" dns "github.com/ionos-cloud/sdk-go-dns" - "github.com/spf13/cobra" "github.com/spf13/viper" ) @@ -62,12 +61,13 @@ ionosctl dns keys list --zone ZONE --cols PubKey --no-headers`, InitClient: true, }) - cmd.AddStringFlag(constants.FlagZone, constants.FlagZoneShort, "", constants.DescZone) - _ = cmd.Command.RegisterFlagCompletionFunc(constants.FlagZone, func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - return completer.ZonesProperty(func(t dns.ZoneRead) string { - return *t.Properties.ZoneName - }), cobra.ShellCompDirectiveNoFileComp - }) + cmd.AddStringFlag(constants.FlagZone, constants.FlagZoneShort, "", constants.DescZone, core.RequiredFlagOption(), + core.WithCompletion(func() []string { + return completer.ZonesProperty(func(t dns.ZoneRead) string { + return *t.Properties.ZoneName + }) + }, constants.DNSApiRegionalURL), + ) cmd.Command.SilenceUsage = true cmd.Command.Flags().SortFlags = false diff --git a/commands/dns/reverse-record/delete.go b/commands/dns/reverse-record/delete.go index b7218f027..7ab375b82 100644 --- a/commands/dns/reverse-record/delete.go +++ b/commands/dns/reverse-record/delete.go @@ -10,7 +10,6 @@ import ( "github.com/ionos-cloud/ionosctl/v6/pkg/confirm" "github.com/ionos-cloud/ionosctl/v6/pkg/functional" ionoscloud "github.com/ionos-cloud/sdk-go-dns" - "github.com/spf13/cobra" "github.com/spf13/viper" ) @@ -42,14 +41,15 @@ func Delete() *core.Command { InitClient: true, }) - cmd.AddStringFlag(constants.FlagRecord, "", "", "The record ID or IP which you want to delete", core.RequiredFlagOption()) - // Completions: all current IPs - cmd.Command.RegisterFlagCompletionFunc(constants.FlagRecord, func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - ips := RecordsProperty(func(read ionoscloud.ReverseRecordRead) string { - return *read.Properties.Ip - }) - return ips, cobra.ShellCompDirectiveNoFileComp - }) + cmd.AddStringFlag(constants.FlagRecord, "", "", "The record ID or IP which you want to delete", + core.RequiredFlagOption(), + core.WithCompletion(func() []string { + return RecordsProperty(func(read ionoscloud.ReverseRecordRead) string { + return *read.Properties.Ip + }) + }, constants.DNSApiRegionalURL), + ) + cmd.AddBoolFlag(constants.ArgAll, constants.ArgAllShort, false, "Delete all records if set", core.RequiredFlagOption()) cmd.Command.SilenceUsage = true diff --git a/commands/dns/reverse-record/get.go b/commands/dns/reverse-record/get.go index 506ea2ee2..915fc7af2 100644 --- a/commands/dns/reverse-record/get.go +++ b/commands/dns/reverse-record/get.go @@ -11,7 +11,6 @@ import ( "github.com/ionos-cloud/ionosctl/v6/internal/printer/jsontabwriter" "github.com/ionos-cloud/ionosctl/v6/internal/printer/tabheaders" ionoscloud "github.com/ionos-cloud/sdk-go-dns" - "github.com/spf13/cobra" "github.com/spf13/viper" ) @@ -56,13 +55,14 @@ func Get() *core.Command { InitClient: true, }) - cmd.AddStringFlag(constants.FlagRecord, "", "", "The record ID or IP, for identifying which record you want to update", core.RequiredFlagOption()) - cmd.Command.RegisterFlagCompletionFunc(constants.FlagRecord, func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - ips := RecordsProperty(func(read ionoscloud.ReverseRecordRead) string { - return *read.Properties.Ip - }) - return ips, cobra.ShellCompDirectiveNoFileComp - }) + cmd.AddStringFlag(constants.FlagRecord, "", "", "The record ID or IP which you want to get", + core.RequiredFlagOption(), + core.WithCompletion(func() []string { + return RecordsProperty(func(read ionoscloud.ReverseRecordRead) string { + return *read.Properties.Ip + }) + }, constants.DNSApiRegionalURL), + ) cmd.Command.SilenceUsage = true return cmd diff --git a/commands/dns/reverse-record/list.go b/commands/dns/reverse-record/list.go index 1b831bebb..515aa77cc 100644 --- a/commands/dns/reverse-record/list.go +++ b/commands/dns/reverse-record/list.go @@ -5,13 +5,11 @@ import ( "fmt" "github.com/ionos-cloud/ionosctl/v6/internal/constants" + "github.com/ionos-cloud/ionosctl/v6/internal/core" "github.com/ionos-cloud/ionosctl/v6/internal/printer/json2table/jsonpaths" "github.com/ionos-cloud/ionosctl/v6/internal/printer/jsontabwriter" "github.com/ionos-cloud/ionosctl/v6/internal/printer/tabheaders" dns "github.com/ionos-cloud/sdk-go-dns" - "github.com/spf13/cobra" - - "github.com/ionos-cloud/ionosctl/v6/internal/core" ) func List() *core.Command { @@ -46,12 +44,13 @@ func List() *core.Command { InitClient: true, }) - cmd.AddStringFlag(constants.FlagIps, "i", "", "Optional filter for the IP address of the reverse record") - _ = cmd.Command.RegisterFlagCompletionFunc(constants.FlagZone, func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - return RecordsProperty(func(r dns.ReverseRecordRead) string { - return *r.Properties.Ip - }), cobra.ShellCompDirectiveNoFileComp - }) + cmd.AddStringFlag(constants.FlagIps, "i", "", "Optional filter for the IP address of the reverse record", + core.WithCompletion(func() []string { + return RecordsProperty(func(t dns.ReverseRecordRead) string { + return *t.Properties.Ip + }) + }, constants.DNSApiRegionalURL), + ) cmd.AddInt32Flag(constants.FlagOffset, "", 0, "The first element (of the total list of elements) to include in the response. Use together with limit for pagination") cmd.AddInt32Flag(constants.FlagMaxResults, "", 0, constants.DescMaxResults) diff --git a/commands/dns/reverse-record/update.go b/commands/dns/reverse-record/update.go index 656144ff4..700d9e077 100644 --- a/commands/dns/reverse-record/update.go +++ b/commands/dns/reverse-record/update.go @@ -12,7 +12,6 @@ import ( "github.com/ionos-cloud/ionosctl/v6/internal/printer/tabheaders" "github.com/ionos-cloud/ionosctl/v6/pkg/pointer" ionoscloud "github.com/ionos-cloud/sdk-go-dns" - "github.com/spf13/cobra" "github.com/spf13/viper" ) @@ -69,27 +68,30 @@ func Update() *core.Command { InitClient: true, }) - cmd.AddStringFlag(constants.FlagRecord, "", "", "The record ID or IP, for identifying which record you want to update", core.RequiredFlagOption()) - cmd.Command.RegisterFlagCompletionFunc(constants.FlagRecord, func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - ips := RecordsProperty(func(read ionoscloud.ReverseRecordRead) string { - return *read.Properties.Ip - }) - return ips, cobra.ShellCompDirectiveNoFileComp - }) - cmd.AddStringFlag(constants.FlagIp, "", "", "The new IP") - cmd.Command.RegisterFlagCompletionFunc(constants.FlagIp, func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - ipblocks, _, err := client.Must().CloudClient.IPBlocksApi.IpblocksGet(context.Background()).Execute() - if err != nil || ipblocks.Items == nil || len(*ipblocks.Items) == 0 { - return nil, cobra.ShellCompDirectiveError - } - var ips []string - for _, ipblock := range *ipblocks.Items { - if ipblock.Properties.Ips != nil { - ips = append(ips, *ipblock.Properties.Ips...) + cmd.AddStringFlag(constants.FlagRecord, "", "", "The record ID or IP which you want to update", + core.RequiredFlagOption(), + core.WithCompletion(func() []string { + return RecordsProperty(func(read ionoscloud.ReverseRecordRead) string { + return *read.Properties.Ip + }) + }, constants.DNSApiRegionalURL), + ) + + cmd.AddStringFlag(constants.FlagIp, "", "", "The new IP", core.WithCompletionE( + func() ([]string, error) { + ipblocks, _, err := client.Must().CloudClient.IPBlocksApi.IpblocksGet(context.Background()).Execute() + if err != nil || ipblocks.Items == nil || len(*ipblocks.Items) == 0 { + return nil, fmt.Errorf("failed to get IP blocks: %s", err) } - } - return ips, cobra.ShellCompDirectiveNoFileComp - }) + var ips []string + for _, ipblock := range *ipblocks.Items { + if ipblock.Properties.Ips != nil { + ips = append(ips, *ipblock.Properties.Ips...) + } + } + return ips, nil + }, ""), + ) cmd.AddStringFlag(constants.FlagName, "", "", "The new record name") cmd.AddStringFlag(constants.FlagDescription, "", "", "The new description of the record") diff --git a/commands/dns/secondary-zones/delete.go b/commands/dns/secondary-zones/delete.go index eeac68d5a..a036c7bb5 100644 --- a/commands/dns/secondary-zones/delete.go +++ b/commands/dns/secondary-zones/delete.go @@ -12,8 +12,6 @@ import ( "github.com/ionos-cloud/ionosctl/v6/internal/printer/jsontabwriter" "github.com/ionos-cloud/ionosctl/v6/pkg/confirm" "github.com/ionos-cloud/ionosctl/v6/pkg/functional" - "github.com/spf13/cobra" - dns "github.com/ionos-cloud/sdk-go-dns" "github.com/spf13/viper" ) @@ -52,11 +50,8 @@ func deleteCmd() *core.Command { c.Command.Flags().BoolP(constants.ArgAll, constants.ArgAllShort, false, "Delete all secondary zones") - c.Command.Flags().StringP(constants.FlagZone, constants.FlagZoneShort, "", constants.DescZone) - _ = c.Command.RegisterFlagCompletionFunc( - constants.FlagZone, func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - return completer.SecondaryZonesIDs(), cobra.ShellCompDirectiveNoFileComp - }, + c.AddStringFlag(constants.FlagZone, constants.FlagZoneShort, "", constants.DescZone, + core.WithCompletion(completer.SecondaryZonesIDs, constants.DNSApiRegionalURL), ) c.Command.SilenceUsage = true diff --git a/commands/dns/secondary-zones/get.go b/commands/dns/secondary-zones/get.go index 4749fda0d..80431bdcd 100644 --- a/commands/dns/secondary-zones/get.go +++ b/commands/dns/secondary-zones/get.go @@ -12,7 +12,6 @@ import ( "github.com/ionos-cloud/ionosctl/v6/internal/printer/json2table/jsonpaths" "github.com/ionos-cloud/ionosctl/v6/internal/printer/jsontabwriter" "github.com/ionos-cloud/ionosctl/v6/internal/printer/tabheaders" - "github.com/spf13/cobra" ) func getCmd() *core.Command { @@ -51,11 +50,8 @@ func getCmd() *core.Command { }, ) - c.Command.Flags().StringP(constants.FlagZone, constants.FlagZoneShort, "", constants.DescZone) - _ = c.Command.RegisterFlagCompletionFunc( - constants.FlagZone, func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - return completer.SecondaryZonesIDs(), cobra.ShellCompDirectiveNoFileComp - }, + c.AddStringFlag(constants.FlagZone, constants.FlagZoneShort, "", constants.DescZone, + core.WithCompletion(completer.SecondaryZonesIDs, constants.DNSApiRegionalURL), ) c.Command.SilenceUsage = true diff --git a/commands/dns/secondary-zones/transfer/get.go b/commands/dns/secondary-zones/transfer/get.go index 54894bff0..2e8fc25ea 100644 --- a/commands/dns/secondary-zones/transfer/get.go +++ b/commands/dns/secondary-zones/transfer/get.go @@ -12,7 +12,6 @@ import ( "github.com/ionos-cloud/ionosctl/v6/internal/printer/json2table/jsonpaths" "github.com/ionos-cloud/ionosctl/v6/internal/printer/jsontabwriter" "github.com/ionos-cloud/ionosctl/v6/internal/printer/tabheaders" - "github.com/spf13/cobra" ) func getCmd() *core.Command { @@ -51,11 +50,8 @@ func getCmd() *core.Command { }, ) - c.Command.Flags().StringP(constants.FlagZone, constants.FlagZoneShort, "", constants.DescZone) - _ = c.Command.RegisterFlagCompletionFunc( - constants.FlagZone, func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - return completer.SecondaryZonesIDs(), cobra.ShellCompDirectiveNoFileComp - }, + c.AddStringFlag(constants.FlagZone, constants.FlagZoneShort, "", constants.DescZone, + core.WithCompletion(completer.SecondaryZonesIDs, constants.DNSApiRegionalURL), ) c.Command.SilenceUsage = true diff --git a/commands/dns/secondary-zones/transfer/start.go b/commands/dns/secondary-zones/transfer/start.go index bfb3936a2..1fdd14c7e 100644 --- a/commands/dns/secondary-zones/transfer/start.go +++ b/commands/dns/secondary-zones/transfer/start.go @@ -10,7 +10,6 @@ import ( "github.com/ionos-cloud/ionosctl/v6/internal/constants" "github.com/ionos-cloud/ionosctl/v6/internal/core" "github.com/ionos-cloud/ionosctl/v6/internal/printer/jsontabwriter" - "github.com/spf13/cobra" ) func startCmd() *core.Command { @@ -41,11 +40,8 @@ func startCmd() *core.Command { }, ) - c.Command.Flags().StringP(constants.FlagZone, constants.FlagZoneShort, "", constants.DescZone) - _ = c.Command.RegisterFlagCompletionFunc( - constants.FlagZone, func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - return completer.SecondaryZonesIDs(), cobra.ShellCompDirectiveNoFileComp - }, + c.AddStringFlag(constants.FlagZone, constants.FlagZoneShort, "", constants.DescZone, + core.WithCompletion(completer.SecondaryZonesIDs, constants.DNSApiRegionalURL), ) c.Command.SilenceUsage = true diff --git a/commands/dns/secondary-zones/update.go b/commands/dns/secondary-zones/update.go index 0ddcce5e1..4a9e51dc4 100644 --- a/commands/dns/secondary-zones/update.go +++ b/commands/dns/secondary-zones/update.go @@ -13,8 +13,6 @@ import ( "github.com/ionos-cloud/ionosctl/v6/internal/printer/json2table/jsonpaths" "github.com/ionos-cloud/ionosctl/v6/internal/printer/jsontabwriter" "github.com/ionos-cloud/ionosctl/v6/internal/printer/tabheaders" - "github.com/spf13/cobra" - dns "github.com/ionos-cloud/sdk-go-dns" ) @@ -84,11 +82,8 @@ func updateCmd() *core.Command { c.Command.Flags().String(constants.FlagDescription, "", "Description of the secondary zone") c.Command.Flags().StringSlice(constants.FlagPrimaryIPs, []string{}, "Primary DNS server IP addresses") - c.Command.Flags().StringP(constants.FlagZone, constants.FlagZoneShort, "", constants.DescZone) - _ = c.Command.RegisterFlagCompletionFunc( - constants.FlagZone, func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - return completer.SecondaryZonesIDs(), cobra.ShellCompDirectiveNoFileComp - }, + c.AddStringFlag(constants.FlagZone, constants.FlagZoneShort, "", constants.DescZone, + core.WithCompletion(completer.SecondaryZonesIDs, constants.DNSApiRegionalURL), ) c.Command.SilenceUsage = true diff --git a/commands/dns/zone/delete.go b/commands/dns/zone/delete.go index 2c217c5f1..652208e74 100644 --- a/commands/dns/zone/delete.go +++ b/commands/dns/zone/delete.go @@ -13,7 +13,6 @@ import ( dns "github.com/ionos-cloud/sdk-go-dns" "github.com/ionos-cloud/ionosctl/v6/internal/client" - "github.com/spf13/cobra" "github.com/spf13/viper" "github.com/ionos-cloud/ionosctl/v6/internal/core" @@ -57,12 +56,13 @@ func ZonesDeleteCmd() *core.Command { InitClient: true, }) - cmd.AddStringFlag(constants.FlagZone, constants.FlagZoneShort, "", fmt.Sprintf("%s. Required or -%s", constants.DescZone, constants.ArgAllShort)) - _ = cmd.Command.RegisterFlagCompletionFunc(constants.FlagZone, func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - return completer.ZonesProperty(func(t dns.ZoneRead) string { - return *t.Properties.ZoneName - }), cobra.ShellCompDirectiveNoFileComp - }) + cmd.AddStringFlag(constants.FlagZone, constants.FlagZoneShort, "", fmt.Sprintf("%s. Required or -%s", constants.DescZone, constants.ArgAllShort), + core.WithCompletion(func() []string { + return completer.ZonesProperty(func(t dns.ZoneRead) string { + return *t.Properties.ZoneName + }) + }, constants.DNSApiRegionalURL), + ) cmd.AddBoolFlag(constants.ArgAll, constants.ArgAllShort, false, fmt.Sprintf("Delete all zones. Required or -%s", constants.FlagZoneShort)) diff --git a/commands/dns/zone/file/get.go b/commands/dns/zone/file/get.go index 84f4aeafa..a3f258ed7 100644 --- a/commands/dns/zone/file/get.go +++ b/commands/dns/zone/file/get.go @@ -9,8 +9,6 @@ import ( "github.com/ionos-cloud/ionosctl/v6/internal/constants" "github.com/ionos-cloud/ionosctl/v6/internal/core" "github.com/ionos-cloud/ionosctl/v6/internal/printer/jsontabwriter" - "github.com/spf13/cobra" - dns "github.com/ionos-cloud/sdk-go-dns" ) @@ -38,15 +36,12 @@ func getCmd() *core.Command { }, ) - c.Command.Flags().StringP(constants.FlagZone, constants.FlagZoneShort, "", constants.DescZone) - _ = c.Command.RegisterFlagCompletionFunc( - constants.FlagZone, func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - return completer.ZonesProperty( - func(t dns.ZoneRead) string { - return *t.Properties.ZoneName - }, - ), cobra.ShellCompDirectiveNoFileComp - }, + c.AddStringFlag(constants.FlagZone, constants.FlagZoneShort, "", constants.DescZone, core.RequiredFlagOption(), + core.WithCompletion(func() []string { + return completer.ZonesProperty(func(t dns.ZoneRead) string { + return *t.Properties.ZoneName + }) + }, constants.DNSApiRegionalURL), ) c.Command.SilenceUsage = true diff --git a/commands/dns/zone/file/update.go b/commands/dns/zone/file/update.go index 791b93dd6..e4387a0ad 100644 --- a/commands/dns/zone/file/update.go +++ b/commands/dns/zone/file/update.go @@ -11,8 +11,6 @@ import ( "github.com/ionos-cloud/ionosctl/v6/internal/constants" "github.com/ionos-cloud/ionosctl/v6/internal/core" "github.com/ionos-cloud/ionosctl/v6/internal/printer/jsontabwriter" - "github.com/spf13/cobra" - dns "github.com/ionos-cloud/sdk-go-dns" ) @@ -50,17 +48,13 @@ func updateCmd() *core.Command { }, ) - c.Command.Flags().StringP(constants.FlagZone, constants.FlagZoneShort, "", constants.DescZone) - _ = c.Command.RegisterFlagCompletionFunc( - constants.FlagZone, func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - return completer.ZonesProperty( - func(t dns.ZoneRead) string { - return *t.Properties.ZoneName - }, - ), cobra.ShellCompDirectiveNoFileComp - }, + c.AddStringFlag(constants.FlagZone, constants.FlagZoneShort, "", constants.DescZone, core.RequiredFlagOption(), + core.WithCompletion(func() []string { + return completer.ZonesProperty(func(t dns.ZoneRead) string { + return *t.Properties.ZoneName + }) + }, constants.DNSApiRegionalURL), ) - c.Command.Flags().String(constants.FlagZoneFile, "", "Path to the zone file") c.Command.SilenceUsage = true diff --git a/commands/dns/zone/get.go b/commands/dns/zone/get.go index 0cc5a9167..2e91ca06a 100644 --- a/commands/dns/zone/get.go +++ b/commands/dns/zone/get.go @@ -12,8 +12,6 @@ import ( "github.com/ionos-cloud/ionosctl/v6/internal/printer/tabheaders" dns "github.com/ionos-cloud/sdk-go-dns" - "github.com/spf13/cobra" - "github.com/ionos-cloud/ionosctl/v6/internal/client" "github.com/ionos-cloud/ionosctl/v6/internal/core" "github.com/spf13/viper" @@ -59,12 +57,13 @@ func ZonesFindByIdCmd() *core.Command { InitClient: true, }) - cmd.AddStringFlag(constants.FlagZone, constants.FlagZoneShort, "", constants.DescZone, core.RequiredFlagOption()) - _ = cmd.Command.RegisterFlagCompletionFunc(constants.FlagZone, func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - return completer.ZonesProperty(func(t dns.ZoneRead) string { - return *t.Properties.ZoneName - }), cobra.ShellCompDirectiveNoFileComp - }) + cmd.AddStringFlag(constants.FlagZone, constants.FlagZoneShort, "", constants.DescZone, core.RequiredFlagOption(), + core.WithCompletion(func() []string { + return completer.ZonesProperty(func(t dns.ZoneRead) string { + return *t.Properties.ZoneName + }) + }, constants.DNSApiRegionalURL), + ) cmd.Command.SilenceUsage = true cmd.Command.Flags().SortFlags = false diff --git a/commands/dns/zone/update.go b/commands/dns/zone/update.go index bacd972d3..98e479236 100644 --- a/commands/dns/zone/update.go +++ b/commands/dns/zone/update.go @@ -13,8 +13,6 @@ import ( "github.com/ionos-cloud/ionosctl/v6/pkg/pointer" dns "github.com/ionos-cloud/sdk-go-dns" - "github.com/spf13/cobra" - "github.com/ionos-cloud/ionosctl/v6/internal/client" "github.com/ionos-cloud/ionosctl/v6/internal/core" "github.com/spf13/viper" @@ -75,12 +73,13 @@ func ZonesPutCmd() *core.Command { InitClient: true, }) - cmd.AddStringFlag(constants.FlagZone, constants.FlagZoneShort, "", constants.DescZone, core.RequiredFlagOption()) - _ = cmd.Command.RegisterFlagCompletionFunc(constants.FlagZone, func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - return completer.ZonesProperty(func(t dns.ZoneRead) string { - return *t.Properties.ZoneName - }), cobra.ShellCompDirectiveNoFileComp - }) + cmd.AddStringFlag(constants.FlagZone, constants.FlagZoneShort, "", constants.DescZone, core.RequiredFlagOption(), + core.WithCompletion(func() []string { + return completer.ZonesProperty(func(t dns.ZoneRead) string { + return *t.Properties.ZoneName + }) + }, constants.DNSApiRegionalURL), + ) cmd.AddStringFlag(constants.FlagName, constants.FlagNameShort, "", "The new name of the DNS zone, e.g. foo.com") cmd.AddStringFlag(constants.FlagDescription, "", "", "The new description of the DNS zone") cmd.AddBoolFlag(constants.FlagEnabled, "", true, "Activate or deactivate the DNS zone") diff --git a/commands/logging-service/logging-service.go b/commands/logging-service/logging-service.go index 6563b2216..9148851d0 100644 --- a/commands/logging-service/logging-service.go +++ b/commands/logging-service/logging-service.go @@ -3,11 +3,12 @@ package logging_service import ( "github.com/ionos-cloud/ionosctl/v6/commands/logging-service/logs" "github.com/ionos-cloud/ionosctl/v6/commands/logging-service/pipeline" + "github.com/ionos-cloud/ionosctl/v6/internal/constants" "github.com/ionos-cloud/ionosctl/v6/internal/core" "github.com/spf13/cobra" ) -func LoggingServiceCmd() *core.Command { +func Root() *core.Command { cmd := &core.Command{ Command: &cobra.Command{ Use: "logging-service", @@ -20,5 +21,6 @@ func LoggingServiceCmd() *core.Command { cmd.AddCommand(pipeline.PipelineCmd()) cmd.AddCommand(logs.LogsCmd()) - return cmd + + return core.WithRegionalFlags(cmd, constants.LoggingApiRegionalURL, constants.LoggingAPILocations) } diff --git a/commands/logging-service/logs/add.go b/commands/logging-service/logs/add.go index 7021aa2dc..d5c4979f8 100644 --- a/commands/logging-service/logs/add.go +++ b/commands/logging-service/logs/add.go @@ -11,7 +11,6 @@ import ( "github.com/ionos-cloud/ionosctl/v6/internal/core" "github.com/ionos-cloud/ionosctl/v6/internal/printer/tabheaders" ionoscloud "github.com/ionos-cloud/sdk-go-logging" - "github.com/spf13/cobra" "github.com/spf13/viper" ) @@ -32,13 +31,9 @@ func LogsAddCmd() *core.Command { cmd.AddStringFlag( constants.FlagLoggingPipelineId, constants.FlagIdShort, "", "The ID of the logging pipeline", core.RequiredFlagOption(), + core.WithCompletion(completer.LoggingServicePipelineIds, constants.LoggingApiRegionalURL), ) - _ = cmd.Command.RegisterFlagCompletionFunc( - constants.FlagLoggingPipelineId, - func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - return completer.LoggingServicePipelineIds(), cobra.ShellCompDirectiveNoFileComp - }, - ) + cmd.AddStringFlag( constants.FlagLoggingPipelineLogTag, "", "", "Sets the tag for the pipeline log", core.RequiredFlagOption(), ) diff --git a/commands/logging-service/logs/get.go b/commands/logging-service/logs/get.go index d5c6cda77..7e33674e6 100644 --- a/commands/logging-service/logs/get.go +++ b/commands/logging-service/logs/get.go @@ -12,7 +12,6 @@ import ( "github.com/ionos-cloud/ionosctl/v6/internal/printer/jsontabwriter" "github.com/ionos-cloud/ionosctl/v6/internal/printer/tabheaders" ionoscloud "github.com/ionos-cloud/sdk-go-logging" - "github.com/spf13/cobra" "github.com/spf13/viper" ) @@ -32,28 +31,17 @@ func LogsGetCmd() *core.Command { cmd.AddStringFlag( constants.FlagLoggingPipelineId, constants.FlagIdShort, "", "The ID of the logging pipeline", core.RequiredFlagOption(), + core.WithCompletion(completer.LoggingServicePipelineIds, constants.LoggingApiRegionalURL), ) - _ = cmd.Command.RegisterFlagCompletionFunc( - constants.FlagLoggingPipelineId, - func(c *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - return completer.LoggingServicePipelineIds(), cobra.ShellCompDirectiveNoFileComp - }, - ) + cmd.AddStringFlag( constants.FlagLoggingPipelineLogTag, "", "", "The tag of the pipeline log that you want to retrieve", core.RequiredFlagOption(), - ) - _ = cmd.Command.RegisterFlagCompletionFunc( - constants.FlagLoggingPipelineLogTag, - func(c *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { + core.WithCompletion(func() []string { return completer.LoggingServiceLogTags( - viper.GetString( - core.GetFlagName( - cmd.NS, constants.FlagLoggingPipelineId, - ), - ), - ), cobra.ShellCompDirectiveNoFileComp - }, + viper.GetString(core.GetFlagName(cmd.NS, constants.FlagLoggingPipelineId)), + ) + }, constants.LoggingApiRegionalURL), ) return cmd diff --git a/commands/logging-service/logs/list.go b/commands/logging-service/logs/list.go index 17327eac3..8844dcdac 100644 --- a/commands/logging-service/logs/list.go +++ b/commands/logging-service/logs/list.go @@ -8,7 +8,6 @@ import ( "github.com/ionos-cloud/ionosctl/v6/internal/constants" "github.com/ionos-cloud/ionosctl/v6/internal/core" "github.com/ionos-cloud/ionosctl/v6/internal/printer/tabheaders" - "github.com/spf13/cobra" "github.com/spf13/viper" ) @@ -29,13 +28,8 @@ func LogsListCmd() *core.Command { cmd.AddBoolFlag(constants.ArgAll, constants.ArgAllShort, false, "Use this flag to list all logging pipeline logs") cmd.AddStringFlag( constants.FlagLoggingPipelineId, constants.FlagIdShort, "", - "The ID of the logging pipeline you want to list logs for", core.RequiredFlagOption(), - ) - _ = cmd.Command.RegisterFlagCompletionFunc( - constants.FlagLoggingPipelineId, - func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - return completer.LoggingServicePipelineIds(), cobra.ShellCompDirectiveNoFileComp - }, + "The ID of the logging pipeline", core.RequiredFlagOption(), + core.WithCompletion(completer.LoggingServicePipelineIds, constants.LoggingApiRegionalURL), ) return cmd diff --git a/commands/logging-service/logs/remove.go b/commands/logging-service/logs/remove.go index d867d8795..c03c71e3c 100644 --- a/commands/logging-service/logs/remove.go +++ b/commands/logging-service/logs/remove.go @@ -12,7 +12,6 @@ import ( "github.com/ionos-cloud/ionosctl/v6/internal/printer/tabheaders" "github.com/ionos-cloud/ionosctl/v6/pkg/confirm" ionoscloud "github.com/ionos-cloud/sdk-go-logging" - "github.com/spf13/cobra" "github.com/spf13/viper" ) @@ -33,28 +32,16 @@ func LogsRemoveCmd() *core.Command { cmd.AddStringFlag( constants.FlagLoggingPipelineId, constants.FlagIdShort, "", "The ID of the logging pipeline", core.RequiredFlagOption(), - ) - _ = cmd.Command.RegisterFlagCompletionFunc( - constants.FlagLoggingPipelineId, - func(c *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - return completer.LoggingServicePipelineIds(), cobra.ShellCompDirectiveNoFileComp - }, + core.WithCompletion(completer.LoggingServicePipelineIds, constants.LoggingApiRegionalURL), ) cmd.AddStringFlag( - constants.FlagLoggingPipelineLogTag, "", "", "The tag of the pipeline log that you want to remove", + constants.FlagLoggingPipelineLogTag, "", "", "The tag of the pipeline log that you want to delete", core.RequiredFlagOption(), - ) - _ = cmd.Command.RegisterFlagCompletionFunc( - constants.FlagLoggingPipelineLogTag, - func(c *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { + core.WithCompletion(func() []string { return completer.LoggingServiceLogTags( - viper.GetString( - core.GetFlagName( - cmd.NS, constants.FlagLoggingPipelineId, - ), - ), - ), cobra.ShellCompDirectiveNoFileComp - }, + viper.GetString(core.GetFlagName(cmd.NS, constants.FlagLoggingPipelineId)), + ) + }, constants.LoggingApiRegionalURL), ) return cmd diff --git a/commands/logging-service/logs/update.go b/commands/logging-service/logs/update.go index febe01439..96547e279 100644 --- a/commands/logging-service/logs/update.go +++ b/commands/logging-service/logs/update.go @@ -9,7 +9,6 @@ import ( "github.com/ionos-cloud/ionosctl/v6/internal/core" "github.com/ionos-cloud/ionosctl/v6/internal/printer/tabheaders" ionoscloud "github.com/ionos-cloud/sdk-go-logging" - "github.com/spf13/cobra" "github.com/spf13/viper" ) @@ -30,28 +29,16 @@ func LogsUpdateCmd() *core.Command { cmd.AddStringFlag( constants.FlagLoggingPipelineId, constants.FlagIdShort, "", "The ID of the logging pipeline", core.RequiredFlagOption(), - ) - _ = cmd.Command.RegisterFlagCompletionFunc( - constants.FlagLoggingPipelineId, - func(c *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - return completer.LoggingServicePipelineIds(), cobra.ShellCompDirectiveNoFileComp - }, + core.WithCompletion(completer.LoggingServicePipelineIds, constants.LoggingApiRegionalURL), ) cmd.AddStringFlag( constants.FlagLoggingPipelineLogTag, "", "", "The tag of the pipeline log that you want to update", core.RequiredFlagOption(), - ) - _ = cmd.Command.RegisterFlagCompletionFunc( - constants.FlagLoggingPipelineLogTag, - func(c *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { + core.WithCompletion(func() []string { return completer.LoggingServiceLogTags( - viper.GetString( - core.GetFlagName( - cmd.NS, constants.FlagLoggingPipelineId, - ), - ), - ), cobra.ShellCompDirectiveNoFileComp - }, + viper.GetString(core.GetFlagName(cmd.NS, constants.FlagLoggingPipelineId)), + ) + }, constants.LoggingApiRegionalURL), ) cmd.AddStringFlag( diff --git a/commands/logging-service/pipeline/delete.go b/commands/logging-service/pipeline/delete.go index 743fdad38..b3941bfd6 100644 --- a/commands/logging-service/pipeline/delete.go +++ b/commands/logging-service/pipeline/delete.go @@ -17,7 +17,6 @@ import ( "github.com/ionos-cloud/ionosctl/v6/pkg/confirm" "github.com/ionos-cloud/ionosctl/v6/pkg/functional" ionoscloud "github.com/ionos-cloud/sdk-go-logging" - "github.com/spf13/cobra" "github.com/spf13/viper" ) @@ -38,12 +37,7 @@ func PipelineDeleteCmd() *core.Command { cmd.AddStringFlag( constants.FlagLoggingPipelineId, constants.FlagIdShort, "", "The ID of the logging pipeline you want to delete", core.RequiredFlagOption(), - ) - _ = cmd.Command.RegisterFlagCompletionFunc( - constants.FlagLoggingPipelineId, - func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - return completer.LoggingServicePipelineIds(), cobra.ShellCompDirectiveNoFileComp - }, + core.WithCompletion(completer.LoggingServicePipelineIds, constants.LoggingApiRegionalURL), ) return cmd diff --git a/commands/logging-service/pipeline/get.go b/commands/logging-service/pipeline/get.go index c1632b57b..bb42d72c4 100644 --- a/commands/logging-service/pipeline/get.go +++ b/commands/logging-service/pipeline/get.go @@ -8,7 +8,6 @@ import ( "github.com/ionos-cloud/ionosctl/v6/internal/constants" "github.com/ionos-cloud/ionosctl/v6/internal/core" "github.com/ionos-cloud/ionosctl/v6/internal/printer/tabheaders" - "github.com/spf13/cobra" "github.com/spf13/viper" ) @@ -28,12 +27,7 @@ func PipelineGetCmd() *core.Command { cmd.AddStringFlag( constants.FlagLoggingPipelineId, constants.FlagIdShort, "", "The ID of the logging pipeline you want to retrieve", core.RequiredFlagOption(), - ) - _ = cmd.Command.RegisterFlagCompletionFunc( - constants.FlagLoggingPipelineId, - func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - return completer.LoggingServicePipelineIds(), cobra.ShellCompDirectiveNoFileComp - }, + core.WithCompletion(completer.LoggingServicePipelineIds, constants.LoggingApiRegionalURL), ) return cmd diff --git a/commands/logging-service/pipeline/key.go b/commands/logging-service/pipeline/key.go index 35af7ea65..8ec069e41 100644 --- a/commands/logging-service/pipeline/key.go +++ b/commands/logging-service/pipeline/key.go @@ -10,7 +10,6 @@ import ( "github.com/ionos-cloud/ionosctl/v6/internal/core" "github.com/ionos-cloud/ionosctl/v6/internal/printer/jsontabwriter" "github.com/ionos-cloud/ionosctl/v6/internal/printer/tabheaders" - "github.com/spf13/cobra" ) func PipelineKeyCmd() *core.Command { @@ -29,13 +28,8 @@ func PipelineKeyCmd() *core.Command { cmd.Command.Flags().StringSlice(constants.ArgCols, defaultCols, tabheaders.ColsMessage(defaultCols)) cmd.AddStringFlag( constants.FlagLoggingPipelineId, constants.FlagIdShort, "", - "The ID of the logging pipeline you want to retrieve", core.RequiredFlagOption(), - ) - _ = cmd.Command.RegisterFlagCompletionFunc( - constants.FlagLoggingPipelineId, - func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - return completer.LoggingServicePipelineIds(), cobra.ShellCompDirectiveNoFileComp - }, + "The ID of the logging pipeline you want to generate a key for", core.RequiredFlagOption(), + core.WithCompletion(completer.LoggingServicePipelineIds, constants.LoggingApiRegionalURL), ) return cmd diff --git a/commands/logging-service/pipeline/update.go b/commands/logging-service/pipeline/update.go index 86ffad473..cd4ce8919 100644 --- a/commands/logging-service/pipeline/update.go +++ b/commands/logging-service/pipeline/update.go @@ -9,7 +9,6 @@ import ( "github.com/ionos-cloud/ionosctl/v6/internal/core" "github.com/ionos-cloud/ionosctl/v6/internal/printer/tabheaders" ionoscloud "github.com/ionos-cloud/sdk-go-logging" - "github.com/spf13/cobra" "github.com/spf13/viper" ) @@ -34,13 +33,8 @@ func PipelineUpdateCmd() *core.Command { cmd.Command.Flags().StringSlice(constants.ArgCols, defaultCols, tabheaders.ColsMessage(defaultCols)) cmd.AddStringFlag( constants.FlagLoggingPipelineId, constants.FlagIdShort, "", - "The ID of the logging pipeline", core.RequiredFlagOption(), - ) - _ = cmd.Command.RegisterFlagCompletionFunc( - constants.FlagLoggingPipelineId, - func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - return completer.LoggingServicePipelineIds(), cobra.ShellCompDirectiveNoFileComp - }, + "The ID of the logging pipeline you want to delete", core.RequiredFlagOption(), + core.WithCompletion(completer.LoggingServicePipelineIds, constants.LoggingApiRegionalURL), ) return cmd diff --git a/commands/root.go b/commands/root.go index 686090116..44b27786f 100644 --- a/commands/root.go +++ b/commands/root.go @@ -2,10 +2,11 @@ package commands import ( "fmt" - "github.com/ionos-cloud/ionosctl/v6/commands/cdn" "os" "strings" + "github.com/ionos-cloud/ionosctl/v6/commands/cdn" + certificates "github.com/ionos-cloud/ionosctl/v6/commands/certmanager" "github.com/ionos-cloud/ionosctl/v6/commands/cfg" cloudapiv6 "github.com/ionos-cloud/ionosctl/v6/commands/cloudapi-v6" @@ -218,38 +219,8 @@ func addCommands() { // VM-Autoscaling commands rootCmd.AddCommand(vm_autoscaling.Root()) - // DNS --- - funcChangeDefaultApiUrl := func(command *core.Command, newDefault string) *core.Command { - // For some reason, this line only changes the help text - command.Command.PersistentFlags().StringP( - constants.ArgServerUrl, constants.ArgServerUrlShort, newDefault, "Override default host url", - ) - - // We should still run the original PersistentPreRun - originalPreRun := command.Command.PersistentPreRun - - // If unset, manually set the flag to the new default. SIDE EFFECT: Now, this flag will always be considered "set", within DNS sub commands. Can't find a better alternative - command.Command.PersistentPreRun = func(cmd *cobra.Command, args []string) { - if originalPreRun != nil { - originalPreRun(cmd, args) - } - - setVal := newDefault - if val, _ := cmd.Flags().GetString(constants.ArgServerUrl); val != "" { - setVal = val - } - viper.Set(constants.ArgServerUrl, setVal) - } - return command - } - - rootCmd.AddCommand(funcChangeDefaultApiUrl(dns.DNSCommand(), constants.DefaultDnsApiURL)) - // Logging Service - rootCmd.AddCommand( - funcChangeDefaultApiUrl( - logging_service.LoggingServiceCmd(), constants.DefaultLoggingServiceApiURL, - ), - ) + rootCmd.AddCommand(dns.Root()) + rootCmd.AddCommand(logging_service.Root()) // CDN rootCmd.AddCommand(cdn.Command()) diff --git a/docs/subcommands/CDN/distribution/create.md b/docs/subcommands/CDN/distribution/create.md index 82dab51ad..33e9b2586 100644 --- a/docs/subcommands/CDN/distribution/create.md +++ b/docs/subcommands/CDN/distribution/create.md @@ -31,7 +31,7 @@ Create a CDN distribution. Wiki: https://docs.ionos.com/cloud/network-services/c ## Options ```text - -u, --api-url string Override default host url (default "https://api.ionos.com") + -u, --api-url string Override default host URL (default "https://cdn.de-fra.ionos.com") --certificate-id string The ID of the certificate --cols strings Set of columns to be printed on output Available columns: [Id Domain CertificateId State] @@ -39,6 +39,7 @@ Create a CDN distribution. Wiki: https://docs.ionos.com/cloud/network-services/c --domain string The domain of the distribution -f, --force Force command to execute without user input -h, --help Print usage + -l, --location string Location of the resource to operate on. Can be one of: de/fra --no-headers Don't print table headers when table output is used -o, --output string Desired output format [text|json|api-json] (default "text") -q, --quiet Quiet output diff --git a/docs/subcommands/CDN/distribution/delete.md b/docs/subcommands/CDN/distribution/delete.md index 4a887d4f3..89c16aa80 100644 --- a/docs/subcommands/CDN/distribution/delete.md +++ b/docs/subcommands/CDN/distribution/delete.md @@ -32,13 +32,14 @@ Delete a distribution ```text -a, --all Delete all records if set (required) - -u, --api-url string Override default host url (default "https://api.ionos.com") + -u, --api-url string Override default host URL (default "https://cdn.de-fra.ionos.com") --cols strings Set of columns to be printed on output Available columns: [Id Domain CertificateId State] -c, --config string Configuration file used for authentication (default "$XDG_CONFIG_HOME/ionosctl/config.json") - -i, --distribution-id string The ID of the distribution you want to retrieve (required) + -i, --distribution-id string The ID of the distribution you want to delete (required) -f, --force Force command to execute without user input -h, --help Print usage + -l, --location string Location of the resource to operate on. Can be one of: de/fra --no-headers Don't print table headers when table output is used -o, --output string Desired output format [text|json|api-json] (default "text") -q, --quiet Quiet output diff --git a/docs/subcommands/CDN/distribution/get.md b/docs/subcommands/CDN/distribution/get.md index 30cbb9050..4991f2106 100644 --- a/docs/subcommands/CDN/distribution/get.md +++ b/docs/subcommands/CDN/distribution/get.md @@ -31,13 +31,14 @@ Retrieve a distribution ## Options ```text - -u, --api-url string Override default host url (default "https://api.ionos.com") + -u, --api-url string Override default host URL (default "https://cdn.de-fra.ionos.com") --cols strings Set of columns to be printed on output Available columns: [Id Domain CertificateId State] -c, --config string Configuration file used for authentication (default "$XDG_CONFIG_HOME/ionosctl/config.json") -i, --distribution-id string The ID of the distribution you want to retrieve (required) -f, --force Force command to execute without user input -h, --help Print usage + -l, --location string Location of the resource to operate on. Can be one of: de/fra --no-headers Don't print table headers when table output is used -o, --output string Desired output format [text|json|api-json] (default "text") -q, --quiet Quiet output diff --git a/docs/subcommands/CDN/distribution/list.md b/docs/subcommands/CDN/distribution/list.md index ac174844b..84d5b0bd1 100644 --- a/docs/subcommands/CDN/distribution/list.md +++ b/docs/subcommands/CDN/distribution/list.md @@ -31,13 +31,14 @@ Retrieve all distributions using pagination and optional filters ## Options ```text - -u, --api-url string Override default host url (default "https://api.ionos.com") + -u, --api-url string Override default host URL (default "https://cdn.de-fra.ionos.com") --cols strings Set of columns to be printed on output Available columns: [Id Domain CertificateId State] -c, --config string Configuration file used for authentication (default "$XDG_CONFIG_HOME/ionosctl/config.json") --domain string Filter used to fetch only the records that contain specified domain. -f, --force Force command to execute without user input -h, --help Print usage + -l, --location string Location of the resource to operate on. Can be one of: de/fra --max-results int32 The maximum number of elements to return --no-headers Don't print table headers when table output is used --offset int32 The first element (of the total list of elements) to include in the response. Use together with limit for pagination diff --git a/docs/subcommands/CDN/distribution/routingrules/get.md b/docs/subcommands/CDN/distribution/routingrules/get.md index d286c7661..61dba8b01 100644 --- a/docs/subcommands/CDN/distribution/routingrules/get.md +++ b/docs/subcommands/CDN/distribution/routingrules/get.md @@ -37,13 +37,14 @@ Retrieve a distribution routing rules ## Options ```text - -u, --api-url string Override default host url (default "https://api.ionos.com") + -u, --api-url string Override default host URL (default "https://cdn.de-fra.ionos.com") --cols strings Set of columns to be printed on output Available columns: [Id Domain CertificateId State] -c, --config string Configuration file used for authentication (default "$XDG_CONFIG_HOME/ionosctl/config.json") - -i, --distribution-id string The ID of the distribution you want to retrieve (required) + -i, --distribution-id string The ID of the distribution (required) -f, --force Force command to execute without user input -h, --help Print usage + -l, --location string Location of the resource to operate on. Can be one of: de/fra --no-headers Don't print table headers when table output is used -o, --output string Desired output format [text|json|api-json] (default "text") -q, --quiet Quiet output diff --git a/docs/subcommands/CDN/distribution/update.md b/docs/subcommands/CDN/distribution/update.md index 56733097e..56355c97e 100644 --- a/docs/subcommands/CDN/distribution/update.md +++ b/docs/subcommands/CDN/distribution/update.md @@ -31,15 +31,16 @@ Partially modify a distribution's properties. This command uses a combination of ## Options ```text - -u, --api-url string Override default host url (default "https://api.ionos.com") + -u, --api-url string Override default host URL (default "https://cdn.de-fra.ionos.com") --certificate-id string The ID of the certificate --cols strings Set of columns to be printed on output Available columns: [Id Domain CertificateId State] -c, --config string Configuration file used for authentication (default "$XDG_CONFIG_HOME/ionosctl/config.json") - -i, --distribution-id string The ID of the CDN distribution (required) + -i, --distribution-id string The ID of the distribution you want to update (required) --domain string The domain of the distribution -f, --force Force command to execute without user input -h, --help Print usage + -l, --location string Location of the resource to operate on. Can be one of: de/fra --no-headers Don't print table headers when table output is used -o, --output string Desired output format [text|json|api-json] (default "text") -q, --quiet Quiet output diff --git a/docs/subcommands/DNS/dnssec/create.md b/docs/subcommands/DNS/dnssec/create.md index baca052b4..00dc60d7e 100644 --- a/docs/subcommands/DNS/dnssec/create.md +++ b/docs/subcommands/DNS/dnssec/create.md @@ -32,13 +32,14 @@ Enable DNSSEC keys and create associated DNSKEY records for your DNS zone ```text --algorithm string Algorithm used to generate signing keys (both Key Signing Keys and Zone Signing Keys) (default "RSASHA256") - -u, --api-url string Override default host url (default "dns.de-fra.ionos.com") + -u, --api-url string Override default host URL (default "https://dns.de-fra.ionos.com") --cols strings Set of columns to be printed on output Available columns: [Id KeyTag DigestAlgorithmMnemonic Digest Validity Flags PubKey ComposedKeyData Algorithm KskBits ZskBits NsecMode Nsec3Iterations Nsec3SaltBits] (default [Id,KeyTag,DigestAlgorithmMnemonic,Digest,Validity]) -c, --config string Configuration file used for authentication (default "$XDG_CONFIG_HOME/ionosctl/config.json") -f, --force Force command to execute without user input -h, --help Print usage --ksk-bits int Key signing key length in bits. kskBits >= zskBits: [1024/2048/4096] (default 1024) + -l, --location string Location of the resource to operate on. Can be one of: de/fra --no-headers Don't print table headers when table output is used --nsec-mode string NSEC mode.. Can be one of: NSEC, NSEC3 (default "NSEC") --nsec3-iterations int Number of iterations for NSEC3. [0..50] @@ -47,7 +48,7 @@ Enable DNSSEC keys and create associated DNSKEY records for your DNS zone -q, --quiet Quiet output --validity int Signature validity in days [90..365] (default 90) -v, --verbose Print step-by-step process when running command - -z, --zone string The name or ID of the DNS zone + -z, --zone string The name or ID of the DNS zone (required) --zsk-bits int Zone signing key length in bits. zskBits <= kskBits: [1024/2048/4096] (default 1024) ``` diff --git a/docs/subcommands/DNS/dnssec/delete.md b/docs/subcommands/DNS/dnssec/delete.md index 6726b1a35..f9fcc9b5d 100644 --- a/docs/subcommands/DNS/dnssec/delete.md +++ b/docs/subcommands/DNS/dnssec/delete.md @@ -31,17 +31,18 @@ Removes ALL associated DNSKEY records for your DNS zone and disables DNSSEC keys ## Options ```text - -u, --api-url string Override default host url (default "dns.de-fra.ionos.com") - --cols strings Set of columns to be printed on output - Available columns: [Id KeyTag DigestAlgorithmMnemonic Digest Validity Flags PubKey ComposedKeyData Algorithm KskBits ZskBits NsecMode Nsec3Iterations Nsec3SaltBits] (default [Id,KeyTag,DigestAlgorithmMnemonic,Digest,Validity]) - -c, --config string Configuration file used for authentication (default "$XDG_CONFIG_HOME/ionosctl/config.json") - -f, --force Force command to execute without user input - -h, --help Print usage - --no-headers Don't print table headers when table output is used - -o, --output string Desired output format [text|json|api-json] (default "text") - -q, --quiet Quiet output - -v, --verbose Print step-by-step process when running command - -z, --zone string The name or ID of the DNS zone + -u, --api-url string Override default host URL (default "https://dns.de-fra.ionos.com") + --cols strings Set of columns to be printed on output + Available columns: [Id KeyTag DigestAlgorithmMnemonic Digest Validity Flags PubKey ComposedKeyData Algorithm KskBits ZskBits NsecMode Nsec3Iterations Nsec3SaltBits] (default [Id,KeyTag,DigestAlgorithmMnemonic,Digest,Validity]) + -c, --config string Configuration file used for authentication (default "$XDG_CONFIG_HOME/ionosctl/config.json") + -f, --force Force command to execute without user input + -h, --help Print usage + -l, --location string Location of the resource to operate on. Can be one of: de/fra + --no-headers Don't print table headers when table output is used + -o, --output string Desired output format [text|json|api-json] (default "text") + -q, --quiet Quiet output + -v, --verbose Print step-by-step process when running command + -z, --zone string The name or ID of the DNS zone (required) ``` ## Examples diff --git a/docs/subcommands/DNS/dnssec/list.md b/docs/subcommands/DNS/dnssec/list.md index 4c102b28b..f39c11a72 100644 --- a/docs/subcommands/DNS/dnssec/list.md +++ b/docs/subcommands/DNS/dnssec/list.md @@ -31,17 +31,18 @@ Retrieve your zone's DNSSEC keys ## Options ```text - -u, --api-url string Override default host url (default "dns.de-fra.ionos.com") - --cols strings Set of columns to be printed on output - Available columns: [Id KeyTag DigestAlgorithmMnemonic Digest Validity Flags PubKey ComposedKeyData Algorithm KskBits ZskBits NsecMode Nsec3Iterations Nsec3SaltBits] (default [Id,KeyTag,DigestAlgorithmMnemonic,Digest,Validity]) - -c, --config string Configuration file used for authentication (default "$XDG_CONFIG_HOME/ionosctl/config.json") - -f, --force Force command to execute without user input - -h, --help Print usage - --no-headers Don't print table headers when table output is used - -o, --output string Desired output format [text|json|api-json] (default "text") - -q, --quiet Quiet output - -v, --verbose Print step-by-step process when running command - -z, --zone string The name or ID of the DNS zone + -u, --api-url string Override default host URL (default "https://dns.de-fra.ionos.com") + --cols strings Set of columns to be printed on output + Available columns: [Id KeyTag DigestAlgorithmMnemonic Digest Validity Flags PubKey ComposedKeyData Algorithm KskBits ZskBits NsecMode Nsec3Iterations Nsec3SaltBits] (default [Id,KeyTag,DigestAlgorithmMnemonic,Digest,Validity]) + -c, --config string Configuration file used for authentication (default "$XDG_CONFIG_HOME/ionosctl/config.json") + -f, --force Force command to execute without user input + -h, --help Print usage + -l, --location string Location of the resource to operate on. Can be one of: de/fra + --no-headers Don't print table headers when table output is used + -o, --output string Desired output format [text|json|api-json] (default "text") + -q, --quiet Quiet output + -v, --verbose Print step-by-step process when running command + -z, --zone string The name or ID of the DNS zone (required) ``` ## Examples diff --git a/docs/subcommands/DNS/quota/get.md b/docs/subcommands/DNS/quota/get.md index 944ecad6c..38e69645c 100644 --- a/docs/subcommands/DNS/quota/get.md +++ b/docs/subcommands/DNS/quota/get.md @@ -31,16 +31,17 @@ Retrieve your quotas ## Options ```text - -u, --api-url string Override default host url (default "dns.de-fra.ionos.com") - --cols strings Set of columns to be printed on output - Available columns: [ZonesUsed ZonesLimit SecondaryZonesUsed SecondaryZonesLimit RecordsUsed RecordsLimit ReverseRecordsUsed ReverseRecordsLimit] - -c, --config string Configuration file used for authentication (default "$XDG_CONFIG_HOME/ionosctl/config.json") - -f, --force Force command to execute without user input - -h, --help Print usage - --no-headers Don't print table headers when table output is used - -o, --output string Desired output format [text|json|api-json] (default "text") - -q, --quiet Quiet output - -v, --verbose Print step-by-step process when running command + -u, --api-url string Override default host URL (default "https://dns.de-fra.ionos.com") + --cols strings Set of columns to be printed on output + Available columns: [ZonesUsed ZonesLimit SecondaryZonesUsed SecondaryZonesLimit RecordsUsed RecordsLimit ReverseRecordsUsed ReverseRecordsLimit] + -c, --config string Configuration file used for authentication (default "$XDG_CONFIG_HOME/ionosctl/config.json") + -f, --force Force command to execute without user input + -h, --help Print usage + -l, --location string Location of the resource to operate on. Can be one of: de/fra + --no-headers Don't print table headers when table output is used + -o, --output string Desired output format [text|json|api-json] (default "text") + -q, --quiet Quiet output + -v, --verbose Print step-by-step process when running command ``` ## Examples diff --git a/docs/subcommands/DNS/record/create.md b/docs/subcommands/DNS/record/create.md index 8306e6f2c..e677afd21 100644 --- a/docs/subcommands/DNS/record/create.md +++ b/docs/subcommands/DNS/record/create.md @@ -31,23 +31,24 @@ Create a record. Wiki: https://docs.ionos.com/cloud/network-services/cloud-dns/a ## Options ```text - -u, --api-url string Override default host url (default "dns.de-fra.ionos.com") - --cols strings Set of columns to be printed on output - Available columns: [Id Name Content Type Enabled FQDN ZoneId ZoneName State] - -c, --config string Configuration file used for authentication (default "$XDG_CONFIG_HOME/ionosctl/config.json") - --content string The content (Record Data) for your chosen record type. For example, if --type A, --content should be an IPv4 IP. (required) - --enabled When true - the record is visible for lookup (default true) - -f, --force Force command to execute without user input - -h, --help Print usage - -n, --name \* The name of the DNS record. Provide a wildcard i.e. \* to match requests for non-existent names under your DNS Zone name. Note that some terminals require '*' to be escaped, e.g. '\*' (required) - --no-headers Don't print table headers when table output is used - -o, --output string Desired output format [text|json|api-json] (default "text") - --priority int32 Priority value is between 0 and 65535. Priority is mandatory for MX, SRV and URI record types and ignored for all other types. - -q, --quiet Quiet output - --ttl int32 Time to live. The amount of time the record can be cached by a resolver or server before it needs to be refreshed from the authoritative DNS server (default 3600) - -t, --type string Type of DNS Record. Can be one of: A, AAAA, CNAME, ALIAS, MX, NS, SRV, TXT, CAA, SSHFP, TLSA, SMIMEA, DS, HTTPS, SVCB, OPENPGPKEY, CERT, URI, RP, LOC (required) (default "AAAA") - -v, --verbose Print step-by-step process when running command - -z, --zone string The ID or name of the DNS zone (required) + -u, --api-url string Override default host URL (default "https://dns.de-fra.ionos.com") + --cols strings Set of columns to be printed on output + Available columns: [Id Name Content Type Enabled FQDN ZoneId ZoneName State] + -c, --config string Configuration file used for authentication (default "$XDG_CONFIG_HOME/ionosctl/config.json") + --content string The content (Record Data) for your chosen record type. For example, if --type A, --content should be an IPv4 IP. (required) + --enabled When true - the record is visible for lookup (default true) + -f, --force Force command to execute without user input + -h, --help Print usage + -l, --location string Location of the resource to operate on. Can be one of: de/fra + -n, --name \* The name of the DNS record. Provide a wildcard i.e. \* to match requests for non-existent names under your DNS Zone name. Note that some terminals require '*' to be escaped, e.g. '\*' (required) + --no-headers Don't print table headers when table output is used + -o, --output string Desired output format [text|json|api-json] (default "text") + --priority int32 Priority value is between 0 and 65535. Priority is mandatory for MX, SRV and URI record types and ignored for all other types. + -q, --quiet Quiet output + --ttl int32 Time to live. The amount of time the record can be cached by a resolver or server before it needs to be refreshed from the authoritative DNS server (default 3600) + -t, --type string Type of DNS Record. Can be one of: A, AAAA, CNAME, ALIAS, MX, NS, SRV, TXT, CAA, SSHFP, TLSA, SMIMEA, DS, HTTPS, SVCB, OPENPGPKEY, CERT, URI, RP, LOC (required) (default "AAAA") + -v, --verbose Print step-by-step process when running command + -z, --zone string The ID or name of the DNS zone (required) ``` ## Examples diff --git a/docs/subcommands/DNS/record/delete.md b/docs/subcommands/DNS/record/delete.md index e344e5930..aba788b72 100644 --- a/docs/subcommands/DNS/record/delete.md +++ b/docs/subcommands/DNS/record/delete.md @@ -41,19 +41,20 @@ Here, PARTIAL_NAME is a part of the name of the DNS record you want to delete. I ## Options ```text - -a, --all Delete all records. You can optionally filter the deleted records using --zone (full name / ID) and --record (partial name) - -u, --api-url string Override default host url (default "dns.de-fra.ionos.com") - --cols strings Set of columns to be printed on output - Available columns: [Id Name Content Type Enabled FQDN ZoneId ZoneName State] - -c, --config string Configuration file used for authentication (default "$XDG_CONFIG_HOME/ionosctl/config.json") - -f, --force Force command to execute without user input - -h, --help Print usage - --no-headers Don't print table headers when table output is used - -o, --output string Desired output format [text|json|api-json] (default "text") - -q, --quiet Quiet output - -r, --record string The ID, or full name of the DNS record. Required together with --zone. Can also provide partial names, but must narrow down to a single record result if not using --all. If using it, will however delete all records that match. - -v, --verbose Print step-by-step process when running command - -z, --zone string The full name or ID of the zone of the containing the target record. If --all is set this is applied as a filter - limiting to records within this zone + -a, --all Delete all records. You can optionally filter the deleted records using --zone (full name / ID) and --record (partial name) + -u, --api-url string Override default host URL (default "https://dns.de-fra.ionos.com") + --cols strings Set of columns to be printed on output + Available columns: [Id Name Content Type Enabled FQDN ZoneId ZoneName State] + -c, --config string Configuration file used for authentication (default "$XDG_CONFIG_HOME/ionosctl/config.json") + -f, --force Force command to execute without user input + -h, --help Print usage + -l, --location string Location of the resource to operate on. Can be one of: de/fra + --no-headers Don't print table headers when table output is used + -o, --output string Desired output format [text|json|api-json] (default "text") + -q, --quiet Quiet output + -r, --record string The ID, or full name of the DNS record. Required together with --zone. Can also provide partial names, but must narrow down to a single record result if not using --all. If using it, will however delete all records that match. + -v, --verbose Print step-by-step process when running command + -z, --zone string The full name or ID of the zone of the containing the target record. If --all is set this is applied as a filter - limiting to records within this zone ``` ## Examples diff --git a/docs/subcommands/DNS/record/get.md b/docs/subcommands/DNS/record/get.md index 5e2bc5463..241003f94 100644 --- a/docs/subcommands/DNS/record/get.md +++ b/docs/subcommands/DNS/record/get.md @@ -31,18 +31,19 @@ Retrieve a record ## Options ```text - -u, --api-url string Override default host url (default "dns.de-fra.ionos.com") - --cols strings Set of columns to be printed on output - Available columns: [Id Name Content Type Enabled FQDN ZoneId ZoneName State] - -c, --config string Configuration file used for authentication (default "$XDG_CONFIG_HOME/ionosctl/config.json") - -f, --force Force command to execute without user input - -h, --help Print usage - --no-headers Don't print table headers when table output is used - -o, --output string Desired output format [text|json|api-json] (default "text") - -q, --quiet Quiet output - --record string The ID or name of the DNS record - -v, --verbose Print step-by-step process when running command - -z, --zone string The name or ID of the DNS zone + -u, --api-url string Override default host URL (default "https://dns.de-fra.ionos.com") + --cols strings Set of columns to be printed on output + Available columns: [Id Name Content Type Enabled FQDN ZoneId ZoneName State] + -c, --config string Configuration file used for authentication (default "$XDG_CONFIG_HOME/ionosctl/config.json") + -f, --force Force command to execute without user input + -h, --help Print usage + -l, --location string Location of the resource to operate on. Can be one of: de/fra + --no-headers Don't print table headers when table output is used + -o, --output string Desired output format [text|json|api-json] (default "text") + -q, --quiet Quiet output + --record string The ID or name of the DNS record + -v, --verbose Print step-by-step process when running command + -z, --zone string The name or ID of the DNS zone ``` ## Examples diff --git a/docs/subcommands/DNS/record/list.md b/docs/subcommands/DNS/record/list.md index 8d24a8168..96c4c91ca 100644 --- a/docs/subcommands/DNS/record/list.md +++ b/docs/subcommands/DNS/record/list.md @@ -31,13 +31,14 @@ Retrieve all records from either a primary or secondary zone ## Options ```text - -u, --api-url string Override default host url (default "dns.de-fra.ionos.com") + -u, --api-url string Override default host URL (default "https://dns.de-fra.ionos.com") --cols strings Set of columns to be printed on output Available columns for primary zones: [Id Name Content Type Enabled FQDN ZoneId ZoneName State] Available columns for secondary zones: [Id Name Content Type Enabled FQDN ZoneId ZoneName RootName] -c, --config string Configuration file used for authentication (default "$XDG_CONFIG_HOME/ionosctl/config.json") -f, --force Force command to execute without user input -h, --help Print usage + -l, --location string Location of the resource to operate on. Can be one of: de/fra --max-results int32 The maximum number of elements to return --name string Filter used to fetch only the records that contain specified record name. NOTE: Only available for zone records. --no-headers Don't print table headers when table output is used diff --git a/docs/subcommands/DNS/record/update.md b/docs/subcommands/DNS/record/update.md index c1e7cd57d..e7b755b9a 100644 --- a/docs/subcommands/DNS/record/update.md +++ b/docs/subcommands/DNS/record/update.md @@ -31,24 +31,25 @@ Partially modify a record's properties. This command uses a combination of GET a ## Options ```text - -u, --api-url string Override default host url (default "dns.de-fra.ionos.com") - --cols strings Set of columns to be printed on output - Available columns: [Id Name Content Type Enabled FQDN ZoneId ZoneName State] - -c, --config string Configuration file used for authentication (default "$XDG_CONFIG_HOME/ionosctl/config.json") - --content string The content (Record Data) for your chosen record type. For example, if --type A, --content should be an IPv4 IP. (required) - --enabled When true - the record is visible for lookup (default true) - -f, --force Force command to execute without user input - -h, --help Print usage - -n, --name \* The name of the DNS record. Provide a wildcard i.e. \* to match requests for non-existent names under your DNS Zone name. Note that some terminals require '*' to be escaped, e.g. '\*' (required) - --no-headers Don't print table headers when table output is used - -o, --output string Desired output format [text|json|api-json] (default "text") - --priority int32 Priority value is between 0 and 65535. Priority is mandatory for MX, SRV and URI record types and ignored for all other types. - -q, --quiet Quiet output - -r, --record string The ID or name of the DNS record (required) - --ttl int32 Time to live. The amount of time the record can be cached by a resolver or server before it needs to be refreshed from the authoritative DNS server (default 3600) - -t, --type string Type of DNS Record. Can be one of: A, AAAA, CNAME, ALIAS, MX, NS, SRV, TXT, CAA, SSHFP, TLSA, SMIMEA, DS, HTTPS, SVCB, OPENPGPKEY, CERT, URI, RP, LOC (required) (default "AAAA") - -v, --verbose Print step-by-step process when running command - -z, --zone string The name or ID of the DNS zone (required) + -u, --api-url string Override default host URL (default "https://dns.de-fra.ionos.com") + --cols strings Set of columns to be printed on output + Available columns: [Id Name Content Type Enabled FQDN ZoneId ZoneName State] + -c, --config string Configuration file used for authentication (default "$XDG_CONFIG_HOME/ionosctl/config.json") + --content string The content (Record Data) for your chosen record type. For example, if --type A, --content should be an IPv4 IP. (required) + --enabled When true - the record is visible for lookup (default true) + -f, --force Force command to execute without user input + -h, --help Print usage + -l, --location string Location of the resource to operate on. Can be one of: de/fra + -n, --name \* The name of the DNS record. Provide a wildcard i.e. \* to match requests for non-existent names under your DNS Zone name. Note that some terminals require '*' to be escaped, e.g. '\*' (required) + --no-headers Don't print table headers when table output is used + -o, --output string Desired output format [text|json|api-json] (default "text") + --priority int32 Priority value is between 0 and 65535. Priority is mandatory for MX, SRV and URI record types and ignored for all other types. + -q, --quiet Quiet output + -r, --record string The ID or name of the DNS record (required) + --ttl int32 Time to live. The amount of time the record can be cached by a resolver or server before it needs to be refreshed from the authoritative DNS server (default 3600) + -t, --type string Type of DNS Record. Can be one of: A, AAAA, CNAME, ALIAS, MX, NS, SRV, TXT, CAA, SSHFP, TLSA, SMIMEA, DS, HTTPS, SVCB, OPENPGPKEY, CERT, URI, RP, LOC (required) (default "AAAA") + -v, --verbose Print step-by-step process when running command + -z, --zone string The name or ID of the DNS zone (required) ``` ## Examples diff --git a/docs/subcommands/DNS/reverse/record/create.md b/docs/subcommands/DNS/reverse/record/create.md index 3e96bc869..d1563118c 100644 --- a/docs/subcommands/DNS/reverse/record/create.md +++ b/docs/subcommands/DNS/reverse/record/create.md @@ -31,7 +31,7 @@ Create a record. Wiki: https://docs.ionos.com/cloud/network-services/cloud-dns/a ## Options ```text - -u, --api-url string Override default host url (default "dns.de-fra.ionos.com") + -u, --api-url string Override default host URL (default "https://dns.de-fra.ionos.com") --cols strings Set of columns to be printed on output Available columns: [Id Name IP Description] (default [Id,Name,IP,Description]) -c, --config string Configuration file used for authentication (default "$XDG_CONFIG_HOME/ionosctl/config.json") @@ -39,6 +39,7 @@ Create a record. Wiki: https://docs.ionos.com/cloud/network-services/cloud-dns/a -f, --force Force command to execute without user input -h, --help Print usage --ip string [IPv4/IPv6] Specifies for which IP address the reverse record should be created. The IP addresses needs to be owned by the contract (required) + -l, --location string Location of the resource to operate on. Can be one of: de/fra -n, --name string The name of the DNS Reverse Record. (required) --no-headers Don't print table headers when table output is used -o, --output string Desired output format [text|json|api-json] (default "text") diff --git a/docs/subcommands/DNS/reverse/record/delete.md b/docs/subcommands/DNS/reverse/record/delete.md index e35b6ddf4..73c1b4f05 100644 --- a/docs/subcommands/DNS/reverse/record/delete.md +++ b/docs/subcommands/DNS/reverse/record/delete.md @@ -31,18 +31,19 @@ Delete a record ## Options ```text - -a, --all Delete all records if set (required) - -u, --api-url string Override default host url (default "dns.de-fra.ionos.com") - --cols strings Set of columns to be printed on output - Available columns: [Id Name IP Description] (default [Id,Name,IP,Description]) - -c, --config string Configuration file used for authentication (default "$XDG_CONFIG_HOME/ionosctl/config.json") - -f, --force Force command to execute without user input - -h, --help Print usage - --no-headers Don't print table headers when table output is used - -o, --output string Desired output format [text|json|api-json] (default "text") - -q, --quiet Quiet output - --record string The record ID or IP which you want to delete (required) - -v, --verbose Print step-by-step process when running command + -a, --all Delete all records if set (required) + -u, --api-url string Override default host URL (default "https://dns.de-fra.ionos.com") + --cols strings Set of columns to be printed on output + Available columns: [Id Name IP Description] (default [Id,Name,IP,Description]) + -c, --config string Configuration file used for authentication (default "$XDG_CONFIG_HOME/ionosctl/config.json") + -f, --force Force command to execute without user input + -h, --help Print usage + -l, --location string Location of the resource to operate on. Can be one of: de/fra + --no-headers Don't print table headers when table output is used + -o, --output string Desired output format [text|json|api-json] (default "text") + -q, --quiet Quiet output + --record string The record ID or IP which you want to delete (required) + -v, --verbose Print step-by-step process when running command ``` ## Examples diff --git a/docs/subcommands/DNS/reverse/record/get.md b/docs/subcommands/DNS/reverse/record/get.md index 3d6987153..3e4e82924 100644 --- a/docs/subcommands/DNS/reverse/record/get.md +++ b/docs/subcommands/DNS/reverse/record/get.md @@ -31,17 +31,18 @@ Find a record by IP or ID ## Options ```text - -u, --api-url string Override default host url (default "dns.de-fra.ionos.com") - --cols strings Set of columns to be printed on output - Available columns: [Id Name IP Description] (default [Id,Name,IP,Description]) - -c, --config string Configuration file used for authentication (default "$XDG_CONFIG_HOME/ionosctl/config.json") - -f, --force Force command to execute without user input - -h, --help Print usage - --no-headers Don't print table headers when table output is used - -o, --output string Desired output format [text|json|api-json] (default "text") - -q, --quiet Quiet output - --record string The record ID or IP, for identifying which record you want to update (required) - -v, --verbose Print step-by-step process when running command + -u, --api-url string Override default host URL (default "https://dns.de-fra.ionos.com") + --cols strings Set of columns to be printed on output + Available columns: [Id Name IP Description] (default [Id,Name,IP,Description]) + -c, --config string Configuration file used for authentication (default "$XDG_CONFIG_HOME/ionosctl/config.json") + -f, --force Force command to execute without user input + -h, --help Print usage + -l, --location string Location of the resource to operate on. Can be one of: de/fra + --no-headers Don't print table headers when table output is used + -o, --output string Desired output format [text|json|api-json] (default "text") + -q, --quiet Quiet output + --record string The record ID or IP which you want to get (required) + -v, --verbose Print step-by-step process when running command ``` ## Examples diff --git a/docs/subcommands/DNS/reverse/record/list.md b/docs/subcommands/DNS/reverse/record/list.md index 1d8b23437..d91ccf825 100644 --- a/docs/subcommands/DNS/reverse/record/list.md +++ b/docs/subcommands/DNS/reverse/record/list.md @@ -31,13 +31,14 @@ Retrieve all reverse records ## Options ```text - -u, --api-url string Override default host url (default "dns.de-fra.ionos.com") + -u, --api-url string Override default host URL (default "https://dns.de-fra.ionos.com") --cols strings Set of columns to be printed on output Available columns: [Id Name IP Description] (default [Id,Name,IP,Description]) -c, --config string Configuration file used for authentication (default "$XDG_CONFIG_HOME/ionosctl/config.json") -f, --force Force command to execute without user input -h, --help Print usage -i, --ips string Optional filter for the IP address of the reverse record + -l, --location string Location of the resource to operate on. Can be one of: de/fra --max-results int32 The maximum number of elements to return --no-headers Don't print table headers when table output is used --offset int32 The first element (of the total list of elements) to include in the response. Use together with limit for pagination diff --git a/docs/subcommands/DNS/reverse/record/update.md b/docs/subcommands/DNS/reverse/record/update.md index 33d275703..1fbfef75b 100644 --- a/docs/subcommands/DNS/reverse/record/update.md +++ b/docs/subcommands/DNS/reverse/record/update.md @@ -31,7 +31,7 @@ Update a record ## Options ```text - -u, --api-url string Override default host url (default "dns.de-fra.ionos.com") + -u, --api-url string Override default host URL (default "https://dns.de-fra.ionos.com") --cols strings Set of columns to be printed on output Available columns: [Id Name IP Description] (default [Id,Name,IP,Description]) -c, --config string Configuration file used for authentication (default "$XDG_CONFIG_HOME/ionosctl/config.json") @@ -39,11 +39,12 @@ Update a record -f, --force Force command to execute without user input -h, --help Print usage --ip string The new IP + -l, --location string Location of the resource to operate on. Can be one of: de/fra --name string The new record name --no-headers Don't print table headers when table output is used -o, --output string Desired output format [text|json|api-json] (default "text") -q, --quiet Quiet output - --record string The record ID or IP, for identifying which record you want to update (required) + --record string The record ID or IP which you want to update (required) -v, --verbose Print step-by-step process when running command ``` diff --git a/docs/subcommands/DNS/secondary/zone/create.md b/docs/subcommands/DNS/secondary/zone/create.md index 311edb499..592d7f9a2 100644 --- a/docs/subcommands/DNS/secondary/zone/create.md +++ b/docs/subcommands/DNS/secondary/zone/create.md @@ -34,13 +34,14 @@ IPv6: 2001:8d8:fe:53::5cd:25 ## Options ```text - -u, --api-url string Override default host url (default "dns.de-fra.ionos.com") + -u, --api-url string Override default host URL (default "https://dns.de-fra.ionos.com") --cols strings Set of columns to be printed on output Available columns: [Id Name Description PrimaryIPs State] (default [Id,Name,Description,PrimaryIPs,State]) -c, --config string Configuration file used for authentication (default "$XDG_CONFIG_HOME/ionosctl/config.json") --description string Description of the secondary zone -f, --force Force command to execute without user input -h, --help Print usage + -l, --location string Location of the resource to operate on. Can be one of: de/fra -n, --name string Name of the secondary zone --no-headers Don't print table headers when table output is used -o, --output string Desired output format [text|json|api-json] (default "text") diff --git a/docs/subcommands/DNS/secondary/zone/delete.md b/docs/subcommands/DNS/secondary/zone/delete.md index e07ba7585..59212cadb 100644 --- a/docs/subcommands/DNS/secondary/zone/delete.md +++ b/docs/subcommands/DNS/secondary/zone/delete.md @@ -31,18 +31,19 @@ Delete a secondary zone ## Options ```text - -a, --all Delete all secondary zones - -u, --api-url string Override default host url (default "dns.de-fra.ionos.com") - --cols strings Set of columns to be printed on output - Available columns: [Id Name Description PrimaryIPs State] (default [Id,Name,Description,PrimaryIPs,State]) - -c, --config string Configuration file used for authentication (default "$XDG_CONFIG_HOME/ionosctl/config.json") - -f, --force Force command to execute without user input - -h, --help Print usage - --no-headers Don't print table headers when table output is used - -o, --output string Desired output format [text|json|api-json] (default "text") - -q, --quiet Quiet output - -v, --verbose Print step-by-step process when running command - -z, --zone string The name or ID of the DNS zone + -a, --all Delete all secondary zones + -u, --api-url string Override default host URL (default "https://dns.de-fra.ionos.com") + --cols strings Set of columns to be printed on output + Available columns: [Id Name Description PrimaryIPs State] (default [Id,Name,Description,PrimaryIPs,State]) + -c, --config string Configuration file used for authentication (default "$XDG_CONFIG_HOME/ionosctl/config.json") + -f, --force Force command to execute without user input + -h, --help Print usage + -l, --location string Location of the resource to operate on. Can be one of: de/fra + --no-headers Don't print table headers when table output is used + -o, --output string Desired output format [text|json|api-json] (default "text") + -q, --quiet Quiet output + -v, --verbose Print step-by-step process when running command + -z, --zone string The name or ID of the DNS zone ``` ## Examples diff --git a/docs/subcommands/DNS/secondary/zone/get.md b/docs/subcommands/DNS/secondary/zone/get.md index 34667cfc7..0775ecbf9 100644 --- a/docs/subcommands/DNS/secondary/zone/get.md +++ b/docs/subcommands/DNS/secondary/zone/get.md @@ -25,17 +25,18 @@ Retrieve a secondary zone by its ID or name ## Options ```text - -u, --api-url string Override default host url (default "dns.de-fra.ionos.com") - --cols strings Set of columns to be printed on output - Available columns: [Id Name Description PrimaryIPs State] (default [Id,Name,Description,PrimaryIPs,State]) - -c, --config string Configuration file used for authentication (default "$XDG_CONFIG_HOME/ionosctl/config.json") - -f, --force Force command to execute without user input - -h, --help Print usage - --no-headers Don't print table headers when table output is used - -o, --output string Desired output format [text|json|api-json] (default "text") - -q, --quiet Quiet output - -v, --verbose Print step-by-step process when running command - -z, --zone string The name or ID of the DNS zone + -u, --api-url string Override default host URL (default "https://dns.de-fra.ionos.com") + --cols strings Set of columns to be printed on output + Available columns: [Id Name Description PrimaryIPs State] (default [Id,Name,Description,PrimaryIPs,State]) + -c, --config string Configuration file used for authentication (default "$XDG_CONFIG_HOME/ionosctl/config.json") + -f, --force Force command to execute without user input + -h, --help Print usage + -l, --location string Location of the resource to operate on. Can be one of: de/fra + --no-headers Don't print table headers when table output is used + -o, --output string Desired output format [text|json|api-json] (default "text") + -q, --quiet Quiet output + -v, --verbose Print step-by-step process when running command + -z, --zone string The name or ID of the DNS zone ``` ## Examples diff --git a/docs/subcommands/DNS/secondary/zone/list.md b/docs/subcommands/DNS/secondary/zone/list.md index 753f7e43b..acc6daa21 100644 --- a/docs/subcommands/DNS/secondary/zone/list.md +++ b/docs/subcommands/DNS/secondary/zone/list.md @@ -25,12 +25,13 @@ List all secondary zones. Default limit is the first 100 items. Use pagination q ## Options ```text - -u, --api-url string Override default host url (default "dns.de-fra.ionos.com") + -u, --api-url string Override default host URL (default "https://dns.de-fra.ionos.com") --cols strings Set of columns to be printed on output Available columns: [Id Name Description PrimaryIPs State] (default [Id,Name,Description,PrimaryIPs,State]) -c, --config string Configuration file used for authentication (default "$XDG_CONFIG_HOME/ionosctl/config.json") -f, --force Force command to execute without user input -h, --help Print usage + -l, --location string Location of the resource to operate on. Can be one of: de/fra --max-results int32 Pagination limit -n, --name string Filter used to fetch only the zones that contain the specified zone name --no-headers Don't print table headers when table output is used diff --git a/docs/subcommands/DNS/secondary/zone/transfer/get.md b/docs/subcommands/DNS/secondary/zone/transfer/get.md index 8b716574a..dd91cd032 100644 --- a/docs/subcommands/DNS/secondary/zone/transfer/get.md +++ b/docs/subcommands/DNS/secondary/zone/transfer/get.md @@ -37,16 +37,17 @@ Get the transfer status for a secondary zone ## Options ```text - -u, --api-url string Override default host url (default "dns.de-fra.ionos.com") - --cols strings Set of columns to be printed on output - Available columns: [PrimaryIP Status ErrorMessage] (default [PrimaryIP,Status,ErrorMessage]) - -c, --config string Configuration file used for authentication (default "$XDG_CONFIG_HOME/ionosctl/config.json") - -f, --force Force command to execute without user input - -h, --help Print usage - --no-headers Don't print table headers when table output is used - -o, --output string Desired output format [text|json|api-json] (default "text") - -q, --quiet Quiet output - -v, --verbose Print step-by-step process when running command - -z, --zone string The name or ID of the DNS zone + -u, --api-url string Override default host URL (default "https://dns.de-fra.ionos.com") + --cols strings Set of columns to be printed on output + Available columns: [PrimaryIP Status ErrorMessage] (default [PrimaryIP,Status,ErrorMessage]) + -c, --config string Configuration file used for authentication (default "$XDG_CONFIG_HOME/ionosctl/config.json") + -f, --force Force command to execute without user input + -h, --help Print usage + -l, --location string Location of the resource to operate on. Can be one of: de/fra + --no-headers Don't print table headers when table output is used + -o, --output string Desired output format [text|json|api-json] (default "text") + -q, --quiet Quiet output + -v, --verbose Print step-by-step process when running command + -z, --zone string The name or ID of the DNS zone ``` diff --git a/docs/subcommands/DNS/secondary/zone/transfer/start.md b/docs/subcommands/DNS/secondary/zone/transfer/start.md index 690730df0..dbbd8f39a 100644 --- a/docs/subcommands/DNS/secondary/zone/transfer/start.md +++ b/docs/subcommands/DNS/secondary/zone/transfer/start.md @@ -37,16 +37,17 @@ Initiate zone transfer ## Options ```text - -u, --api-url string Override default host url (default "dns.de-fra.ionos.com") - --cols strings Set of columns to be printed on output - Available columns: [PrimaryIP Status ErrorMessage] (default [PrimaryIP,Status,ErrorMessage]) - -c, --config string Configuration file used for authentication (default "$XDG_CONFIG_HOME/ionosctl/config.json") - -f, --force Force command to execute without user input - -h, --help Print usage - --no-headers Don't print table headers when table output is used - -o, --output string Desired output format [text|json|api-json] (default "text") - -q, --quiet Quiet output - -v, --verbose Print step-by-step process when running command - -z, --zone string The name or ID of the DNS zone + -u, --api-url string Override default host URL (default "https://dns.de-fra.ionos.com") + --cols strings Set of columns to be printed on output + Available columns: [PrimaryIP Status ErrorMessage] (default [PrimaryIP,Status,ErrorMessage]) + -c, --config string Configuration file used for authentication (default "$XDG_CONFIG_HOME/ionosctl/config.json") + -f, --force Force command to execute without user input + -h, --help Print usage + -l, --location string Location of the resource to operate on. Can be one of: de/fra + --no-headers Don't print table headers when table output is used + -o, --output string Desired output format [text|json|api-json] (default "text") + -q, --quiet Quiet output + -v, --verbose Print step-by-step process when running command + -z, --zone string The name or ID of the DNS zone ``` diff --git a/docs/subcommands/DNS/secondary/zone/update.md b/docs/subcommands/DNS/secondary/zone/update.md index 034fed8a7..ba04acb54 100644 --- a/docs/subcommands/DNS/secondary/zone/update.md +++ b/docs/subcommands/DNS/secondary/zone/update.md @@ -25,13 +25,14 @@ Update or create a secondary zone ## Options ```text - -u, --api-url string Override default host url (default "dns.de-fra.ionos.com") + -u, --api-url string Override default host URL (default "https://dns.de-fra.ionos.com") --cols strings Set of columns to be printed on output Available columns: [Id Name Description PrimaryIPs State] (default [Id,Name,Description,PrimaryIPs,State]) -c, --config string Configuration file used for authentication (default "$XDG_CONFIG_HOME/ionosctl/config.json") --description string Description of the secondary zone -f, --force Force command to execute without user input -h, --help Print usage + -l, --location string Location of the resource to operate on. Can be one of: de/fra --no-headers Don't print table headers when table output is used -o, --output string Desired output format [text|json|api-json] (default "text") --primary-ips strings Primary DNS server IP addresses diff --git a/docs/subcommands/DNS/zone/create.md b/docs/subcommands/DNS/zone/create.md index be4d1600a..035dc1f9c 100644 --- a/docs/subcommands/DNS/zone/create.md +++ b/docs/subcommands/DNS/zone/create.md @@ -31,7 +31,7 @@ Create a zone ## Options ```text - -u, --api-url string Override default host url (default "dns.de-fra.ionos.com") + -u, --api-url string Override default host URL (default "https://dns.de-fra.ionos.com") --cols strings Set of columns to be printed on output Available columns: [Id Name Description NameServers Enabled State] -c, --config string Configuration file used for authentication (default "$XDG_CONFIG_HOME/ionosctl/config.json") @@ -39,6 +39,7 @@ Create a zone --enabled Activate or deactivate the DNS zone (default true) -f, --force Force command to execute without user input -h, --help Print usage + -l, --location string Location of the resource to operate on. Can be one of: de/fra -n, --name string The name of the DNS zone, e.g. foo.com --no-headers Don't print table headers when table output is used -o, --output string Desired output format [text|json|api-json] (default "text") diff --git a/docs/subcommands/DNS/zone/delete.md b/docs/subcommands/DNS/zone/delete.md index a505f221b..3af606061 100644 --- a/docs/subcommands/DNS/zone/delete.md +++ b/docs/subcommands/DNS/zone/delete.md @@ -31,18 +31,19 @@ Delete a zone ## Options ```text - -a, --all Delete all zones. Required or -z - -u, --api-url string Override default host url (default "dns.de-fra.ionos.com") - --cols strings Set of columns to be printed on output - Available columns: [Id Name Description NameServers Enabled State] - -c, --config string Configuration file used for authentication (default "$XDG_CONFIG_HOME/ionosctl/config.json") - -f, --force Force command to execute without user input - -h, --help Print usage - --no-headers Don't print table headers when table output is used - -o, --output string Desired output format [text|json|api-json] (default "text") - -q, --quiet Quiet output - -v, --verbose Print step-by-step process when running command - -z, --zone string The name or ID of the DNS zone. Required or -a + -a, --all Delete all zones. Required or -z + -u, --api-url string Override default host URL (default "https://dns.de-fra.ionos.com") + --cols strings Set of columns to be printed on output + Available columns: [Id Name Description NameServers Enabled State] + -c, --config string Configuration file used for authentication (default "$XDG_CONFIG_HOME/ionosctl/config.json") + -f, --force Force command to execute without user input + -h, --help Print usage + -l, --location string Location of the resource to operate on. Can be one of: de/fra + --no-headers Don't print table headers when table output is used + -o, --output string Desired output format [text|json|api-json] (default "text") + -q, --quiet Quiet output + -v, --verbose Print step-by-step process when running command + -z, --zone string The name or ID of the DNS zone. Required or -a ``` ## Examples diff --git a/docs/subcommands/DNS/zone/file/get.md b/docs/subcommands/DNS/zone/file/get.md index c9a8f15af..897bb197c 100644 --- a/docs/subcommands/DNS/zone/file/get.md +++ b/docs/subcommands/DNS/zone/file/get.md @@ -37,16 +37,17 @@ Get the exported zone file in BIND format (RFC 1035) ## Options ```text - -u, --api-url string Override default host url (default "dns.de-fra.ionos.com") - --cols strings Set of columns to be printed on output - Available columns: [Id Name Description NameServers Enabled State] - -c, --config string Configuration file used for authentication (default "$XDG_CONFIG_HOME/ionosctl/config.json") - -f, --force Force command to execute without user input - -h, --help Print usage - --no-headers Don't print table headers when table output is used - -o, --output string Desired output format [text|json|api-json] (default "text") - -q, --quiet Quiet output - -v, --verbose Print step-by-step process when running command - -z, --zone string The name or ID of the DNS zone + -u, --api-url string Override default host URL (default "https://dns.de-fra.ionos.com") + --cols strings Set of columns to be printed on output + Available columns: [Id Name Description NameServers Enabled State] + -c, --config string Configuration file used for authentication (default "$XDG_CONFIG_HOME/ionosctl/config.json") + -f, --force Force command to execute without user input + -h, --help Print usage + -l, --location string Location of the resource to operate on. Can be one of: de/fra + --no-headers Don't print table headers when table output is used + -o, --output string Desired output format [text|json|api-json] (default "text") + -q, --quiet Quiet output + -v, --verbose Print step-by-step process when running command + -z, --zone string The name or ID of the DNS zone (required) ``` diff --git a/docs/subcommands/DNS/zone/file/update.md b/docs/subcommands/DNS/zone/file/update.md index 26e964b48..4c424c306 100644 --- a/docs/subcommands/DNS/zone/file/update.md +++ b/docs/subcommands/DNS/zone/file/update.md @@ -31,17 +31,18 @@ Update a zone file ## Options ```text - -u, --api-url string Override default host url (default "dns.de-fra.ionos.com") + -u, --api-url string Override default host URL (default "https://dns.de-fra.ionos.com") --cols strings Set of columns to be printed on output Available columns: [Id Name Description NameServers Enabled State] -c, --config string Configuration file used for authentication (default "$XDG_CONFIG_HOME/ionosctl/config.json") -f, --force Force command to execute without user input -h, --help Print usage + -l, --location string Location of the resource to operate on. Can be one of: de/fra --no-headers Don't print table headers when table output is used -o, --output string Desired output format [text|json|api-json] (default "text") -q, --quiet Quiet output -v, --verbose Print step-by-step process when running command - -z, --zone string The name or ID of the DNS zone + -z, --zone string The name or ID of the DNS zone (required) --zone-file string Path to the zone file ``` diff --git a/docs/subcommands/DNS/zone/get.md b/docs/subcommands/DNS/zone/get.md index 4466d9173..4e14cf80d 100644 --- a/docs/subcommands/DNS/zone/get.md +++ b/docs/subcommands/DNS/zone/get.md @@ -31,17 +31,18 @@ Retrieve a zone ## Options ```text - -u, --api-url string Override default host url (default "dns.de-fra.ionos.com") - --cols strings Set of columns to be printed on output - Available columns: [Id Name Description NameServers Enabled State] - -c, --config string Configuration file used for authentication (default "$XDG_CONFIG_HOME/ionosctl/config.json") - -f, --force Force command to execute without user input - -h, --help Print usage - --no-headers Don't print table headers when table output is used - -o, --output string Desired output format [text|json|api-json] (default "text") - -q, --quiet Quiet output - -v, --verbose Print step-by-step process when running command - -z, --zone string The name or ID of the DNS zone (required) + -u, --api-url string Override default host URL (default "https://dns.de-fra.ionos.com") + --cols strings Set of columns to be printed on output + Available columns: [Id Name Description NameServers Enabled State] + -c, --config string Configuration file used for authentication (default "$XDG_CONFIG_HOME/ionosctl/config.json") + -f, --force Force command to execute without user input + -h, --help Print usage + -l, --location string Location of the resource to operate on. Can be one of: de/fra + --no-headers Don't print table headers when table output is used + -o, --output string Desired output format [text|json|api-json] (default "text") + -q, --quiet Quiet output + -v, --verbose Print step-by-step process when running command + -z, --zone string The name or ID of the DNS zone (required) ``` ## Examples diff --git a/docs/subcommands/DNS/zone/list.md b/docs/subcommands/DNS/zone/list.md index 6b01482dd..c394a5a38 100644 --- a/docs/subcommands/DNS/zone/list.md +++ b/docs/subcommands/DNS/zone/list.md @@ -31,12 +31,13 @@ Retrieve zones ## Options ```text - -u, --api-url string Override default host url (default "dns.de-fra.ionos.com") + -u, --api-url string Override default host URL (default "https://dns.de-fra.ionos.com") --cols strings Set of columns to be printed on output Available columns: [Id Name Description NameServers Enabled State] -c, --config string Configuration file used for authentication (default "$XDG_CONFIG_HOME/ionosctl/config.json") -f, --force Force command to execute without user input -h, --help Print usage + -l, --location string Location of the resource to operate on. Can be one of: de/fra --max-results int32 Pagination limit --name string Filter used to fetch only the zones that contain the specified zone name --no-headers Don't print table headers when table output is used diff --git a/docs/subcommands/DNS/zone/update.md b/docs/subcommands/DNS/zone/update.md index bea9727b0..acc41d234 100644 --- a/docs/subcommands/DNS/zone/update.md +++ b/docs/subcommands/DNS/zone/update.md @@ -31,7 +31,7 @@ Partially modify a zone's properties. This command uses a combination of GET and ## Options ```text - -u, --api-url string Override default host url (default "dns.de-fra.ionos.com") + -u, --api-url string Override default host URL (default "https://dns.de-fra.ionos.com") --cols strings Set of columns to be printed on output Available columns: [Id Name Description NameServers Enabled State] -c, --config string Configuration file used for authentication (default "$XDG_CONFIG_HOME/ionosctl/config.json") @@ -39,6 +39,7 @@ Partially modify a zone's properties. This command uses a combination of GET and --enabled Activate or deactivate the DNS zone (default true) -f, --force Force command to execute without user input -h, --help Print usage + -l, --location string Location of the resource to operate on. Can be one of: de/fra -n, --name string The new name of the DNS zone, e.g. foo.com --no-headers Don't print table headers when table output is used -o, --output string Desired output format [text|json|api-json] (default "text") diff --git a/docs/subcommands/Database-as-a-Service/mariadb/backup/get.md b/docs/subcommands/Database-as-a-Service/mariadb/backup/get.md index 9117777fd..dc07f5cca 100644 --- a/docs/subcommands/Database-as-a-Service/mariadb/backup/get.md +++ b/docs/subcommands/Database-as-a-Service/mariadb/backup/get.md @@ -37,13 +37,14 @@ Get a MariaDB Backup ## Options ```text - -u, --api-url string Override default host url (default "https://api.ionos.com") - --backup-id string The ID of the Backup to be retrieved + -u, --api-url string Override default host URL (default "https://mariadb.de-txl.ionos.com") + --backup-id string The ID of the Backup to be retrieved (required) --cols strings Set of columns to be printed on output Available columns: [BackupId ClusterId Size Items] (default [BackupId,ClusterId,Size,Items]) -c, --config string Configuration file used for authentication (default "$XDG_CONFIG_HOME/ionosctl/config.json") -f, --force Force command to execute without user input -h, --help Print usage + -l, --location string Location of the resource to operate on. Can be one of: de/txl, de/fra, es/vit, fr/par, gb/lhr, us/ewr, us/las, us/mci --no-headers Don't print table headers when table output is used -o, --output string Desired output format [text|json|api-json] (default "text") -q, --quiet Quiet output diff --git a/docs/subcommands/Database-as-a-Service/mariadb/backup/list.md b/docs/subcommands/Database-as-a-Service/mariadb/backup/list.md index 3653fc226..0cc36c907 100644 --- a/docs/subcommands/Database-as-a-Service/mariadb/backup/list.md +++ b/docs/subcommands/Database-as-a-Service/mariadb/backup/list.md @@ -37,13 +37,14 @@ List all MariaDB Backups, or optionally provide a Cluster ID to list those of a ## Options ```text - -u, --api-url string Override default host url (default "https://api.ionos.com") - -i, --cluster-id string Optionally limit shown backups to those of a certain cluster + -u, --api-url string Override default host URL (default "https://mariadb.de-txl.ionos.com") + -i, --cluster-id string Optionally limit shown backups to those of a certain cluster (required) --cols strings Set of columns to be printed on output Available columns: [BackupId ClusterId Size Items] (default [BackupId,ClusterId,Size,Items]) -c, --config string Configuration file used for authentication (default "$XDG_CONFIG_HOME/ionosctl/config.json") -f, --force Force command to execute without user input -h, --help Print usage + -l, --location string Location of the resource to operate on. Can be one of: de/txl, de/fra, es/vit, fr/par, gb/lhr, us/ewr, us/las, us/mci -M, --max-results int32 The maximum number of elements to return --no-headers Don't print table headers when table output is used --offset int32 Skip a certain number of results diff --git a/docs/subcommands/Database-as-a-Service/mariadb/cluster/create.md b/docs/subcommands/Database-as-a-Service/mariadb/cluster/create.md index 00f5f604d..8c9779e2b 100644 --- a/docs/subcommands/Database-as-a-Service/mariadb/cluster/create.md +++ b/docs/subcommands/Database-as-a-Service/mariadb/cluster/create.md @@ -37,7 +37,7 @@ Create DBaaS MariaDB clusters ## Options ```text - -u, --api-url string Override default host url (default "https://api.ionos.com") + -u, --api-url string Override default host URL (default "https://mariadb.de-txl.ionos.com") --cidr string The IP and subnet for your cluster. All IPs must be in a /24 network (required) --cols strings Set of columns to be printed on output Available columns: [ClusterId Name DNS Instances Version State Cores RAM StorageSize MaintenanceDay MaintenanceTime] (default [ClusterId,Name,DNS,Instances,Version,State]) @@ -48,6 +48,7 @@ Create DBaaS MariaDB clusters -h, --help Print usage --instances int32 The total number of instances of the cluster (one primary and n-1 secondaries) (default 1) --lan-id string The numeric LAN ID with which you connect your cluster (required) + -l, --location string Location of the resource to operate on. Can be one of: de/txl, de/fra, es/vit, fr/par, gb/lhr, us/ewr, us/las, us/mci --maintenance-day string Day Of the Week for the MaintenanceWindows. The MaintenanceWindow is a weekly 4 hour-long windows, during which maintenance might occur. Defaults to a random day during Mon-Fri, during the hours 10:00-16:00 (default "Random (Mon-Fri 10:00-16:00)") --maintenance-time string Time for the MaintenanceWindows. The MaintenanceWindow is a weekly 4 hour-long windows, during which maintenance might occur. e.g.: 16:30:59. Defaults to a random day during Mon-Fri, during the hours 10:00-16:00 (default "Random (Mon-Fri 10:00-16:00)") -n, --name string The name of your cluster (required) diff --git a/docs/subcommands/Database-as-a-Service/mariadb/cluster/delete.md b/docs/subcommands/Database-as-a-Service/mariadb/cluster/delete.md index acbf967dd..55bd40397 100644 --- a/docs/subcommands/Database-as-a-Service/mariadb/cluster/delete.md +++ b/docs/subcommands/Database-as-a-Service/mariadb/cluster/delete.md @@ -38,13 +38,14 @@ Delete a MariaDB Cluster by ID ```text -a, --all Delete all mariadb clusters - -u, --api-url string Override default host url (default "https://api.ionos.com") + -u, --api-url string Override default host URL (default "https://mariadb.de-txl.ionos.com") -i, --cluster-id string The unique ID of the cluster (required) --cols strings Set of columns to be printed on output Available columns: [ClusterId Name DNS Instances Version State Cores RAM StorageSize MaintenanceDay MaintenanceTime] -c, --config string Configuration file used for authentication (default "$XDG_CONFIG_HOME/ionosctl/config.json") -f, --force Force command to execute without user input -h, --help Print usage + -l, --location string Location of the resource to operate on. Can be one of: de/txl, de/fra, es/vit, fr/par, gb/lhr, us/ewr, us/las, us/mci --name When deleting all clusters, filter the clusters by a name --no-headers Don't print table headers when table output is used -o, --output string Desired output format [text|json|api-json] (default "text") diff --git a/docs/subcommands/Database-as-a-Service/mariadb/cluster/get.md b/docs/subcommands/Database-as-a-Service/mariadb/cluster/get.md index d4f7edd65..0683682d3 100644 --- a/docs/subcommands/Database-as-a-Service/mariadb/cluster/get.md +++ b/docs/subcommands/Database-as-a-Service/mariadb/cluster/get.md @@ -37,13 +37,14 @@ Get a MariaDB Cluster by ID ## Options ```text - -u, --api-url string Override default host url (default "https://api.ionos.com") + -u, --api-url string Override default host URL (default "https://mariadb.de-txl.ionos.com") -i, --cluster-id string The unique ID of the cluster (required) --cols strings Set of columns to be printed on output Available columns: [ClusterId Name DNS Instances Version State Cores RAM StorageSize MaintenanceDay MaintenanceTime] (default [ClusterId,Name,DNS,Instances,Version,State]) -c, --config string Configuration file used for authentication (default "$XDG_CONFIG_HOME/ionosctl/config.json") -f, --force Force command to execute without user input -h, --help Print usage + -l, --location string Location of the resource to operate on. Can be one of: de/txl, de/fra, es/vit, fr/par, gb/lhr, us/ewr, us/las, us/mci --no-headers Don't print table headers when table output is used -o, --output string Desired output format [text|json|api-json] (default "text") -q, --quiet Quiet output diff --git a/docs/subcommands/Database-as-a-Service/mariadb/cluster/list.md b/docs/subcommands/Database-as-a-Service/mariadb/cluster/list.md index 1c63049ce..1b68dca4d 100644 --- a/docs/subcommands/Database-as-a-Service/mariadb/cluster/list.md +++ b/docs/subcommands/Database-as-a-Service/mariadb/cluster/list.md @@ -37,12 +37,13 @@ Use this command to retrieve a list of MariaDB Clusters provisioned under your a ## Options ```text - -u, --api-url string Override default host url (default "https://api.ionos.com") + -u, --api-url string Override default host URL (default "https://mariadb.de-txl.ionos.com") --cols strings Set of columns to be printed on output Available columns: [ClusterId Name DNS Instances Version State Cores RAM StorageSize MaintenanceDay MaintenanceTime] (default [ClusterId,Name,DNS,Instances,Version,State]) -c, --config string Configuration file used for authentication (default "$XDG_CONFIG_HOME/ionosctl/config.json") -f, --force Force command to execute without user input -h, --help Print usage + -l, --location string Location of the resource to operate on. Can be one of: de/txl, de/fra, es/vit, fr/par, gb/lhr, us/ewr, us/las, us/mci -M, --max-results int32 The maximum number of elements to return -n, --name string Response filter to list only the MariaDB Clusters that contain the specified name in the DisplayName field. The value is case insensitive --no-headers Don't print table headers when table output is used diff --git a/docs/subcommands/Logging-Service/logs/add.md b/docs/subcommands/Logging-Service/logs/add.md index 99a272965..6c90141f2 100644 --- a/docs/subcommands/Logging-Service/logs/add.md +++ b/docs/subcommands/Logging-Service/logs/add.md @@ -17,12 +17,13 @@ Add a log to a logging pipeline ## Options ```text - -u, --api-url string Override default host url (default "logging.de-txl.ionos.com") + -u, --api-url string Override default host URL (default "https://logging.de-txl.ionos.com") --cols strings Set of columns to be printed on output Available columns: [Tag Source Protocol Public Destinations] (default [Tag,Source,Protocol,Public,Destinations]) -c, --config string Configuration file used for authentication (default "$XDG_CONFIG_HOME/ionosctl/config.json") -f, --force Force command to execute without user input -h, --help Print usage + -l, --location string Location of the resource to operate on. Can be one of: de/txl, de/fra, gb/lhr, fr/par, es/vit --log-labels strings Sets the labels for the pipeline log --log-protocol string Sets the protocol for the pipeline log. Can be one of: http, tcp (required) --log-retention-time string Sets the retention time in days for the pipeline log. Can be one of: 7, 14, 30 (default "30") diff --git a/docs/subcommands/Logging-Service/logs/get.md b/docs/subcommands/Logging-Service/logs/get.md index 4f1a0e3d9..6f1f7d068 100644 --- a/docs/subcommands/Logging-Service/logs/get.md +++ b/docs/subcommands/Logging-Service/logs/get.md @@ -17,12 +17,13 @@ Retrieve a log from a logging pipeline ## Options ```text - -u, --api-url string Override default host url (default "logging.de-txl.ionos.com") + -u, --api-url string Override default host URL (default "https://logging.de-txl.ionos.com") --cols strings Set of columns to be printed on output Available columns: [Tag Source Protocol Public Destinations] (default [Tag,Source,Protocol,Public,Destinations]) -c, --config string Configuration file used for authentication (default "$XDG_CONFIG_HOME/ionosctl/config.json") -f, --force Force command to execute without user input -h, --help Print usage + -l, --location string Location of the resource to operate on. Can be one of: de/txl, de/fra, gb/lhr, fr/par, es/vit --log-tag string The tag of the pipeline log that you want to retrieve (required) --no-headers Don't print table headers when table output is used -o, --output string Desired output format [text|json|api-json] (default "text") diff --git a/docs/subcommands/Logging-Service/logs/list.md b/docs/subcommands/Logging-Service/logs/list.md index 8310ce6f7..bac7a8280 100644 --- a/docs/subcommands/Logging-Service/logs/list.md +++ b/docs/subcommands/Logging-Service/logs/list.md @@ -32,15 +32,16 @@ Retrieve logging pipeline logs ```text -a, --all Use this flag to list all logging pipeline logs - -u, --api-url string Override default host url (default "logging.de-txl.ionos.com") + -u, --api-url string Override default host URL (default "https://logging.de-txl.ionos.com") --cols strings Set of columns to be printed on output Available columns: [Tag Source Protocol Public Destinations] (default [Tag,Source,Protocol,Public,Destinations]) -c, --config string Configuration file used for authentication (default "$XDG_CONFIG_HOME/ionosctl/config.json") -f, --force Force command to execute without user input -h, --help Print usage + -l, --location string Location of the resource to operate on. Can be one of: de/txl, de/fra, gb/lhr, fr/par, es/vit --no-headers Don't print table headers when table output is used -o, --output string Desired output format [text|json|api-json] (default "text") - -i, --pipeline-id string The ID of the logging pipeline you want to list logs for (required) + -i, --pipeline-id string The ID of the logging pipeline (required) -q, --quiet Quiet output -v, --verbose Print step-by-step process when running command ``` diff --git a/docs/subcommands/Logging-Service/logs/remove.md b/docs/subcommands/Logging-Service/logs/remove.md index cbb6f77d8..73337312f 100644 --- a/docs/subcommands/Logging-Service/logs/remove.md +++ b/docs/subcommands/Logging-Service/logs/remove.md @@ -17,13 +17,14 @@ Remove a log from a logging pipeline. NOTE:There needs to be at least one log in ## Options ```text - -u, --api-url string Override default host url (default "logging.de-txl.ionos.com") + -u, --api-url string Override default host URL (default "https://logging.de-txl.ionos.com") --cols strings Set of columns to be printed on output Available columns: [Tag Source Protocol Public Destinations] (default [Tag,Source,Protocol,Public,Destinations]) -c, --config string Configuration file used for authentication (default "$XDG_CONFIG_HOME/ionosctl/config.json") -f, --force Force command to execute without user input -h, --help Print usage - --log-tag string The tag of the pipeline log that you want to remove (required) + -l, --location string Location of the resource to operate on. Can be one of: de/txl, de/fra, gb/lhr, fr/par, es/vit + --log-tag string The tag of the pipeline log that you want to delete (required) --no-headers Don't print table headers when table output is used -o, --output string Desired output format [text|json|api-json] (default "text") -i, --pipeline-id string The ID of the logging pipeline (required) diff --git a/docs/subcommands/Logging-Service/logs/update.md b/docs/subcommands/Logging-Service/logs/update.md index 82374aeb1..758f1dda9 100644 --- a/docs/subcommands/Logging-Service/logs/update.md +++ b/docs/subcommands/Logging-Service/logs/update.md @@ -17,12 +17,13 @@ Update a log from a logging pipeline ## Options ```text - -u, --api-url string Override default host url (default "logging.de-txl.ionos.com") + -u, --api-url string Override default host URL (default "https://logging.de-txl.ionos.com") --cols strings Set of columns to be printed on output Available columns: [Tag Source Protocol Public Destinations] (default [Tag,Source,Protocol,Public,Destinations]) -c, --config string Configuration file used for authentication (default "$XDG_CONFIG_HOME/ionosctl/config.json") -f, --force Force command to execute without user input -h, --help Print usage + -l, --location string Location of the resource to operate on. Can be one of: de/txl, de/fra, gb/lhr, fr/par, es/vit --log-labels strings Sets the labels for the pipeline log --log-protocol string Sets the protocol for the pipeline log. Can be one of: http, tcp --log-retention-time string Sets the retention time in days for the pipeline log. Can be one of: 7, 14, 30 (default "30") diff --git a/docs/subcommands/Logging-Service/pipeline/create.md b/docs/subcommands/Logging-Service/pipeline/create.md index c9660086c..aa4d84e1c 100644 --- a/docs/subcommands/Logging-Service/pipeline/create.md +++ b/docs/subcommands/Logging-Service/pipeline/create.md @@ -31,7 +31,7 @@ Create a logging pipeline ## Options ```text - -u, --api-url string Override default host url (default "logging.de-txl.ionos.com") + -u, --api-url string Override default host URL (default "https://logging.de-txl.ionos.com") --cols strings Set of columns to be printed on output Available columns: [Id Name GrafanaAddress CreatedDate State] (default [Id,Name,GrafanaAddress,CreatedDate,State]) -c, --config string Configuration file used for authentication (default "$XDG_CONFIG_HOME/ionosctl/config.json") @@ -39,6 +39,7 @@ Create a logging pipeline -h, --help Print usage --json-properties string Path to a JSON file containing the desired properties. Overrides any other properties set. --json-properties-example If set, prints a complete JSON which could be used for --json-properties and exits. Hint: Pipe me to a .json file + -l, --location string Location of the resource to operate on. Can be one of: de/txl, de/fra, gb/lhr, fr/par, es/vit --log-labels strings Sets the labels for the pipeline log --log-protocol string Sets the protocol for the pipeline log. Can be one of: http, tcp --log-retention-time string Sets the retention time in days for the pipeline log. Can be one of: 7, 14, 30 (default "30") diff --git a/docs/subcommands/Logging-Service/pipeline/delete.md b/docs/subcommands/Logging-Service/pipeline/delete.md index 548fdcb3c..59e81aba2 100644 --- a/docs/subcommands/Logging-Service/pipeline/delete.md +++ b/docs/subcommands/Logging-Service/pipeline/delete.md @@ -32,12 +32,13 @@ Delete a logging pipeline using its ID ```text -a, --all Use this flag to delete all logging pipelines - -u, --api-url string Override default host url (default "logging.de-txl.ionos.com") + -u, --api-url string Override default host URL (default "https://logging.de-txl.ionos.com") --cols strings Set of columns to be printed on output Available columns: [Id Name GrafanaAddress CreatedDate State] (default [Id,Name,GrafanaAddress,CreatedDate,State]) -c, --config string Configuration file used for authentication (default "$XDG_CONFIG_HOME/ionosctl/config.json") -f, --force Force command to execute without user input -h, --help Print usage + -l, --location string Location of the resource to operate on. Can be one of: de/txl, de/fra, gb/lhr, fr/par, es/vit --no-headers Don't print table headers when table output is used -o, --output string Desired output format [text|json|api-json] (default "text") -i, --pipeline-id string The ID of the logging pipeline you want to delete (required) diff --git a/docs/subcommands/Logging-Service/pipeline/get.md b/docs/subcommands/Logging-Service/pipeline/get.md index e84ddaf91..293bf6a61 100644 --- a/docs/subcommands/Logging-Service/pipeline/get.md +++ b/docs/subcommands/Logging-Service/pipeline/get.md @@ -31,12 +31,13 @@ Retrieve a logging pipeline by ID ## Options ```text - -u, --api-url string Override default host url (default "logging.de-txl.ionos.com") + -u, --api-url string Override default host URL (default "https://logging.de-txl.ionos.com") --cols strings Set of columns to be printed on output Available columns: [Id Name GrafanaAddress CreatedDate State] (default [Id,Name,GrafanaAddress,CreatedDate,State]) -c, --config string Configuration file used for authentication (default "$XDG_CONFIG_HOME/ionosctl/config.json") -f, --force Force command to execute without user input -h, --help Print usage + -l, --location string Location of the resource to operate on. Can be one of: de/txl, de/fra, gb/lhr, fr/par, es/vit --no-headers Don't print table headers when table output is used -o, --output string Desired output format [text|json|api-json] (default "text") -i, --pipeline-id string The ID of the logging pipeline you want to retrieve (required) diff --git a/docs/subcommands/Logging-Service/pipeline/key.md b/docs/subcommands/Logging-Service/pipeline/key.md index 2a48835fe..ade2c51ec 100644 --- a/docs/subcommands/Logging-Service/pipeline/key.md +++ b/docs/subcommands/Logging-Service/pipeline/key.md @@ -31,15 +31,16 @@ Generate a new key for a logging pipeline, invalidating the old one. The key is ## Options ```text - -u, --api-url string Override default host url (default "logging.de-txl.ionos.com") + -u, --api-url string Override default host URL (default "https://logging.de-txl.ionos.com") --cols strings Set of columns to be printed on output Available columns: [Id Name GrafanaAddress CreatedDate State] (default [Id,Name,GrafanaAddress,CreatedDate,State]) -c, --config string Configuration file used for authentication (default "$XDG_CONFIG_HOME/ionosctl/config.json") -f, --force Force command to execute without user input -h, --help Print usage + -l, --location string Location of the resource to operate on. Can be one of: de/txl, de/fra, gb/lhr, fr/par, es/vit --no-headers Don't print table headers when table output is used -o, --output string Desired output format [text|json|api-json] (default "text") - -i, --pipeline-id string The ID of the logging pipeline you want to retrieve (required) + -i, --pipeline-id string The ID of the logging pipeline you want to generate a key for (required) -q, --quiet Quiet output -v, --verbose Print step-by-step process when running command ``` diff --git a/docs/subcommands/Logging-Service/pipeline/list.md b/docs/subcommands/Logging-Service/pipeline/list.md index 0ce3505d8..f7f36e910 100644 --- a/docs/subcommands/Logging-Service/pipeline/list.md +++ b/docs/subcommands/Logging-Service/pipeline/list.md @@ -37,16 +37,17 @@ Retrieve logging pipelines ## Options ```text - -u, --api-url string Override default host url (default "logging.de-txl.ionos.com") - --cols strings Set of columns to be printed on output - Available columns: [Id Name GrafanaAddress CreatedDate State] (default [Id,Name,GrafanaAddress,CreatedDate,State]) - -c, --config string Configuration file used for authentication (default "$XDG_CONFIG_HOME/ionosctl/config.json") - -f, --force Force command to execute without user input - -h, --help Print usage - --no-headers Don't print table headers when table output is used - -o, --output string Desired output format [text|json|api-json] (default "text") - -q, --quiet Quiet output - -v, --verbose Print step-by-step process when running command + -u, --api-url string Override default host URL (default "https://logging.de-txl.ionos.com") + --cols strings Set of columns to be printed on output + Available columns: [Id Name GrafanaAddress CreatedDate State] (default [Id,Name,GrafanaAddress,CreatedDate,State]) + -c, --config string Configuration file used for authentication (default "$XDG_CONFIG_HOME/ionosctl/config.json") + -f, --force Force command to execute without user input + -h, --help Print usage + -l, --location string Location of the resource to operate on. Can be one of: de/txl, de/fra, gb/lhr, fr/par, es/vit + --no-headers Don't print table headers when table output is used + -o, --output string Desired output format [text|json|api-json] (default "text") + -q, --quiet Quiet output + -v, --verbose Print step-by-step process when running command ``` ## Examples diff --git a/docs/subcommands/Logging-Service/pipeline/update.md b/docs/subcommands/Logging-Service/pipeline/update.md index 81d8bfbb3..d3cb27b35 100644 --- a/docs/subcommands/Logging-Service/pipeline/update.md +++ b/docs/subcommands/Logging-Service/pipeline/update.md @@ -31,7 +31,7 @@ Update a logging pipeline ## Options ```text - -u, --api-url string Override default host url (default "logging.de-txl.ionos.com") + -u, --api-url string Override default host URL (default "https://logging.de-txl.ionos.com") --cols strings Set of columns to be printed on output Available columns: [Id Name GrafanaAddress CreatedDate State] (default [Id,Name,GrafanaAddress,CreatedDate,State]) -c, --config string Configuration file used for authentication (default "$XDG_CONFIG_HOME/ionosctl/config.json") @@ -39,9 +39,10 @@ Update a logging pipeline -h, --help Print usage --json-properties string Path to a JSON file containing the desired properties. Overrides any other properties set. --json-properties-example If set, prints a complete JSON which could be used for --json-properties and exits. Hint: Pipe me to a .json file + -l, --location string Location of the resource to operate on. Can be one of: de/txl, de/fra, gb/lhr, fr/par, es/vit --no-headers Don't print table headers when table output is used -o, --output string Desired output format [text|json|api-json] (default "text") - -i, --pipeline-id string The ID of the logging pipeline (required) + -i, --pipeline-id string The ID of the logging pipeline you want to delete (required) -q, --quiet Quiet output -v, --verbose Print step-by-step process when running command ``` diff --git a/internal/client/client.go b/internal/client/client.go index cea7ddb8a..cef71eebd 100644 --- a/internal/client/client.go +++ b/internal/client/client.go @@ -121,6 +121,11 @@ func TestCreds(user, pass, token string) error { } func (c *Client) TestCreds() error { + if config.GetServerUrlOrApiIonos() != constants.DefaultApiURL { + // TODO: Remove this if we can somehow reliably test credentials on all APIs. + // TODO: This currently skips if the server URL is manually overwritten. (i.e. staging environment, or regional APIs) + return nil + } _, _, err := c.CloudClient.DefaultApi.ApiInfoGet(context.Background()).MaxResults(1).Depth(0).Execute() if err != nil { usedScheme := "used token" diff --git a/internal/client/model.go b/internal/client/model.go index b46ac7228..5fcbe48f6 100644 --- a/internal/client/model.go +++ b/internal/client/model.go @@ -2,6 +2,7 @@ package client import ( "fmt" + cdn "github.com/ionos-cloud/sdk-go-cdn" "github.com/ionos-cloud/ionosctl/v6/internal/constants" diff --git a/internal/config/config.go b/internal/config/config.go index b527fe5e9..9b0385809 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -8,7 +8,6 @@ import ( "os" "path/filepath" "runtime" - "strings" "github.com/ionos-cloud/ionosctl/v6/internal/constants" "github.com/ionos-cloud/ionosctl/v6/pkg/die" @@ -23,22 +22,17 @@ var FieldsWithSensitiveDataInConfigFile = []string{ // GetServerUrl returns the server URL the SDK should use, with support for layered fallbacks. func GetServerUrl() string { viper.AutomaticEnv() - if flagVal := viper.GetString(constants.ArgServerUrl); viper.IsSet(constants.ArgServerUrl) { + if val := viper.GetString(constants.ArgServerUrl); viper.IsSet(constants.ArgServerUrl) { // 1. Above all, use global flag val - if !strings.Contains(flagVal, constants.DefaultDnsApiURL) && !strings.Contains( - flagVal, constants.DefaultLoggingServiceApiURL, - ) { - // Workaround for changing the default for dns namepsace and still allowing this to be customized via env var / cfg - return flagVal - } + return val } - if envVal := viper.GetString(constants.EnvServerUrl); viper.IsSet(constants.EnvServerUrl) { + if val := viper.GetString(constants.EnvServerUrl); viper.IsSet(constants.EnvServerUrl) { // 2. Fallback to non-empty env vars - return envVal + return val } - if cfgVal := viper.GetString(constants.CfgServerUrl); viper.IsSet(constants.CfgServerUrl) { + if val := viper.GetString(constants.CfgServerUrl); viper.IsSet(constants.CfgServerUrl) { // 3. Fallback to non-empty cfg field - return cfgVal + return val } // 4. Return empty string. SDKs should handle it, per docs return "" diff --git a/internal/config/config_test.go b/internal/config/config_test.go index e0566158c..89dc8a5de 100644 --- a/internal/config/config_test.go +++ b/internal/config/config_test.go @@ -210,18 +210,25 @@ func TestGetServerUrl(t *testing.T) { expectedServerUrl: "http://flag.url", }, { - name: "Flag value is DNS default, Env value is used", + name: "Flag value is DNS Default, return flag value", flagVal: "dns.de-fra.ionos.com", envVal: "http://env.url", cfgVal: "http://cfg.url", - expectedServerUrl: "http://env.url", + expectedServerUrl: "dns.de-fra.ionos.com", }, { - name: "All values are DNS default or not set, return empty string", + name: "Flag value is DNS default, all other empty, return flag value", flagVal: "dns.de-fra.ionos.com", envVal: "", cfgVal: "", - expectedServerUrl: "", + expectedServerUrl: "dns.de-fra.ionos.com", + }, + { + name: "Flag value is empty, env and cfg set, return env value", + flagVal: "", + envVal: "dns.de-fra.ionos.com", + cfgVal: "dns.de-txl.ionos.com", + expectedServerUrl: "dns.de-fra.ionos.com", }, { name: "Explicit flag URL is returned", @@ -244,6 +251,13 @@ func TestGetServerUrl(t *testing.T) { cfgVal: "", expectedServerUrl: constants.DefaultApiURL, }, + { + name: "CFG value is preferred over defaults", + flagVal: "", + envVal: "", + cfgVal: "cfg-url", + expectedServerUrl: "cfg-url", + }, } for _, tt := range tests { diff --git a/internal/constants/constants.go b/internal/constants/constants.go index 3accd89d7..453c933fb 100644 --- a/internal/constants/constants.go +++ b/internal/constants/constants.go @@ -138,14 +138,26 @@ const ( // Defaults const ( - DefaultApiURL = "https://api.ionos.com" - DefaultDnsApiURL = "dns.de-fra.ionos.com" - DefaultLoggingServiceApiURL = "logging.de-txl.ionos.com" - DefaultConfigFileName = "/config.json" - DefaultOutputFormat = "text" - DefaultWait = false - DefaultTimeoutSeconds = int(60) - DefaultParentIndex = int(1) + DefaultConfigFileName = "/config.json" + DefaultOutputFormat = "text" + DefaultWait = false + DefaultTimeoutSeconds = int(60) + DefaultParentIndex = int(1) +) + +const ( + DefaultApiURL = "https://api.ionos.com" + DNSApiRegionalURL = "https://dns.%s.ionos.com" + LoggingApiRegionalURL = "https://logging.%s.ionos.com" + CDNApiRegionalURL = "https://cdn.%s.ionos.com" + MariaDBApiRegionalURL = "https://mariadb.%s.ionos.com" +) + +var ( + DNSLocations = []string{"de/fra"} + LoggingAPILocations = []string{"de/txl", "de/fra", "gb/lhr", "fr/par", "es/vit"} + CDNLocations = []string{"de/fra"} + MariaDBLocations = []string{"de/txl", "de/fra", "es/vit", "fr/par", "gb/lhr", "us/ewr", "us/las", "us/mci"} ) // enum values. TODO: ideally i'd like these handled by the SDK diff --git a/internal/core/command.go b/internal/core/command.go index 7f56b5b4c..2d1da4ad9 100644 --- a/internal/core/command.go +++ b/internal/core/command.go @@ -69,7 +69,7 @@ func (c *Command) Name() string { // - The '--location' flag allows users to specify a region, which replaces the '%s' placeholder in the 'baseURL'. // - If '--location' is used and is valid (from 'allowedLocations'), the 'baseURL' is formatted with the normalized location. // - If '--location' is invalid or unsupported, a warning is logged, but the constructed URL is still attempted. -// - If 'allowedLocations' is empty, the function panics, as this is considered a programming error.// +// - If 'allowedLocations' is empty, the function panics, as this is considered a programming error. // - If an unsupported location is provided, a warning is logged: // 'WARN: is an invalid location. Valid locations are: ' // - This also marks '--api-url' and '--location' flags as mutually exclusive. diff --git a/internal/core/flag-option.go b/internal/core/flag-option.go index 0ad2d7334..df5ff2c55 100644 --- a/internal/core/flag-option.go +++ b/internal/core/flag-option.go @@ -91,6 +91,8 @@ func WithCompletionComplex( // - WithCompletionE(completionFuncE, "api.%s.ionos.com") for a regional API // // - WithCompletionE(completionFuncE, "api.ionos.com") for an API with a single endpoint +// +// - WithCompletionE(completionFuncE, "") to let the SDK choose the API endpoint func WithCompletionE(completionFunc func() ([]string, error), baseURL string) FlagOptionFunc { return WithCompletionComplex(func(_ *cobra.Command, _ []string, _ string) ([]string, cobra.ShellCompDirective) { results, err := completionFunc() @@ -108,6 +110,8 @@ func WithCompletionE(completionFunc func() ([]string, error), baseURL string) Fl // - WithCompletion(completionFunc, "api.%s.ionos.com") for a regional API // // - WithCompletion(completionFunc, "api.ionos.com") for an API with a single endpoint +// +// - WithCompletion(completionFunc, "") to let the SDKs choose the API endpoint func WithCompletion(completionFunc func() []string, baseURL string) FlagOptionFunc { return WithCompletionComplex(func(_ *cobra.Command, _ []string, _ string) ([]string, cobra.ShellCompDirective) { return completionFunc(), cobra.ShellCompDirectiveNoFileComp